Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
0d3819bb
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d3819bb
编写于
3月 11, 2014
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1155 from msrb/logging
Switch to java.util.logging on few places
上级
a4c4ed5f
86ad8222
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
24 deletion
+14
-24
core/src/main/java/jenkins/security/ExceptionTranslationFilter.java
...ain/java/jenkins/security/ExceptionTranslationFilter.java
+10
-20
core/src/test/java/hudson/util/io/ZipArchiverTest.java
core/src/test/java/hudson/util/io/ZipArchiverTest.java
+4
-4
未找到文件。
core/src/main/java/jenkins/security/ExceptionTranslationFilter.java
浏览文件 @
0d3819bb
...
@@ -28,8 +28,6 @@ import org.acegisecurity.ui.AuthenticationEntryPoint;
...
@@ -28,8 +28,6 @@ import org.acegisecurity.ui.AuthenticationEntryPoint;
import
org.acegisecurity.ui.savedrequest.SavedRequest
;
import
org.acegisecurity.ui.savedrequest.SavedRequest
;
import
org.acegisecurity.util.PortResolver
;
import
org.acegisecurity.util.PortResolver
;
import
org.acegisecurity.util.PortResolverImpl
;
import
org.acegisecurity.util.PortResolverImpl
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
...
@@ -42,6 +40,8 @@ import javax.servlet.ServletResponse;
...
@@ -42,6 +40,8 @@ import javax.servlet.ServletResponse;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
/**
* Handles any <code>AccessDeniedException</code> and <code>AuthenticationException</code> thrown within the
* Handles any <code>AccessDeniedException</code> and <code>AuthenticationException</code> thrown within the
...
@@ -85,7 +85,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
...
@@ -85,7 +85,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
//~ Static fields/initializers =====================================================================================
//~ Static fields/initializers =====================================================================================
private
static
final
Log
logger
=
LogFactory
.
getLog
(
ExceptionTranslationFilter
.
class
);
private
static
final
Log
ger
LOGGER
=
Logger
.
getLogger
(
ExceptionTranslationFilter
.
class
.
getName
()
);
//~ Instance fields ================================================================================================
//~ Instance fields ================================================================================================
...
@@ -116,9 +116,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
...
@@ -116,9 +116,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
try
{
try
{
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
if
(
logger
.
isDebugEnabled
())
{
LOGGER
.
finer
(
"Chain processed normally"
);
logger
.
debug
(
"Chain processed normally"
);
}
}
}
catch
(
AuthenticationException
ex
)
{
catch
(
AuthenticationException
ex
)
{
handleException
(
request
,
response
,
chain
,
ex
);
handleException
(
request
,
response
,
chain
,
ex
);
...
@@ -155,27 +153,21 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
...
@@ -155,27 +153,21 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
private
void
handleException
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
,
private
void
handleException
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
,
AcegiSecurityException
exception
)
throws
IOException
,
ServletException
{
AcegiSecurityException
exception
)
throws
IOException
,
ServletException
{
if
(
exception
instanceof
AuthenticationException
)
{
if
(
exception
instanceof
AuthenticationException
)
{
if
(
logger
.
isDebugEnabled
())
{
LOGGER
.
log
(
Level
.
FINER
,
"Authentication exception occurred; redirecting to authentication entry point"
,
exception
);
logger
.
debug
(
"Authentication exception occurred; redirecting to authentication entry point"
,
exception
);
}
sendStartAuthentication
(
request
,
response
,
chain
,
(
AuthenticationException
)
exception
);
sendStartAuthentication
(
request
,
response
,
chain
,
(
AuthenticationException
)
exception
);
}
}
else
if
(
exception
instanceof
AccessDeniedException
)
{
else
if
(
exception
instanceof
AccessDeniedException
)
{
if
(
authenticationTrustResolver
.
isAnonymous
(
SecurityContextHolder
.
getContext
().
getAuthentication
()))
{
if
(
authenticationTrustResolver
.
isAnonymous
(
SecurityContextHolder
.
getContext
().
getAuthentication
()))
{
if
(
logger
.
isDebugEnabled
())
{
LOGGER
.
log
(
Level
.
FINER
,
"Access is denied (user is anonymous); redirecting to authentication entry point"
,
logger
.
debug
(
"Access is denied (user is anonymous); redirecting to authentication entry point"
,
exception
);
exception
);
}
sendStartAuthentication
(
request
,
response
,
chain
,
new
InsufficientAuthenticationException
(
sendStartAuthentication
(
request
,
response
,
chain
,
new
InsufficientAuthenticationException
(
"Full authentication is required to access this resource"
,
exception
));
"Full authentication is required to access this resource"
,
exception
));
}
}
else
{
else
{
if
(
logger
.
isDebugEnabled
())
{
LOGGER
.
log
(
Level
.
FINER
,
"Access is denied (user is not anonymous); delegating to AccessDeniedHandler"
,
logger
.
debug
(
"Access is denied (user is not anonymous); delegating to AccessDeniedHandler"
,
exception
);
exception
);
}
accessDeniedHandler
.
handle
(
request
,
response
,
(
AccessDeniedException
)
exception
);
accessDeniedHandler
.
handle
(
request
,
response
,
(
AccessDeniedException
)
exception
);
}
}
...
@@ -205,9 +197,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
...
@@ -205,9 +197,7 @@ public class ExceptionTranslationFilter implements Filter, InitializingBean {
SavedRequest
savedRequest
=
new
SavedRequest
(
httpRequest
,
portResolver
);
SavedRequest
savedRequest
=
new
SavedRequest
(
httpRequest
,
portResolver
);
if
(
logger
.
isDebugEnabled
())
{
LOGGER
.
finer
(
"Authentication entry point being called; SavedRequest added to Session: "
+
savedRequest
);
logger
.
debug
(
"Authentication entry point being called; SavedRequest added to Session: "
+
savedRequest
);
}
if
(
createSessionAllowed
)
{
if
(
createSessionAllowed
)
{
// Store the HTTP request itself. Used by AbstractProcessingFilter
// Store the HTTP request itself. Used by AbstractProcessingFilter
...
...
core/src/test/java/hudson/util/io/ZipArchiverTest.java
浏览文件 @
0d3819bb
...
@@ -9,14 +9,14 @@ import java.io.FileOutputStream;
...
@@ -9,14 +9,14 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.Log
;
public
class
ZipArchiverTest
extends
TestCase
{
public
class
ZipArchiverTest
extends
TestCase
{
private
final
Log
logger
=
LogFactory
.
getLog
(
getClass
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
ZipArchiverTest
.
class
.
getName
());
private
File
tmpDir
;
private
File
tmpDir
;
...
@@ -103,7 +103,7 @@ public class ZipArchiverTest extends TestCase {
...
@@ -103,7 +103,7 @@ public class ZipArchiverTest extends TestCase {
* @param cause the root cause of the failure
* @param cause the root cause of the failure
*/
*/
private
final
void
fail
(
final
String
msg
,
final
Throwable
cause
)
{
private
final
void
fail
(
final
String
msg
,
final
Throwable
cause
)
{
logger
.
error
(
msg
,
cause
);
LOGGER
.
log
(
Level
.
SEVERE
,
msg
,
cause
);
fail
(
msg
);
fail
(
msg
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录