Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
6c6fb950
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6c6fb950
编写于
9月 22, 2009
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6882384: Update http protocol handler to use PlatformLogger
Reviewed-by: jccollet, alanb
上级
3b0a64c7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
79 addition
and
134 deletion
+79
-134
jdk/src/share/classes/sun/net/www/http/HttpCapture.java
jdk/src/share/classes/sun/net/www/http/HttpCapture.java
+4
-76
jdk/src/share/classes/sun/net/www/http/HttpClient.java
jdk/src/share/classes/sun/net/www/http/HttpClient.java
+4
-2
jdk/src/share/classes/sun/net/www/protocol/http/HttpLogFormatter.java
...e/classes/sun/net/www/protocol/http/HttpLogFormatter.java
+4
-2
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
.../classes/sun/net/www/protocol/http/HttpURLConnection.java
+43
-34
jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java
...es/sun/net/www/protocol/http/NTLMAuthenticationProxy.java
+8
-9
jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
...es/sun/net/www/protocol/http/NegotiateAuthentication.java
+7
-8
jdk/src/share/classes/sun/util/logging/PlatformLogger.java
jdk/src/share/classes/sun/util/logging/PlatformLogger.java
+9
-3
未找到文件。
jdk/src/share/classes/sun/net/www/http/HttpCapture.java
浏览文件 @
6c6fb950
...
...
@@ -24,14 +24,12 @@
*/
package
sun.net.www.http
;
import
java.io.*
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
sun.net.NetProperties
;
import
java.util.regex.*
;
import
sun.net.NetProperties
;
import
sun.util.logging.PlatformLogger
;
/**
* Main class of the HTTP traffic capture tool.
...
...
@@ -62,76 +60,6 @@ public class HttpCapture {
private
static
boolean
initialized
=
false
;
private
static
volatile
ArrayList
<
Pattern
>
patterns
=
null
;
private
static
volatile
ArrayList
<
String
>
capFiles
=
null
;
/* Logging is done in an ugly way so that it does not require the presence
* the java.util.logging package. If the Logger class is not available, then
* logging is turned off. This is for helping the modularization effort.
*/
private
static
Object
logger
=
null
;
private
static
boolean
logging
=
false
;
static
{
Class
cl
;
try
{
cl
=
Class
.
forName
(
"java.util.logging.Logger"
);
}
catch
(
ClassNotFoundException
ex
)
{
cl
=
null
;
}
if
(
cl
!=
null
)
{
try
{
Method
m
=
cl
.
getMethod
(
"getLogger"
,
String
.
class
);
logger
=
m
.
invoke
(
null
,
"sun.net.www.protocol.http.HttpURLConnection"
);
logging
=
true
;
}
catch
(
NoSuchMethodException
noSuchMethodException
)
{
}
catch
(
SecurityException
securityException
)
{
}
catch
(
IllegalAccessException
illegalAccessException
)
{
}
catch
(
IllegalArgumentException
illegalArgumentException
)
{
}
catch
(
InvocationTargetException
invocationTargetException
)
{
}
}
}
public
static
void
fine
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
fine
(
s
);
}
}
public
static
void
finer
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
finer
(
s
);
}
}
public
static
void
finest
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
finest
(
s
);
}
}
public
static
void
severe
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
finest
(
s
);
}
}
public
static
void
info
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
info
(
s
);
}
}
public
static
void
warning
(
String
s
)
{
if
(
logging
)
{
((
Logger
)
logger
).
warning
(
s
);
}
}
public
static
boolean
isLoggable
(
String
level
)
{
if
(!
logging
)
{
return
false
;
}
return
((
Logger
)
logger
).
isLoggable
(
Level
.
parse
(
level
));
}
private
static
synchronized
void
init
()
{
initialized
=
true
;
...
...
@@ -187,7 +115,7 @@ public class HttpCapture {
out
=
new
BufferedWriter
(
new
FileWriter
(
file
,
true
));
out
.
write
(
"URL: "
+
url
+
"\n"
);
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
HttpCapture
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
PlatformLogger
.
getLogger
(
HttpCapture
.
class
.
getName
()).
severe
(
null
,
ex
);
}
}
...
...
jdk/src/share/classes/sun/net/www/http/HttpClient.java
浏览文件 @
6c6fb950
...
...
@@ -35,6 +35,7 @@ import sun.net.www.HeaderParser;
import
sun.net.www.MeteredStream
;
import
sun.net.www.ParseUtil
;
import
sun.net.www.protocol.http.HttpURLConnection
;
import
sun.util.logging.PlatformLogger
;
/**
* @author Herb Jellinek
...
...
@@ -804,8 +805,9 @@ public class HttpClient extends NetworkClient {
if
(
isKeepingAlive
())
{
// Wrap KeepAliveStream if keep alive is enabled.
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"KeepAlive stream used: "
+
url
);
PlatformLogger
logger
=
HttpURLConnection
.
getHttpLogger
();
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"KeepAlive stream used: "
+
url
);
}
serverInput
=
new
KeepAliveStream
(
serverInput
,
pi
,
cl
,
this
);
failedOnce
=
false
;
...
...
jdk/src/share/classes/sun/net/www/protocol/http/HttpLogFormatter.java
浏览文件 @
6c6fb950
...
...
@@ -49,8 +49,10 @@ public class HttpLogFormatter extends java.util.logging.SimpleFormatter {
@Override
public
String
format
(
LogRecord
record
)
{
if
(!
"sun.net.www.http.HttpCapture"
.
equalsIgnoreCase
(
record
.
getSourceClassName
()))
{
// Don't change format for stuff that doesn't concern us
String
sourceClassName
=
record
.
getSourceClassName
();
if
(
sourceClassName
==
null
||
!(
sourceClassName
.
startsWith
(
"sun.net.www.protocol.http"
)
||
sourceClassName
.
startsWith
(
"sun.net.www.http"
)))
{
return
super
.
format
(
record
);
}
String
src
=
record
.
getMessage
();
...
...
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
浏览文件 @
6c6fb950
...
...
@@ -57,7 +57,7 @@ import sun.net.www.http.HttpClient;
import
sun.net.www.http.PosterOutputStream
;
import
sun.net.www.http.ChunkedInputStream
;
import
sun.net.www.http.ChunkedOutputStream
;
import
sun.
net.www.http.HttpCapture
;
import
sun.
util.logging.PlatformLogger
;
import
java.text.SimpleDateFormat
;
import
java.util.TimeZone
;
import
java.net.MalformedURLException
;
...
...
@@ -292,6 +292,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
private
int
connectTimeout
=
-
1
;
private
int
readTimeout
=
-
1
;
/* Logging support */
private
static
final
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.net.www.protocol.http.HttpURLConnection"
);
/*
* privileged request password authentication
*
...
...
@@ -309,20 +313,25 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
return
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
PasswordAuthentication
>()
{
public
PasswordAuthentication
run
()
{
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"Requesting Authentication: host ="
+
host
+
" url = "
+
url
);
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"Requesting Authentication: host ="
+
host
+
" url = "
+
url
);
}
PasswordAuthentication
pass
=
Authenticator
.
requestPasswordAuthentication
(
host
,
addr
,
port
,
protocol
,
prompt
,
scheme
,
url
,
authType
);
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"Authentication returned: "
+
(
pass
!=
null
?
pass
.
toString
()
:
"null"
));
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"Authentication returned: "
+
(
pass
!=
null
?
pass
.
toString
()
:
"null"
));
}
return
pass
;
}
});
}
/* Logging support */
public
static
PlatformLogger
getHttpLogger
()
{
return
logger
;
}
/*
* checks the validity of http message header and throws
* IllegalArgumentException if invalid.
...
...
@@ -471,8 +480,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
setRequests
=
true
;
}
if
(
HttpCapture
.
isLoggable
(
"FINE"
))
{
HttpCapture
.
fine
(
requests
.
toString
());
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
))
{
logger
.
fine
(
requests
.
toString
());
}
http
.
writeRequests
(
requests
,
poster
);
if
(
ps
.
checkError
())
{
...
...
@@ -736,9 +745,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
&&
!(
cachedResponse
instanceof
SecureCacheResponse
))
{
cachedResponse
=
null
;
}
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"Cache Request for "
+
uri
+
" / "
+
getRequestMethod
());
HttpCapture
.
finest
(
"From cache: "
+
(
cachedResponse
!=
null
?
cachedResponse
.
toString
()
:
"null"
));
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"Cache Request for "
+
uri
+
" / "
+
getRequestMethod
());
logger
.
finest
(
"From cache: "
+
(
cachedResponse
!=
null
?
cachedResponse
.
toString
()
:
"null"
));
}
if
(
cachedResponse
!=
null
)
{
cachedHeaders
=
mapToMessageHeader
(
cachedResponse
.
getHeaders
());
...
...
@@ -777,8 +786,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
});
if
(
sel
!=
null
)
{
URI
uri
=
sun
.
net
.
www
.
ParseUtil
.
toURI
(
url
);
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"ProxySelector Request for "
+
uri
);
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"ProxySelector Request for "
+
uri
);
}
Iterator
<
Proxy
>
it
=
sel
.
select
(
uri
).
iterator
();
Proxy
p
;
...
...
@@ -794,9 +803,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
http
=
getNewHttpClient
(
url
,
p
,
connectTimeout
,
false
);
http
.
setReadTimeout
(
readTimeout
);
}
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
if
(
p
!=
null
)
{
HttpCapture
.
finest
(
"Proxy used: "
+
p
.
toString
());
logger
.
finest
(
"Proxy used: "
+
p
.
toString
());
}
}
break
;
...
...
@@ -1026,15 +1035,15 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
URI
uri
=
ParseUtil
.
toURI
(
url
);
if
(
uri
!=
null
)
{
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"CookieHandler request for "
+
uri
);
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"CookieHandler request for "
+
uri
);
}
Map
<
String
,
List
<
String
>>
cookies
=
cookieHandler
.
get
(
uri
,
requests
.
getHeaders
(
EXCLUDE_HEADERS
));
if
(!
cookies
.
isEmpty
())
{
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"Cookies retrieved: "
+
cookies
.
toString
());
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"Cookies retrieved: "
+
cookies
.
toString
());
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
cookies
.
entrySet
())
{
...
...
@@ -1165,8 +1174,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
writeRequests
();
}
http
.
parseHTTP
(
responses
,
pi
,
this
);
if
(
HttpCapture
.
isLoggable
(
"FINE"
))
{
HttpCapture
.
fine
(
responses
.
toString
());
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
))
{
logger
.
fine
(
responses
.
toString
());
}
inputStream
=
http
.
getInputStream
();
...
...
@@ -1610,8 +1619,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
http
.
parseHTTP
(
responses
,
null
,
this
);
/* Log the response to the CONNECT */
if
(
HttpCapture
.
isLoggable
(
"FINE"
))
{
HttpCapture
.
fine
(
responses
.
toString
());
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
))
{
logger
.
fine
(
responses
.
toString
());
}
statusLine
=
responses
.
getValue
(
0
);
...
...
@@ -1738,8 +1747,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
setPreemptiveProxyAuthentication
(
requests
);
/* Log the CONNECT request */
if
(
HttpCapture
.
isLoggable
(
"FINE"
))
{
HttpCapture
.
fine
(
requests
.
toString
());
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
))
{
logger
.
fine
(
requests
.
toString
());
}
http
.
writeRequests
(
requests
,
null
);
...
...
@@ -1852,7 +1861,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
a
=
null
;
if
(
tryTransparentNTLMProxy
)
{
HttpCapture
.
finest
(
"Trying Transparent NTLM authentication"
);
logger
.
finest
(
"Trying Transparent NTLM authentication"
);
}
else
{
a
=
privilegedRequestPasswordAuthentication
(
host
,
null
,
port
,
url
.
getProtocol
(),
...
...
@@ -1880,7 +1889,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
ret
=
new
NegotiateAuthentication
(
new
HttpCallerInfo
(
authhdr
.
getHttpCallerInfo
(),
"Kerberos"
));
break
;
case
UNKNOWN:
HttpCapture
.
finest
(
"Unknown/Unsupported authentication scheme: "
+
scheme
);
logger
.
finest
(
"Unknown/Unsupported authentication scheme: "
+
scheme
);
default
:
throw
new
AssertionError
(
"should not reach here"
);
}
...
...
@@ -1906,8 +1915,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
}
}
if
(
HttpCapture
.
isLoggable
(
"FINER"
))
{
HttpCapture
.
finer
(
"Proxy Authentication for "
+
authhdr
.
toString
()
+
" returned "
+
(
ret
!=
null
?
ret
.
toString
()
:
"null"
));
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINER
))
{
logger
.
finer
(
"Proxy Authentication for "
+
authhdr
.
toString
()
+
" returned "
+
(
ret
!=
null
?
ret
.
toString
()
:
"null"
));
}
return
ret
;
}
...
...
@@ -2004,7 +2013,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
a
=
null
;
if
(
tryTransparentNTLMServer
)
{
HttpCapture
.
finest
(
"Trying Transparent NTLM authentication"
);
logger
.
finest
(
"Trying Transparent NTLM authentication"
);
}
else
{
a
=
privilegedRequestPasswordAuthentication
(
url
.
getHost
(),
addr
,
port
,
url
.
getProtocol
(),
...
...
@@ -2027,7 +2036,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
break
;
case
UNKNOWN:
HttpCapture
.
finest
(
"Unknown/Unsupported authentication scheme: "
+
scheme
);
logger
.
finest
(
"Unknown/Unsupported authentication scheme: "
+
scheme
);
default
:
throw
new
AssertionError
(
"should not reach here"
);
}
...
...
@@ -2051,8 +2060,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
}
}
if
(
HttpCapture
.
isLoggable
(
"FINER"
))
{
HttpCapture
.
finer
(
"Server Authentication for "
+
authhdr
.
toString
()
+
" returned "
+
(
ret
!=
null
?
ret
.
toString
()
:
"null"
));
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINER
))
{
logger
.
finer
(
"Server Authentication for "
+
authhdr
.
toString
()
+
" returned "
+
(
ret
!=
null
?
ret
.
toString
()
:
"null"
));
}
return
ret
;
}
...
...
@@ -2127,8 +2136,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if
(
streaming
())
{
throw
new
HttpRetryException
(
RETRY_MSG3
,
stat
,
loc
);
}
if
(
HttpCapture
.
isLoggable
(
"FINE"
))
{
HttpCapture
.
fine
(
"Redirected from "
+
url
+
" to "
+
locUrl
);
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
))
{
logger
.
fine
(
"Redirected from "
+
url
+
" to "
+
locUrl
);
}
// clear out old response headers!!!!
...
...
jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java
浏览文件 @
6c6fb950
...
...
@@ -28,7 +28,7 @@ import java.net.URL;
import
java.net.PasswordAuthentication
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Method
;
import
sun.
net.www.http.HttpCapture
;
import
sun.
util.logging.PlatformLogger
;
/**
* Proxy class for loading NTLMAuthentication, so as to remove static
...
...
@@ -59,7 +59,7 @@ class NTLMAuthenticationProxy {
try
{
return
threeArgCtr
.
newInstance
(
isProxy
,
url
,
pw
);
}
catch
(
ReflectiveOperationException
roe
)
{
log
(
roe
);
finest
(
roe
);
}
return
null
;
...
...
@@ -72,7 +72,7 @@ class NTLMAuthenticationProxy {
try
{
return
fiveArgCtr
.
newInstance
(
isProxy
,
host
,
port
,
pw
);
}
catch
(
ReflectiveOperationException
roe
)
{
log
(
roe
);
finest
(
roe
);
}
return
null
;
...
...
@@ -86,7 +86,7 @@ class NTLMAuthenticationProxy {
try
{
return
(
Boolean
)
method
.
invoke
(
null
);
}
catch
(
ReflectiveOperationException
roe
)
{
log
(
roe
);
finest
(
roe
);
}
return
false
;
...
...
@@ -116,7 +116,7 @@ class NTLMAuthenticationProxy {
fiveArg
);
}
}
catch
(
ClassNotFoundException
cnfe
)
{
log
(
cnfe
);
finest
(
cnfe
);
}
catch
(
ReflectiveOperationException
roe
)
{
throw
new
AssertionError
(
roe
);
}
...
...
@@ -124,9 +124,8 @@ class NTLMAuthenticationProxy {
return
null
;
}
static
void
log
(
Exception
e
)
{
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"NTLMAuthenticationProxy: "
+
e
);
}
static
void
finest
(
Exception
e
)
{
PlatformLogger
logger
=
HttpURLConnection
.
getHttpLogger
();
logger
.
finest
(
"NTLMAuthenticationProxy: "
+
e
);
}
}
jdk/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
浏览文件 @
6c6fb950
...
...
@@ -30,12 +30,12 @@ import java.util.HashMap;
import
sun.net.www.HeaderParser
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
import
sun.util.logging.PlatformLogger
;
import
java.net.URL
;
import
java.io.IOException
;
import
java.net.Authenticator.RequestorType
;
import
java.lang.reflect.Constructor
;
import
sun.net.www.http.HttpCapture
;
import
static
sun
.
net
.
www
.
protocol
.
http
.
AuthScheme
.
NEGOTIATE
;
import
static
sun
.
net
.
www
.
protocol
.
http
.
AuthScheme
.
KERBEROS
;
...
...
@@ -258,7 +258,7 @@ abstract class Negotiator {
clazz
=
Class
.
forName
(
"sun.net.www.protocol.http.NegotiatorImpl"
,
true
,
null
);
c
=
clazz
.
getConstructor
(
HttpCallerInfo
.
class
);
}
catch
(
ClassNotFoundException
cnfe
)
{
log
(
cnfe
);
finest
(
cnfe
);
throw
cnfe
;
}
catch
(
ReflectiveOperationException
roe
)
{
// if the class is there then something seriously wrong if
...
...
@@ -269,10 +269,10 @@ abstract class Negotiator {
try
{
return
(
Negotiator
)
(
c
.
newInstance
(
hci
));
}
catch
(
ReflectiveOperationException
roe
)
{
log
(
roe
);
finest
(
roe
);
Throwable
t
=
roe
.
getCause
();
if
(
t
!=
null
&&
t
instanceof
Exception
)
log
((
Exception
)
t
);
finest
((
Exception
)
t
);
throw
roe
;
}
}
...
...
@@ -281,9 +281,8 @@ abstract class Negotiator {
abstract
byte
[]
nextToken
(
byte
[]
in
)
throws
IOException
;
static
void
log
(
Exception
e
)
{
if
(
HttpCapture
.
isLoggable
(
"FINEST"
))
{
HttpCapture
.
finest
(
"NegotiateAuthentication: "
+
e
);
}
static
void
finest
(
Exception
e
)
{
PlatformLogger
logger
=
HttpURLConnection
.
getHttpLogger
();
logger
.
finest
(
"NegotiateAuthentication: "
+
e
);
}
}
jdk/src/share/classes/sun/util/logging/PlatformLogger.java
浏览文件 @
6c6fb950
...
...
@@ -29,15 +29,15 @@ package sun.util.logging;
import
java.lang.ref.WeakReference
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.io.File
;
import
java.io.PrintStream
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.text.MessageFormat
;
import
java.util.logging.Logger
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
sun.misc.JavaLangAccess
;
import
sun.misc.SharedSecrets
;
...
...
@@ -493,6 +493,7 @@ public class PlatformLogger {
private
static
final
Method
getLoggerMethod
;
private
static
final
Method
setLevelMethod
;
private
static
final
Method
getLevelMethod
;
private
static
final
Method
isLoggableMethod
;
private
static
final
Method
logMethod
;
private
static
final
Method
logThrowMethod
;
private
static
final
Method
logParamsMethod
;
...
...
@@ -505,6 +506,7 @@ public class PlatformLogger {
getLoggerMethod
=
getMethod
(
loggerClass
,
"getLogger"
,
String
.
class
);
setLevelMethod
=
getMethod
(
loggerClass
,
"setLevel"
,
levelClass
);
getLevelMethod
=
getMethod
(
loggerClass
,
"getLevel"
);
isLoggableMethod
=
getMethod
(
loggerClass
,
"isLoggable"
,
levelClass
);
logMethod
=
getMethod
(
loggerClass
,
"log"
,
levelClass
,
String
.
class
);
logThrowMethod
=
getMethod
(
loggerClass
,
"log"
,
levelClass
,
String
.
class
,
Throwable
.
class
);
logParamsMethod
=
getMethod
(
loggerClass
,
"log"
,
levelClass
,
String
.
class
,
Object
[].
class
);
...
...
@@ -608,6 +610,10 @@ public class PlatformLogger {
levelValue
=
newLevel
;
invoke
(
setLevelMethod
,
javaLogger
,
levelObjects
.
get
(
newLevel
));
}
public
boolean
isLoggable
(
int
level
)
{
return
(
Boolean
)
invoke
(
isLoggableMethod
,
javaLogger
,
levelObjects
.
get
(
level
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录