# HG changeset patch # User naoto # Date 1446482779 28800 # Node ID 3429cce328396ce7285562963a85779f5039d9b2 # Parent 442660a9b96fe96b63f79e6add935640e6a0e7f7 8062006: Add a new locale data name "COMPAT" for java.locale.providers system property to reduce ambiguity Reviewed-by: okutsu diff -r 442660a9b96f -r 3429cce32839 jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java --- a/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java Mon Nov 02 14:57:04 2015 +0100 +++ b/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java Mon Nov 02 08:46:19 2015 -0800 @@ -123,25 +123,27 @@ *
* For example, if the following is specified in the property: *
- * java.locale.providers=SPI,CLDR,JRE + * java.locale.providers=SPI,CLDR,COMPAT ** 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, - * JRE in that order. + * COMPAT in that order. *
- * The default order for looking up the preferred locale providers is "CLDR,JRE", - * so specifying "CLDR,JRE" is identical to the default behavior. Applications which + * The default order for looking up the preferred locale providers is "CLDR,COMPAT", + * so specifying "CLDR,COMPAT" is identical to the default behavior. Applications which * require implementations of the locale sensitive services must explicitly specify * "SPI" in order for the Java runtime to load them from the classpath. * diff -r 442660a9b96f -r 3429cce32839 jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java --- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Mon Nov 02 14:57:04 2015 +0100 +++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Mon Nov 02 08:46:19 2015 -0800 @@ -124,6 +124,10 @@ if (order != null && order.length() != 0) { String[] types = order.split(","); for (String type : types) { + type = type.trim().toUpperCase(Locale.ROOT); + if (type.equals("COMPAT")) { + type = "JRE"; + } try { Type aType = Type.valueOf(type.trim().toUpperCase(Locale.ROOT)); if (!typeList.contains(aType)) { diff -r 442660a9b96f -r 3429cce32839 jdk/test/java/util/Locale/LocaleProviders.sh --- a/jdk/test/java/util/Locale/LocaleProviders.sh Mon Nov 02 14:57:04 2015 +0100 +++ b/jdk/test/java/util/Locale/LocaleProviders.sh Mon Nov 02 08:46:19 2015 -0800 @@ -1,6 +1,6 @@ #!/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. # # This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ # # @test # @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 # @compile -XDignore.symbol.file LocaleProviders.java # @run shell/timeout=600 LocaleProviders.sh @@ -182,7 +182,7 @@ if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then PARAM2=en PARAM3=US -elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then +elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then PARAM2=ja PARAM3=JP else @@ -200,6 +200,8 @@ PARAM3=US SPICLASSES= runTest +PREFLIST=SPI,COMPAT +runTest # testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR METHODNAME=adapterTest @@ -209,6 +211,8 @@ PARAM3=GB SPICLASSES= runTest +PREFLIST=CLDR,COMPAT +runTest # testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR METHODNAME=adapterTest @@ -218,6 +222,8 @@ PARAM3=GB SPICLASSES= runTest +PREFLIST=COMPAT,CLDR +runTest # testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE. METHODNAME=adapterTest @@ -227,6 +233,8 @@ PARAM3= SPICLASSES= runTest +PREFLIST=COMPAT,CLDR +runTest # testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN" METHODNAME=adapterTest @@ -275,6 +283,8 @@ PARAM3= SPICLASSES=${SPIDIR} runTest +PREFLIST=COMPAT +runTest # testing 8000615 fix. METHODNAME=tzNameTest @@ -284,6 +294,8 @@ PARAM3= SPICLASSES=${SPIDIR} runTest +PREFLIST=COMPAT +runTest # testing 8001440 fix. METHODNAME=bug8001440Test @@ -314,6 +326,8 @@ PARAM3= SPICLASSES=${SPIDIR} runTest +PREFLIST=COMPAT,SPI +runTest # testing 8013903 fix. (Windows only) METHODNAME=bug8013903Test @@ -323,12 +337,9 @@ PARAM3= SPICLASSES= runTest -METHODNAME=bug8013903Test PREFLIST=HOST -PARAM1= -PARAM2= -PARAM3= -SPICLASSES= +runTest +PREFLIST=HOST,COMPAT runTest # testing 8027289 fix, if the platform format default is zh_CN @@ -342,12 +353,10 @@ PARAM3= SPICLASSES= runTest - METHODNAME=bug8027289Test + PREFLIST=COMPAT,HOST + runTest PREFLIST=HOST PARAM1=00A5 - PARAM2= - PARAM3= - SPICLASSES= runTest fi