Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f5e0b359
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f5e0b359
编写于
9月 18, 2009
作者:
M
mchung
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
59c6728a
11a3c1ee
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
778 addition
and
26 deletion
+778
-26
make/java/logging/Makefile
make/java/logging/Makefile
+1
-2
src/share/classes/java/util/Currency.java
src/share/classes/java/util/Currency.java
+9
-9
src/share/classes/java/util/jar/Attributes.java
src/share/classes/java/util/jar/Attributes.java
+2
-2
src/share/classes/java/util/logging/LogManager.java
src/share/classes/java/util/logging/LogManager.java
+4
-0
src/share/classes/java/util/logging/LogRecord.java
src/share/classes/java/util/logging/LogRecord.java
+10
-6
src/share/classes/sun/util/LocaleServiceProviderPool.java
src/share/classes/sun/util/LocaleServiceProviderPool.java
+8
-3
src/share/classes/sun/util/logging/PlatformLogger.java
src/share/classes/sun/util/logging/PlatformLogger.java
+629
-0
src/windows/classes/java/util/prefs/WindowsPreferences.java
src/windows/classes/java/util/prefs/WindowsPreferences.java
+4
-4
test/sun/util/logging/PlatformLoggerTest.java
test/sun/util/logging/PlatformLoggerTest.java
+111
-0
未找到文件。
make/java/logging/Makefile
浏览文件 @
f5e0b359
...
@@ -31,7 +31,7 @@ include $(BUILDDIR)/common/Defs.gmk
...
@@ -31,7 +31,7 @@ include $(BUILDDIR)/common/Defs.gmk
#
#
# Files to compile.
# Files to compile.
#
#
AUTO_FILES_JAVA_DIRS
=
java/util/logging
AUTO_FILES_JAVA_DIRS
=
java/util/logging
sun/util/logging
#
#
# Resources
# Resources
...
@@ -46,7 +46,6 @@ RESOURCE_BUNDLES_COMPILED_PROPERTIES = \
...
@@ -46,7 +46,6 @@ RESOURCE_BUNDLES_COMPILED_PROPERTIES = \
include
$(BUILDDIR)/common/Classes.gmk
include
$(BUILDDIR)/common/Classes.gmk
properties
:
$(LIBDIR)/logging.properties
properties
:
$(LIBDIR)/logging.properties
$(LIBDIR)/logging.properties
:
$(SHARE_SRC)/lib/logging.properties
$(LIBDIR)/logging.properties
:
$(SHARE_SRC)/lib/logging.properties
$
(
install-file
)
$
(
install-file
)
...
...
src/share/classes/java/util/Currency.java
浏览文件 @
f5e0b359
...
@@ -35,12 +35,12 @@ import java.io.Serializable;
...
@@ -35,12 +35,12 @@ import java.io.Serializable;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleServiceProvider
;
import
java.util.spi.LocaleServiceProvider
;
import
sun.util.LocaleServiceProviderPool
;
import
sun.util.LocaleServiceProviderPool
;
import
sun.util.logging.PlatformLogger
;
import
sun.util.resources.LocaleData
;
import
sun.util.resources.LocaleData
;
import
sun.util.resources.OpenListResourceBundle
;
import
sun.util.resources.OpenListResourceBundle
;
...
@@ -244,7 +244,7 @@ public final class Currency implements Serializable {
...
@@ -244,7 +244,7 @@ public final class Currency implements Serializable {
}
}
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
(
Level
.
INFO
,
"currency.properties is ignored because of an IOException"
,
e
);
info
(
"currency.properties is ignored because of an IOException"
,
e
);
}
}
return
null
;
return
null
;
}
}
...
@@ -686,7 +686,7 @@ public final class Currency implements Serializable {
...
@@ -686,7 +686,7 @@ public final class Currency implements Serializable {
.
append
(
"The entry in currency.properties for "
)
.
append
(
"The entry in currency.properties for "
)
.
append
(
ctry
).
append
(
" is ignored because of the invalid country code."
)
.
append
(
ctry
).
append
(
" is ignored because of the invalid country code."
)
.
toString
();
.
toString
();
log
(
Level
.
INFO
,
message
,
null
);
info
(
message
,
null
);
return
;
return
;
}
}
...
@@ -698,7 +698,7 @@ public final class Currency implements Serializable {
...
@@ -698,7 +698,7 @@ public final class Currency implements Serializable {
.
append
(
ctry
)
.
append
(
ctry
)
.
append
(
" is ignored because the value format is not recognized."
)
.
append
(
" is ignored because the value format is not recognized."
)
.
toString
();
.
toString
();
log
(
Level
.
INFO
,
message
,
null
);
info
(
message
,
null
);
return
;
return
;
}
}
...
@@ -726,13 +726,13 @@ public final class Currency implements Serializable {
...
@@ -726,13 +726,13 @@ public final class Currency implements Serializable {
setMainTableEntry
(
ctry
.
charAt
(
0
),
ctry
.
charAt
(
1
),
entry
);
setMainTableEntry
(
ctry
.
charAt
(
0
),
ctry
.
charAt
(
1
),
entry
);
}
}
private
static
void
log
(
Level
level
,
String
message
,
Throwable
t
)
{
private
static
void
info
(
String
message
,
Throwable
t
)
{
Logger
logger
=
Logger
.
getLogger
(
"java.util.Currency"
);
PlatformLogger
logger
=
Platform
Logger
.
getLogger
(
"java.util.Currency"
);
if
(
logger
.
isLoggable
(
level
))
{
if
(
logger
.
isLoggable
(
PlatformLogger
.
INFO
))
{
if
(
t
!=
null
)
{
if
(
t
!=
null
)
{
logger
.
log
(
level
,
message
,
t
);
logger
.
info
(
message
,
t
);
}
else
{
}
else
{
logger
.
log
(
level
,
message
);
logger
.
info
(
message
);
}
}
}
}
}
}
...
...
src/share/classes/java/util/jar/Attributes.java
浏览文件 @
f5e0b359
...
@@ -34,7 +34,7 @@ import java.util.Set;
...
@@ -34,7 +34,7 @@ import java.util.Set;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.AbstractSet
;
import
java.util.AbstractSet
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.logging.
Logger
;
import
sun.util.logging.Platform
Logger
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
sun.misc.ASCIICaseInsensitiveComparator
;
import
sun.misc.ASCIICaseInsensitiveComparator
;
...
@@ -419,7 +419,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
...
@@ -419,7 +419,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
}
}
try
{
try
{
if
((
putValue
(
name
,
value
)
!=
null
)
&&
(!
lineContinued
))
{
if
((
putValue
(
name
,
value
)
!=
null
)
&&
(!
lineContinued
))
{
Logger
.
getLogger
(
"java.util.jar"
).
warning
(
Platform
Logger
.
getLogger
(
"java.util.jar"
).
warning
(
"Duplicate name in Manifest: "
+
name
"Duplicate name in Manifest: "
+
name
+
".\n"
+
".\n"
+
"Ensure that the manifest does not "
+
"Ensure that the manifest does not "
...
...
src/share/classes/java/util/logging/LogManager.java
浏览文件 @
f5e0b359
...
@@ -283,6 +283,10 @@ public class LogManager {
...
@@ -283,6 +283,10 @@ public class LogManager {
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
public
Object
run
()
throws
Exception
{
public
Object
run
()
throws
Exception
{
readConfiguration
();
readConfiguration
();
// Platform loggers begin to delegate to java.util.logging.Logger
sun
.
util
.
logging
.
PlatformLogger
.
redirectPlatformLoggers
();
return
null
;
return
null
;
}
}
});
});
...
...
src/share/classes/java/util/logging/LogRecord.java
浏览文件 @
f5e0b359
...
@@ -530,6 +530,7 @@ public class LogRecord implements java.io.Serializable {
...
@@ -530,6 +530,7 @@ public class LogRecord implements java.io.Serializable {
int
depth
=
access
.
getStackTraceDepth
(
throwable
);
int
depth
=
access
.
getStackTraceDepth
(
throwable
);
String
logClassName
=
"java.util.logging.Logger"
;
String
logClassName
=
"java.util.logging.Logger"
;
String
plogClassName
=
"sun.util.logging.PlatformLogger"
;
boolean
lookingForLogger
=
true
;
boolean
lookingForLogger
=
true
;
for
(
int
ix
=
0
;
ix
<
depth
;
ix
++)
{
for
(
int
ix
=
0
;
ix
<
depth
;
ix
++)
{
// Calling getStackTraceElement directly prevents the VM
// Calling getStackTraceElement directly prevents the VM
...
@@ -539,15 +540,18 @@ public class LogRecord implements java.io.Serializable {
...
@@ -539,15 +540,18 @@ public class LogRecord implements java.io.Serializable {
String
cname
=
frame
.
getClassName
();
String
cname
=
frame
.
getClassName
();
if
(
lookingForLogger
)
{
if
(
lookingForLogger
)
{
// Skip all frames until we have found the first logger frame.
// Skip all frames until we have found the first logger frame.
if
(
cname
.
equals
(
logClassName
))
{
if
(
cname
.
equals
(
logClassName
)
||
cname
.
startsWith
(
plogClassName
)
)
{
lookingForLogger
=
false
;
lookingForLogger
=
false
;
}
}
}
else
{
}
else
{
if
(!
cname
.
equals
(
logClassName
))
{
if
(!
cname
.
equals
(
logClassName
)
&&
!
cname
.
startsWith
(
plogClassName
))
{
// We've found the relevant frame.
// skip reflection call
setSourceClassName
(
cname
);
if
(!
cname
.
startsWith
(
"java.lang.reflect."
)
&&
!
cname
.
startsWith
(
"sun.reflect."
))
{
setSourceMethodName
(
frame
.
getMethodName
());
// We've found the relevant frame.
return
;
setSourceClassName
(
cname
);
setSourceMethodName
(
frame
.
getMethodName
());
return
;
}
}
}
}
}
}
}
...
...
src/share/classes/sun/util/LocaleServiceProviderPool.java
浏览文件 @
f5e0b359
...
@@ -39,8 +39,8 @@ import java.util.ServiceLoader;
...
@@ -39,8 +39,8 @@ import java.util.ServiceLoader;
import
java.util.ServiceConfigurationError
;
import
java.util.ServiceConfigurationError
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.logging.Logger
;
import
java.util.spi.LocaleServiceProvider
;
import
java.util.spi.LocaleServiceProvider
;
import
sun.util.logging.PlatformLogger
;
import
sun.util.resources.LocaleData
;
import
sun.util.resources.LocaleData
;
import
sun.util.resources.OpenListResourceBundle
;
import
sun.util.resources.OpenListResourceBundle
;
...
@@ -122,10 +122,15 @@ public final class LocaleServiceProviderPool {
...
@@ -122,10 +122,15 @@ public final class LocaleServiceProviderPool {
}
}
});
});
}
catch
(
PrivilegedActionException
e
)
{
}
catch
(
PrivilegedActionException
e
)
{
Logger
.
getLogger
(
"sun.util.LocaleServiceProviderPool"
).
config
(
e
.
toString
());
config
(
e
.
toString
());
}
}
}
}
private
static
void
config
(
String
message
)
{
PlatformLogger
logger
=
PlatformLogger
.
getLogger
(
"sun.util.LocaleServiceProviderPool"
);
logger
.
config
(
message
);
}
/**
/**
* Lazy loaded set of available locales.
* Lazy loaded set of available locales.
* Loading all locales is a very long operation.
* Loading all locales is a very long operation.
...
@@ -337,7 +342,7 @@ public final class LocaleServiceProviderPool {
...
@@ -337,7 +342,7 @@ public final class LocaleServiceProviderPool {
if
(
providersObj
!=
null
)
{
if
(
providersObj
!=
null
)
{
return
providersObj
;
return
providersObj
;
}
else
if
(
isObjectProvider
)
{
}
else
if
(
isObjectProvider
)
{
Logger
.
getLogger
(
"sun.util.LocaleServiceProviderPool"
).
config
(
config
(
"A locale sensitive service provider returned null for a localized objects, which should not happen. provider: "
+
lsp
+
" locale: "
+
requested
);
"A locale sensitive service provider returned null for a localized objects, which should not happen. provider: "
+
lsp
+
" locale: "
+
requested
);
}
}
}
}
...
...
src/share/classes/sun/util/logging/PlatformLogger.java
0 → 100644
浏览文件 @
f5e0b359
此差异已折叠。
点击以展开。
src/windows/classes/java/util/prefs/WindowsPreferences.java
浏览文件 @
f5e0b359
...
@@ -29,7 +29,7 @@ import java.util.Map;
...
@@ -29,7 +29,7 @@ import java.util.Map;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.util.logging.
Logger
;
import
sun.util.logging.Platform
Logger
;
/**
/**
* Windows registry based implementation of <tt>Preferences</tt>.
* Windows registry based implementation of <tt>Preferences</tt>.
...
@@ -48,7 +48,7 @@ class WindowsPreferences extends AbstractPreferences{
...
@@ -48,7 +48,7 @@ class WindowsPreferences extends AbstractPreferences{
/**
/**
* Logger for error messages
* Logger for error messages
*/
*/
private
static
Logger
logger
;
private
static
Platform
Logger
logger
;
/**
/**
* Windows registry path to <tt>Preferences</tt>'s root nodes.
* Windows registry path to <tt>Preferences</tt>'s root nodes.
...
@@ -1102,9 +1102,9 @@ class WindowsPreferences extends AbstractPreferences{
...
@@ -1102,9 +1102,9 @@ class WindowsPreferences extends AbstractPreferences{
// assert false;
// assert false;
}
}
private
static
synchronized
Logger
logger
()
{
private
static
synchronized
Platform
Logger
logger
()
{
if
(
logger
==
null
)
{
if
(
logger
==
null
)
{
logger
=
Logger
.
getLogger
(
"java.util.prefs"
);
logger
=
Platform
Logger
.
getLogger
(
"java.util.prefs"
);
}
}
return
logger
;
return
logger
;
}
}
...
...
test/sun/util/logging/PlatformLoggerTest.java
0 → 100644
浏览文件 @
f5e0b359
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6882376
* @summary Test if java.util.logging.Logger is created before and after
* logging is enabled. Also validate some basic PlatformLogger
* operations.
*
* @build PlatformLoggerTest
* @run main PlatformLoggerTest
*/
import
java.util.logging.*
;
import
sun.util.logging.PlatformLogger
;
public
class
PlatformLoggerTest
{
private
static
final
int
defaultEffectiveLevel
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
final
String
FOO_PLATFORM_LOGGER
=
"test.platformlogger.foo"
;
final
String
BAR_PLATFORM_LOGGER
=
"test.platformlogger.bar"
;
final
String
GOO_PLATFORM_LOGGER
=
"test.platformlogger.goo"
;
final
String
BAR_LOGGER
=
"test.logger.bar"
;
PlatformLogger
goo
=
PlatformLogger
.
getLogger
(
GOO_PLATFORM_LOGGER
);
// Create a platform logger using the default
PlatformLogger
foo
=
PlatformLogger
.
getLogger
(
FOO_PLATFORM_LOGGER
);
checkPlatformLogger
(
foo
,
FOO_PLATFORM_LOGGER
);
// create a java.util.logging.Logger
// now java.util.logging.Logger should be created for each platform logger
Logger
logger
=
Logger
.
getLogger
(
BAR_LOGGER
);
logger
.
setLevel
(
Level
.
WARNING
);
PlatformLogger
bar
=
PlatformLogger
.
getLogger
(
BAR_PLATFORM_LOGGER
);
checkPlatformLogger
(
bar
,
BAR_PLATFORM_LOGGER
);
checkLogger
(
FOO_PLATFORM_LOGGER
,
Level
.
FINER
);
checkLogger
(
BAR_PLATFORM_LOGGER
,
Level
.
FINER
);
checkLogger
(
GOO_PLATFORM_LOGGER
,
null
);
checkLogger
(
BAR_LOGGER
,
Level
.
WARNING
);
foo
.
setLevel
(
PlatformLogger
.
SEVERE
);
checkLogger
(
FOO_PLATFORM_LOGGER
,
Level
.
SEVERE
);
}
private
static
void
checkPlatformLogger
(
PlatformLogger
logger
,
String
name
)
{
if
(!
logger
.
getName
().
equals
(
name
))
{
throw
new
RuntimeException
(
"Invalid logger's name "
+
logger
.
getName
()
+
" but expected "
+
name
);
}
if
(
logger
.
getLevel
()
!=
defaultEffectiveLevel
)
{
throw
new
RuntimeException
(
"Invalid default level for logger "
+
logger
.
getName
());
}
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
)
!=
false
)
{
throw
new
RuntimeException
(
"isLoggerable(FINE) returns true for logger "
+
logger
.
getName
()
+
" but expected false"
);
}
logger
.
setLevel
(
PlatformLogger
.
FINER
);
if
(
logger
.
getLevel
()
!=
Level
.
FINER
.
intValue
())
{
throw
new
RuntimeException
(
"Invalid level for logger "
+
logger
.
getName
()
+
" "
+
logger
.
getLevel
());
}
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINE
)
!=
true
)
{
throw
new
RuntimeException
(
"isLoggerable(FINE) returns false for logger "
+
logger
.
getName
()
+
" but expected true"
);
}
logger
.
info
(
"OK: Testing log message"
);
}
private
static
void
checkLogger
(
String
name
,
Level
level
)
{
Logger
logger
=
LogManager
.
getLogManager
().
getLogger
(
name
);
if
(
logger
==
null
)
{
throw
new
RuntimeException
(
"Logger "
+
name
+
" does not exist"
);
}
if
(
logger
.
getLevel
()
!=
level
)
{
throw
new
RuntimeException
(
"Invalid level for logger "
+
logger
.
getName
()
+
" "
+
logger
.
getLevel
());
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录