Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f6ef9ec5
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看板
提交
f6ef9ec5
编写于
5月 07, 2013
作者:
N
naoto
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
Reviewed-by: okutsu
上级
8900c528
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
10 deletion
+65
-10
src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java
...classes/sun/util/locale/provider/TimeZoneNameUtility.java
+18
-7
test/java/util/Locale/LocaleProviders.java
test/java/util/Locale/LocaleProviders.java
+13
-0
test/java/util/Locale/LocaleProviders.sh
test/java/util/Locale/LocaleProviders.sh
+34
-3
未找到文件。
src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java
浏览文件 @
f6ef9ec5
/*
* Copyright (c) 2005, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. 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
...
...
@@ -239,14 +239,25 @@ public final class TimeZoneNameUtility {
for
(
int
i
=
1
;
i
<=
4
;
i
++)
{
names
[
i
]
=
tznp
.
getDisplayName
(
id
,
i
>=
3
,
i
%
2
,
locale
);
if
(
i
>=
3
&&
names
[
i
]
==
null
)
{
names
[
i
]
=
names
[
i
-
2
];
if
(
names
[
i
]
==
null
)
{
switch
(
i
)
{
case
1
:
// this id seems not localized by this provider
return
null
;
case
2
:
case
4
:
// If the display name for SHORT is not supplied,
// copy the LONG name.
names
[
i
]
=
names
[
i
-
1
];
break
;
case
3
:
// If the display name for DST is not supplied,
// copy the "standard" name.
names
[
3
]
=
names
[
1
];
break
;
}
}
if
(
names
[
1
]
==
null
)
{
// this id seems not localized by this provider
names
=
null
;
}
return
names
;
...
...
test/java/util/Locale/LocaleProviders.java
浏览文件 @
f6ef9ec5
...
...
@@ -60,6 +60,10 @@ public class LocaleProviders {
bug8010666Test
();
break
;
case
"bug8013086Test"
:
bug8013086Test
(
args
[
1
],
args
[
2
]);
break
;
default
:
throw
new
RuntimeException
(
"Test method '"
+
methodName
+
"' not found."
);
}
...
...
@@ -142,4 +146,13 @@ public class LocaleProviders {
}
}
}
static
void
bug8013086Test
(
String
lang
,
String
ctry
)
{
try
{
// Throws a NullPointerException if the test fails.
System
.
out
.
println
(
new
SimpleDateFormat
(
"z"
,
new
Locale
(
lang
,
ctry
)).
parse
(
"UTC"
));
}
catch
(
ParseException
pe
)
{
// ParseException is fine in this test, as it's not "UTC"
}
}
}
test/java/util/Locale/LocaleProviders.sh
浏览文件 @
f6ef9ec5
...
...
@@ -24,6 +24,7 @@
#
# @test
# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8010666
# 8013086
# @summary tests for "java.locale.providers" system property
# @compile -XDignore.symbol.file LocaleProviders.java
# @run shell/timeout=600 LocaleProviders.sh
...
...
@@ -69,7 +70,7 @@ case "$OS" in
;;
esac
# create
an SPI implementation
# create
SPI implementations
mk
()
{
d
=
`
dirname
$1
`
if
[
!
-d
$d
]
;
then
mkdir
-p
$d
;
fi
...
...
@@ -88,16 +89,38 @@ public class tznp extends TimeZoneNameProvider {
}
public Locale[] getAvailableLocales() {
Locale[] locales = {Locale.GERMAN, Locale.US, Locale.JAPANESE, Locale.CHINESE};
Locale[] locales = {Locale.US};
return locales;
}
}
EOF
mk
${
SPIDIR
}${
FS
}
src
${
FS
}
tznp8013086.java
<<
EOF
import java.util.spi.TimeZoneNameProvider;
import java.util.Locale;
import java.util.TimeZone;
public class tznp8013086 extends TimeZoneNameProvider {
public String getDisplayName(String ID, boolean daylight, int style, Locale locale) {
if (!daylight && style==TimeZone.LONG) {
return "tznp8013086";
} else {
return null;
}
}
public Locale[] getAvailableLocales() {
Locale[] locales = {Locale.JAPAN};
return locales;
}
}
EOF
mk
${
SPIDIR
}${
FS
}
dest
${
FS
}
META-INF
${
FS
}
services
${
FS
}
java.util.spi.TimeZoneNameProvider
<<
EOF
tznp
tznp8013086
EOF
${
COMPILEJAVA
}${
FS
}
bin
${
FS
}
javac
${
TESTJAVACOPTS
}
${
TESTTOOLVMOPTS
}
-d
${
SPIDIR
}${
FS
}
dest
\
${
SPIDIR
}${
FS
}
src
${
FS
}
tznp.java
${
SPIDIR
}${
FS
}
src
${
FS
}
tznp.java
\
${
SPIDIR
}${
FS
}
src
${
FS
}
tznp8013086.java
${
COMPILEJAVA
}${
FS
}
bin
${
FS
}
jar
${
TESTTOOLVMOPTS
}
cvf
${
SPIDIR
}${
FS
}
tznp.jar
-C
${
SPIDIR
}${
FS
}
dest
.
# get the platform default locales
...
...
@@ -269,4 +292,12 @@ then
runTest
fi
# testing 8013086 fix.
METHODNAME
=
bug8013086Test
PREFLIST
=
"JRE,SPI -Djava.ext.dirs=
${
SPIDIR
}
"
PARAM1
=
ja
PARAM2
=
JP
PARAM3
=
runTest
exit
$result
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录