8062006: Add a new locale data name "COMPAT" for java.locale.providers system property to reduce ambiguity
Reviewed-by: okutsu
This commit is contained in:
parent
638270935d
commit
5710e3c754
@ -123,25 +123,27 @@ import java.util.Locale;
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li> "CLDR": A provider based on Unicode Consortium's
|
* <li> "CLDR": A provider based on Unicode Consortium's
|
||||||
* <a href="http://cldr.unicode.org/">CLDR Project</a>.
|
* <a href="http://cldr.unicode.org/">CLDR Project</a>.
|
||||||
* <li> "JRE": represents the locale sensitive services that is compatible
|
* <li> "COMPAT": represents the locale sensitive services that is compatible
|
||||||
* with the prior JDK releases (same with JDK8's "JRE").
|
* with the prior JDK releases up to JDK8 (same as JDK8's "JRE").
|
||||||
* <li> "SPI": represents the locale sensitive services implementing the subclasses of
|
* <li> "SPI": represents the locale sensitive services implementing the subclasses of
|
||||||
* this {@code LocaleServiceProvider} class.
|
* this {@code LocaleServiceProvider} class.
|
||||||
* <li> "HOST": A provider that reflects the user's custom settings in the
|
* <li> "HOST": A provider that reflects the user's custom settings in the
|
||||||
* underlying operating system. This provider may not be available, depending
|
* underlying operating system. This provider may not be available, depending
|
||||||
* on the Java Runtime Environment implementation.
|
* on the Java Runtime Environment implementation.
|
||||||
|
* <li> "JRE": represents a synonym to "COMPAT". This name
|
||||||
|
* is deprecated and will be removed in the future release of JDK.
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* For example, if the following is specified in the property:
|
* For example, if the following is specified in the property:
|
||||||
* <pre>
|
* <pre>
|
||||||
* java.locale.providers=SPI,CLDR,JRE
|
* java.locale.providers=SPI,CLDR,COMPAT
|
||||||
* </pre>
|
* </pre>
|
||||||
* the locale sensitive services in the SPI providers are looked up first. If the
|
* the locale sensitive services in the SPI providers are looked up first. If the
|
||||||
* desired locale sensitive service is not available, then the runtime looks for CLDR,
|
* desired locale sensitive service is not available, then the runtime looks for CLDR,
|
||||||
* JRE in that order.
|
* COMPAT in that order.
|
||||||
* <p>
|
* <p>
|
||||||
* The default order for looking up the preferred locale providers is "CLDR,JRE",
|
* The default order for looking up the preferred locale providers is "CLDR,COMPAT",
|
||||||
* so specifying "CLDR,JRE" is identical to the default behavior. Applications which
|
* so specifying "CLDR,COMPAT" is identical to the default behavior. Applications which
|
||||||
* require implementations of the locale sensitive services must explicitly specify
|
* require implementations of the locale sensitive services must explicitly specify
|
||||||
* "SPI" in order for the Java runtime to load them from the classpath.
|
* "SPI" in order for the Java runtime to load them from the classpath.
|
||||||
*
|
*
|
||||||
|
@ -124,6 +124,10 @@ public abstract class LocaleProviderAdapter {
|
|||||||
if (order != null && order.length() != 0) {
|
if (order != null && order.length() != 0) {
|
||||||
String[] types = order.split(",");
|
String[] types = order.split(",");
|
||||||
for (String type : types) {
|
for (String type : types) {
|
||||||
|
type = type.trim().toUpperCase(Locale.ROOT);
|
||||||
|
if (type.equals("COMPAT")) {
|
||||||
|
type = "JRE";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Type aType = Type.valueOf(type.trim().toUpperCase(Locale.ROOT));
|
Type aType = Type.valueOf(type.trim().toUpperCase(Locale.ROOT));
|
||||||
if (!typeList.contains(aType)) {
|
if (!typeList.contains(aType)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# @test
|
# @test
|
||||||
# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
|
# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
|
||||||
# 8010666 8013086 8013233 8013903 8015960 8028771
|
# 8010666 8013086 8013233 8013903 8015960 8028771 8062006
|
||||||
# @summary tests for "java.locale.providers" system property
|
# @summary tests for "java.locale.providers" system property
|
||||||
# @compile -XDignore.symbol.file LocaleProviders.java
|
# @compile -XDignore.symbol.file LocaleProviders.java
|
||||||
# @run shell/timeout=600 LocaleProviders.sh
|
# @run shell/timeout=600 LocaleProviders.sh
|
||||||
@ -182,7 +182,7 @@ PARAM1=JRE
|
|||||||
if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then
|
if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then
|
||||||
PARAM2=en
|
PARAM2=en
|
||||||
PARAM3=US
|
PARAM3=US
|
||||||
elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then
|
elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then
|
||||||
PARAM2=ja
|
PARAM2=ja
|
||||||
PARAM3=JP
|
PARAM3=JP
|
||||||
else
|
else
|
||||||
@ -200,6 +200,8 @@ PARAM2=en
|
|||||||
PARAM3=US
|
PARAM3=US
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=SPI,COMPAT
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
||||||
METHODNAME=adapterTest
|
METHODNAME=adapterTest
|
||||||
@ -209,6 +211,8 @@ PARAM2=en
|
|||||||
PARAM3=GB
|
PARAM3=GB
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=CLDR,COMPAT
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
||||||
METHODNAME=adapterTest
|
METHODNAME=adapterTest
|
||||||
@ -218,6 +222,8 @@ PARAM2=en
|
|||||||
PARAM3=GB
|
PARAM3=GB
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=COMPAT,CLDR
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
|
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
|
||||||
METHODNAME=adapterTest
|
METHODNAME=adapterTest
|
||||||
@ -227,6 +233,8 @@ PARAM2=haw
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=COMPAT,CLDR
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN"
|
# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN"
|
||||||
METHODNAME=adapterTest
|
METHODNAME=adapterTest
|
||||||
@ -275,6 +283,8 @@ PARAM2=
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=${SPIDIR}
|
SPICLASSES=${SPIDIR}
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=COMPAT
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing 8000615 fix.
|
# testing 8000615 fix.
|
||||||
METHODNAME=tzNameTest
|
METHODNAME=tzNameTest
|
||||||
@ -284,6 +294,8 @@ PARAM2=
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=${SPIDIR}
|
SPICLASSES=${SPIDIR}
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=COMPAT
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing 8001440 fix.
|
# testing 8001440 fix.
|
||||||
METHODNAME=bug8001440Test
|
METHODNAME=bug8001440Test
|
||||||
@ -314,6 +326,8 @@ PARAM2=JP
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=${SPIDIR}
|
SPICLASSES=${SPIDIR}
|
||||||
runTest
|
runTest
|
||||||
|
PREFLIST=COMPAT,SPI
|
||||||
|
runTest
|
||||||
|
|
||||||
# testing 8013903 fix. (Windows only)
|
# testing 8013903 fix. (Windows only)
|
||||||
METHODNAME=bug8013903Test
|
METHODNAME=bug8013903Test
|
||||||
@ -323,12 +337,9 @@ PARAM2=
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
METHODNAME=bug8013903Test
|
|
||||||
PREFLIST=HOST
|
PREFLIST=HOST
|
||||||
PARAM1=
|
runTest
|
||||||
PARAM2=
|
PREFLIST=HOST,COMPAT
|
||||||
PARAM3=
|
|
||||||
SPICLASSES=
|
|
||||||
runTest
|
runTest
|
||||||
|
|
||||||
# testing 8027289 fix, if the platform format default is zh_CN
|
# testing 8027289 fix, if the platform format default is zh_CN
|
||||||
@ -342,12 +353,10 @@ if [ "${DEFFMTLANG}" = "zh" ] && [ "${DEFFMTCTRY}" = "CN" ]; then
|
|||||||
PARAM3=
|
PARAM3=
|
||||||
SPICLASSES=
|
SPICLASSES=
|
||||||
runTest
|
runTest
|
||||||
METHODNAME=bug8027289Test
|
PREFLIST=COMPAT,HOST
|
||||||
|
runTest
|
||||||
PREFLIST=HOST
|
PREFLIST=HOST
|
||||||
PARAM1=00A5
|
PARAM1=00A5
|
||||||
PARAM2=
|
|
||||||
PARAM3=
|
|
||||||
SPICLASSES=
|
|
||||||
runTest
|
runTest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user