Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1d5b1f12
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看板
提交
1d5b1f12
编写于
7月 29, 2011
作者:
X
xuelei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7068662: Reserve and restore the default locale
Reviewed-by: alanb, weijun
上级
8632cf43
变更
23
显示空白变更内容
内联
并排
Showing
23 changed file
with
727 addition
and
582 deletion
+727
-582
test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java
...g/apache/xml/internal/security/exceptions/LocaleTest.java
+7
-3
test/java/beans/XMLDecoder/Test6341798.java
test/java/beans/XMLDecoder/Test6341798.java
+9
-3
test/java/io/pathNames/win32/bug6344646.java
test/java/io/pathNames/win32/bug6344646.java
+17
-10
test/java/net/CookieHandler/B6791927.java
test/java/net/CookieHandler/B6791927.java
+17
-10
test/java/net/URLConnection/SetIfModifiedSince.java
test/java/net/URLConnection/SetIfModifiedSince.java
+6
-1
test/java/util/Locale/LocaleCategory.java
test/java/util/Locale/LocaleCategory.java
+31
-24
test/java/util/PluggableLocale/CurrencyNameProviderTest.java
test/java/util/PluggableLocale/CurrencyNameProviderTest.java
+8
-2
test/java/util/PluggableLocale/TimeZoneNameProviderTest.java
test/java/util/PluggableLocale/TimeZoneNameProviderTest.java
+6
-4
test/java/util/ResourceBundle/Bug6190861.java
test/java/util/ResourceBundle/Bug6190861.java
+23
-16
test/java/util/ResourceBundle/Control/Bug6530694.java
test/java/util/ResourceBundle/Control/Bug6530694.java
+8
-2
test/java/util/ResourceBundle/Control/StressTest.java
test/java/util/ResourceBundle/Control/StressTest.java
+32
-24
test/java/util/ResourceBundle/Test4314141.java
test/java/util/ResourceBundle/Test4314141.java
+9
-3
test/java/util/ResourceBundle/Test4318520.java
test/java/util/ResourceBundle/Test4318520.java
+9
-3
test/java/util/jar/JarFile/TurkCert.java
test/java/util/jar/JarFile/TurkCert.java
+19
-11
test/javax/crypto/Cipher/Turkish.java
test/javax/crypto/Cipher/Turkish.java
+15
-9
test/javax/swing/JColorChooser/Test6524757.java
test/javax/swing/JColorChooser/Test6524757.java
+18
-12
test/sun/security/tools/keytool/KeyToolTest.java
test/sun/security/tools/keytool/KeyToolTest.java
+46
-40
test/sun/text/resources/Collator/Bug4248694.java
test/sun/text/resources/Collator/Bug4248694.java
+37
-31
test/sun/text/resources/Collator/Bug4804273.java
test/sun/text/resources/Collator/Bug4804273.java
+76
-69
test/sun/text/resources/Collator/Bug4848897.java
test/sun/text/resources/Collator/Bug4848897.java
+34
-29
test/sun/text/resources/Format/Bug4651568.java
test/sun/text/resources/Format/Bug4651568.java
+25
-19
test/sun/util/resources/Locale/Bug4965260.java
test/sun/util/resources/Locale/Bug4965260.java
+47
-41
test/sun/util/resources/TimeZone/Bug4640234.java
test/sun/util/resources/TimeZone/Bug4640234.java
+228
-216
未找到文件。
test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006,
2011,
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
...
...
@@ -36,15 +36,19 @@ public class LocaleTest {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
Locale
.
ITALY
);
try
{
throw
new
XMLSecurityException
(
"foo"
);
}
catch
(
XMLSecurityException
xse
)
{
System
.
out
.
println
(
"Test PASSED"
);
}
catch
(
Throwable
t
)
{
System
.
out
.
println
(
"Test FAILED"
);
t
.
printStackTrace
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/java/beans/XMLDecoder/Test6341798.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2005, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
11
, 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
...
...
@@ -47,8 +47,14 @@ public class Test6341798 {
+
"</java> "
;
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
test
(
ENGLISH
,
DATA
.
getBytes
());
test
(
TURKISH
,
DATA
.
getBytes
());
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
private
static
void
test
(
Locale
locale
,
byte
[]
data
)
{
...
...
test/java/io/pathNames/win32/bug6344646.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005,
2011,
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
...
...
@@ -32,6 +32,8 @@ import java.util.*;
public
class
bug6344646
{
public
static
void
main
(
String
[]
s
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
/* This test is only valid on win32 systems */
if
(
File
.
separatorChar
!=
'\\'
)
{
return
;
...
...
@@ -42,7 +44,12 @@ public class bug6344646 {
File
f2
=
new
File
(
"j\u0301"
);
if
(
f1
.
hashCode
()
!=
f2
.
hashCode
())
{
throw
new
RuntimeException
(
"File.hashCode() for \"J\u0301\" and \"j\u0301\" should be the same"
);
throw
new
RuntimeException
(
"File.hashCode() for \"J\u0301\" "
+
"and \"j\u0301\" should be the same"
);
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/java/net/CookieHandler/B6791927.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009,
2011,
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
...
...
@@ -33,6 +33,8 @@ import java.util.Locale;
public
class
B6791927
{
public
static
final
void
main
(
String
[]
aaParamters
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
// Forces a non US locale
Locale
.
setDefault
(
Locale
.
FRANCE
);
List
<
HttpCookie
>
cookies
=
HttpCookie
.
parse
(
"set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT"
);
...
...
@@ -41,8 +43,13 @@ public class B6791927 {
}
for
(
HttpCookie
c
:
cookies
)
{
if
(
c
.
getMaxAge
()
==
0
)
{
throw
new
RuntimeException
(
"Expiration date shouldn't be 0"
);
throw
new
RuntimeException
(
"Expiration date shouldn't be 0"
);
}
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/java/net/URLConnection/SetIfModifiedSince.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
1
, 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
...
...
@@ -73,6 +73,7 @@ public class SetIfModifiedSince {
}
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
Locale
.
JAPAN
);
ServerSocket
serversocket
=
new
ServerSocket
(
0
);
...
...
@@ -87,6 +88,10 @@ public class SetIfModifiedSince {
int
i
=
0
,
c
;
Thread
.
sleep
(
5000
);
}
catch
(
Exception
e
)
{
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/java/util/Locale/LocaleCategory.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2011,
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
...
...
@@ -29,13 +29,16 @@ public class LocaleCategory {
private
static
String
enc
=
null
;
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
Builder
builder
=
new
Locale
.
Builder
();
base
=
builder
.
setLanguage
(
System
.
getProperty
(
"user.language"
,
""
))
.
setScript
(
System
.
getProperty
(
"user.script"
,
""
))
.
setRegion
(
System
.
getProperty
(
"user.country"
,
""
))
.
setVariant
(
System
.
getProperty
(
"user.variant"
,
""
)).
build
();
disp
=
builder
.
setLanguage
(
System
.
getProperty
(
"user.language.display"
,
disp
=
builder
.
setLanguage
(
System
.
getProperty
(
"user.language.display"
,
Locale
.
getDefault
().
getLanguage
()))
.
setScript
(
System
.
getProperty
(
"user.script.display"
,
Locale
.
getDefault
().
getScript
()))
...
...
@@ -53,6 +56,10 @@ public class LocaleCategory {
Locale
.
getDefault
().
getVariant
())).
build
();
checkDefault
();
testGetSetDefault
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
static
void
checkDefault
()
{
...
...
test/java/util/PluggableLocale/CurrencyNameProviderTest.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -32,7 +32,13 @@ import sun.util.resources.*;
public
class
CurrencyNameProviderTest
extends
ProviderTest
{
public
static
void
main
(
String
[]
s
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
new
CurrencyNameProviderTest
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
CurrencyNameProviderTest
()
{
...
...
test/java/util/PluggableLocale/TimeZoneNameProviderTest.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -113,6 +113,7 @@ public class TimeZoneNameProviderTest extends ProviderTest {
void
test2
()
{
Locale
defaultLocale
=
Locale
.
getDefault
();
TimeZone
reservedTimeZone
=
TimeZone
.
getDefault
();
Date
d
=
new
Date
(
2005
-
1900
,
Calendar
.
DECEMBER
,
22
);
String
formatted
;
...
...
@@ -139,7 +140,6 @@ public class TimeZoneNameProviderTest extends ProviderTest {
df
=
new
SimpleDateFormat
(
pattern
,
DateFormatSymbols
.
getInstance
());
System
.
out
.
println
(
formatted
=
df
.
format
(
d
));
if
(!
formatted
.
equals
(
DISPLAY_NAMES_KYOTO
[
i
]))
{
Locale
.
setDefault
(
defaultLocale
);
throw
new
RuntimeException
(
"Timezone "
+
TIMEZONES
[
i
]
+
": formatted zone names mismatch. "
+
formatted
+
" should match with "
+
...
...
@@ -148,10 +148,12 @@ public class TimeZoneNameProviderTest extends ProviderTest {
df
.
parse
(
DISPLAY_NAMES_KYOTO
[
i
]);
}
}
catch
(
ParseException
pe
)
{
Locale
.
setDefault
(
defaultLocale
);
throw
new
RuntimeException
(
"parse error occured"
+
pe
);
}
}
finally
{
// restore the reserved locale and time zone
Locale
.
setDefault
(
defaultLocale
);
TimeZone
.
setDefault
(
reservedTimeZone
);
}
}
final
String
LATIME
=
"America/Los_Angeles"
;
...
...
test/java/util/ResourceBundle/Bug6190861.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -32,6 +32,8 @@ import java.util.*;
public
class
Bug6190861
{
static
public
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
new
Locale
(
"en"
,
"US"
));
List
localeList
=
new
ArrayList
();
...
...
@@ -47,13 +49,18 @@ public class Bug6190861 {
System
.
out
.
println
(
"\ncurrentLocale = "
+
currentLocale
.
getDisplayName
());
ResourceBundle
messages
=
ResourceBundle
.
getBundle
(
"Bug6190861Data"
,
currentLocale
);
ResourceBundle
messages
=
ResourceBundle
.
getBundle
(
"Bug6190861Data"
,
currentLocale
);
Locale
messagesLocale
=
messages
.
getLocale
();
System
.
out
.
println
(
"messagesLocale = "
+
messagesLocale
.
getDisplayName
());
checkMessages
(
messages
);
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
static
void
checkMessages
(
ResourceBundle
messages
)
{
...
...
test/java/util/ResourceBundle/Control/Bug6530694.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -43,6 +43,12 @@ public class Bug6530694 {
}
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
new
Bug6530694
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/java/util/ResourceBundle/Control/StressTest.java
浏览文件 @
1d5b1f12
...
...
@@ -69,6 +69,9 @@ public class StressTest {
if
(
args
.
length
>
1
)
{
duration
=
Math
.
max
(
5
,
Integer
.
parseInt
(
args
[
1
]));
}
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
Locale
.
US
);
Thread
[]
tasks
=
new
Thread
[
locales
.
length
*
threadsFactor
];
counters
=
new
AtomicIntegerArray
(
tasks
.
length
);
...
...
@@ -82,7 +85,8 @@ public class StressTest {
int
nProcessors
=
Runtime
.
getRuntime
().
availableProcessors
();
intervalForCounterCheck
=
Math
.
max
(
tasks
.
length
/
nProcessors
,
1
);
System
.
out
.
printf
(
"%d processors, intervalForCounterCheck = %d [sec]%n"
,
System
.
out
.
printf
(
"%d processors, intervalForCounterCheck = %d [sec]%n"
,
nProcessors
,
intervalForCounterCheck
);
try
{
for
(
int
i
=
0
;
runrun
&&
i
<
duration
;
i
++)
{
...
...
@@ -99,6 +103,10 @@ public class StressTest {
}
printCounters
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
static
void
checkCounters
()
{
...
...
test/java/util/ResourceBundle/Test4314141.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -35,8 +35,14 @@ import java.util.MissingResourceException;
public
class
Test4314141
{
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
testCandidateOmission
();
testExample
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
/**
...
...
test/java/util/ResourceBundle/Test4318520.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -36,8 +36,14 @@ import java.util.Locale;
public
class
Test4318520
{
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
test
(
Locale
.
GERMAN
);
test
(
Locale
.
ENGLISH
);
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
private
static
void
test
(
Locale
locale
)
{
...
...
test/java/util/jar/JarFile/TurkCert.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002,
2011,
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
...
...
@@ -26,7 +26,6 @@
* @bug 4624534
* @summary Make sure jar certificates work for Turkish locale
* @author kladko
* @run main/othervm TurkCert
*/
import
java.util.*
;
...
...
@@ -36,15 +35,24 @@ import java.io.*;
public
class
TurkCert
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
new
Locale
(
"TR"
,
"tr"
));
File
f
=
new
File
(
System
.
getProperty
(
"test.src"
,
"."
),
"test.jar"
);
JarFile
jf
=
new
JarFile
(
f
,
true
);
try
(
JarFile
jf
=
new
JarFile
(
f
,
true
))
{
JarEntry
je
=
(
JarEntry
)
jf
.
getEntry
(
"test.class"
);
InputStream
is
=
jf
.
getInputStream
(
je
);
try
(
InputStream
is
=
jf
.
getInputStream
(
je
))
{
byte
[]
b
=
new
byte
[
1024
];
while
(
is
.
read
(
b
)
!=
-
1
)
{
}
if
(
je
.
getCertificates
()
==
null
)
}
if
(
je
.
getCertificates
()
==
null
)
{
throw
new
Exception
(
"Null certificate for test.class."
);
}
}
}
finally
{
// restore the default locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/javax/crypto/Cipher/Turkish.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2005, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
11
, 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
...
...
@@ -35,6 +35,8 @@ import javax.crypto.Cipher;
public
class
Turkish
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
new
Locale
(
"tr"
,
"TR"
));
System
.
out
.
println
(
Cipher
.
getInstance
(
"RSA/ECB/PKCS1Padding"
));
...
...
@@ -45,5 +47,9 @@ public class Turkish {
System
.
out
.
println
(
Cipher
.
getInstance
(
"BLOWFISH"
));
System
.
out
.
println
(
"OK"
);
}
finally
{
// restore the default locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/javax/swing/JColorChooser/Test6524757.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 20
11
, 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
...
...
@@ -98,6 +98,8 @@ public class Test6524757 {
private
static
final
Object
[]
FRENCH
=
convert
(
Locale
.
FRENCH
,
KEYS
);
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
// it affects Swing because it is not initialized
Locale
.
setDefault
(
Locale
.
KOREAN
);
validate
(
KOREAN
,
create
());
...
...
@@ -109,6 +111,10 @@ public class Test6524757 {
// it definitely should affect Swing
JComponent
.
setDefaultLocale
(
Locale
.
FRENCH
);
validate
(
FRENCH
,
create
());
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
private
static
void
validate
(
Object
[]
expected
,
Object
[]
actual
)
{
...
...
test/sun/security/tools/keytool/KeyToolTest.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2005, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
11
, 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
...
...
@@ -1278,6 +1278,8 @@ public class KeyToolTest {
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
// first test if HumanInputStream really acts like a human being
HumanInputStream
.
test
();
KeyToolTest
t
=
new
KeyToolTest
();
...
...
@@ -1324,6 +1326,10 @@ public class KeyToolTest {
}
System
.
out
.
println
(
"Test pass!!!"
);
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
...
...
test/sun/text/resources/Collator/Bug4248694.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -35,6 +35,8 @@ public class Bug4248694 {
/********************************************************
*********************************************************/
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
int
errors
=
0
;
Locale
loc
=
new
Locale
(
"is"
,
"is"
);
// Icelandic
...
...
@@ -72,6 +74,10 @@ public class Bug4248694 {
if
(
errors
>
0
)
throw
new
RuntimeException
();
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
//end main
}
//end class CollatorTest
test/sun/text/resources/Collator/Bug4804273.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -35,6 +35,8 @@ public class Bug4804273 {
/********************************************************
*********************************************************/
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
int
errors
=
0
;
Locale
loc
=
new
Locale
(
"sv"
,
"se"
);
// Swedish
...
...
@@ -110,7 +112,12 @@ public class Bug4804273 {
}
//end for
if
(
errors
>
0
)
throw
new
RuntimeException
(
"There are "
+
errors
+
" words sorted incorrectly!"
);
throw
new
RuntimeException
(
"There are "
+
errors
+
" words sorted incorrectly!"
);
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
//end main
}
//end class CollatorTest
test/sun/text/resources/Collator/Bug4848897.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -35,7 +35,8 @@ public class Bug4848897 {
/********************************************************
*********************************************************/
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
int
errors
=
0
;
Locale
loc
=
new
Locale
(
"no"
,
"NO"
);
// Norwegian
...
...
@@ -68,6 +69,10 @@ public class Bug4848897 {
if
(
errors
>
0
)
throw
new
RuntimeException
();
}
//end main
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
// end main
}
//end class CollatorTest
test/sun/text/resources/Format/Bug4651568.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -34,6 +34,8 @@ import java.util.Locale;
public
class
Bug4651568
{
public
static
void
main
(
String
argv
[]
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
String
expectedCurrencyPattern
=
"\u00A4 #.##0,00"
;
Locale
locale
=
new
Locale
(
"pt"
,
"BR"
);
...
...
@@ -42,8 +44,8 @@ public class Bug4651568 {
DecimalFormat
formatter
=
(
DecimalFormat
)
NumberFormat
.
getCurrencyInstance
(
locale
);
if
(
formatter
.
toLocalizedPattern
().
equals
(
expectedCurrencyPattern
))
{
if
(
formatter
.
toLocalizedPattern
().
equals
(
expectedCurrencyPattern
))
{
System
.
out
.
println
(
"Passed."
);
}
else
{
System
.
out
.
println
(
"Failed Currency pattern."
+
...
...
@@ -52,5 +54,9 @@ public class Bug4651568 {
throw
new
RuntimeException
();
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/sun/util/resources/Locale/Bug4965260.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -48,6 +48,8 @@ public class Bug4965260 {
};
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
Locale
.
ENGLISH
);
if
(
locales2Test
.
length
!=
expectedNames
.
length
)
{
throw
new
Exception
(
"\nData sizes does not match!\n"
);
...
...
@@ -74,5 +76,9 @@ public class Bug4965260 {
if
(
message
.
length
()
>
0
)
{
throw
new
Exception
(
"\n"
+
message
.
toString
());
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
}
test/sun/util/resources/TimeZone/Bug4640234.java
浏览文件 @
1d5b1f12
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2011,
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
...
...
@@ -24,11 +24,11 @@
/**
* @test
* @bug 4640234 4946057 4938151 4873691 5023181
* @summary Verifies the translation of time zone names, this test will catch
presence
*
of country name for english and selected locales for all ISO country
* codes.
* The test program also displays which timezone, country and
language names
* are not translated
* @summary Verifies the translation of time zone names, this test will catch
*
presence of country name for english and selected locales for all
*
ISO country
codes.
* The test program also displays which timezone, country and
*
language names
are not translated
*/
...
...
@@ -73,6 +73,8 @@ public class Bug4640234 {
};
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
Locale
.
setDefault
(
Locale
.
ENGLISH
);
StringBuffer
errors
=
new
StringBuffer
(
""
);
...
...
@@ -82,7 +84,8 @@ public class Bug4640234 {
String
[]
countries
=
locEn
.
getISOCountries
();
String
[]
languages
=
locEn
.
getISOLanguages
();
ResourceBundle
resEn
=
ResourceBundle
.
getBundle
(
"sun.util.resources.LocaleNames"
,
locEn
);
ResourceBundle
resEn
=
ResourceBundle
.
getBundle
(
"sun.util.resources.LocaleNames"
,
locEn
);
Map
<
String
,
String
>
countryMapEn
=
getList
(
resEn
,
true
);
Map
<
String
,
String
>
languageMapEn
=
getList
(
resEn
,
false
);
...
...
@@ -91,7 +94,8 @@ public class Bug4640234 {
Map
<
String
,
String
>
languageMap
;
for
(
Locale
locale
:
locales2Test
)
{
resLoc
=
ResourceBundle
.
getBundle
(
"sun.util.resources.LocaleNames"
,
locale
);
resLoc
=
ResourceBundle
.
getBundle
(
"sun.util.resources.LocaleNames"
,
locale
);
sdfLoc
=
new
SimpleDateFormat
(
"zzzz"
,
locale
);
sdfLocShort
=
new
SimpleDateFormat
(
"z"
,
locale
);
...
...
@@ -153,6 +157,10 @@ public class Bug4640234 {
System
.
out
.
println
(
warnings
.
toString
());
throw
new
Exception
(
"\n"
+
message
);
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
/**
...
...
@@ -210,16 +218,19 @@ public class Bug4640234 {
/**
* Verifies whether the name for ISOCode is localized.
* @param ISOCode - ISO country/language code for country/language name to test
* @param ISOCode - ISO country/language code for country/language name
* to test
* @param entriesEn - array of english country/language names
* @param entriesLoc - array of localized country/language names for specified locale
* @param entriesLoc - array of localized country/language names for
* specified locale
* @param locale - locale to test against english
* @param notFoundMessage - message in form ready for MessageFormat, {0} will be human readable
* language name, {1} will be ISOCode.
* @param notLocalizedMessage - message in for ready for MessageFormat, same formatting like
* for notFountMessage
* @return array of two empty strings when passed, descriptive error message in
* other cases, [0] - warnings for not localized, [1] - errors for missing keys.
* @param notFoundMessage - message in form ready for MessageFormat,
* {0} will be human readable language name, {1} will be ISOCode.
* @param notLocalizedMessage - message in for ready for MessageFormat,
* same formatting like for notFountMessage
* @return array of two empty strings when passed, descriptive error message
* in other cases, [0] - warnings for not localized, [1] - errors for
* missing keys.
*/
private
static
String
[]
testEntry
(
String
ISOCode
,
Map
<
String
,
String
>
entriesEn
,
...
...
@@ -274,7 +285,8 @@ public class Bug4640234 {
return
false
;
}
private
static
Map
<
String
,
String
>
getList
(
ResourceBundle
rs
,
Boolean
getCountryList
)
{
private
static
Map
<
String
,
String
>
getList
(
ResourceBundle
rs
,
Boolean
getCountryList
)
{
char
beginChar
=
'a'
;
char
endChar
=
'z'
;
if
(
getCountryList
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录