6336885: RFE: Locale Data Deployment Enhancements

4609153: Provide locale data for Indic locales
5104387: Support for gl_ES locale (galician language)
6337471: desktop/system locale preferences support
7056139: (cal) SPI support for locale-dependent Calendar parameters
7058206: Provide CalendarData SPI for week params and display field value names
7073852: Support multiple scripts for digits and decimal symbols per locale
7079560: [Fmt-Da] Context dependent month names support in SimpleDateFormat
7171324: getAvailableLocales() of locale sensitive services should return the actual availability of locales
7151414: (cal) Support calendar type identification
7168528: LocaleServiceProvider needs to be aware of Locale extensions
7171372: (cal) locale's default Calendar should be created if unknown calendar is specified

JEP 127: Improve Locale Data Packaging and Adopt Unicode CLDR Data (part 1 w/o packaging changes. by Naoto Sato and Masayoshi Okutsu)

Reviewed-by: erikj, sherman, peytoia
This commit is contained in:
Naoto Sato 2012-08-21 11:00:30 -07:00
parent ae25fd53b6
commit 73ff23b7f7
1131 changed files with 400989 additions and 4786 deletions

View file

@ -93,7 +93,8 @@ FILES_export = \
sun/reflect/ConstantPool.java \
sun/reflect/NativeConstructorAccessorImpl.java \
sun/reflect/NativeMethodAccessorImpl.java \
sun/reflect/Reflection.java
sun/reflect/Reflection.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
EXPORTED_inner = \
java.lang.ClassLoader$$NativeLibrary
@ -170,7 +171,8 @@ FILES_export = \
sun/reflect/NativeMethodAccessorImpl.java \
sun/reflect/Reflection.java \
sun/security/provider/NativeSeedGenerator.java \
sun/io/Win32ErrorMode.java
sun/io/Win32ErrorMode.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
EXPORTED_inner = \
java.lang.ClassLoader$$NativeLibrary

View file

@ -78,4 +78,5 @@ FILES_c = \
AtomicLong.c \
Version.c \
VM.c \
VMSupport.c
VMSupport.c \
HostLocaleProviderAdapter_md.c

View file

@ -188,7 +188,6 @@ JAVA_JAVA_java = \
java/util/IllformedLocaleException.java \
java/util/FormatterClosedException.java \
java/util/ListResourceBundle.java \
sun/util/EmptyListResourceBundle.java \
java/util/Locale.java \
sun/util/locale/BaseLocale.java \
sun/util/locale/Extension.java \
@ -201,9 +200,35 @@ JAVA_JAVA_java = \
sun/util/locale/ParseStatus.java \
sun/util/locale/StringTokenIterator.java \
sun/util/locale/UnicodeLocaleExtension.java \
sun/util/locale/provider/AuxLocaleProviderAdapter.java \
sun/util/locale/provider/AvailableLanguageTags.java \
sun/util/locale/provider/BreakDictionary.java \
sun/util/locale/provider/BreakIteratorProviderImpl.java \
sun/util/locale/provider/CalendarDataProviderImpl.java \
sun/util/locale/provider/CalendarDataUtility.java \
sun/util/locale/provider/CollationRules.java \
sun/util/locale/provider/CollatorProviderImpl.java \
sun/util/locale/provider/CurrencyNameProviderImpl.java \
sun/util/locale/provider/DateFormatProviderImpl.java \
sun/util/locale/provider/DateFormatSymbolsProviderImpl.java \
sun/util/locale/provider/DecimalFormatSymbolsProviderImpl.java \
sun/util/locale/provider/DictionaryBasedBreakIterator.java \
sun/util/locale/provider/HostLocaleProviderAdapter.java \
sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
sun/util/locale/provider/JRELocaleConstants.java \
sun/util/locale/provider/JRELocaleProviderAdapter.java \
sun/util/locale/provider/LocaleServiceProviderPool.java \
sun/util/locale/provider/LocaleProviderAdapter.java \
sun/util/locale/provider/LocaleDataMetaInfo.java \
sun/util/locale/provider/LocaleNameProviderImpl.java \
sun/util/locale/provider/LocaleResources.java \
sun/util/locale/provider/NumberFormatProviderImpl.java \
sun/util/locale/provider/RuleBasedBreakIterator.java \
sun/util/locale/provider/SPILocaleProviderAdapter.java \
sun/util/locale/provider/TimeZoneNameProviderImpl.java \
sun/util/locale/provider/TimeZoneNameUtility.java \
java/util/LocaleISOData.java \
sun/util/LocaleServiceProviderPool.java \
sun/util/LocaleDataMetaInfo.java \
sun/util/cldr/CLDRLocaleProviderAdapter.java \
java/util/MissingResourceException.java \
java/util/NoSuchElementException.java \
java/util/Observable.java \
@ -222,7 +247,6 @@ JAVA_JAVA_java = \
java/util/StringTokenizer.java \
java/util/TimeZone.java \
java/util/SimpleTimeZone.java \
sun/util/TimeZoneNameUtility.java \
sun/util/calendar/ZoneInfo.java \
sun/util/calendar/ZoneInfoFile.java \
sun/util/calendar/TzIDOldMapping.java \
@ -369,6 +393,7 @@ JAVA_JAVA_java = \
java/util/prefs/PreferencesFactory.java \
java/util/prefs/Base64.java \
java/util/prefs/XmlSupport.java \
java/util/spi/CalendarDataProvider.java \
java/util/spi/CurrencyNameProvider.java \
java/util/spi/LocaleNameProvider.java \
java/util/spi/LocaleServiceProvider.java \

View file

@ -156,6 +156,11 @@ vpath %.c $(PLATFORM_SRC)/native/common
vpath %.c $(PLATFORM_SRC)/native/java/util
vpath %.c $(PLATFORM_SRC)/native/sun/security/provider
vpath %.c $(PLATFORM_SRC)/native/sun/io
ifeq ($(PLATFORM),macosx)
vpath %.c $(PLATFORM_SRC_MACOS)/native/sun/util/locale/provider
else # PLATFORM
vpath %.c $(PLATFORM_SRC)/native/sun/util/locale/provider
endif # PLATFORM
#
# Includes the fdlibm header file.

View file

@ -68,8 +68,8 @@ NonEuro_Resources_properties := $(FILES_compiled_properties)
FILES_java := $(FILES_java_orig)
FILES_compiled_properties := $(FILES_compiled_properties_orig)
LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java
LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/locale/provider/LocaleDataMetaInfo.java
LOCALEGEN_SH=localegen.sh
RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"

View file

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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,20 +47,29 @@ OUTPUT_FILE=$5
localelist=
getlocalelist() {
localelist=""
localelist=`$NAWK -F$1_ '{print $2}' $2 | $SORT`
localelist=`$NAWK -F$1_ '{print $2}' $2 | $SORT | $SED -e 's/_/-/g'`
}
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
noneuroall=" ja-JP-JP th-TH-TH "
for FILE in $RESOURCE_NAMES
do
getlocalelist $FILE $EURO_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_EuroLocales#@$localelist@g\" "
euroall=$euroall" "$localelist
getlocalelist $FILE $NONEURO_FILES_LIST
sed_script=$sed_script"-e \"s@#"$FILE"_NonEuroLocales#@$localelist@g\" "
noneuroall=$noneuroall" "$localelist
done
euroall=`(for LOC in $euroall; do echo $LOC;done) |$SORT -u`
noneuroall=`(for LOC in $noneuroall; do echo $LOC;done) |$SORT -u`
sed_script=$sed_script"-e \"s@#AvailableLocales_EuroLocales#@$euroall@g\" "
sed_script=$sed_script"-e \"s@#AvailableLocales_NonEuroLocales#@$noneuroall@g\" "
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
eval $sed_script

View file

@ -285,6 +285,8 @@ SUNWprivate_1.1 {
# Java_sun_misc_VM_unsuspendSomeThreads; threads.c
# Java_sun_misc_VM_unsuspendThreads; threads.c
Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPattern;
# Outcalls from libjvm done using dlsym().
VerifyClassCodes;

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 2012, 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
@ -27,7 +27,6 @@ FILES_java = \
java/text/Annotation.java \
java/text/AttributedCharacterIterator.java \
java/text/AttributedString.java \
java/text/BreakDictionary.java \
java/text/BreakIterator.java \
java/text/CalendarBuilder.java \
java/text/CharacterIterator.java \
@ -36,11 +35,9 @@ FILES_java = \
java/text/Collator.java \
java/text/CollationElementIterator.java \
java/text/CollationKey.java \
java/text/CollationRules.java \
java/text/DateFormat.java \
java/text/DateFormatSymbols.java \
java/text/DecimalFormat.java \
java/text/DictionaryBasedBreakIterator.java \
java/text/DigitList.java \
java/text/EntryPair.java \
java/text/Format.java \
@ -56,7 +53,6 @@ FILES_java = \
java/text/PatternEntry.java \
java/text/RBCollationTables.java \
java/text/RBTableBuilder.java \
java/text/RuleBasedBreakIterator.java \
java/text/RuleBasedCollator.java \
java/text/RuleBasedCollationKey.java \
java/text/SimpleDateFormat.java \
@ -107,158 +103,150 @@ FILES_java = \
sun/text/resources/BreakIteratorInfo.java \
\
sun/text/resources/CollationData.java \
sun/text/resources/CollationData_be.java \
sun/text/resources/CollationData_bg.java \
sun/text/resources/CollationData_ca.java \
sun/text/resources/CollationData_cs.java \
sun/text/resources/CollationData_da.java \
sun/text/resources/CollationData_de.java \
sun/text/resources/CollationData_el.java \
sun/text/resources/CollationData_en.java \
sun/text/resources/CollationData_es.java \
sun/text/resources/CollationData_et.java \
sun/text/resources/CollationData_fi.java \
sun/text/resources/CollationData_fr.java \
sun/text/resources/CollationData_hr.java \
sun/text/resources/CollationData_hu.java \
sun/text/resources/CollationData_is.java \
sun/text/resources/CollationData_it.java \
sun/text/resources/CollationData_lt.java \
sun/text/resources/CollationData_lv.java \
sun/text/resources/CollationData_mk.java \
sun/text/resources/CollationData_nl.java \
sun/text/resources/CollationData_no.java \
sun/text/resources/CollationData_pl.java \
sun/text/resources/CollationData_pt.java \
sun/text/resources/CollationData_ro.java \
sun/text/resources/CollationData_ru.java \
sun/text/resources/CollationData_sk.java \
sun/text/resources/CollationData_sl.java \
sun/text/resources/CollationData_sq.java \
sun/text/resources/CollationData_sr.java \
sun/text/resources/CollationData_sr_Latn.java \
sun/text/resources/CollationData_sv.java \
sun/text/resources/CollationData_tr.java \
sun/text/resources/CollationData_uk.java \
sun/text/resources/be/CollationData_be.java \
sun/text/resources/bg/CollationData_bg.java \
sun/text/resources/ca/CollationData_ca.java \
sun/text/resources/cs/CollationData_cs.java \
sun/text/resources/da/CollationData_da.java \
sun/text/resources/el/CollationData_el.java \
sun/text/resources/es/CollationData_es.java \
sun/text/resources/et/CollationData_et.java \
sun/text/resources/fi/CollationData_fi.java \
sun/text/resources/fr/CollationData_fr.java \
sun/text/resources/hr/CollationData_hr.java \
sun/text/resources/hu/CollationData_hu.java \
sun/text/resources/is/CollationData_is.java \
sun/text/resources/lt/CollationData_lt.java \
sun/text/resources/lv/CollationData_lv.java \
sun/text/resources/mk/CollationData_mk.java \
sun/text/resources/no/CollationData_no.java \
sun/text/resources/pl/CollationData_pl.java \
sun/text/resources/ro/CollationData_ro.java \
sun/text/resources/ru/CollationData_ru.java \
sun/text/resources/sk/CollationData_sk.java \
sun/text/resources/sl/CollationData_sl.java \
sun/text/resources/sq/CollationData_sq.java \
sun/text/resources/sr/CollationData_sr.java \
sun/text/resources/sr/CollationData_sr_Latn.java \
sun/text/resources/sv/CollationData_sv.java \
sun/text/resources/tr/CollationData_tr.java \
sun/text/resources/uk/CollationData_uk.java \
\
sun/text/resources/FormatData.java \
sun/text/resources/FormatData_be.java \
sun/text/resources/FormatData_be_BY.java \
sun/text/resources/FormatData_bg.java \
sun/text/resources/FormatData_bg_BG.java \
sun/text/resources/FormatData_ca.java \
sun/text/resources/FormatData_ca_ES.java \
sun/text/resources/FormatData_cs.java \
sun/text/resources/FormatData_cs_CZ.java \
sun/text/resources/FormatData_da.java \
sun/text/resources/FormatData_da_DK.java \
sun/text/resources/FormatData_de.java \
sun/text/resources/FormatData_de_AT.java \
sun/text/resources/FormatData_de_CH.java \
sun/text/resources/FormatData_de_DE.java \
sun/text/resources/FormatData_de_LU.java \
sun/text/resources/FormatData_el.java \
sun/text/resources/FormatData_el_CY.java \
sun/text/resources/FormatData_el_GR.java \
sun/text/resources/FormatData_en.java \
sun/text/resources/FormatData_en_US.java \
sun/text/resources/FormatData_en_AU.java \
sun/text/resources/FormatData_en_CA.java \
sun/text/resources/FormatData_en_GB.java \
sun/text/resources/FormatData_en_IE.java \
sun/text/resources/FormatData_en_IN.java \
sun/text/resources/FormatData_en_MT.java \
sun/text/resources/FormatData_en_NZ.java \
sun/text/resources/FormatData_en_PH.java \
sun/text/resources/FormatData_en_SG.java \
sun/text/resources/FormatData_en_ZA.java \
sun/text/resources/FormatData_es.java \
sun/text/resources/FormatData_es_BO.java \
sun/text/resources/FormatData_es_AR.java \
sun/text/resources/FormatData_es_CL.java \
sun/text/resources/FormatData_es_CO.java \
sun/text/resources/FormatData_es_CR.java \
sun/text/resources/FormatData_es_DO.java \
sun/text/resources/FormatData_es_EC.java \
sun/text/resources/FormatData_es_ES.java \
sun/text/resources/FormatData_es_GT.java \
sun/text/resources/FormatData_es_HN.java \
sun/text/resources/FormatData_es_MX.java \
sun/text/resources/FormatData_es_NI.java \
sun/text/resources/FormatData_es_PA.java \
sun/text/resources/FormatData_es_PE.java \
sun/text/resources/FormatData_es_PR.java \
sun/text/resources/FormatData_es_PY.java \
sun/text/resources/FormatData_es_SV.java \
sun/text/resources/FormatData_es_US.java \
sun/text/resources/FormatData_es_UY.java \
sun/text/resources/FormatData_es_VE.java \
sun/text/resources/FormatData_et.java \
sun/text/resources/FormatData_et_EE.java \
sun/text/resources/FormatData_fi.java \
sun/text/resources/FormatData_fi_FI.java \
sun/text/resources/FormatData_fr.java \
sun/text/resources/FormatData_fr_BE.java \
sun/text/resources/FormatData_fr_CA.java \
sun/text/resources/FormatData_fr_CH.java \
sun/text/resources/FormatData_fr_FR.java \
sun/text/resources/FormatData_fr_LU.java \
sun/text/resources/FormatData_ga.java \
sun/text/resources/FormatData_ga_IE.java \
sun/text/resources/FormatData_hr.java \
sun/text/resources/FormatData_hr_HR.java \
sun/text/resources/FormatData_hu.java \
sun/text/resources/FormatData_hu_HU.java \
sun/text/resources/FormatData_in.java \
sun/text/resources/FormatData_in_ID.java \
sun/text/resources/FormatData_is.java \
sun/text/resources/FormatData_is_IS.java \
sun/text/resources/FormatData_it.java \
sun/text/resources/FormatData_it_CH.java \
sun/text/resources/FormatData_it_IT.java \
sun/text/resources/FormatData_lt.java \
sun/text/resources/FormatData_lt_LT.java \
sun/text/resources/FormatData_lv.java \
sun/text/resources/FormatData_lv_LV.java \
sun/text/resources/FormatData_mk.java \
sun/text/resources/FormatData_mk_MK.java \
sun/text/resources/FormatData_ms.java \
sun/text/resources/FormatData_ms_MY.java \
sun/text/resources/FormatData_mt.java \
sun/text/resources/FormatData_mt_MT.java \
sun/text/resources/FormatData_nl.java \
sun/text/resources/FormatData_nl_BE.java \
sun/text/resources/FormatData_nl_NL.java \
sun/text/resources/FormatData_no.java \
sun/text/resources/FormatData_no_NO.java \
sun/text/resources/FormatData_no_NO_NY.java \
sun/text/resources/FormatData_pl.java \
sun/text/resources/FormatData_pl_PL.java \
sun/text/resources/FormatData_pt.java \
sun/text/resources/FormatData_pt_BR.java \
sun/text/resources/FormatData_pt_PT.java \
sun/text/resources/FormatData_ro.java \
sun/text/resources/FormatData_ro_RO.java \
sun/text/resources/FormatData_ru.java \
sun/text/resources/FormatData_ru_RU.java \
sun/text/resources/FormatData_sk.java \
sun/text/resources/FormatData_sk_SK.java \
sun/text/resources/FormatData_sl.java \
sun/text/resources/FormatData_sl_SI.java \
sun/text/resources/FormatData_sq.java \
sun/text/resources/FormatData_sq_AL.java \
sun/text/resources/FormatData_sr.java \
sun/text/resources/FormatData_sr_BA.java \
sun/text/resources/FormatData_sr_CS.java \
sun/text/resources/FormatData_sr_ME.java \
sun/text/resources/FormatData_sr_RS.java \
sun/text/resources/FormatData_sr_Latn.java \
sun/text/resources/FormatData_sr_Latn_BA.java \
sun/text/resources/FormatData_sr_Latn_ME.java \
sun/text/resources/FormatData_sr_Latn_RS.java \
sun/text/resources/FormatData_sv.java \
sun/text/resources/FormatData_sv_SE.java \
sun/text/resources/FormatData_tr.java \
sun/text/resources/FormatData_tr_TR.java \
sun/text/resources/FormatData_uk.java \
sun/text/resources/FormatData_uk_UA.java
sun/text/resources/be/FormatData_be.java \
sun/text/resources/be/FormatData_be_BY.java \
sun/text/resources/bg/FormatData_bg.java \
sun/text/resources/bg/FormatData_bg_BG.java \
sun/text/resources/ca/FormatData_ca.java \
sun/text/resources/ca/FormatData_ca_ES.java \
sun/text/resources/cs/FormatData_cs.java \
sun/text/resources/cs/FormatData_cs_CZ.java \
sun/text/resources/da/FormatData_da.java \
sun/text/resources/da/FormatData_da_DK.java \
sun/text/resources/de/FormatData_de.java \
sun/text/resources/de/FormatData_de_AT.java \
sun/text/resources/de/FormatData_de_CH.java \
sun/text/resources/de/FormatData_de_DE.java \
sun/text/resources/de/FormatData_de_LU.java \
sun/text/resources/el/FormatData_el.java \
sun/text/resources/el/FormatData_el_CY.java \
sun/text/resources/el/FormatData_el_GR.java \
sun/text/resources/en/FormatData_en.java \
sun/text/resources/en/FormatData_en_US.java \
sun/text/resources/en/FormatData_en_AU.java \
sun/text/resources/en/FormatData_en_CA.java \
sun/text/resources/en/FormatData_en_GB.java \
sun/text/resources/en/FormatData_en_IE.java \
sun/text/resources/en/FormatData_en_IN.java \
sun/text/resources/en/FormatData_en_MT.java \
sun/text/resources/en/FormatData_en_NZ.java \
sun/text/resources/en/FormatData_en_PH.java \
sun/text/resources/en/FormatData_en_SG.java \
sun/text/resources/en/FormatData_en_ZA.java \
sun/text/resources/es/FormatData_es.java \
sun/text/resources/es/FormatData_es_BO.java \
sun/text/resources/es/FormatData_es_AR.java \
sun/text/resources/es/FormatData_es_CL.java \
sun/text/resources/es/FormatData_es_CO.java \
sun/text/resources/es/FormatData_es_CR.java \
sun/text/resources/es/FormatData_es_DO.java \
sun/text/resources/es/FormatData_es_EC.java \
sun/text/resources/es/FormatData_es_ES.java \
sun/text/resources/es/FormatData_es_GT.java \
sun/text/resources/es/FormatData_es_HN.java \
sun/text/resources/es/FormatData_es_MX.java \
sun/text/resources/es/FormatData_es_NI.java \
sun/text/resources/es/FormatData_es_PA.java \
sun/text/resources/es/FormatData_es_PE.java \
sun/text/resources/es/FormatData_es_PR.java \
sun/text/resources/es/FormatData_es_PY.java \
sun/text/resources/es/FormatData_es_SV.java \
sun/text/resources/es/FormatData_es_US.java \
sun/text/resources/es/FormatData_es_UY.java \
sun/text/resources/es/FormatData_es_VE.java \
sun/text/resources/et/FormatData_et.java \
sun/text/resources/et/FormatData_et_EE.java \
sun/text/resources/fi/FormatData_fi.java \
sun/text/resources/fi/FormatData_fi_FI.java \
sun/text/resources/fr/FormatData_fr.java \
sun/text/resources/fr/FormatData_fr_BE.java \
sun/text/resources/fr/FormatData_fr_CA.java \
sun/text/resources/fr/FormatData_fr_CH.java \
sun/text/resources/fr/FormatData_fr_FR.java \
sun/text/resources/ga/FormatData_ga.java \
sun/text/resources/ga/FormatData_ga_IE.java \
sun/text/resources/hr/FormatData_hr.java \
sun/text/resources/hr/FormatData_hr_HR.java \
sun/text/resources/hu/FormatData_hu.java \
sun/text/resources/hu/FormatData_hu_HU.java \
sun/text/resources/in/FormatData_in.java \
sun/text/resources/in/FormatData_in_ID.java \
sun/text/resources/is/FormatData_is.java \
sun/text/resources/is/FormatData_is_IS.java \
sun/text/resources/it/FormatData_it.java \
sun/text/resources/it/FormatData_it_CH.java \
sun/text/resources/it/FormatData_it_IT.java \
sun/text/resources/lt/FormatData_lt.java \
sun/text/resources/lt/FormatData_lt_LT.java \
sun/text/resources/lv/FormatData_lv.java \
sun/text/resources/lv/FormatData_lv_LV.java \
sun/text/resources/mk/FormatData_mk.java \
sun/text/resources/mk/FormatData_mk_MK.java \
sun/text/resources/ms/FormatData_ms.java \
sun/text/resources/ms/FormatData_ms_MY.java \
sun/text/resources/mt/FormatData_mt.java \
sun/text/resources/mt/FormatData_mt_MT.java \
sun/text/resources/nl/FormatData_nl.java \
sun/text/resources/nl/FormatData_nl_BE.java \
sun/text/resources/nl/FormatData_nl_NL.java \
sun/text/resources/no/FormatData_no.java \
sun/text/resources/no/FormatData_no_NO.java \
sun/text/resources/no/FormatData_no_NO_NY.java \
sun/text/resources/pl/FormatData_pl.java \
sun/text/resources/pl/FormatData_pl_PL.java \
sun/text/resources/pt/FormatData_pt.java \
sun/text/resources/pt/FormatData_pt_BR.java \
sun/text/resources/pt/FormatData_pt_PT.java \
sun/text/resources/ro/FormatData_ro.java \
sun/text/resources/ro/FormatData_ro_RO.java \
sun/text/resources/ru/FormatData_ru.java \
sun/text/resources/ru/FormatData_ru_RU.java \
sun/text/resources/sk/FormatData_sk.java \
sun/text/resources/sk/FormatData_sk_SK.java \
sun/text/resources/sl/FormatData_sl.java \
sun/text/resources/sl/FormatData_sl_SI.java \
sun/text/resources/sq/FormatData_sq.java \
sun/text/resources/sq/FormatData_sq_AL.java \
sun/text/resources/sr/FormatData_sr.java \
sun/text/resources/sr/FormatData_sr_BA.java \
sun/text/resources/sr/FormatData_sr_CS.java \
sun/text/resources/sr/FormatData_sr_ME.java \
sun/text/resources/sr/FormatData_sr_RS.java \
sun/text/resources/sr/FormatData_sr_Latn.java \
sun/text/resources/sr/FormatData_sr_Latn_ME.java \
sun/text/resources/sv/FormatData_sv.java \
sun/text/resources/sv/FormatData_sv_SE.java \
sun/text/resources/tr/FormatData_tr.java \
sun/text/resources/tr/FormatData_tr_TR.java \
sun/text/resources/uk/FormatData_uk.java \
sun/text/resources/uk/FormatData_uk_UA.java

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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,13 @@ FILES_java = \
sun/util/resources/LocaleNamesBundle.java \
sun/util/resources/TimeZoneNamesBundle.java \
sun/util/resources/TimeZoneNames.java \
sun/util/resources/TimeZoneNames_de.java \
sun/util/resources/TimeZoneNames_en.java \
sun/util/resources/TimeZoneNames_en_CA.java \
sun/util/resources/TimeZoneNames_en_GB.java \
sun/util/resources/TimeZoneNames_en_IE.java \
sun/util/resources/TimeZoneNames_es.java \
sun/util/resources/TimeZoneNames_fr.java \
sun/util/resources/TimeZoneNames_it.java \
sun/util/resources/TimeZoneNames_pt_BR.java \
sun/util/resources/TimeZoneNames_sv.java
sun/util/resources/de/TimeZoneNames_de.java \
sun/util/resources/en/TimeZoneNames_en.java \
sun/util/resources/en/TimeZoneNames_en_CA.java \
sun/util/resources/en/TimeZoneNames_en_GB.java \
sun/util/resources/en/TimeZoneNames_en_IE.java \
sun/util/resources/es/TimeZoneNames_es.java \
sun/util/resources/fr/TimeZoneNames_fr.java \
sun/util/resources/it/TimeZoneNames_it.java \
sun/util/resources/pt/TimeZoneNames_pt_BR.java \
sun/util/resources/sv/TimeZoneNames_sv.java

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
@ -25,189 +25,189 @@
FILES_compiled_properties = \
sun/util/resources/LocaleNames.properties \
sun/util/resources/LocaleNames_be.properties \
sun/util/resources/LocaleNames_bg.properties \
sun/util/resources/LocaleNames_ca.properties \
sun/util/resources/LocaleNames_cs.properties \
sun/util/resources/LocaleNames_da.properties \
sun/util/resources/LocaleNames_de.properties \
sun/util/resources/LocaleNames_el.properties \
sun/util/resources/LocaleNames_el_CY.properties \
sun/util/resources/LocaleNames_en.properties \
sun/util/resources/LocaleNames_en_MT.properties \
sun/util/resources/LocaleNames_en_PH.properties \
sun/util/resources/LocaleNames_en_SG.properties \
sun/util/resources/LocaleNames_es.properties \
sun/util/resources/LocaleNames_es_US.properties \
sun/util/resources/LocaleNames_et.properties \
sun/util/resources/LocaleNames_fi.properties \
sun/util/resources/LocaleNames_fr.properties \
sun/util/resources/LocaleNames_ga.properties \
sun/util/resources/LocaleNames_hr.properties \
sun/util/resources/LocaleNames_hu.properties \
sun/util/resources/LocaleNames_in.properties \
sun/util/resources/LocaleNames_is.properties \
sun/util/resources/LocaleNames_it.properties \
sun/util/resources/LocaleNames_lt.properties \
sun/util/resources/LocaleNames_lv.properties \
sun/util/resources/LocaleNames_mk.properties \
sun/util/resources/LocaleNames_ms.properties \
sun/util/resources/LocaleNames_mt.properties \
sun/util/resources/LocaleNames_nl.properties \
sun/util/resources/LocaleNames_no.properties \
sun/util/resources/LocaleNames_no_NO_NY.properties \
sun/util/resources/LocaleNames_pl.properties \
sun/util/resources/LocaleNames_pt.properties \
sun/util/resources/LocaleNames_pt_BR.properties \
sun/util/resources/LocaleNames_pt_PT.properties \
sun/util/resources/LocaleNames_ro.properties \
sun/util/resources/LocaleNames_ru.properties \
sun/util/resources/LocaleNames_sk.properties \
sun/util/resources/LocaleNames_sl.properties \
sun/util/resources/LocaleNames_sq.properties \
sun/util/resources/LocaleNames_sr.properties \
sun/util/resources/LocaleNames_sr_Latn.properties \
sun/util/resources/LocaleNames_sv.properties \
sun/util/resources/LocaleNames_tr.properties \
sun/util/resources/LocaleNames_uk.properties \
sun/util/resources/be/LocaleNames_be.properties \
sun/util/resources/bg/LocaleNames_bg.properties \
sun/util/resources/ca/LocaleNames_ca.properties \
sun/util/resources/cs/LocaleNames_cs.properties \
sun/util/resources/da/LocaleNames_da.properties \
sun/util/resources/de/LocaleNames_de.properties \
sun/util/resources/el/LocaleNames_el.properties \
sun/util/resources/el/LocaleNames_el_CY.properties \
sun/util/resources/en/LocaleNames_en.properties \
sun/util/resources/en/LocaleNames_en_MT.properties \
sun/util/resources/en/LocaleNames_en_PH.properties \
sun/util/resources/en/LocaleNames_en_SG.properties \
sun/util/resources/es/LocaleNames_es.properties \
sun/util/resources/es/LocaleNames_es_US.properties \
sun/util/resources/et/LocaleNames_et.properties \
sun/util/resources/fi/LocaleNames_fi.properties \
sun/util/resources/fr/LocaleNames_fr.properties \
sun/util/resources/ga/LocaleNames_ga.properties \
sun/util/resources/hr/LocaleNames_hr.properties \
sun/util/resources/hu/LocaleNames_hu.properties \
sun/util/resources/in/LocaleNames_in.properties \
sun/util/resources/is/LocaleNames_is.properties \
sun/util/resources/it/LocaleNames_it.properties \
sun/util/resources/lt/LocaleNames_lt.properties \
sun/util/resources/lv/LocaleNames_lv.properties \
sun/util/resources/mk/LocaleNames_mk.properties \
sun/util/resources/ms/LocaleNames_ms.properties \
sun/util/resources/mt/LocaleNames_mt.properties \
sun/util/resources/nl/LocaleNames_nl.properties \
sun/util/resources/no/LocaleNames_no.properties \
sun/util/resources/no/LocaleNames_no_NO_NY.properties \
sun/util/resources/pl/LocaleNames_pl.properties \
sun/util/resources/pt/LocaleNames_pt.properties \
sun/util/resources/pt/LocaleNames_pt_BR.properties \
sun/util/resources/pt/LocaleNames_pt_PT.properties \
sun/util/resources/ro/LocaleNames_ro.properties \
sun/util/resources/ru/LocaleNames_ru.properties \
sun/util/resources/sk/LocaleNames_sk.properties \
sun/util/resources/sl/LocaleNames_sl.properties \
sun/util/resources/sq/LocaleNames_sq.properties \
sun/util/resources/sr/LocaleNames_sr.properties \
sun/util/resources/sr/LocaleNames_sr_Latn.properties \
sun/util/resources/sv/LocaleNames_sv.properties \
sun/util/resources/tr/LocaleNames_tr.properties \
sun/util/resources/uk/LocaleNames_uk.properties \
\
sun/util/resources/CalendarData.properties \
sun/util/resources/CalendarData_be.properties \
sun/util/resources/CalendarData_bg.properties \
sun/util/resources/CalendarData_ca.properties \
sun/util/resources/CalendarData_cs.properties \
sun/util/resources/CalendarData_da.properties \
sun/util/resources/CalendarData_de.properties \
sun/util/resources/CalendarData_el.properties \
sun/util/resources/CalendarData_el_CY.properties \
sun/util/resources/CalendarData_en.properties \
sun/util/resources/CalendarData_en_GB.properties \
sun/util/resources/CalendarData_en_IE.properties \
sun/util/resources/CalendarData_en_MT.properties \
sun/util/resources/CalendarData_es.properties \
sun/util/resources/CalendarData_es_ES.properties \
sun/util/resources/CalendarData_es_US.properties \
sun/util/resources/CalendarData_et.properties \
sun/util/resources/CalendarData_fi.properties \
sun/util/resources/CalendarData_fr.properties \
sun/util/resources/CalendarData_fr_CA.properties \
sun/util/resources/CalendarData_hr.properties \
sun/util/resources/CalendarData_hu.properties \
sun/util/resources/CalendarData_in_ID.properties \
sun/util/resources/CalendarData_is.properties \
sun/util/resources/CalendarData_it.properties \
sun/util/resources/CalendarData_lt.properties \
sun/util/resources/CalendarData_lv.properties \
sun/util/resources/CalendarData_mk.properties \
sun/util/resources/CalendarData_ms_MY.properties \
sun/util/resources/CalendarData_mt.properties \
sun/util/resources/CalendarData_mt_MT.properties \
sun/util/resources/CalendarData_nl.properties \
sun/util/resources/CalendarData_no.properties \
sun/util/resources/CalendarData_pl.properties \
sun/util/resources/CalendarData_pt.properties \
sun/util/resources/CalendarData_pt_PT.properties \
sun/util/resources/CalendarData_ro.properties \
sun/util/resources/CalendarData_ru.properties \
sun/util/resources/CalendarData_sk.properties \
sun/util/resources/CalendarData_sl.properties \
sun/util/resources/CalendarData_sq.properties \
sun/util/resources/CalendarData_sr.properties \
sun/util/resources/CalendarData_sr_Latn_BA.properties \
sun/util/resources/CalendarData_sr_Latn_ME.properties \
sun/util/resources/CalendarData_sr_Latn_RS.properties \
sun/util/resources/CalendarData_sv.properties \
sun/util/resources/CalendarData_tr.properties \
sun/util/resources/CalendarData_uk.properties \
sun/util/resources/be/CalendarData_be.properties \
sun/util/resources/bg/CalendarData_bg.properties \
sun/util/resources/ca/CalendarData_ca.properties \
sun/util/resources/cs/CalendarData_cs.properties \
sun/util/resources/da/CalendarData_da.properties \
sun/util/resources/de/CalendarData_de.properties \
sun/util/resources/el/CalendarData_el.properties \
sun/util/resources/el/CalendarData_el_CY.properties \
sun/util/resources/en/CalendarData_en.properties \
sun/util/resources/en/CalendarData_en_GB.properties \
sun/util/resources/en/CalendarData_en_IE.properties \
sun/util/resources/en/CalendarData_en_MT.properties \
sun/util/resources/es/CalendarData_es.properties \
sun/util/resources/es/CalendarData_es_ES.properties \
sun/util/resources/es/CalendarData_es_US.properties \
sun/util/resources/et/CalendarData_et.properties \
sun/util/resources/fi/CalendarData_fi.properties \
sun/util/resources/fr/CalendarData_fr.properties \
sun/util/resources/fr/CalendarData_fr_CA.properties \
sun/util/resources/hr/CalendarData_hr.properties \
sun/util/resources/hu/CalendarData_hu.properties \
sun/util/resources/in/CalendarData_in_ID.properties \
sun/util/resources/is/CalendarData_is.properties \
sun/util/resources/it/CalendarData_it.properties \
sun/util/resources/lt/CalendarData_lt.properties \
sun/util/resources/lv/CalendarData_lv.properties \
sun/util/resources/mk/CalendarData_mk.properties \
sun/util/resources/ms/CalendarData_ms_MY.properties \
sun/util/resources/mt/CalendarData_mt.properties \
sun/util/resources/mt/CalendarData_mt_MT.properties \
sun/util/resources/nl/CalendarData_nl.properties \
sun/util/resources/no/CalendarData_no.properties \
sun/util/resources/pl/CalendarData_pl.properties \
sun/util/resources/pt/CalendarData_pt.properties \
sun/util/resources/pt/CalendarData_pt_PT.properties \
sun/util/resources/ro/CalendarData_ro.properties \
sun/util/resources/ru/CalendarData_ru.properties \
sun/util/resources/sk/CalendarData_sk.properties \
sun/util/resources/sl/CalendarData_sl.properties \
sun/util/resources/sq/CalendarData_sq.properties \
sun/util/resources/sr/CalendarData_sr.properties \
sun/util/resources/sr/CalendarData_sr_Latn_BA.properties \
sun/util/resources/sr/CalendarData_sr_Latn_ME.properties \
sun/util/resources/sr/CalendarData_sr_Latn_RS.properties \
sun/util/resources/sv/CalendarData_sv.properties \
sun/util/resources/tr/CalendarData_tr.properties \
sun/util/resources/uk/CalendarData_uk.properties \
\
sun/util/resources/CurrencyNames.properties \
sun/util/resources/CurrencyNames_be_BY.properties \
sun/util/resources/CurrencyNames_bg_BG.properties \
sun/util/resources/CurrencyNames_ca_ES.properties \
sun/util/resources/CurrencyNames_cs_CZ.properties \
sun/util/resources/CurrencyNames_da_DK.properties \
sun/util/resources/CurrencyNames_de.properties \
sun/util/resources/CurrencyNames_de_AT.properties \
sun/util/resources/CurrencyNames_de_CH.properties \
sun/util/resources/CurrencyNames_de_DE.properties \
sun/util/resources/CurrencyNames_de_GR.properties \
sun/util/resources/CurrencyNames_de_LU.properties \
sun/util/resources/CurrencyNames_el_CY.properties \
sun/util/resources/CurrencyNames_el_GR.properties \
sun/util/resources/CurrencyNames_en_AU.properties \
sun/util/resources/CurrencyNames_en_CA.properties \
sun/util/resources/CurrencyNames_en_GB.properties \
sun/util/resources/CurrencyNames_en_IE.properties \
sun/util/resources/CurrencyNames_en_IN.properties \
sun/util/resources/CurrencyNames_en_MT.properties \
sun/util/resources/CurrencyNames_en_NZ.properties \
sun/util/resources/CurrencyNames_en_PH.properties \
sun/util/resources/CurrencyNames_en_SG.properties \
sun/util/resources/CurrencyNames_en_US.properties \
sun/util/resources/CurrencyNames_en_ZA.properties \
sun/util/resources/CurrencyNames_es.properties \
sun/util/resources/CurrencyNames_es_AR.properties \
sun/util/resources/CurrencyNames_es_BO.properties \
sun/util/resources/CurrencyNames_es_CL.properties \
sun/util/resources/CurrencyNames_es_CO.properties \
sun/util/resources/CurrencyNames_es_CR.properties \
sun/util/resources/CurrencyNames_es_CU.properties \
sun/util/resources/CurrencyNames_es_DO.properties \
sun/util/resources/CurrencyNames_es_EC.properties \
sun/util/resources/CurrencyNames_es_ES.properties \
sun/util/resources/CurrencyNames_es_GT.properties \
sun/util/resources/CurrencyNames_es_HN.properties \
sun/util/resources/CurrencyNames_es_MX.properties \
sun/util/resources/CurrencyNames_es_NI.properties \
sun/util/resources/CurrencyNames_es_PA.properties \
sun/util/resources/CurrencyNames_es_PE.properties \
sun/util/resources/CurrencyNames_es_PR.properties \
sun/util/resources/CurrencyNames_es_PY.properties \
sun/util/resources/CurrencyNames_es_SV.properties \
sun/util/resources/CurrencyNames_es_US.properties \
sun/util/resources/CurrencyNames_es_UY.properties \
sun/util/resources/CurrencyNames_es_VE.properties \
sun/util/resources/CurrencyNames_et_EE.properties \
sun/util/resources/CurrencyNames_fi_FI.properties \
sun/util/resources/CurrencyNames_fr.properties \
sun/util/resources/CurrencyNames_fr_BE.properties \
sun/util/resources/CurrencyNames_fr_CA.properties \
sun/util/resources/CurrencyNames_fr_CH.properties \
sun/util/resources/CurrencyNames_fr_FR.properties \
sun/util/resources/CurrencyNames_fr_LU.properties \
sun/util/resources/CurrencyNames_ga_IE.properties \
sun/util/resources/CurrencyNames_hr_HR.properties \
sun/util/resources/CurrencyNames_hu_HU.properties \
sun/util/resources/CurrencyNames_in_ID.properties \
sun/util/resources/CurrencyNames_is_IS.properties \
sun/util/resources/CurrencyNames_it.properties \
sun/util/resources/CurrencyNames_it_CH.properties \
sun/util/resources/CurrencyNames_it_IT.properties \
sun/util/resources/CurrencyNames_lt_LT.properties \
sun/util/resources/CurrencyNames_lv_LV.properties \
sun/util/resources/CurrencyNames_mk_MK.properties \
sun/util/resources/CurrencyNames_ms_MY.properties \
sun/util/resources/CurrencyNames_mt_MT.properties \
sun/util/resources/CurrencyNames_nl_BE.properties \
sun/util/resources/CurrencyNames_nl_NL.properties \
sun/util/resources/CurrencyNames_no_NO.properties \
sun/util/resources/CurrencyNames_pl_PL.properties \
sun/util/resources/CurrencyNames_pt.properties \
sun/util/resources/CurrencyNames_pt_BR.properties \
sun/util/resources/CurrencyNames_pt_PT.properties \
sun/util/resources/CurrencyNames_ro_RO.properties \
sun/util/resources/CurrencyNames_ru_RU.properties \
sun/util/resources/CurrencyNames_sk_SK.properties \
sun/util/resources/CurrencyNames_sl_SI.properties \
sun/util/resources/CurrencyNames_sq_AL.properties \
sun/util/resources/CurrencyNames_sr_BA.properties \
sun/util/resources/CurrencyNames_sr_CS.properties \
sun/util/resources/CurrencyNames_sr_ME.properties \
sun/util/resources/CurrencyNames_sr_RS.properties \
sun/util/resources/CurrencyNames_sr_Latn_BA.properties \
sun/util/resources/CurrencyNames_sr_Latn_ME.properties \
sun/util/resources/CurrencyNames_sr_Latn_RS.properties \
sun/util/resources/CurrencyNames_sv.properties \
sun/util/resources/CurrencyNames_sv_SE.properties \
sun/util/resources/CurrencyNames_tr_TR.properties \
sun/util/resources/CurrencyNames_uk_UA.properties
sun/util/resources/be/CurrencyNames_be_BY.properties \
sun/util/resources/bg/CurrencyNames_bg_BG.properties \
sun/util/resources/ca/CurrencyNames_ca_ES.properties \
sun/util/resources/cs/CurrencyNames_cs_CZ.properties \
sun/util/resources/da/CurrencyNames_da_DK.properties \
sun/util/resources/de/CurrencyNames_de.properties \
sun/util/resources/de/CurrencyNames_de_AT.properties \
sun/util/resources/de/CurrencyNames_de_CH.properties \
sun/util/resources/de/CurrencyNames_de_DE.properties \
sun/util/resources/de/CurrencyNames_de_GR.properties \
sun/util/resources/de/CurrencyNames_de_LU.properties \
sun/util/resources/el/CurrencyNames_el_CY.properties \
sun/util/resources/el/CurrencyNames_el_GR.properties \
sun/util/resources/en/CurrencyNames_en_AU.properties \
sun/util/resources/en/CurrencyNames_en_CA.properties \
sun/util/resources/en/CurrencyNames_en_GB.properties \
sun/util/resources/en/CurrencyNames_en_IE.properties \
sun/util/resources/en/CurrencyNames_en_IN.properties \
sun/util/resources/en/CurrencyNames_en_MT.properties \
sun/util/resources/en/CurrencyNames_en_NZ.properties \
sun/util/resources/en/CurrencyNames_en_PH.properties \
sun/util/resources/en/CurrencyNames_en_SG.properties \
sun/util/resources/en/CurrencyNames_en_US.properties \
sun/util/resources/en/CurrencyNames_en_ZA.properties \
sun/util/resources/es/CurrencyNames_es.properties \
sun/util/resources/es/CurrencyNames_es_AR.properties \
sun/util/resources/es/CurrencyNames_es_BO.properties \
sun/util/resources/es/CurrencyNames_es_CL.properties \
sun/util/resources/es/CurrencyNames_es_CO.properties \
sun/util/resources/es/CurrencyNames_es_CR.properties \
sun/util/resources/es/CurrencyNames_es_CU.properties \
sun/util/resources/es/CurrencyNames_es_DO.properties \
sun/util/resources/es/CurrencyNames_es_EC.properties \
sun/util/resources/es/CurrencyNames_es_ES.properties \
sun/util/resources/es/CurrencyNames_es_GT.properties \
sun/util/resources/es/CurrencyNames_es_HN.properties \
sun/util/resources/es/CurrencyNames_es_MX.properties \
sun/util/resources/es/CurrencyNames_es_NI.properties \
sun/util/resources/es/CurrencyNames_es_PA.properties \
sun/util/resources/es/CurrencyNames_es_PE.properties \
sun/util/resources/es/CurrencyNames_es_PR.properties \
sun/util/resources/es/CurrencyNames_es_PY.properties \
sun/util/resources/es/CurrencyNames_es_SV.properties \
sun/util/resources/es/CurrencyNames_es_US.properties \
sun/util/resources/es/CurrencyNames_es_UY.properties \
sun/util/resources/es/CurrencyNames_es_VE.properties \
sun/util/resources/et/CurrencyNames_et_EE.properties \
sun/util/resources/fi/CurrencyNames_fi_FI.properties \
sun/util/resources/fr/CurrencyNames_fr.properties \
sun/util/resources/fr/CurrencyNames_fr_BE.properties \
sun/util/resources/fr/CurrencyNames_fr_CA.properties \
sun/util/resources/fr/CurrencyNames_fr_CH.properties \
sun/util/resources/fr/CurrencyNames_fr_FR.properties \
sun/util/resources/fr/CurrencyNames_fr_LU.properties \
sun/util/resources/ga/CurrencyNames_ga_IE.properties \
sun/util/resources/hr/CurrencyNames_hr_HR.properties \
sun/util/resources/hu/CurrencyNames_hu_HU.properties \
sun/util/resources/in/CurrencyNames_in_ID.properties \
sun/util/resources/is/CurrencyNames_is_IS.properties \
sun/util/resources/it/CurrencyNames_it.properties \
sun/util/resources/it/CurrencyNames_it_CH.properties \
sun/util/resources/it/CurrencyNames_it_IT.properties \
sun/util/resources/lt/CurrencyNames_lt_LT.properties \
sun/util/resources/lv/CurrencyNames_lv_LV.properties \
sun/util/resources/mk/CurrencyNames_mk_MK.properties \
sun/util/resources/ms/CurrencyNames_ms_MY.properties \
sun/util/resources/mt/CurrencyNames_mt_MT.properties \
sun/util/resources/nl/CurrencyNames_nl_BE.properties \
sun/util/resources/nl/CurrencyNames_nl_NL.properties \
sun/util/resources/no/CurrencyNames_no_NO.properties \
sun/util/resources/pl/CurrencyNames_pl_PL.properties \
sun/util/resources/pt/CurrencyNames_pt.properties \
sun/util/resources/pt/CurrencyNames_pt_BR.properties \
sun/util/resources/pt/CurrencyNames_pt_PT.properties \
sun/util/resources/ro/CurrencyNames_ro_RO.properties \
sun/util/resources/ru/CurrencyNames_ru_RU.properties \
sun/util/resources/sk/CurrencyNames_sk_SK.properties \
sun/util/resources/sl/CurrencyNames_sl_SI.properties \
sun/util/resources/sq/CurrencyNames_sq_AL.properties \
sun/util/resources/sr/CurrencyNames_sr_BA.properties \
sun/util/resources/sr/CurrencyNames_sr_CS.properties \
sun/util/resources/sr/CurrencyNames_sr_ME.properties \
sun/util/resources/sr/CurrencyNames_sr_RS.properties \
sun/util/resources/sr/CurrencyNames_sr_Latn_BA.properties \
sun/util/resources/sr/CurrencyNames_sr_Latn_ME.properties \
sun/util/resources/sr/CurrencyNames_sr_Latn_RS.properties \
sun/util/resources/sv/CurrencyNames_sv.properties \
sun/util/resources/sv/CurrencyNames_sv_SE.properties \
sun/util/resources/tr/CurrencyNames_tr_TR.properties \
sun/util/resources/uk/CurrencyNames_uk_UA.properties

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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
@ -50,7 +50,7 @@ include FILES_properties.gmk
#
# Compile properties
#
COMPILED_PROPERTIES_SUPERCLASS=LocaleNamesBundle
COMPILED_PROPERTIES_SUPERCLASS=sun.util.resources.LocaleNamesBundle
#
# Include

View file

@ -76,7 +76,7 @@ else
endif
# nio need to be compiled before awt to have all charsets ready
SUBDIRS = jar security javazic misc net nio text util launcher
SUBDIRS = jar security javazic misc net nio text util launcher cldr
ifdef BUILD_HEADLESS_ONLY
DISPLAY_LIBS = awt $(HEADLESS_SUBDIR)

107
jdk/make/sun/cldr/Makefile Normal file
View file

@ -0,0 +1,107 @@
#
# Copyright (c) 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile for CLDR locale data.
#
BUILDDIR = ../..
PACKAGE = sun.text.resources.cldr
PRODUCT = sun
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
include $(BUILDDIR)/common/Defs.gmk
# Re-direct classes to another location (we are building cldrdata.jar)
CLASSDESTDIR = $(TEMPDIR)/classes
CLDRVERSION = 21.0.1
CLDRSRCDIR = $(SHARE_SRC)/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
CLDRDATA_JAR = $(EXTDIR)/cldrdata.jar
CLDRCONVERTER_JAR = $(BUILDTOOLJARDIR)/cldrconverter.jar
#
# Files
#
CLDRGENSRCDIR = $(GENSRCDIR)/sun/text/resources/cldr \
$(GENSRCDIR)/sun/util/cldr \
$(GENSRCDIR)/sun/util/resources/cldr
MANIFEST_FILE = $(TEMPDIR)/manifest.mf
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
gensrc: $(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java
$(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java: \
$(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml)
$(prep-target)
@$(BOOT_JAVA_CMD) -jar $(CLDRCONVERTER_JAR) \
-base $(CLDRSRCDIR) \
-o $(GENSRCDIR)
@$(java-vm-cleanup)
$(CLDRDATA_JAR): $(EXTDIR) $(GENSRCDIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java $(MANIFEST_FILE)
$(prep-target)
$(MKDIR) -p $(CLASSDESTDIR)
$(shell \
for dir in $(GENSRCDIR); do \
if [ -d $$dir ] ; then \
( $(CD) $$dir; \
for sdir in $(CLDRGENSRCDIR); do \
if [ -d $$sdir ] ; then \
$(FIND) $$sdir \
-name '*.java' -print >> $(JAVA_SOURCE_LIST) ; \
fi ; \
done \
); \
fi; \
done \
)
$(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST)
$(BOOT_JAR_CMD) -cmf $(MANIFEST_FILE) $@ -C $(CLASSDESTDIR) sun \
$(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
$(MANIFEST_FILE):
@$(prep-target)
$(ECHO) "CLDR-Version: $(CLDRVERSION)" > $@
build: gensrc $(CLDRDATA_JAR)
clean clobber::
$(RM) -r $(CLASSDESTDIR)
$(RM) -r $(GENSRCDIR)/sun/text/resources/cldr
$(RM) -r $(GENSRCDIR)/sun/util/cldr
$(RM) -r $(GENSRCDIR)/sun/util/resources/cldr
$(RM) $(MANIFEST_FILE)
$(RM) $(CLDRDATA_JAR)
.PHONY: gensrc

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2012, 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,63 +33,47 @@
#
FILES_java = \
sun/text/resources/BreakIteratorInfo_th.java \
sun/text/resources/th/BreakIteratorInfo_th.java \
\
sun/text/resources/CollationData_ar.java \
sun/text/resources/CollationData_hi.java \
sun/text/resources/CollationData_iw.java \
sun/text/resources/CollationData_ja.java \
sun/text/resources/CollationData_ko.java \
sun/text/resources/CollationData_th.java \
sun/text/resources/CollationData_vi.java \
sun/text/resources/CollationData_zh.java \
sun/text/resources/CollationData_zh_HK.java \
sun/text/resources/CollationData_zh_TW.java \
sun/text/resources/ar/CollationData_ar.java \
sun/text/resources/hi/CollationData_hi.java \
sun/text/resources/iw/CollationData_iw.java \
sun/text/resources/ja/CollationData_ja.java \
sun/text/resources/ko/CollationData_ko.java \
sun/text/resources/th/CollationData_th.java \
sun/text/resources/vi/CollationData_vi.java \
sun/text/resources/zh/CollationData_zh.java \
sun/text/resources/zh/CollationData_zh_HK.java \
sun/text/resources/zh/CollationData_zh_TW.java \
\
sun/text/resources/FormatData_ar.java \
sun/text/resources/FormatData_ar_AE.java \
sun/text/resources/FormatData_ar_BH.java \
sun/text/resources/FormatData_ar_DZ.java \
sun/text/resources/FormatData_ar_EG.java \
sun/text/resources/FormatData_ar_IQ.java \
sun/text/resources/FormatData_ar_JO.java \
sun/text/resources/FormatData_ar_KW.java \
sun/text/resources/FormatData_ar_LB.java \
sun/text/resources/FormatData_ar_LY.java \
sun/text/resources/FormatData_ar_MA.java \
sun/text/resources/FormatData_ar_OM.java \
sun/text/resources/FormatData_ar_QA.java \
sun/text/resources/FormatData_ar_SA.java \
sun/text/resources/FormatData_ar_SD.java \
sun/text/resources/FormatData_ar_SY.java \
sun/text/resources/FormatData_ar_TN.java \
sun/text/resources/FormatData_ar_YE.java \
sun/text/resources/FormatData_hi_IN.java \
sun/text/resources/FormatData_iw.java \
sun/text/resources/FormatData_iw_IL.java \
sun/text/resources/FormatData_ja.java \
sun/text/resources/FormatData_ja_JP.java \
sun/text/resources/FormatData_ja_JP_JP.java \
sun/text/resources/FormatData_ko.java \
sun/text/resources/FormatData_ko_KR.java \
sun/text/resources/FormatData_th.java \
sun/text/resources/FormatData_th_TH.java \
sun/text/resources/FormatData_th_TH_TH.java \
sun/text/resources/FormatData_vi.java \
sun/text/resources/FormatData_vi_VN.java \
sun/text/resources/FormatData_zh.java \
sun/text/resources/FormatData_zh_CN.java \
sun/text/resources/FormatData_zh_HK.java \
sun/text/resources/FormatData_zh_SG.java \
sun/text/resources/FormatData_zh_TW.java \
sun/text/resources/ar/FormatData_ar.java \
sun/text/resources/ar/FormatData_ar_JO.java \
sun/text/resources/ar/FormatData_ar_LB.java \
sun/text/resources/ar/FormatData_ar_SY.java \
sun/text/resources/hi/FormatData_hi_IN.java \
sun/text/resources/iw/FormatData_iw.java \
sun/text/resources/iw/FormatData_iw_IL.java \
sun/text/resources/ja/FormatData_ja.java \
sun/text/resources/ja/FormatData_ja_JP.java \
sun/text/resources/ko/FormatData_ko.java \
sun/text/resources/ko/FormatData_ko_KR.java \
sun/text/resources/th/FormatData_th.java \
sun/text/resources/th/FormatData_th_TH.java \
sun/text/resources/vi/FormatData_vi.java \
sun/text/resources/vi/FormatData_vi_VN.java \
sun/text/resources/zh/FormatData_zh.java \
sun/text/resources/zh/FormatData_zh_CN.java \
sun/text/resources/zh/FormatData_zh_HK.java \
sun/text/resources/zh/FormatData_zh_SG.java \
sun/text/resources/zh/FormatData_zh_TW.java \
\
sun/util/resources/CurrencyNames_zh_HK.java \
sun/util/resources/CurrencyNames_zh_SG.java \
sun/util/resources/LocaleNames_zh_HK.java \
sun/util/resources/TimeZoneNames_hi.java \
sun/util/resources/TimeZoneNames_ja.java \
sun/util/resources/TimeZoneNames_ko.java \
sun/util/resources/TimeZoneNames_zh_CN.java \
sun/util/resources/TimeZoneNames_zh_TW.java \
sun/util/resources/TimeZoneNames_zh_HK.java
sun/util/resources/zh/CurrencyNames_zh_HK.java \
sun/util/resources/zh/CurrencyNames_zh_SG.java \
sun/util/resources/zh/LocaleNames_zh_HK.java \
sun/util/resources/hi/TimeZoneNames_hi.java \
sun/util/resources/ja/TimeZoneNames_ja.java \
sun/util/resources/ko/TimeZoneNames_ko.java \
sun/util/resources/zh/TimeZoneNames_zh_CN.java \
sun/util/resources/zh/TimeZoneNames_zh_TW.java \
sun/util/resources/zh/TimeZoneNames_zh_HK.java

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2012, 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,50 +24,50 @@
#
FILES_compiled_properties = \
sun/util/resources/LocaleNames_ar.properties \
sun/util/resources/LocaleNames_hi.properties \
sun/util/resources/LocaleNames_iw.properties \
sun/util/resources/LocaleNames_ja.properties \
sun/util/resources/LocaleNames_ko.properties \
sun/util/resources/LocaleNames_th.properties \
sun/util/resources/LocaleNames_vi.properties \
sun/util/resources/LocaleNames_zh.properties \
sun/util/resources/LocaleNames_zh_SG.properties \
sun/util/resources/LocaleNames_zh_TW.properties \
sun/util/resources/ar/LocaleNames_ar.properties \
sun/util/resources/hi/LocaleNames_hi.properties \
sun/util/resources/iw/LocaleNames_iw.properties \
sun/util/resources/ja/LocaleNames_ja.properties \
sun/util/resources/ko/LocaleNames_ko.properties \
sun/util/resources/th/LocaleNames_th.properties \
sun/util/resources/vi/LocaleNames_vi.properties \
sun/util/resources/zh/LocaleNames_zh.properties \
sun/util/resources/zh/LocaleNames_zh_SG.properties \
sun/util/resources/zh/LocaleNames_zh_TW.properties \
\
sun/util/resources/CalendarData_ar.properties \
sun/util/resources/CalendarData_hi.properties \
sun/util/resources/CalendarData_iw.properties \
sun/util/resources/CalendarData_ja.properties \
sun/util/resources/CalendarData_ko.properties \
sun/util/resources/CalendarData_th.properties \
sun/util/resources/CalendarData_vi.properties \
sun/util/resources/CalendarData_zh.properties \
sun/util/resources/ar/CalendarData_ar.properties \
sun/util/resources/hi/CalendarData_hi.properties \
sun/util/resources/iw/CalendarData_iw.properties \
sun/util/resources/ja/CalendarData_ja.properties \
sun/util/resources/ko/CalendarData_ko.properties \
sun/util/resources/th/CalendarData_th.properties \
sun/util/resources/vi/CalendarData_vi.properties \
sun/util/resources/zh/CalendarData_zh.properties \
\
sun/util/resources/CurrencyNames_ar_AE.properties \
sun/util/resources/CurrencyNames_ar_BH.properties \
sun/util/resources/CurrencyNames_ar_DZ.properties \
sun/util/resources/CurrencyNames_ar_EG.properties \
sun/util/resources/CurrencyNames_ar_IQ.properties \
sun/util/resources/CurrencyNames_ar_JO.properties \
sun/util/resources/CurrencyNames_ar_KW.properties \
sun/util/resources/CurrencyNames_ar_LB.properties \
sun/util/resources/CurrencyNames_ar_LY.properties \
sun/util/resources/CurrencyNames_ar_MA.properties \
sun/util/resources/CurrencyNames_ar_OM.properties \
sun/util/resources/CurrencyNames_ar_QA.properties \
sun/util/resources/CurrencyNames_ar_SA.properties \
sun/util/resources/CurrencyNames_ar_SD.properties \
sun/util/resources/CurrencyNames_ar_SY.properties \
sun/util/resources/CurrencyNames_ar_TN.properties \
sun/util/resources/CurrencyNames_ar_YE.properties \
sun/util/resources/CurrencyNames_hi_IN.properties \
sun/util/resources/CurrencyNames_iw_IL.properties \
sun/util/resources/CurrencyNames_ja.properties \
sun/util/resources/CurrencyNames_ja_JP.properties \
sun/util/resources/CurrencyNames_ko.properties \
sun/util/resources/CurrencyNames_ko_KR.properties \
sun/util/resources/CurrencyNames_th_TH.properties \
sun/util/resources/CurrencyNames_vi_VN.properties \
sun/util/resources/CurrencyNames_zh_CN.properties \
sun/util/resources/CurrencyNames_zh_TW.properties
sun/util/resources/ar/CurrencyNames_ar_AE.properties \
sun/util/resources/ar/CurrencyNames_ar_BH.properties \
sun/util/resources/ar/CurrencyNames_ar_DZ.properties \
sun/util/resources/ar/CurrencyNames_ar_EG.properties \
sun/util/resources/ar/CurrencyNames_ar_IQ.properties \
sun/util/resources/ar/CurrencyNames_ar_JO.properties \
sun/util/resources/ar/CurrencyNames_ar_KW.properties \
sun/util/resources/ar/CurrencyNames_ar_LB.properties \
sun/util/resources/ar/CurrencyNames_ar_LY.properties \
sun/util/resources/ar/CurrencyNames_ar_MA.properties \
sun/util/resources/ar/CurrencyNames_ar_OM.properties \
sun/util/resources/ar/CurrencyNames_ar_QA.properties \
sun/util/resources/ar/CurrencyNames_ar_SA.properties \
sun/util/resources/ar/CurrencyNames_ar_SD.properties \
sun/util/resources/ar/CurrencyNames_ar_SY.properties \
sun/util/resources/ar/CurrencyNames_ar_TN.properties \
sun/util/resources/ar/CurrencyNames_ar_YE.properties \
sun/util/resources/hi/CurrencyNames_hi_IN.properties \
sun/util/resources/iw/CurrencyNames_iw_IL.properties \
sun/util/resources/ja/CurrencyNames_ja.properties \
sun/util/resources/ja/CurrencyNames_ja_JP.properties \
sun/util/resources/ko/CurrencyNames_ko.properties \
sun/util/resources/ko/CurrencyNames_ko_KR.properties \
sun/util/resources/th/CurrencyNames_th_TH.properties \
sun/util/resources/vi/CurrencyNames_vi_VN.properties \
sun/util/resources/zh/CurrencyNames_zh_CN.properties \
sun/util/resources/zh/CurrencyNames_zh_TW.properties

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2001, 2012, 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,7 +48,7 @@ include FILES_properties.gmk
#
# Compile the properties files
#
COMPILED_PROPERTIES_SUPERCLASS=LocaleNamesBundle
COMPILED_PROPERTIES_SUPERCLASS=sun.util.resources.LocaleNamesBundle
#
# Rules
@ -68,13 +68,13 @@ TEXT_CLASSES = $(BUILDTOOLCLASSDIR)/sun.text/classes
#
TEXT_SRCDIR = $(SHARE_SRC)/classes/sun/text/resources
BIRULES = $(TEXT_SRCDIR)/BreakIteratorRules.java \
$(TEXT_SRCDIR)/BreakIteratorRules_th.java
BIINFO = $(TEXT_SRCDIR)/BreakIteratorInfo_th.java
$(TEXT_SRCDIR)/th/BreakIteratorRules_th.java
BIINFO = $(TEXT_SRCDIR)/th/BreakIteratorInfo_th.java
UNICODEDATA = $(BUILDDIR)/tools/UnicodeData
# output
BIFILES = $(CLASSDESTDIR)/sun/text/resources/WordBreakIteratorData_th \
$(CLASSDESTDIR)/sun/text/resources/LineBreakIteratorData_th
BIFILES = $(CLASSDESTDIR)/sun/text/resources/th/WordBreakIteratorData_th \
$(CLASSDESTDIR)/sun/text/resources/th/LineBreakIteratorData_th
# builder
GENERATEBREAKITERATORDATA_JARFILE = \
@ -106,7 +106,7 @@ clean::
#
LOCALEDATA_JAR = $(EXTDIR)/localedata.jar
SPECIALFILES = $(CLASSDESTDIR)/sun/text/resources/thai_dict
SPECIALFILES = $(CLASSDESTDIR)/sun/text/resources/th/thai_dict
$(CLASSDESTDIR)/sun/text/resources/% : $(TEXT_SRCDIR)/%
$(install-file)

View file

@ -36,6 +36,7 @@ include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = \
addjsum \
buildmetaindex \
cldrconverter \
commentchecker \
compile_font_config \
compile_properties \

View file

@ -0,0 +1,43 @@
#
# Copyright (c) 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile for building the CLDRConverter tool
#
BUILDDIR = ../..
PACKAGE = build.tools.cldrconverter
PRODUCT = cldrconverter
PROGRAM = cldrconverter
include $(BUILDDIR)/common/Defs.gmk
BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src
BUILDTOOL_MAIN = $(PKGDIR)/CLDRConverter.java
#
# Build tool jar rules.
#
include $(BUILDDIR)/common/BuildToolJar.gmk

View file

@ -0,0 +1,189 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/**
* This is an abstract class for general LDML parsing purpose.
* LDMLParseHandler, SupplementLDMLParseHandler, and NumberingLDMLParseHandler
* are the subclasses of this class.
*/
abstract class AbstractLDMLHandler<V> extends DefaultHandler {
static final Map<String, String> DAY_OF_WEEK_MAP = new HashMap<>();
static {
DAY_OF_WEEK_MAP.put("sun", "1");
DAY_OF_WEEK_MAP.put("mon", "2");
DAY_OF_WEEK_MAP.put("tue", "3");
DAY_OF_WEEK_MAP.put("wed", "4");
DAY_OF_WEEK_MAP.put("thu", "5");
DAY_OF_WEEK_MAP.put("fri", "6");
DAY_OF_WEEK_MAP.put("sat", "7");
}
// Collected data in JRE locale data format.
private Map<String, V> data = new HashMap<>();
// The root Container
Container currentContainer = new Container("$ROOT", null);
AbstractLDMLHandler() {
}
Map<String, V> getData() {
return data;
}
V put(String key, V value) {
return data.put(key, value);
}
V get(String key) {
return data.get(key);
}
Set<String> keySet() {
return data.keySet();
}
/*
* It returns true if the data should be ignored based on the user
* defined acceptance level, which is listed with draft attribute in
* the cldr locale xml files.
* When the alt attribute is present, the data is always ignored since
* we always use the primary data
*/
boolean isIgnored(Attributes attributes) {
if (attributes.getValue("alt") != null) {
return true;
}
String draftValue = attributes.getValue("draft");
if (draftValue != null) {
return CLDRConverter.draftType > CLDRConverter.DRAFT_MAP.get(draftValue);
}
return false;
}
void pushContainer(String qName, Attributes attributes) {
if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
currentContainer = new IgnoredContainer(qName, currentContainer);
} else {
currentContainer = new Container(qName, currentContainer);
}
}
void pushIgnoredContainer(String qName) {
currentContainer = new IgnoredContainer(qName, currentContainer);
}
void pushKeyContainer(String qName, Attributes attributes, String key) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new KeyContainer(qName, currentContainer, key);
}
}
/**
* start an element that defines a string entry, with the value provided by the element's text.
*/
void pushStringEntry(String qName, Attributes attributes, String key) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringEntry(qName, currentContainer, key);
}
}
/**
* start an element that defines a string entry, with the value provided by an attribute value.
*/
void pushStringEntry(String qName, Attributes attributes, String key, String value) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringEntry(qName, currentContainer, key, value);
}
}
void pushStringArrayEntry(String qName, Attributes attributes, String key, int length) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringArrayEntry(qName, currentContainer, key, length);
}
}
void pushStringArrayElement(String qName, Attributes attributes, int index) {
if (!pushIfIgnored(qName, attributes)) {
currentContainer = new StringArrayElement(qName, currentContainer, index);
}
}
private boolean pushIfIgnored(String qName, Attributes attributes) {
if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
pushIgnoredContainer(qName);
return true;
}
return false;
}
/**
* Obtains the key from the innermost containing container that provides one.
*/
String getContainerKey() {
Container current = currentContainer;
while (current != null) {
if (current instanceof KeyContainer) {
return ((KeyContainer) current).getKey();
}
current = current.getParent();
}
return null;
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
currentContainer.addCharacters(ch, start, length);
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void warning(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void error(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void fatalError(SAXParseException e) throws SAXException {
e.printStackTrace();
super.fatalError(e);
}
}

View file

@ -0,0 +1,542 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class Bundle {
static enum Type {
LOCALENAMES, CURRENCYNAMES, TIMEZONENAMES, CALENDARDATA, FORMATDATA;
static EnumSet<Type> ALL_TYPES = EnumSet.of(LOCALENAMES,
CURRENCYNAMES,
TIMEZONENAMES,
CALENDARDATA,
FORMATDATA);
}
private final static Map<String, Bundle> bundles = new HashMap<>();
private final static String[] NUMBER_PATTERN_KEYS = {
"NumberPatterns/decimal",
"NumberPatterns/currency",
"NumberPatterns/percent"
};
private final static String[] NUMBER_ELEMENT_KEYS = {
"NumberElements/decimal",
"NumberElements/group",
"NumberElements/list",
"NumberElements/percent",
"NumberElements/zero",
"NumberElements/pattern",
"NumberElements/minus",
"NumberElements/exponential",
"NumberElements/permille",
"NumberElements/infinity",
"NumberElements/nan"
};
private final static String[] TIME_PATTERN_KEYS = {
"DateTimePatterns/full-time",
"DateTimePatterns/long-time",
"DateTimePatterns/medium-time",
"DateTimePatterns/short-time",
};
private final static String[] DATE_PATTERN_KEYS = {
"DateTimePatterns/full-date",
"DateTimePatterns/long-date",
"DateTimePatterns/medium-date",
"DateTimePatterns/short-date",
};
private final static String[] DATETIME_PATTERN_KEYS = {
"DateTimePatterns/date-time"
};
private final static String[] ERA_KEYS = {
"long.Eras",
"Eras",
"short.Eras"
};
private final String id;
private final String cldrPath;
private final EnumSet<Type> bundleTypes;
private final String currencies;
static Bundle getBundle(String id) {
return bundles.get(id);
}
Bundle(String id, String cldrPath, String bundles, String currencies) {
this.id = id;
this.cldrPath = cldrPath;
if ("localenames".equals(bundles)) {
bundleTypes = EnumSet.of(Type.LOCALENAMES);
} else if ("currencynames".equals(bundles)) {
bundleTypes = EnumSet.of(Type.CURRENCYNAMES);
} else {
bundleTypes = Type.ALL_TYPES;
}
if (currencies == null) {
currencies = "local";
}
this.currencies = currencies;
addBundle();
}
private void addBundle() {
Bundle.bundles.put(id, this);
}
String getID() {
return id;
}
boolean isRoot() {
return "root".equals(id);
}
String getCLDRPath() {
return cldrPath;
}
EnumSet<Type> getBundleTypes() {
return bundleTypes;
}
String getCurrencies() {
return currencies;
}
/**
* Generate a map that contains all the data that should be
* visible for the bundle's locale
*/
Map<String, Object> getTargetMap() throws Exception {
String[] cldrBundles = getCLDRPath().split(",");
// myMap contains resources for id.
Map<String, Object> myMap = new HashMap<>();
int index;
for (index = 0; index < cldrBundles.length; index++) {
if (cldrBundles[index].equals(id)) {
myMap.putAll(CLDRConverter.getCLDRBundle(cldrBundles[index]));
break;
}
}
// parentsMap contains resources from id's parents.
Map<String, Object> parentsMap = new HashMap<>();
for (int i = cldrBundles.length - 1; i > index; i--) {
if (!("no".equals(cldrBundles[i]) || cldrBundles[i].startsWith("no_"))) {
parentsMap.putAll(CLDRConverter.getCLDRBundle(cldrBundles[i]));
}
}
// Duplicate myMap as parentsMap for "root" so that the
// fallback works. This is a huck, though.
if ("root".equals(cldrBundles[0])) {
assert parentsMap.isEmpty();
parentsMap.putAll(myMap);
}
// merge individual strings into arrays
// if myMap has any of the NumberPatterns members
for (String k : NUMBER_PATTERN_KEYS) {
if (myMap.containsKey(k)) {
String[] numberPatterns = new String[NUMBER_PATTERN_KEYS.length];
for (int i = 0; i < NUMBER_PATTERN_KEYS.length; i++) {
String key = NUMBER_PATTERN_KEYS[i];
String value = (String) myMap.remove(key);
if (value == null) {
value = (String) parentsMap.remove(key);
}
if (value.length() == 0) {
CLDRConverter.warning("empty pattern for " + key);
}
numberPatterns[i] = value;
}
myMap.put("NumberPatterns", numberPatterns);
break;
}
}
// if myMap has any of NUMBER_ELEMENT_KEYS, create a complete NumberElements.
String defaultScript = (String) myMap.get("DefaultNumberingSystem");
@SuppressWarnings("unchecked")
List<String> scripts = (List<String>) myMap.get("numberingScripts");
if (defaultScript == null && scripts != null) {
// Some locale data has no default script for numbering even with mutiple scripts.
// Take the first one as default in that case.
defaultScript = scripts.get(0);
myMap.put("DefaultNumberingSystem", defaultScript);
}
if (scripts != null) {
for (String script : scripts) {
for (String k : NUMBER_ELEMENT_KEYS) {
String[] numberElements = new String[NUMBER_ELEMENT_KEYS.length];
for (int i = 0; i < NUMBER_ELEMENT_KEYS.length; i++) {
String key = script + "." + NUMBER_ELEMENT_KEYS[i];
String value = (String) myMap.remove(key);
if (value == null) {
if (key.endsWith("/pattern")) {
value = "#";
} else {
value = (String) parentsMap.get(key);
if (value == null) {
// the last resort is "latn"
key = "latn." + NUMBER_ELEMENT_KEYS[i];
value = (String) parentsMap.get(key);
if (value == null) {
throw new InternalError("NumberElements: null for " + key);
}
}
}
}
numberElements[i] = value;
}
myMap.put(script + "." + "NumberElements", numberElements);
break;
}
}
}
// another hack: parentsMap is not used for date-time resources.
if ("root".equals(id)) {
parentsMap = null;
}
for (CalendarType calendarType : CalendarType.values()) {
String calendarPrefix = calendarType.keyElementName();
// handle multiple inheritance for month and day names
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers");
adjustEraNames(myMap, calendarType);
handleDateTimeFormatPatterns(TIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "TimePatterns");
handleDateTimeFormatPatterns(DATE_PATTERN_KEYS, myMap, parentsMap, calendarType, "DatePatterns");
handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns");
}
return myMap;
}
private void handleMultipleInheritance(Map<String, Object> map, Map<String, Object> parents, String key) {
String formatKey = key + "/format";
Object format = map.get(formatKey);
if (format != null) {
map.remove(formatKey);
map.put(key, format);
if (fillInElements(parents, formatKey, format)) {
map.remove(key);
}
}
String standaloneKey = key + "/stand-alone";
Object standalone = map.get(standaloneKey);
if (standalone != null) {
map.remove(standaloneKey);
String realKey = key;
if (format != null) {
realKey = "standalone." + key;
}
map.put(realKey, standalone);
if (fillInElements(parents, standaloneKey, standalone)) {
map.remove(realKey);
}
}
}
/**
* Fills in any empty elements with its parent element. Returns true if the resulting array is
* identical to its parent array.
*
* @param parents
* @param key
* @param value
* @return true if the resulting array is identical to its parent array.
*/
private boolean fillInElements(Map<String, Object> parents, String key, Object value) {
if (parents == null) {
return false;
}
if (value instanceof String[]) {
Object pvalue = parents.get(key);
if (pvalue != null && pvalue instanceof String[]) {
String[] strings = (String[]) value;
String[] pstrings = (String[]) pvalue;
for (int i = 0; i < strings.length; i++) {
if (strings[i] == null || strings[i].length() == 0) {
strings[i] = pstrings[i];
}
}
return Arrays.equals(strings, pstrings);
}
}
return false;
}
/*
* Adjusts String[] for era names because JRE's Calendars use different
* ERA value indexes in the Buddhist and Japanese Imperial calendars.
*/
private void adjustEraNames(Map<String, Object> map, CalendarType type) {
String[][] eraNames = new String[ERA_KEYS.length][];
String[] realKeys = new String[ERA_KEYS.length];
int index = 0;
for (String key : ERA_KEYS) {
String realKey = type.keyElementName() + key;
String[] value = (String[]) map.get(realKey);
if (value != null) {
switch (type) {
case GREGORIAN:
break;
case JAPANESE:
{
String[] newValue = new String[value.length + 1];
String[] julianEras = (String[]) map.get(key);
if (julianEras != null && julianEras.length >= 2) {
newValue[0] = julianEras[1];
} else {
newValue[0] = "";
}
System.arraycopy(value, 0, newValue, 1, value.length);
value = newValue;
}
break;
case BUDDHIST:
// Replace the value
value = new String[] {"BC", value[0]};
break;
}
if (!key.equals(realKey)) {
map.put(realKey, value);
}
}
realKeys[index] = realKey;
eraNames[index++] = value;
}
if (eraNames[0] != null) {
if (eraNames[1] != null) {
if (eraNames[2] == null) {
// Eras -> short.Eras
// long.Eras -> Eras
map.put(realKeys[2], map.get(realKeys[1]));
map.put(realKeys[1], map.get(realKeys[0]));
}
} else {
// long.Eras -> Eras
map.put(realKeys[1], map.get(realKeys[0]));
}
// remove long.Eras
map.remove(realKeys[0]);
}
}
private void handleDateTimeFormatPatterns(String[] patternKeys, Map<String, Object> myMap, Map<String, Object> parentsMap,
CalendarType calendarType, String name) {
String calendarPrefix = calendarType.keyElementName();
for (String k : patternKeys) {
if (myMap.containsKey(calendarPrefix + k)) {
int len = patternKeys.length;
List<String> patterns = new ArrayList<>();
for (int i = 0; i < len; i++) {
String key = calendarPrefix + patternKeys[i];
String pattern = (String) myMap.remove(key);
if (pattern == null) {
pattern = (String) parentsMap.remove(key);
}
if (pattern != null) {
patterns.add(i, translateDateFormatLetters(calendarType, pattern));
}
}
if (patterns.isEmpty()) {
return;
}
String key = calendarPrefix + name;
myMap.put(key, patterns.toArray(new String[len]));
break;
}
}
}
private String translateDateFormatLetters(CalendarType calendarType, String cldrFormat) {
String pattern = cldrFormat;
int length = pattern.length();
boolean inQuote = false;
StringBuilder jrePattern = new StringBuilder(length);
int count = 0;
char lastLetter = 0;
for (int i = 0; i < length; i++) {
char c = pattern.charAt(i);
if (c == '\'') {
// '' is treated as a single quote regardless of being
// in a quoted section.
if ((i + 1) < length) {
char nextc = pattern.charAt(i + 1);
if (nextc == '\'') {
i++;
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append("''");
continue;
}
}
if (!inQuote) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
inQuote = true;
} else {
inQuote = false;
}
jrePattern.append(c);
continue;
}
if (inQuote) {
jrePattern.append(c);
continue;
}
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append(c);
continue;
}
if (lastLetter == 0 || lastLetter == c) {
lastLetter = c;
count++;
continue;
}
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = c;
count = 1;
}
if (inQuote) {
throw new InternalError("Unterminated quote in date-time pattern: " + cldrFormat);
}
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
}
if (cldrFormat.contentEquals(jrePattern)) {
return cldrFormat;
}
return jrePattern.toString();
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
case 'G':
if (calendarType != CalendarType.GREGORIAN) {
// Adjust the number of 'G's for JRE SimpleDateFormat
if (count == 5) {
// CLDR narrow -> JRE short
count = 1;
} else if (count == 1) {
// CLDR abbr -> JRE long
count = 4;
}
}
appendN(cldrLetter, count, sb);
break;
// TODO: support 'c' and 'e' in JRE SimpleDateFormat
// Use 'u' and 'E' for now.
case 'c':
case 'e':
switch (count) {
case 1:
sb.append('u');
break;
case 3:
case 4:
appendN('E', count, sb);
break;
case 5:
appendN('E', 3, sb);
break;
}
break;
case 'v':
case 'V':
appendN('z', count, sb);
break;
case 'Z':
if (count == 4 || count == 5) {
sb.append("XXX");
}
break;
case 'u':
case 'U':
case 'q':
case 'Q':
case 'l':
case 'g':
case 'j':
case 'A':
throw new InternalError(String.format("Unsupported letter: '%c', count=%d%n",
cldrLetter, count));
default:
appendN(cldrLetter, count, sb);
break;
}
}
private void appendN(char c, int n, StringBuilder sb) {
for (int i = 0; i < n; i++) {
sb.append(c);
}
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.IOException;
import java.util.Map;
import java.util.SortedSet;
public interface BundleGenerator {
public void generateBundle(String packageName, String baseName, String localeID,
boolean useJava, Map<String, ?> map, boolean open) throws IOException;
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException;
}

View file

@ -0,0 +1,615 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
/**
* Converts locale data from "Locale Data Markup Language" format to
* JRE resource bundle format. LDML is the format used by the Common
* Locale Data Repository maintained by the Unicode Consortium.
*/
public class CLDRConverter {
static final String LDML_DTD_SYSTEM_ID = "http://www.unicode.org/cldr/dtd/2.0/ldml.dtd";
static final String SPPL_LDML_DTD_SYSTEM_ID = "http://www.unicode.org/cldr/dtd/2.0/ldmlSupplemental.dtd";
private static String CLDR_BASE = "../CLDR/21.0.1/";
static String LOCAL_LDML_DTD;
static String LOCAL_SPPL_LDML_DTD;
private static String SOURCE_FILE_DIR;
private static String SPPL_SOURCE_FILE;
private static String NUMBERING_SOURCE_FILE;
private static String METAZONES_SOURCE_FILE;
static String DESTINATION_DIR = "build/gensrc";
static final String LOCALE_NAME_PREFIX = "locale.displayname.";
static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol.";
static final String CURRENCY_NAME_PREFIX = "currency.displayname.";
static final String TIMEZONE_ID_PREFIX = "timezone.id.";
static final String TIMEZONE_NAME_PREFIX = "timezone.displayname.";
static final String METAZONE_ID_PREFIX = "metazone.id.";
static final String METAZONE_NAME_PREFIX = "metazone.displayname.";
private static SupplementDataParseHandler handlerSuppl;
static NumberingSystemsParseHandler handlerNumbering;
static MetaZonesParseHandler handlerMetaZones;
private static BundleGenerator bundleGenerator;
static int draftType;
private static final String DRAFT_UNCONFIRMED = "unconfirmed";
private static final String DRAFT_PROVISIONAL = "provisional";
private static final String DRAFT_CONTRIBUTED = "contributed";
private static final String DRAFT_APPROVED = "approved";
private static final String DRAFT_TRUE = "true";
private static final String DRAFT_FALSE = "false";
private static final String DRAFT_DEFAULT = DRAFT_APPROVED;
static final Map<String, Integer> DRAFT_MAP = new HashMap<>();
static {
DRAFT_MAP.put(DRAFT_UNCONFIRMED, 0);
DRAFT_MAP.put(DRAFT_PROVISIONAL, 1);
DRAFT_MAP.put(DRAFT_CONTRIBUTED, 2);
DRAFT_MAP.put(DRAFT_APPROVED, 3);
DRAFT_MAP.put(DRAFT_TRUE, 0);
DRAFT_MAP.put(DRAFT_FALSE, 2);
draftType = DRAFT_MAP.get(DRAFT_DEFAULT);
};
static boolean USE_UTF8 = false;
private static boolean verbose;
private CLDRConverter() {
// no instantiation
}
@SuppressWarnings("AssignmentToForLoopParameter")
public static void main(String[] args) throws Exception {
if (args.length != 0) {
String currentArg = null;
try {
for (int i = 0; i < args.length; i++) {
currentArg = args[i];
switch (currentArg) {
case "-draft":
String draftDataType = args[++i];
try {
draftType = DRAFT_MAP.get(draftDataType);
} catch (NullPointerException e) {
severe("Error: incorrect draft value: %s%n", draftDataType);
System.exit(1);
}
info("Using the specified data type: %s%n", draftDataType);
break;
case "-base":
// base directory for input files
CLDR_BASE = args[++i];
if (!CLDR_BASE.endsWith("/")) {
CLDR_BASE += "/";
}
break;
case "-o":
// output directory
DESTINATION_DIR = args[++i];
break;
case "-utf8":
USE_UTF8 = true;
break;
case "-verbose":
verbose = true;
break;
case "-help":
usage();
System.exit(0);
break;
default:
throw new RuntimeException();
}
}
} catch (RuntimeException e) {
severe("unknown or imcomplete arg(s): " + currentArg);
usage();
System.exit(1);
}
}
// Set up path names
LOCAL_LDML_DTD = CLDR_BASE + "common/dtd/ldml.dtd";
LOCAL_SPPL_LDML_DTD = CLDR_BASE + "common/dtd/ldmlSupplemental.dtd";
SOURCE_FILE_DIR = CLDR_BASE + "common/main";
SPPL_SOURCE_FILE = CLDR_BASE + "common/supplemental/supplementalData.xml";
NUMBERING_SOURCE_FILE = CLDR_BASE + "common/supplemental/numberingSystems.xml";
METAZONES_SOURCE_FILE = CLDR_BASE + "common/supplemental/metaZones.xml";
bundleGenerator = new ResourceBundleGenerator();
List<Bundle> bundles = readBundleList();
convertBundles(bundles);
}
private static void usage() {
errout("Usage: java CLDRConverter [options]%n"
+ "\t-help output this usage message and exit%n"
+ "\t-verbose output information%n"
+ "\t-draft [approved | provisional | unconfirmed]%n"
+ "\t\t draft level for using data (default: approved)%n"
+ "\t-base dir base directory for CLDR input files%n"
+ "\t-o dir output directory (defaut: ./build/gensrc)%n"
+ "\t-utf8 use UTF-8 rather than \\uxxxx (for debug)%n");
}
static void info(String fmt, Object... args) {
if (verbose) {
System.out.printf(fmt, args);
}
}
static void info(String msg) {
if (verbose) {
System.out.println(msg);
}
}
static void warning(String fmt, Object... args) {
System.err.print("Warning: ");
System.err.printf(fmt, args);
}
static void warning(String msg) {
System.err.print("Warning: ");
errout(msg);
}
static void severe(String fmt, Object... args) {
System.err.print("Error: ");
System.err.printf(fmt, args);
}
static void severe(String msg) {
System.err.print("Error: ");
errout(msg);
}
private static void errout(String msg) {
if (msg.contains("%n")) {
System.err.printf(msg);
} else {
System.err.println(msg);
}
}
private static List<Bundle> readBundleList() throws Exception {
ResourceBundle.Control defCon = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
List<Bundle> retList = new ArrayList<>();
Path path = FileSystems.getDefault().getPath(SOURCE_FILE_DIR);
try (DirectoryStream<Path> dirStr = Files.newDirectoryStream(path)) {
for (Path entry : dirStr) {
String fileName = entry.getFileName().toString();
if (fileName.endsWith(".xml")) {
String id = fileName.substring(0, fileName.indexOf('.'));
Locale cldrLoc = Locale.forLanguageTag(toLanguageTag(id));
List<Locale> candList = defCon.getCandidateLocales("", cldrLoc);
StringBuilder sb = new StringBuilder();
for (Locale loc : candList) {
if (!loc.equals(Locale.ROOT)) {
sb.append(toLocaleName(loc.toLanguageTag()));
sb.append(",");
}
}
if (sb.indexOf("root") == -1) {
sb.append("root");
}
retList.add(new Bundle(id, sb.toString(), null, null));
}
}
}
return retList;
}
private static Map<String, Map<String, Object>> cldrBundles = new HashMap<>();
static Map<String, Object> getCLDRBundle(String id) throws Exception {
Map<String, Object> bundle = cldrBundles.get(id);
if (bundle != null) {
return bundle;
}
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser parser = factory.newSAXParser();
LDMLParseHandler handler = new LDMLParseHandler(id);
File file = new File(SOURCE_FILE_DIR + File.separator + id + ".xml");
if (!file.exists()) {
// Skip if the file doesn't exist.
return Collections.emptyMap();
}
info("..... main directory .....");
info("Reading file " + file);
parser.parse(file, handler);
bundle = handler.getData();
cldrBundles.put(id, bundle);
String country = getCountryCode(id);
if (country != null) {
bundle = handlerSuppl.getData(country);
if (bundle != null) {
//merge two maps into one map
Map<String, Object> temp = cldrBundles.remove(id);
bundle.putAll(temp);
cldrBundles.put(id, bundle);
}
}
return bundle;
}
private static void convertBundles(List<Bundle> bundles) throws Exception {
// Parse SupplementalData file and store the information in the HashMap
// Calendar information such as firstDay and minDay are stored in
// supplementalData.xml as of CLDR1.4. Individual territory is listed
// with its ISO 3166 country code while default is listed using UNM49
// region and composition numerical code (001 for World.)
SAXParserFactory factorySuppl = SAXParserFactory.newInstance();
factorySuppl.setValidating(true);
SAXParser parserSuppl = factorySuppl.newSAXParser();
handlerSuppl = new SupplementDataParseHandler();
File fileSupply = new File(SPPL_SOURCE_FILE);
parserSuppl.parse(fileSupply, handlerSuppl);
// Parse numberingSystems to get digit zero character information.
SAXParserFactory numberingParser = SAXParserFactory.newInstance();
numberingParser.setValidating(true);
SAXParser parserNumbering = numberingParser.newSAXParser();
handlerNumbering = new NumberingSystemsParseHandler();
File fileNumbering = new File(NUMBERING_SOURCE_FILE);
parserNumbering.parse(fileNumbering, handlerNumbering);
// Parse metaZones to create mappings between Olson tzids and CLDR meta zone names
SAXParserFactory metazonesParser = SAXParserFactory.newInstance();
metazonesParser.setValidating(true);
SAXParser parserMetaZones = metazonesParser.newSAXParser();
handlerMetaZones = new MetaZonesParseHandler();
File fileMetaZones = new File(METAZONES_SOURCE_FILE);
parserNumbering.parse(fileMetaZones, handlerMetaZones);
// For generating information on supported locales.
Map<String, SortedSet<String>> metaInfo = new HashMap<>();
metaInfo.put("LocaleNames", new TreeSet<String>());
metaInfo.put("CurrencyNames", new TreeSet<String>());
metaInfo.put("CalendarData", new TreeSet<String>());
metaInfo.put("FormatData", new TreeSet<String>());
for (Bundle bundle : bundles) {
// Get the target map, which contains all the data that should be
// visible for the bundle's locale
Map<String, Object> targetMap = bundle.getTargetMap();
EnumSet<Bundle.Type> bundleTypes = bundle.getBundleTypes();
// Fill in any missing resources in the base bundle from en and en-US data.
// This is because CLDR root.xml is supposed to be language neutral and doesn't
// provide some resource data. Currently, the runtime assumes that there are all
// resources though the parent resource bundle chain.
if (bundle.isRoot()) {
Map<String, Object> enData = new HashMap<>();
// Create a superset of en-US and en bundles data in order to
// fill in any missing resources in the base bundle.
enData.putAll(Bundle.getBundle("en").getTargetMap());
enData.putAll(Bundle.getBundle("en_US").getTargetMap());
for (String key : enData.keySet()) {
if (!targetMap.containsKey(key)) {
targetMap.put(key, enData.get(key));
}
}
// Add DateTimePatternChars because CLDR no longer supports localized patterns.
targetMap.put("DateTimePatternChars", "GyMdkHmsSEDFwWahKzZ");
}
// Now the map contains just the entries that need to be in the resources bundles.
// Go ahead and generate them.
if (bundleTypes.contains(Bundle.Type.LOCALENAMES)) {
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, true);
}
}
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, true);
}
}
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
}
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, false);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
Map<String, Object> formatDataMap = extractFormatData(targetMap, bundle.getID());
// LocaleData.getAvailableLocales depends on having FormatData bundles around
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, false);
}
}
// For testing
SortedSet<String> allLocales = new TreeSet<>();
allLocales.addAll(metaInfo.get("CurrencyNames"));
allLocales.addAll(metaInfo.get("LocaleNames"));
allLocales.addAll(metaInfo.get("CalendarData"));
allLocales.addAll(metaInfo.get("FormatData"));
metaInfo.put("All", allLocales);
}
bundleGenerator.generateMetaInfo(metaInfo);
}
/*
* Returns the language portion of the given id.
* If id is "root", "" is returned.
*/
static String getLanguageCode(String id) {
int index = id.indexOf('_');
String lang = null;
if (index != -1) {
lang = id.substring(0, index);
} else {
lang = "root".equals(id) ? "" : id;
}
return lang;
}
/**
* Examine if the id includes the country (territory) code. If it does, it returns
* the country code.
* Otherwise, it returns null. eg. when the id is "zh_Hans_SG", it return "SG".
*/
private static String getCountryCode(String id) {
//Truncate a variant code with '@' if there is any
//(eg. de_DE@collation=phonebook,currency=DOM)
if (id.indexOf('@') != -1) {
id = id.substring(0, id.indexOf('@'));
}
String[] tokens = id.split("_");
for (int index = 1; index < tokens.length; ++index) {
if (tokens[index].length() == 2
&& Character.isLetter(tokens[index].charAt(0))
&& Character.isLetter(tokens[index].charAt(1))) {
return tokens[index];
}
}
return null;
}
private static class KeyComparator implements Comparator<String> {
static KeyComparator INSTANCE = new KeyComparator();
private KeyComparator() {
}
public int compare(String o1, String o2) {
int len1 = o1.length();
int len2 = o2.length();
if (!isDigit(o1.charAt(0)) && !isDigit(o2.charAt(0))) {
// Shorter string comes first unless either starts with a digit.
if (len1 < len2) {
return -1;
}
if (len1 > len2) {
return 1;
}
}
return o1.compareTo(o2);
}
private boolean isDigit(char c) {
return c >= '0' && c <= '9';
}
}
private static Map<String, Object> extractLocaleNames(Map<String, Object> map, String id) {
Map<String, Object> localeNames = new TreeMap<>(KeyComparator.INSTANCE);
for (String key : map.keySet()) {
if (key.startsWith(LOCALE_NAME_PREFIX)) {
localeNames.put(key.substring(LOCALE_NAME_PREFIX.length()), map.get(key));
}
}
return localeNames;
}
@SuppressWarnings("AssignmentToForLoopParameter")
private static Map<String, Object> extractCurrencyNames(Map<String, Object> map, String id, String names)
throws Exception {
Map<String, Object> currencyNames = new TreeMap<>(KeyComparator.INSTANCE);
for (String key : map.keySet()) {
if (key.startsWith(CURRENCY_NAME_PREFIX)) {
currencyNames.put(key.substring(CURRENCY_NAME_PREFIX.length()), map.get(key));
} else if (key.startsWith(CURRENCY_SYMBOL_PREFIX)) {
currencyNames.put(key.substring(CURRENCY_SYMBOL_PREFIX.length()), map.get(key));
}
}
return currencyNames;
}
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
return null;
}
private static Map<String, Object> extractCalendarData(Map<String, Object> map, String id) {
Map<String, Object> calendarData = new LinkedHashMap<>();
copyIfPresent(map, "firstDayOfWeek", calendarData);
copyIfPresent(map, "minimalDaysInFirstWeek", calendarData);
return calendarData;
}
private static Map<String, Object> extractFormatData(Map<String, Object> map, String id) {
Map<String, Object> formatData = new LinkedHashMap<>();
for (CalendarType calendarType : CalendarType.values()) {
String prefix = calendarType.keyElementName();
copyIfPresent(map, prefix + "MonthNames", formatData); // default FORMAT since JDK8
copyIfPresent(map, prefix + "standalone.MonthNames", formatData);
copyIfPresent(map, prefix + "MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "DayNames", formatData);
copyIfPresent(map, prefix + "DayAbbreviations", formatData);
copyIfPresent(map, prefix + "AmPmMarkers", formatData);
copyIfPresent(map, prefix + "Eras", formatData);
copyIfPresent(map, prefix + "short.Eras", formatData);
copyIfPresent(map, prefix + "TimePatterns", formatData);
copyIfPresent(map, prefix + "DatePatterns", formatData);
copyIfPresent(map, prefix + "DateTimePatterns", formatData);
copyIfPresent(map, prefix + "DateTimePatternChars", formatData);
}
copyIfPresent(map, "DefaultNumberingSystem", formatData);
String defaultScript = (String) map.get("DefaultNumberingSystem");
@SuppressWarnings("unchecked")
List<String> numberingScripts = (List<String>) map.remove("numberingScripts");
if (numberingScripts != null) {
for (String script : numberingScripts) {
copyIfPresent(map, script + "." + "NumberElements", formatData);
}
} else {
copyIfPresent(map, "NumberElements", formatData);
}
copyIfPresent(map, "NumberPatterns", formatData);
return formatData;
}
private static void copyIfPresent(Map<String, Object> src, String key, Map<String, Object> dest) {
Object value = src.get(key);
if (value != null) {
dest.put(key, value);
}
}
// --- code below here is adapted from java.util.Properties ---
private static final String specialSaveCharsJava = "\"";
private static final String specialSaveCharsProperties = "=: \t\r\n\f#!";
/*
* Converts unicodes to encoded &#92;uxxxx
* and writes out any of the characters in specialSaveChars
* with a preceding slash
*/
static String saveConvert(String theString, boolean useJava) {
if (theString == null) {
return "";
}
String specialSaveChars;
if (useJava) {
specialSaveChars = specialSaveCharsJava;
} else {
specialSaveChars = specialSaveCharsProperties;
}
boolean escapeSpace = false;
int len = theString.length();
StringBuilder outBuffer = new StringBuilder(len * 2);
Formatter formatter = new Formatter(outBuffer, Locale.ROOT);
for (int x = 0; x < len; x++) {
char aChar = theString.charAt(x);
switch (aChar) {
case ' ':
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
case '\\':
outBuffer.append('\\');
outBuffer.append('\\');
break;
case '\t':
outBuffer.append('\\');
outBuffer.append('t');
break;
case '\n':
outBuffer.append('\\');
outBuffer.append('n');
break;
case '\r':
outBuffer.append('\\');
outBuffer.append('r');
break;
case '\f':
outBuffer.append('\\');
outBuffer.append('f');
break;
default:
if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) {
formatter.format("\\u%04x", (int)aChar);
} else {
if (specialSaveChars.indexOf(aChar) != -1) {
outBuffer.append('\\');
}
outBuffer.append(aChar);
}
}
}
return outBuffer.toString();
}
private static String toLanguageTag(String locName) {
if (locName.indexOf('_') == -1) {
return locName;
}
String tag = locName.replaceAll("_", "-");
Locale loc = Locale.forLanguageTag(tag);
return loc.toLanguageTag();
}
private static String toLocaleName(String tag) {
if (tag.indexOf('-') == -1) {
return tag;
}
return tag.replaceAll("-", "_");
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.util.Locale;
/**
* Constants for the Calendars supported by JRE.
*/
enum CalendarType {
GREGORIAN, BUDDHIST, JAPANESE;
private static final int[][] ERA_DATA = {
// start index, array length
{0, 2}, // gregorian
{0, 1}, // buddhist
{232, 4}, // japanese (eras from Meiji)
};
private final String lname; // lowercase name
private CalendarType() {
lname = name().toLowerCase(Locale.ROOT);
}
String lname() {
return lname;
}
String keyElementName() {
return (this == GREGORIAN) ? "" : lname + ".";
}
int normalizeEraIndex(int index) {
index -= ERA_DATA[ordinal()][0];
if (index >= ERA_DATA[ordinal()][1]) {
index = -1;
}
return index;
}
int getEraLength(String name) {
return ERA_DATA[ordinal()][1];
}
static CalendarType forName(String name) {
for (CalendarType type : values()) {
if (type.lname.equals(name)) {
return type;
}
}
return null;
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
class Container {
private final String qName;
private final Container parent;
Container(String qName, Container parent) {
this.qName = qName;
this.parent = parent;
}
void addCharacters(char[] characters, int start, int length) {
if (getParent() != null) {
getParent().addCharacters(characters, start, length);
}
}
Container getParent() {
return parent;
}
/**
* @return the qName
*/
String getqName() {
return qName;
}
}

View file

@ -0,0 +1,156 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
class CopyrightHeaders {
private static final String ORACLE2012 =
"/*\n" +
" * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" +
" */\n";
private static final String ORACLE_AFTER2012 =
"/*\n" +
" * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" +
" */\n";
private static final String UNICODE =
"/*\n" +
" * COPYRIGHT AND PERMISSION NOTICE\n" +
" *\n" +
" * Copyright (C) 1991-2012 Unicode, Inc. All rights reserved. Distributed under\n" +
" * the Terms of Use in http://www.unicode.org/copyright.html.\n" +
" *\n" +
" * Permission is hereby granted, free of charge, to any person obtaining a copy\n" +
" * of the Unicode data files and any associated documentation (the \"Data\n" +
" * Files\") or Unicode software and any associated documentation (the\n" +
" * \"Software\") to deal in the Data Files or Software without restriction,\n" +
" * including without limitation the rights to use, copy, modify, merge,\n" +
" * publish, distribute, and/or sell copies of the Data Files or Software, and\n" +
" * to permit persons to whom the Data Files or Software are furnished to do so,\n" +
" * provided that (a) the above copyright notice(s) and this permission notice\n" +
" * appear with all copies of the Data Files or Software, (b) both the above\n" +
" * copyright notice(s) and this permission notice appear in associated\n" +
" * documentation, and (c) there is clear notice in each modified Data File or\n" +
" * in the Software as well as in the documentation associated with the Data\n" +
" * File(s) or Software that the data or software has been modified.\n" +
" *\n" +
" * THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n" +
" * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +
" * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" +
" * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS\n" +
" * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR\n" +
" * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\n" +
" * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n" +
" * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" +
" * OF THE DATA FILES OR SOFTWARE.\n" +
" *\n" +
" * Except as contained in this notice, the name of a copyright holder shall not\n" +
" * be used in advertising or otherwise to promote the sale, use or other\n" +
" * dealings in these Data Files or Software without prior written authorization\n" +
" * of the copyright holder.\n" +
" */\n";
private static String OPENJDK2012 =
"/*\n" +
" * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" +
" * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
" *\n" +
" * This code is free software; you can redistribute it and/or modify it\n" +
" * under the terms of the GNU General Public License version 2 only, as\n" +
" * published by the Free Software Foundation. Oracle designates this\n" +
" * particular file as subject to the \"Classpath\" exception as provided\n" +
" * by Oracle in the LICENSE file that accompanied this code.\n" +
" *\n" +
" * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
" * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
" * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" +
" * version 2 for more details (a copy is included in the LICENSE file that\n" +
" * accompanied this code).\n" +
" *\n" +
" * You should have received a copy of the GNU General Public License version\n" +
" * 2 along with this work; if not, write to the Free Software Foundation,\n" +
" * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
" *\n" +
" * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
" * or visit www.oracle.com if you need additional information or have any\n" +
" * questions.\n" +
" */\n";
private static String OPENJDK_AFTER2012 =
"/*\n" +
" * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" +
" * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" +
" *\n" +
" * This code is free software; you can redistribute it and/or modify it\n" +
" * under the terms of the GNU General Public License version 2 only, as\n" +
" * published by the Free Software Foundation. Oracle designates this\n" +
" * particular file as subject to the \"Classpath\" exception as provided\n" +
" * by Oracle in the LICENSE file that accompanied this code.\n" +
" *\n" +
" * This code is distributed in the hope that it will be useful, but WITHOUT\n" +
" * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" +
" * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" +
" * version 2 for more details (a copy is included in the LICENSE file that\n" +
" * accompanied this code).\n" +
" *\n" +
" * You should have received a copy of the GNU General Public License version\n" +
" * 2 along with this work; if not, write to the Free Software Foundation,\n" +
" * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" +
" *\n" +
" * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" +
" * or visit www.oracle.com if you need additional information or have any\n" +
" * questions.\n" +
" */\n";
static String getOracleCopyright() {
int year = getYear();
return String.format(year > 2012 ? ORACLE_AFTER2012 : ORACLE2012, year);
}
static String getUnicodeCopyright() {
return UNICODE;
}
static String getOpenJDKCopyright() {
int year = getYear();
return String.format(year > 2012 ? OPENJDK_AFTER2012 : OPENJDK2012, year);
}
private static int getYear() {
return new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"),
Locale.US).get(Calendar.YEAR);
}
// no instantiation
private CopyrightHeaders() {
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
abstract class Entry<T> extends Container {
private String key;
Entry(String qName, Container parent, String key) {
super(qName, parent);
this.key = key;
}
String getKey() {
return key;
}
abstract T getValue();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -23,13 +23,17 @@
* questions.
*/
package sun.util;
package build.tools.cldrconverter;
import java.util.ListResourceBundle;
class IgnoredContainer extends Container {
IgnoredContainer(String qName, Container parent) {
super(qName, parent);
}
public class EmptyListResourceBundle extends ListResourceBundle {
@Override
protected final Object[][] getContents() {
return new Object[][] {};
void addCharacters(char[] characters, int start, int length) {
// ignore
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -23,21 +23,22 @@
* questions.
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by IBM. These materials are provided under
* terms of a License Agreement between IBM and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to IBM may not be removed.
*
package build.tools.cldrconverter;
/**
* A container that provides a key for contained elements.
* This container does not provide a value.
*/
class KeyContainer extends Container {
private String key;
KeyContainer(String qName, Container parent, String key) {
super(qName, parent);
this.key = key;
}
String getKey() {
return key;
}
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_fr_LU extends EmptyListResourceBundle {
}

View file

@ -0,0 +1,553 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language and produces a map
* that uses the keys and values of JRE locale data.
*/
class LDMLParseHandler extends AbstractLDMLHandler<Object> {
private String defaultNumberingSystem;
private String currentNumberingSystem = "";
private CalendarType currentCalendarType;
private String zoneNameStyle; // "long" or "short" for time zone names
private String zonePrefix;
private final String id;
LDMLParseHandler(String id) {
this.id = id;
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
//
// Generic information
//
case "identity":
// ignore this element - it has language and territory elements that aren't locale data
pushIgnoredContainer(qName);
break;
case "language":
// for LocaleNames
// copy string
pushStringEntry(qName, attributes, CLDRConverter.LOCALE_NAME_PREFIX + attributes.getValue("type"));
break;
case "script":
// for LocaleNames
// copy string
pushStringEntry(qName, attributes, CLDRConverter.LOCALE_NAME_PREFIX + attributes.getValue("type"));
break;
case "territory":
// for LocaleNames
// copy string
pushStringEntry(qName, attributes, CLDRConverter.LOCALE_NAME_PREFIX + attributes.getValue("type"));
break;
//
// Currency information
//
case "currency":
// for CurrencyNames
// stash away "type" value for nested <symbol>
pushKeyContainer(qName, attributes, attributes.getValue("type"));
break;
case "symbol":
// for CurrencyNames
// need to get the key from the containing <currency> element
pushStringEntry(qName, attributes, CLDRConverter.CURRENCY_SYMBOL_PREFIX + getContainerKey());
break;
case "displayName":
// for CurrencyNames
// need to get the key from the containing <currency> element
// ignore if is has "count" attribute
String containerKey = getContainerKey();
if (containerKey != null && attributes.getValue("count") == null) {
pushStringEntry(qName, attributes,
CLDRConverter.CURRENCY_NAME_PREFIX + containerKey.toLowerCase(Locale.ROOT),
attributes.getValue("type"));
} else {
pushIgnoredContainer(qName);
}
break;
//
// Calendar information
//
case "calendar":
{
// mostly for FormatData (CalendarData items firstDay and minDays are also nested)
// use only if it's supported by java.util.Calendar.
String calendarName = attributes.getValue("type");
currentCalendarType = CalendarType.forName(calendarName);
if (currentCalendarType != null) {
pushContainer(qName, attributes);
} else {
pushIgnoredContainer(qName);
}
}
break;
case "monthContext":
{
// for FormatData
// need to keep stand-alone and format, to allow for inheritance in CLDR
String type = attributes.getValue("type");
if ("stand-alone".equals(type) || "format".equals(type)) {
pushKeyContainer(qName, attributes, type);
} else {
pushIgnoredContainer(qName);
}
}
break;
case "monthWidth":
{
// for FormatData
// create string array for the two types that the JRE knows
// keep info about the context type so we can sort out inheritance later
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
switch (attributes.getValue("type")) {
case "wide":
pushStringArrayEntry(qName, attributes, prefix + "MonthNames/" + getContainerKey(), 13);
break;
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
break;
default:
pushIgnoredContainer(qName);
break;
}
}
break;
case "month":
// for FormatData
// add to string array entry of monthWidth element
pushStringArrayElement(qName, attributes, Integer.parseInt(attributes.getValue("type")) - 1);
break;
case "dayContext":
{
// for FormatData
// need to keep stand-alone and format, to allow for multiple inheritance in CLDR
String type = attributes.getValue("type");
if ("stand-alone".equals(type) || "format".equals(type)) {
pushKeyContainer(qName, attributes, type);
} else {
pushIgnoredContainer(qName);
}
}
break;
case "dayWidth":
{
// for FormatData
// create string array for the two types that the JRE knows
// keep info about the context type so we can sort out inheritance later
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
switch (attributes.getValue("type")) {
case "wide":
pushStringArrayEntry(qName, attributes, prefix + "DayNames/" + getContainerKey(), 7);
break;
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
break;
default:
pushIgnoredContainer(qName);
break;
}
}
break;
case "day":
// for FormatData
// add to string array entry of monthWidth element
pushStringArrayElement(qName, attributes, Integer.parseInt(DAY_OF_WEEK_MAP.get(attributes.getValue("type"))) - 1);
break;
case "dayPeriodContext":
// for FormatData
// need to keep stand-alone and format, to allow for multiple inheritance in CLDR
// for FormatData
// need to keep stand-alone and format, to allow for multiple inheritance in CLDR
{
String type = attributes.getValue("type");
if ("stand-alone".equals(type) || "format".equals(type)) {
pushKeyContainer(qName, attributes, type);
} else {
pushIgnoredContainer(qName);
}
}
break;
case "dayPeriodWidth":
// for FormatData
// create string array entry for am/pm. only keeping wide
if ("wide".equals(attributes.getValue("type"))) {
pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
} else {
pushIgnoredContainer(qName);
}
break;
case "dayPeriod":
// for FormatData
// add to string array entry of AmPmMarkers element
switch (attributes.getValue("type")) {
case "am":
pushStringArrayElement(qName, attributes, 0);
break;
case "pm":
pushStringArrayElement(qName, attributes, 1);
break;
default:
pushIgnoredContainer(qName);
break;
}
break;
case "eraNames":
// CLDR era names are inconsistent in terms of their lengths. For example,
// the full names of Japanese imperial eras are eraAbbr, while the full names
// of the Julian eras are eraNames.
if (currentCalendarType == null) {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
String key = currentCalendarType.keyElementName() + "long.Eras"; // for now
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
}
break;
case "eraAbbr":
// for FormatData
// create string array entry
if (currentCalendarType == null) {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
String key = currentCalendarType.keyElementName() + "Eras";
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
}
break;
case "eraNarrow":
// mainly used for the Japanese imperial calendar
if (currentCalendarType == null) {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
String key = currentCalendarType.keyElementName() + "short.Eras";
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
}
break;
case "era":
// for FormatData
// add to string array entry of eraAbbr element
if (currentCalendarType == null) {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
int index = Integer.parseInt(attributes.getValue("type"));
index = currentCalendarType.normalizeEraIndex(index);
if (index >= 0) {
pushStringArrayElement(qName, attributes, index);
} else {
pushIgnoredContainer(qName);
}
if (currentContainer.getParent() == null) {
throw new InternalError("currentContainer: null parent");
}
}
break;
//
// Time zone names
//
case "timeZoneNames":
pushContainer(qName, attributes);
break;
case "zone":
{
String zone = attributes.getValue("type");
zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
}
break;
case "metazone":
{
String zone = attributes.getValue("type");
zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
}
break;
case "long":
zoneNameStyle = "long";
pushContainer(qName, attributes);
break;
case "short":
zoneNameStyle = "short";
pushContainer(qName, attributes);
break;
case "generic": // not used in JDK
pushIgnoredContainer(qName);
break;
case "standard": // standard time
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle);
break;
case "daylight":
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle);
break;
case "exemplarCity":
pushIgnoredContainer(qName);
break;
//
// Number format information
//
case "decimalFormatLength":
if (attributes.getValue("type") == null) {
// skipping type="short" data
// for FormatData
// copy string for later assembly into NumberPatterns
pushStringEntry(qName, attributes, "NumberPatterns/decimal");
} else {
pushIgnoredContainer(qName);
}
break;
case "currencyFormat":
// for FormatData
// copy string for later assembly into NumberPatterns
pushStringEntry(qName, attributes, "NumberPatterns/currency");
break;
case "percentFormat":
// for FormatData
// copy string for later assembly into NumberPatterns
pushStringEntry(qName, attributes, "NumberPatterns/percent");
break;
case "defaultNumberingSystem":
// default numbering system if multiple numbering systems are used.
pushStringEntry(qName, attributes, "DefaultNumberingSystem");
break;
case "symbols":
// for FormatData
// look up numberingSystems
symbols: {
String script = attributes.getValue("numberSystem");
if (script == null) {
// Has no script. Just ignore.
pushIgnoredContainer(qName);
break;
}
// Use keys as <script>."NumberElements/<symbol>"
currentNumberingSystem = script + ".";
String digits = CLDRConverter.handlerNumbering.get(script);
if (digits == null) {
throw new InternalError("null digits for " + script);
}
if (Character.isSurrogate(digits.charAt(0))) {
// DecimalFormatSymbols doesn't support supplementary characters as digit zero.
pushIgnoredContainer(qName);
break;
}
// in case digits are in the reversed order, reverse back the order.
if (digits.charAt(0) > digits.charAt(digits.length() - 1)) {
StringBuilder sb = new StringBuilder(digits);
digits = sb.reverse().toString();
}
// Check if the order is sequential.
char c0 = digits.charAt(0);
for (int i = 1; i < digits.length(); i++) {
if (digits.charAt(i) != c0 + i) {
pushIgnoredContainer(qName);
break symbols;
}
}
@SuppressWarnings("unchecked")
List<String> numberingScripts = (List<String>) get("numberingScripts");
if (numberingScripts == null) {
numberingScripts = new ArrayList<>();
put("numberingScripts", numberingScripts);
}
numberingScripts.add(script);
put(currentNumberingSystem + "NumberElements/zero", digits.substring(0, 1));
pushContainer(qName, attributes);
}
break;
case "decimal":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/decimal");
break;
case "group":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/group");
break;
case "list":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/list");
break;
case "percentSign":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/percent");
break;
case "nativeZeroDigit":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/zero");
break;
case "patternDigit":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/pattern");
break;
case "plusSign":
// TODO: DecimalFormatSymbols doesn't support plusSign
pushIgnoredContainer(qName);
break;
case "minusSign":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/minus");
break;
case "exponential":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/exponential");
break;
case "perMille":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/permille");
break;
case "infinity":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/infinity");
break;
case "nan":
// for FormatData
// copy string for later assembly into NumberElements
pushStringEntry(qName, attributes, currentNumberingSystem + "NumberElements/nan");
break;
case "timeFormatLength":
{
// for FormatData
// copy string for later assembly into DateTimePatterns
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
pushStringEntry(qName, attributes, prefix + "DateTimePatterns/" + attributes.getValue("type") + "-time");
}
break;
case "dateFormatLength":
{
// for FormatData
// copy string for later assembly into DateTimePatterns
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
pushStringEntry(qName, attributes, prefix + "DateTimePatterns/" + attributes.getValue("type") + "-date");
}
break;
case "dateTimeFormat":
{
// for FormatData
// copy string for later assembly into DateTimePatterns
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
pushStringEntry(qName, attributes, prefix + "DateTimePatterns/date-time");
}
break;
case "localizedPatternChars":
{
// for FormatData
// copy string for later adaptation to JRE use
String prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
pushStringEntry(qName, attributes, prefix + "DateTimePatternChars");
}
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
switch (qName) {
case "calendar":
assert !(currentContainer instanceof Entry);
currentCalendarType = null;
break;
case "defaultNumberingSystem":
if (currentContainer instanceof StringEntry) {
defaultNumberingSystem = ((StringEntry) currentContainer).getValue();
assert defaultNumberingSystem != null;
put(((StringEntry) currentContainer).getKey(), defaultNumberingSystem);
} else {
defaultNumberingSystem = null;
}
break;
case "timeZoneNames":
zonePrefix = null;
break;
case "standard":
case "daylight":
if (zonePrefix != null && (currentContainer instanceof Entry)) {
@SuppressWarnings("unchecked")
Map<String, String> valmap = (Map<String, String>) get(zonePrefix + getContainerKey());
Entry<?> entry = (Entry<?>) currentContainer;
valmap.put(entry.getKey(), (String) entry.getValue());
}
break;
default:
if (currentContainer instanceof Entry) {
Entry<?> entry = (Entry<?>) currentContainer;
Object value = entry.getValue();
if (value != null) {
put(entry.getKey(), value);
}
}
}
currentContainer = currentContainer.getParent();
}
}

View file

@ -0,0 +1,91 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
private String tzid, metazone;
MetaZonesParseHandler() {
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
@SuppressWarnings("fallthrough")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "timezone":
tzid = attributes.getValue("type");
pushContainer(qName, attributes);
break;
case "usesMetazone":
// Ignore any historical zone names (for now)
if (attributes.getValue("to") == null) {
metazone = attributes.getValue("mzone");
}
pushIgnoredContainer(qName);
break;
case "version":
case "generation":
pushIgnoredContainer(qName);
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
switch (qName) {
case "timezone":
if (tzid == null || metazone == null) {
throw new InternalError();
}
put(tzid, metazone);
break;
}
currentContainer = currentContainer.getParent();
}
}

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language for numberingSystems.xml
* and produces a map that uses the keys and values of JRE locale data.
*/
class NumberingSystemsParseHandler extends AbstractLDMLHandler<String> {
NumberingSystemsParseHandler() {
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "numberingSystem":
if ("numeric".equals(attributes.getValue("type"))) {
// eg, <numberingSystem id="latn" type="numeric" digits="0123456789"/>
put(attributes.getValue("id"), attributes.getValue("digits"));
}
pushIgnoredContainer(qName);
break;
case "version":
case "generation":
pushIgnoredContainer(qName);
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
currentContainer = currentContainer.getParent();
}
}

View file

@ -0,0 +1,160 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.SortedSet;
class ResourceBundleGenerator implements BundleGenerator {
@Override
public void generateBundle(String packageName, String baseName, String localeID, boolean useJava,
Map<String, ?> map, boolean open) throws IOException {
String suffix = useJava ? ".java" : ".properties";
String lang = CLDRConverter.getLanguageCode(localeID);
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator
+ packageName + File.separator + "resources" + File.separator + "cldr";
if (lang.length() > 0) {
dirName = dirName + File.separator + lang;
packageName = packageName + ".resources.cldr." + lang;
} else {
packageName = packageName + ".resources.cldr";
}
File dir = new File(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, baseName + ("root".equals(localeID) ? "" : "_" + localeID) + suffix);
if (!file.exists()) {
file.createNewFile();
}
CLDRConverter.info("\tWriting file " + file);
String encoding;
if (useJava) {
if (CLDRConverter.USE_UTF8) {
encoding = "utf-8";
} else {
encoding = "us-ascii";
}
} else {
encoding = "iso-8859-1";
}
try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright());
out.println(CopyrightHeaders.getUnicodeCopyright());
if (useJava) {
out.println("package sun." + packageName + ";\n");
if (open) {
out.println("import sun.util.resources.OpenListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {");
} else {
out.println("import java.util.ListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {");
}
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
}
for (String key : map.keySet()) {
if (useJava) {
Object value = map.get(key);
if (value == null) {
CLDRConverter.warning("null value for " + key);
} else if (value instanceof String) {
out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },");
} else if (value instanceof String[]) {
String[] values = (String[]) value;
out.println(" { \"" + key + "\",\n new String[] {");
for (String s : values) {
out.println(" \"" + CLDRConverter.saveConvert(s, useJava) + "\",");
}
out.println(" }\n },");
} else {
throw new RuntimeException("unknown value type: " + value.getClass().getName());
}
} else {
out.println(key + "=" + CLDRConverter.saveConvert((String) map.get(key), useJava));
}
}
if (useJava) {
out.println(" };\n return data;\n }\n}");
}
}
}
private static final String METAINFO_CLASS = "CLDRLocaleDataMetaInfo";
@Override
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException {
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator + "util" + File.separator
+ "cldr" + File.separator;
File dir = new File(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, METAINFO_CLASS + ".java");
if (!file.exists()) {
file.createNewFile();
}
CLDRConverter.info("Generating file " + file);
try (PrintWriter out = new PrintWriter(file, "us-ascii")) {
out.println(CopyrightHeaders.getOpenJDKCopyright());
out.println("package sun.util.cldr;\n\n"
+ "import java.util.ListResourceBundle;\n");
out.printf("public class %s extends ListResourceBundle {\n", METAINFO_CLASS);
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
for (String key : metaInfo.keySet()) {
out.printf(" { \"%s\",\n", key);
out.printf(" \"%s\" },\n", toLocaleList(metaInfo.get(key)));
}
out.println(" };\n return data;\n }\n}");
}
}
private static String toLocaleList(SortedSet<String> set) {
StringBuilder sb = new StringBuilder(set.size() * 6);
for (String id : set) {
if (!"root".equals(id)) {
if (sb.length() > 0) {
sb.append(' ');
}
sb.append(id);
}
}
return sb.toString();
}
}

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
class StringArrayElement extends Container {
StringArrayEntry array;
int index;
StringArrayElement(String qName, Container parent, int index) {
super(qName, parent);
while (!(parent instanceof StringArrayEntry)) {
parent = parent.getParent();
}
array = (StringArrayEntry) parent;
this.index = index;
}
@Override
void addCharacters(char[] characters, int start, int length) {
array.addCharacters(index, characters, start, length);
}
}

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
class StringArrayEntry extends Entry<String[]> {
private String[] value;
StringArrayEntry(String qName, Container parent, String key, int length) {
super(qName, parent, key);
value = new String[length];
}
void addCharacters(int index, char[] characters, int start, int length) {
if (value[index] != null) {
StringBuilder sb = new StringBuilder(value[index]);
sb.append(characters, start, length);
value[index] = sb.toString();
} else {
value[index] = new String(characters, start, length);
}
}
@Override
String[] getValue() {
// This method patches up a few oddities:
// - Since am/pm strings are nested directly under the calendar element,
// am/pm arrays may be created for which there was no real data.
// This test avoids returning empty arrays.
// - On the other hand, for month names it's OK to not have month 13,
// but this should be indicated by an empty string for compatibility
// with JRE resource bundles.
// - Finally, CLDR doesn't really have string arrays; each string is
// supposed to be inherited separately. Although value is the partially filled array,
// we will return it so that it can be reconstructed later in the method,
// ConvertLocaleData.convertBundles()
// The CLDR's iheritance system is different from JRE's. CLDR can inherit
// by the element level in the array.
if (getKey().startsWith("Month") && value[0] != null && value[12] == null) {
value[12] = "";
}
for (String element : value) {
if (element != null) {
return value;
}
}
return null;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -23,26 +23,32 @@
* questions.
*/
/*
*/
package build.tools.cldrconverter;
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
class StringEntry extends Entry<String> {
private String value;
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_DZ extends EmptyListResourceBundle {
StringEntry(String qName, Container parent, String key) {
super(qName, parent, key);
}
StringEntry(String qName, Container parent, String key, String value) {
super(qName, parent, key);
this.value = value;
}
@Override
void addCharacters(char[] characters, int start, int length) {
String s = new String(characters, start, length);
if (value != null) {
value += s;
} else {
value = s;
}
}
@Override
String getValue() {
return value;
}
}

View file

@ -0,0 +1,154 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language for SupplementData.xml
* and produces a map that uses the keys and values of JRE locale data.
*/
class SupplementDataParseHandler extends AbstractLDMLHandler<Object> {
//UNM49 region and composition code used in supplementalData.xml
private static final String WORLD = "001";
private static final String JAVA_FIRSTDAY = "firstDayOfWeek";
private static final String JAVA_MINDAY = "minimalDaysInFirstWeek";
// The weekData is now in supplementalData.xml,
// which is not a locale specific file.
// Map for JRE is created locale specific way.
// When parsing the locale neutral file (supplementalData.xml),
// we need to rely on the country code because
// the weekData is listed using country code.
private final Map<String, Object> firstDayMap;
private final Map<String, Object> minDaysMap;
SupplementDataParseHandler() {
firstDayMap = new HashMap<>();
minDaysMap = new HashMap<>();
}
/**
* It returns Map that contains the firstDay and minDays information for
* the country. The Map is created in JRE format after obtaining the data
* from two Maps, firstDayMap and minDaysMap.
*
* It returns null when there is no firstDay and minDays for the country
* although this should not happen because supplementalData.xml includes
* default value for the world ("001") for firstDay and minDays.
*/
Map<String, Object> getData(String country) {
Map<String, Object> values = new HashMap<>();
String countryData = getWeekData(country, JAVA_FIRSTDAY, firstDayMap);
if (countryData != null) {
values.put(JAVA_FIRSTDAY, countryData);
}
String minDaysData = getWeekData(country, JAVA_MINDAY, minDaysMap);
if (minDaysData != null) {
values.put(JAVA_MINDAY, minDaysData);
}
return values.isEmpty() ? null : values;
}
/**
* It returns either firstDay or minDays in the JRE format for the country.
*
* @param country territory code of the requested data
* @param jreDataName JAVA_FIRSTDAY or JAVA_MINDAY
* @param dataMap firstDayMap or minDaysMap
* @return the value for the given jreDataName, or null if requested value
* (firstDay/minDays) is not available although that is highly unlikely
* because of the default value for the world (001).
*/
String getWeekData(String country, final String jreDataName, final Map<String, Object> dataMap) {
String countryValue = null;
String defaultWorldValue = null;
for (String key : dataMap.keySet()) {
if (key.contains(country)) {
if (jreDataName.equals(JAVA_FIRSTDAY)) {
countryValue = DAY_OF_WEEK_MAP.get((String) dataMap.get(key));
} else if (jreDataName.equals(JAVA_MINDAY)) {
countryValue = (String) dataMap.get(key);
}
if (countryValue != null) {
return countryValue;
}
} else if (key.contains(WORLD)) {
if (jreDataName.equals(JAVA_FIRSTDAY)) {
defaultWorldValue = DAY_OF_WEEK_MAP.get((String) dataMap.get(key));
} else if (jreDataName.equals(JAVA_MINDAY)) {
defaultWorldValue = (String) dataMap.get(key);
}
}
}
return defaultWorldValue;
}
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
/**
* JRE requires all the data to be organized by the locale while CLDR 1.4 list
* Calendar related data (weekData)in SupplementalData.xml.
* startElement stores JRE required data into two Maps,
* firstDayMap and minDaysMap.
*/
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// elements we need to actively ignore
switch (qName) {
case "firstDay":
if (!isIgnored(attributes)) {
firstDayMap.put(attributes.getValue("territories"), attributes.getValue("day"));
}
break;
case "minDays":
if (!isIgnored(attributes)) {
minDaysMap.put(attributes.getValue("territories"), attributes.getValue("count"));
}
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.generatebreakiteratordata;
import java.util.Arrays;
import java.util.ResourceBundle;
import java.util.List;
import java.util.Locale;
class BreakIteratorRBControl extends ResourceBundle.Control {
static final BreakIteratorRBControl INSTANCE = new BreakIteratorRBControl();
private static final String RESOURCES = ".resources.";
private BreakIteratorRBControl() {
}
@Override
public Locale getFallbackLocale(String baseName, Locale locale) {
// No fallback
return null;
}
@Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
// No parents lookup
return Arrays.asList(locale);
}
/**
* Changes baseName to its per-language package name and
* calls the super class implementation.
*/
@Override
public String toBundleName(String baseName, Locale locale) {
String newBaseName = baseName;
String lang = locale.getLanguage();
if (lang.length() > 0) {
int index = baseName.indexOf(RESOURCES);
if (index > 0) {
index += RESOURCES.length();
newBaseName = baseName.substring(0, index) + lang + "."
+ baseName.substring(index);
}
}
return super.toBundleName(newBaseName, locale);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
@ -79,45 +79,35 @@ public class GenerateBreakIteratorData {
ResourceBundle rules, info;
info = ResourceBundle.getBundle("sun.text.resources.BreakIteratorInfo",
new Locale(language, country, valiant));
new Locale(language, country, valiant),
BreakIteratorRBControl.INSTANCE);
classNames = info.getStringArray("BreakIteratorClasses");
rules = ResourceBundle.getBundle("sun.text.resources.BreakIteratorRules",
new Locale(language, country, valiant));
new Locale(language, country, valiant),
BreakIteratorRBControl.INSTANCE);
/*
* Fallback is not necessary here.... So, cannot use getBundle().
*/
try {
info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
Enumeration<String> keys = info.getKeys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
if (key.equals("CharacterData")) {
generateDataFile(info.getString(key),
if (info.containsKey("CharacterData")) {
generateDataFile(info.getString("CharacterData"),
rules.getString("CharacterBreakRules"),
classNames[0]);
} else if (key.endsWith("WordData")) {
generateDataFile(info.getString(key),
}
if (info.containsKey("WordData")) {
generateDataFile(info.getString("WordData"),
rules.getString("WordBreakRules"),
classNames[1]);
} else if (key.endsWith("LineData")) {
generateDataFile(info.getString(key),
}
if (info.containsKey("LineData")) {
generateDataFile(info.getString("LineData"),
rules.getString("LineBreakRules"),
classNames[2]);
} else if (key.endsWith("SentenceData")) {
generateDataFile(info.getString(key),
}
if (info.containsKey("SentenceData")) {
generateDataFile(info.getString("SentenceData"),
rules.getString("SentenceBreakRules"),
classNames[3]);
}
}
}
catch (Exception e) {
throw new InternalError(e.toString());
}
}
/**
* Generate a data file for break-iterator

View file

@ -74,37 +74,15 @@ JARS+=$(JDK_OUTPUTDIR)/lib/ext/dnsns.jar
##########################################################################################
LOCALEDATA_INCLUDE_PATTERNS := \
sun/text/resources/*_ar* \
sun/text/resources/*_hi* \
sun/text/resources/*_iw* \
sun/text/resources/*_iw* \
sun/text/resources/*_ja* \
sun/text/resources/*_ko* \
sun/text/resources/*_th.* \
sun/text/resources/*_th_* \
sun/text/resources/*_vi* \
sun/text/resources/*_zh* \
sun/text/resources/*Data_th \
sun/text/resources/thai_dict \
sun/util/resources/*_ar* \
sun/util/resources/*_hi* \
sun/util/resources/*_iw* \
sun/util/resources/*_iw* \
sun/util/resources/*_ja* \
sun/util/resources/*_ko* \
sun/util/resources/*_th_* \
sun/util/resources/*_th.* \
sun/util/resources/*_vi* \
sun/util/resources/*_zh*
LOCALEDATA_INCLUDES := $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
$(foreach i,$(LOCALEDATA_INCLUDE_PATTERNS), $(wildcard $(JDK_OUTPUTDIR)/classes/$i)))
LOCALEDATA_INCLUDE_LOCALES := ar hi iw ja ko th vi zh
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \
$(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES))
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class _dict _th,\
INCLUDES:=$(LOCALEDATA_INCLUDES),\
EXCLUDES:=sun/text/resources/th/BreakIteratorRules_th.class,\
JAR:=$(JDK_OUTPUTDIR)/lib/ext/localedata.jar,\
SKIP_METAINF:=true))
@ -244,7 +222,10 @@ RT_JAR_EXCLUDES := \
javax/swing/SwingBeanInfoBase.class \
javax/swing/text/JTextComponentBeanInfo.class \
sun/swing/BeanInfoUtils.class \
$(LOCALEDATA_INCLUDES)
$(LOCALEDATA_INCLUDES) \
sun/text/resources/cldr \
sun/util/resources/cldr \
sun/util/cldr/CLDRLocaleDataMetaInfo.class
# These files should never be put into rt.jar
# but due to a misstake...some are put there if embedded
@ -634,6 +615,26 @@ endif
##########################################################################################
# Get the CLDRVERSION
include GensrcCLDR.gmk
CLDRDATA_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/cldrdata.jar
$(eval $(call SetupArchive,BUILD_CLDRDATA_JAR,$(CLDRDATA_DEPS),\
SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class,\
INCLUDES:=sun/text/resources/cldr \
sun/util/cldr \
sun/util/resources/cldr,\
EXCLUDES:=sun/util/cldr/CLDRLocaleProviderAdapter,\
JAR:=$(CLDRDATA_JAR_DST),\
EXTRA_MANIFEST_ATTR:=CLDR-Version: $(CLDRVERSION),\
SKIP_METAINF:=true))
JARS += $(CLDRDATA_JAR_DST)
##########################################################################################
TOOLS_JAR_INCLUDES := \
sun/tools/asm \
sun/tools/jar \

View file

@ -37,8 +37,8 @@ TEXT_SRCDIR = $(JDK_TOPDIR)/src/share/classes
TEXT_PKG = sun/text/resources
TEXT_SOURCES = $(TEXT_PKG)/BreakIteratorRules.java \
$(TEXT_PKG)/BreakIteratorInfo.java \
$(TEXT_PKG)/BreakIteratorRules_th.java \
$(TEXT_PKG)/BreakIteratorInfo_th.java
$(TEXT_PKG)/th/BreakIteratorRules_th.java \
$(TEXT_PKG)/th/BreakIteratorInfo_th.java
# Generate BreakIteratorData
BREAK_ITERATOR_DIR = $(JDK_OUTPUTDIR)/break_iterator
@ -67,8 +67,8 @@ BIFILES = $(DATA_PKG_DIR)/CharacterBreakIteratorData \
$(DATA_PKG_DIR)/WordBreakIteratorData \
$(DATA_PKG_DIR)/LineBreakIteratorData \
$(DATA_PKG_DIR)/SentenceBreakIteratorData
BIFILES_TH = $(DATA_PKG_DIR)/WordBreakIteratorData_th \
$(DATA_PKG_DIR)/LineBreakIteratorData_th
BIFILES_TH = $(DATA_PKG_DIR)/th/WordBreakIteratorData_th \
$(DATA_PKG_DIR)/th/LineBreakIteratorData_th
$(BIFILES): $(BREAK_ITERATOR_DIR)/_the.bifiles
$(BREAK_ITERATOR_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
@ -85,7 +85,7 @@ $(BIFILES_TH): $(BREAK_ITERATOR_DIR)/_the.bifiles_th
$(BREAK_ITERATOR_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(BREAK_ITERATOR_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
$(ECHO) "Generating BreakIteratorData_th"
$(MKDIR) -p $(DATA_PKG_DIR)
$(MKDIR) -p $(DATA_PKG_DIR)/th
$(RM) -f $(BIFILES_TH)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(DATA_PKG_DIR) \

View file

@ -73,6 +73,9 @@ include GensrcX11Wrappers.gmk
GENSRC += $(GENSRC_X11WRAPPERS)
endif
include GensrcCLDR.gmk
GENSRC += $(GENSRC_CLDR)
include GensrcSwing.gmk
ifndef DISABLE_NIMBUS
GENSRC += $(GENSRC_SWING_NIMBUS)
@ -99,7 +102,8 @@ all: $(GENSRC) $(GENSRC_SWING_BEANINFO)
$(CP) -rp gensrc_charsetmapping/* gensrc && \
$(CP) -rp gensrc_charsetcoder/* gensrc && \
$(CP) -rp gensrc_exceptions/* gensrc && \
$(CP) -rp gensrc_buffer/* gensrc)
$(CP) -rp gensrc_buffer/* gensrc && \
$(CP) -rp gensrc_cldr/* gensrc)
if [ -d $(JDK_OUTPUTDIR)/gensrc_swing/javax/swing/plaf ] ; then \
(cd $(JDK_OUTPUTDIR) && \
$(MKDIR) -p gensrc/javax/swing/plaf && \

View file

@ -0,0 +1,39 @@
#
# Copyright (c) 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
CLDRVERSION := 21.0.1
CLDRSRCDIR := $(JDK_TOPDIR)/src/share/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc_cldr
CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/cldr/CLDRLocaleDataMetaInfo.java
$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml)
$(MKDIR) -p $(@D)
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) -o $(GENSRC_DIR)
GENSRC_CLDR := $(CLDR_METAINFO_FILE)

View file

@ -47,50 +47,60 @@ NEW_RESOURCES:=$(filter-out $(PREV_LOCALE_RESOURCES),$(LOCALE_RESOURCES))
ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES))
# There is a difference in the number of supported resources. Trigger a regeneration.
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java)
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java)
endif
# The non-euro zone locales have to be separated from the euro-zone locales.
NON_EURO_LOCALES:=ar% hi% iw% ja% ko% th% vi% zh%
# This macro creates a sed expression that substitues for example:
# #FormatData_EuroLocales# with: be be_BY bg bg_BG ca ca_ES... and some more.
CAPTURE_LOCALE='s/$$(HASH)$1_$2EuroLocales$$(HASH)/ $$($3 $(NON_EURO_LOCALES),$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))/g'
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
ALL_NON_EURO_LOCALES:=ja-JP-JP th-TH-TH
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
# This macro creates a sed expression that substitues for example:
# #FormatData_EuroLocales# with: be be_BY bg bg_BG ca ca_ES... and some more.
define CaptureLocale
$1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
$1_EURO_LOCALES := $$(filter-out $(NON_EURO_LOCALES),$$($1_LOCALES))
$1_NON_EURO_LOCALES := $$(filter $(NON_EURO_LOCALES),$$($1_LOCALES))
ALL_EURO_LOCALES += $$($1_EURO_LOCALES)
ALL_NON_EURO_LOCALES += $$($1_NON_EURO_LOCALES)
SED_ARGS+= -e 's/$$(HASH)$1_EuroLocales$$(HASH)/ $$($1_EURO_LOCALES)/g'
SED_ARGS+= -e 's/$$(HASH)$1_NonEuroLocales$$(HASH)/ $$($1_NON_EURO_LOCALES)/g'
endef
#sun.text.resources.FormatData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,FormatData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,FormatData,Non,filter))
$(eval $(call CaptureLocale,FormatData))
#sun.text.resources.CollationData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CollationData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CollationData,Non,filter))
$(eval $(call CaptureLocale,CollationData))
#sun.util.resources.TimeZoneNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,TimeZoneNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,TimeZoneNames,Non,filter))
$(eval $(call CaptureLocale,TimeZoneNames))
#sun.util.resources.LocaleNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,LocaleNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,LocaleNames,Non,filter))
$(eval $(call CaptureLocale,LocaleNames))
#sun.util.resources.CurrencyNames
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CurrencyNames,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CurrencyNames,Non,filter))
$(eval $(call CaptureLocale,CurrencyNames))
#sun.util.resources.CalendarData
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CalendarData,,filter-out))
$(eval SED_ARGS+=-e $(call CAPTURE_LOCALE,CalendarData,Non,filter))
$(eval $(call CaptureLocale,CalendarData))
$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
SED_ARGS+= -e 's/$(HASH)AvailableLocales_EuroLocales$(HASH)/$(sort $(ALL_EURO_LOCALES))/g'
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonEuroLocales$(HASH)/$(sort $(ALL_NON_EURO_LOCALES))/g'
$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(MKDIR) -p $(@D)
$(ECHO) Creating sun/util/LocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/_the.locale_resources
$(SED) $(SED_ARGS) $(JDK_TOPDIR)/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template \
> $(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java
$(SED) $(SED_ARGS) $< > $@
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/LocaleDataMetaInfo.java
GENSRC_LOCALEDATAMETAINFO:=$(JDK_OUTPUTDIR)/gensrc_localedatametainfo/sun/util/locale/provider/LocaleDataMetaInfo.java
###

View file

@ -282,7 +282,7 @@ $(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING_HK,\
# sun/util/resources
$(eval $(call add_properties_to_compile,SUN_UTIL,\
$(shell find $(JDK_TOPDIR)/src/share/classes/sun/util/resources -name "*.properties"),\
LocaleNamesBundle))
sun.util.resources.LocaleNamesBundle))
# Now setup the rule for the generation of the resource bundles.
$(JDK_OUTPUTDIR)/gensrc_properties/_the.compiled_properties : $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)

View file

@ -124,6 +124,9 @@ TOOL_WRAPPERGENERATOR=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_TOBIN=$(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
sun.awt.X11.ToBin
TOOL_CLDRCONVERTER=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.cldrconverter.CLDRConverter
##########################################################################################
# Tools needed on solaris because OBJCOPY is broken.

View file

@ -0,0 +1,667 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.util.locale.provider;
import java.lang.ref.SoftReference;
import java.text.*;
import java.text.spi.DateFormatProvider;
import java.text.spi.DateFormatSymbolsProvider;
import java.text.spi.DecimalFormatSymbolsProvider;
import java.text.spi.NumberFormatProvider;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle.Control;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.spi.CalendarDataProvider;
import java.util.spi.CurrencyNameProvider;
import java.util.spi.LocaleNameProvider;
import java.util.spi.TimeZoneNameProvider;
/**
* LocaleProviderAdapter implementation for the Mac OS X locale data
*
* @author Naoto Sato
*/
public class HostLocaleProviderAdapterImpl {
// per supported locale instances
private static ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> dateFormatPatternsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> numberFormatPatternsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<DateFormatSymbols>> dateFormatSymbolsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<DecimalFormatSymbols>> decimalFormatSymbolsMap =
new ConcurrentHashMap<>(2);
// locale categories
private static final int CAT_DISPLAY = 0;
private static final int CAT_FORMAT = 1;
// NumberFormat styles
private static final int NF_NUMBER = 0;
private static final int NF_CURRENCY = 1;
private static final int NF_PERCENT = 2;
private static final int NF_INTEGER = 3;
private static final int NF_MAX = NF_INTEGER;
// CalendarData value types
private static final int CD_FIRSTDAYOFWEEK = 0;
private static final int CD_MINIMALDAYSINFIRSTWEEK = 1;
// Locale/Currency display name types
private static final int DN_LOCALE_LANGUAGE = 0;
private static final int DN_LOCALE_SCRIPT = 1;
private static final int DN_LOCALE_REGION = 2;
private static final int DN_LOCALE_VARIANT = 3;
private static final int DN_CURRENCY_CODE = 4;
private static final int DN_CURRENCY_SYMBOL = 5;
// TimeZone display name types
private static final int DN_TZ_SHORT_STANDARD = 0;
private static final int DN_TZ_SHORT_DST = 1;
private static final int DN_TZ_LONG_STANDARD = 2;
private static final int DN_TZ_LONG_DST = 3;
private static final Set<Locale> supportedLocaleSet;
static {
Set<Locale> tmpSet = new HashSet<Locale>();
// Assuming the default locales do not include any extensions, so
// no stripping is needed here.
Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replaceAll("_","-"));
tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replaceAll("_","-"));
tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
}
private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]);
public static DateFormatProvider getDateFormatProvider() {
return new DateFormatProvider() {
@Override
public Locale[] getAvailableLocales() {
return getSupportedCalendarLocales();
}
@Override
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
public DateFormat getDateInstance(int style, Locale locale) {
return new SimpleDateFormat(getDateTimePattern(style, -1, locale),
getCalendarLocale(locale));
}
@Override
public DateFormat getTimeInstance(int style, Locale locale) {
return new SimpleDateFormat(getDateTimePattern(-1, style, locale),
getCalendarLocale(locale));
}
@Override
public DateFormat getDateTimeInstance(int dateStyle,
int timeStyle, Locale locale) {
return new SimpleDateFormat(getDateTimePattern(dateStyle, timeStyle, locale),
getCalendarLocale(locale));
}
private String getDateTimePattern(int dateStyle, int timeStyle, Locale locale) {
AtomicReferenceArray<String> dateFormatPatterns;
SoftReference<AtomicReferenceArray<String>> ref = dateFormatPatternsMap.get(locale);
if (ref == null || (dateFormatPatterns = ref.get()) == null) {
dateFormatPatterns = new AtomicReferenceArray<>(5 * 5);
ref = new SoftReference<>(dateFormatPatterns);
dateFormatPatternsMap.put(locale, ref);
}
int index = (dateStyle + 1) * 5 + timeStyle + 1;
String pattern = dateFormatPatterns.get(index);
if (pattern == null) {
String langTag = locale.toLanguageTag();
pattern = translateDateFormatLetters(getCalendarID(langTag),
getDateTimePatternNative(dateStyle, timeStyle, langTag));
if (!dateFormatPatterns.compareAndSet(index, null, pattern)) {
pattern = dateFormatPatterns.get(index);
}
}
return pattern;
}
};
}
public static DateFormatSymbolsProvider getDateFormatSymbolsProvider() {
return new DateFormatSymbolsProvider() {
@Override
public Locale[] getAvailableLocales() {
if (isSupportedLocale(Locale.getDefault(Locale.Category.FORMAT))) {
return supportedLocale;
}
return new Locale[0];
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Only supports the locale with Gregorian calendar
Locale base = locale.stripExtensions();
if (supportedLocaleSet.contains(base)) {
return getCalendarID(locale.toLanguageTag()).equals("gregorian");
}
return false;
}
@Override
public DateFormatSymbols getInstance(Locale locale) {
DateFormatSymbols dateFormatSymbols;
SoftReference<DateFormatSymbols> ref = dateFormatSymbolsMap.get(locale);
if (ref == null || (dateFormatSymbols = ref.get()) == null) {
dateFormatSymbols = new DateFormatSymbols(locale);
String langTag = locale.toLanguageTag();
dateFormatSymbols.setAmPmStrings(getAmPmStrings(langTag, dateFormatSymbols.getAmPmStrings()));
dateFormatSymbols.setEras(getEras(langTag, dateFormatSymbols.getEras()));
dateFormatSymbols.setMonths(getMonths(langTag, dateFormatSymbols.getMonths()));
dateFormatSymbols.setShortMonths(getShortMonths(langTag, dateFormatSymbols.getShortMonths()));
dateFormatSymbols.setWeekdays(getWeekdays(langTag, dateFormatSymbols.getWeekdays()));
dateFormatSymbols.setShortWeekdays(getShortWeekdays(langTag, dateFormatSymbols.getShortWeekdays()));
ref = new SoftReference<>(dateFormatSymbols);
dateFormatSymbolsMap.put(locale, ref);
}
return (DateFormatSymbols)dateFormatSymbols.clone();
}
};
}
public static NumberFormatProvider getNumberFormatProvider() {
return new NumberFormatProvider() {
@Override
public Locale[] getAvailableLocales() {
return supportedLocale;
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Ignore the extensions for now
return supportedLocaleSet.contains(locale.stripExtensions());
}
@Override
public NumberFormat getCurrencyInstance(Locale locale) {
return new DecimalFormat(getNumberPattern(NF_CURRENCY, locale),
DecimalFormatSymbols.getInstance(locale));
}
@Override
public NumberFormat getIntegerInstance(Locale locale) {
return new DecimalFormat(getNumberPattern(NF_INTEGER, locale),
DecimalFormatSymbols.getInstance(locale));
}
@Override
public NumberFormat getNumberInstance(Locale locale) {
return new DecimalFormat(getNumberPattern(NF_NUMBER, locale),
DecimalFormatSymbols.getInstance(locale));
}
@Override
public NumberFormat getPercentInstance(Locale locale) {
return new DecimalFormat(getNumberPattern(NF_PERCENT, locale),
DecimalFormatSymbols.getInstance(locale));
}
private String getNumberPattern(int style, Locale locale) {
AtomicReferenceArray<String> numberFormatPatterns;
SoftReference<AtomicReferenceArray<String>> ref = numberFormatPatternsMap.get(locale);
if (ref == null || (numberFormatPatterns = ref.get()) == null) {
numberFormatPatterns = new AtomicReferenceArray<>(4);
ref = new SoftReference<>(numberFormatPatterns);
numberFormatPatternsMap.put(locale, ref);
}
String pattern = numberFormatPatterns.get(style);
if (pattern == null) {
pattern = getNumberPatternNative(style, locale.toLanguageTag());
if (!numberFormatPatterns.compareAndSet(style, null, pattern)) {
pattern = numberFormatPatterns.get(style);
}
}
return pattern;
}
};
}
public static DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
return new DecimalFormatSymbolsProvider() {
@Override
public Locale[] getAvailableLocales() {
return supportedLocale;
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Ignore the extensions for now
return supportedLocaleSet.contains(locale.stripExtensions());
}
@Override
public DecimalFormatSymbols getInstance(Locale locale) {
DecimalFormatSymbols decimalFormatSymbols;
SoftReference<DecimalFormatSymbols> ref = decimalFormatSymbolsMap.get(locale);
if (ref == null || (decimalFormatSymbols = ref.get()) == null) {
decimalFormatSymbols = new DecimalFormatSymbols(locale);
String langTag = locale.toLanguageTag();
// DecimalFormatSymbols.setInternationalCurrencySymbol() has
// a side effect of setting the currency symbol as well. So
// the calling order is relevant here.
decimalFormatSymbols.setInternationalCurrencySymbol(getInternationalCurrencySymbol(langTag, decimalFormatSymbols.getInternationalCurrencySymbol()));
decimalFormatSymbols.setCurrencySymbol(getCurrencySymbol(langTag, decimalFormatSymbols.getCurrencySymbol()));
decimalFormatSymbols.setDecimalSeparator(getDecimalSeparator(langTag, decimalFormatSymbols.getDecimalSeparator()));
decimalFormatSymbols.setGroupingSeparator(getGroupingSeparator(langTag, decimalFormatSymbols.getGroupingSeparator()));
decimalFormatSymbols.setInfinity(getInfinity(langTag, decimalFormatSymbols.getInfinity()));
decimalFormatSymbols.setMinusSign(getMinusSign(langTag, decimalFormatSymbols.getMinusSign()));
decimalFormatSymbols.setMonetaryDecimalSeparator(getMonetaryDecimalSeparator(langTag, decimalFormatSymbols.getMonetaryDecimalSeparator()));
decimalFormatSymbols.setNaN(getNaN(langTag, decimalFormatSymbols.getNaN()));
decimalFormatSymbols.setPercent(getPercent(langTag, decimalFormatSymbols.getPercent()));
decimalFormatSymbols.setPerMill(getPerMill(langTag, decimalFormatSymbols.getPerMill()));
decimalFormatSymbols.setZeroDigit(getZeroDigit(langTag, decimalFormatSymbols.getZeroDigit()));
decimalFormatSymbols.setExponentSeparator(getExponentSeparator(langTag, decimalFormatSymbols.getExponentSeparator()));
ref = new SoftReference<>(decimalFormatSymbols);
decimalFormatSymbolsMap.put(locale, ref);
}
return (DecimalFormatSymbols)decimalFormatSymbols.clone();
}
};
}
public static CalendarDataProvider getCalendarDataProvider() {
return new CalendarDataProvider() {
@Override
public Locale[] getAvailableLocales() {
return getSupportedCalendarLocales();
}
@Override
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
public String getDisplayName(String calType, int field, int value,
int style, Locale locale) {
return null;
}
@Override
public Map<String, Integer> getDisplayNames(String calType,
int field, int style, Locale locale) {
return null;
}
@Override
public int getFirstDayOfWeek(Locale locale) {
return getCalendarInt(locale.toLanguageTag(), CD_FIRSTDAYOFWEEK);
}
@Override
public int getMinimalDaysInFirstWeek(Locale locale) {
return getCalendarInt(locale.toLanguageTag(), CD_MINIMALDAYSINFIRSTWEEK);
}
};
}
public static CurrencyNameProvider getCurrencyNameProvider() {
return new CurrencyNameProvider() {
@Override
public Locale[] getAvailableLocales() {
return supportedLocale;
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Ignore the extensions for now
return supportedLocaleSet.contains(locale.stripExtensions());
}
@Override
public String getDisplayName(String code, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_CURRENCY_CODE, code);
}
@Override
public String getSymbol(String code, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_CURRENCY_SYMBOL, code);
}
};
}
public static LocaleNameProvider getLocaleNameProvider() {
return new LocaleNameProvider() {
@Override
public Locale[] getAvailableLocales() {
return supportedLocale;
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Ignore the extensions for now
return supportedLocaleSet.contains(locale.stripExtensions());
}
@Override
public String getDisplayLanguage(String languageCode, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_LOCALE_LANGUAGE, languageCode);
}
@Override
public String getDisplayCountry(String countryCode, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_LOCALE_REGION, countryCode);
}
@Override
public String getDisplayScript(String scriptCode, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_LOCALE_SCRIPT, scriptCode);
}
@Override
public String getDisplayVariant(String variantCode, Locale locale) {
return getDisplayString(locale.toLanguageTag(), DN_LOCALE_VARIANT, variantCode);
}
};
}
public static TimeZoneNameProvider getTimeZoneNameProvider() {
return new TimeZoneNameProvider() {
@Override
public Locale[] getAvailableLocales() {
return supportedLocale;
}
@Override
public boolean isSupportedLocale(Locale locale) {
// Ignore the extensions for now
return supportedLocaleSet.contains(locale.stripExtensions());
}
@Override
public String getDisplayName(String ID, boolean daylight, int style, Locale locale) {
return getTimeZoneDisplayString(locale.toLanguageTag(), style * 2 + (daylight ? 1 : 0), ID);
}
};
}
private static Locale[] getSupportedCalendarLocales() {
if (supportedLocale.length != 0 &&
supportedLocaleSet.contains(Locale.JAPAN) &&
isJapaneseCalendar()) {
Locale[] sup = new Locale[supportedLocale.length+1];
sup[0] = JRELocaleConstants.JA_JP_JP;
System.arraycopy(supportedLocale, 0, sup, 1, supportedLocale.length);
return sup;
}
return supportedLocale;
}
private static boolean isSupportedCalendarLocale(Locale locale) {
// special case for ja_JP_JP
if (JRELocaleConstants.JA_JP_JP.equals(locale)) {
return isJapaneseCalendar();
}
Locale base = locale.stripExtensions();
if (!supportedLocaleSet.contains(base)) {
return false;
}
String caltype = locale.getUnicodeLocaleType("ca");
if (caltype == null) {
return true;
}
return caltype.replaceFirst("gregory", "gregorian").equals(
getCalendarID(locale.toLanguageTag()));
}
private static boolean isJapaneseCalendar() {
return getCalendarID("ja-JP").equals("japanese");
}
private static Locale getCalendarLocale(Locale locale) {
Locale.Builder lb = new Locale.Builder().setLocale(locale);
String calid = getCalendarID(locale.toLanguageTag());
switch (calid) {
case "gregorian":
calid = "gregory";
// FALL THROUGH!
case "japanese":
case "buddhist":
lb.setUnicodeLocaleKeyword("ca", calid);
return lb.build();
default:
return locale;
}
}
// The following methods are copied from CLDRConverter build tool.
private static String translateDateFormatLetters(String calendarType, String cldrFormat) {
String pattern = cldrFormat;
int length = pattern.length();
boolean inQuote = false;
StringBuilder jrePattern = new StringBuilder(length);
int count = 0;
char lastLetter = 0;
for (int i = 0; i < length; i++) {
char c = pattern.charAt(i);
if (c == '\'') {
// '' is treated as a single quote regardless of being
// in a quoted section.
if ((i + 1) < length) {
char nextc = pattern.charAt(i + 1);
if (nextc == '\'') {
i++;
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append("''");
continue;
}
}
if (!inQuote) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
inQuote = true;
} else {
inQuote = false;
}
jrePattern.append(c);
continue;
}
if (inQuote) {
jrePattern.append(c);
continue;
}
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
jrePattern.append(c);
continue;
}
if (lastLetter == 0 || lastLetter == c) {
lastLetter = c;
count++;
continue;
}
convert(calendarType, lastLetter, count, jrePattern);
lastLetter = c;
count = 1;
}
if (count != 0) {
convert(calendarType, lastLetter, count, jrePattern);
}
if (cldrFormat.contentEquals(jrePattern)) {
return cldrFormat;
}
return jrePattern.toString();
}
private static void convert(String calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
case 'G':
if (!calendarType.equals("gregorian")) {
// Adjust the number of 'G's for JRE SimpleDateFormat
if (count == 5) {
// CLDR narrow -> JRE short
count = 1;
} else if (count == 1) {
// CLDR abbr -> JRE long
count = 4;
}
}
appendN(cldrLetter, count, sb);
break;
// TODO: support 'c' and 'e' in JRE SimpleDateFormat
// Use 'u' and 'E' for now.
case 'c':
case 'e':
switch (count) {
case 1:
sb.append('u');
break;
case 3:
case 4:
appendN('E', count, sb);
break;
case 5:
appendN('E', 3, sb);
break;
}
break;
case 'v':
case 'V':
appendN('z', count, sb);
break;
case 'Z':
if (count == 4 || count == 5) {
sb.append("XXX");
}
break;
case 'u':
case 'U':
case 'q':
case 'Q':
case 'l':
case 'g':
case 'j':
case 'A':
// Unsupported letter. Just append it within quotes
sb.append('\'');
sb.append(cldrLetter);
sb.append('\'');
break;
default:
appendN(cldrLetter, count, sb);
break;
}
}
private static void appendN(char c, int n, StringBuilder sb) {
for (int i = 0; i < n; i++) {
sb.append(c);
}
}
// initialize
private static native String getDefaultLocale(int cat);
// For DateFormatProvider
private static native String getDateTimePatternNative(int dateStyle, int timeStyle, String langtag);
private static native String getCalendarID(String langTag);
// For NumberFormatProvider
private static native String getNumberPatternNative(int style, String langtag);
// For DateFormatSymbolsProvider
private static native String[] getAmPmStrings(String langTag, String[] ampm);
private static native String[] getEras(String langTag, String[] eras);
private static native String[] getMonths(String langTag, String[] months);
private static native String[] getShortMonths(String langTag, String[] smonths);
private static native String[] getWeekdays(String langTag, String[] wdays);
private static native String[] getShortWeekdays(String langTag, String[] swdays);
// For DecimalFormatSymbolsProvider
private static native String getCurrencySymbol(String langTag, String currencySymbol);
private static native char getDecimalSeparator(String langTag, char decimalSeparator);
private static native char getGroupingSeparator(String langTag, char groupingSeparator);
private static native String getInfinity(String langTag, String infinity);
private static native String getInternationalCurrencySymbol(String langTag, String internationalCurrencySymbol);
private static native char getMinusSign(String langTag, char minusSign);
private static native char getMonetaryDecimalSeparator(String langTag, char monetaryDecimalSeparator);
private static native String getNaN(String langTag, String nan);
private static native char getPercent(String langTag, char percent);
private static native char getPerMill(String langTag, char perMill);
private static native char getZeroDigit(String langTag, char zeroDigit);
private static native String getExponentSeparator(String langTag, String exponent);
// For CalendarDataProvider
private static native int getCalendarInt(String langTag, int type);
// For Locale/CurrencyNameProvider
private static native String getDisplayString(String langTag, int key, String value);
// For TimeZoneNameProvider
private static native String getTimeZoneDisplayString(String langTag, int style, String value);
}

View file

@ -0,0 +1,678 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "sun_util_locale_provider_HostLocaleProviderAdapterImpl.h"
#include <CoreFoundation/CoreFoundation.h>
#include <stdio.h>
#define BUFLEN 256
static CFDateFormatterStyle convertDateFormatterStyle(jint javaStyle);
static CFNumberFormatterStyle convertNumberFormatterStyle(jint javaStyle);
static void copyArrayElements(JNIEnv *env, CFArrayRef cfarray, jobjectArray jarray, CFIndex sindex, int dindex, int count);
static jstring getNumberSymbolString(JNIEnv *env, jstring jdefault, CFStringRef type);
static jchar getNumberSymbolChar(jchar jdefault, CFStringRef type);
// from java_props_macosx.c
extern char * getMacOSXLocale(int cat);
extern char * getPosixLocale(int cat);
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getDefaultLocale
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDefaultLocale
(JNIEnv *env, jclass cls, jint cat) {
char * localeString = NULL;
int posixCat;
jstring ret = NULL;
switch (cat) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CAT_DISPLAY:
posixCat = LC_MESSAGES;
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CAT_FORMAT:
default:
posixCat = LC_CTYPE;
break;
}
localeString = getMacOSXLocale(posixCat);
if (localeString == NULL) {
localeString = getPosixLocale(posixCat);
}
ret = (*env)->NewStringUTF(env, localeString);
free(localeString);
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getDateTimePatternNative
* Signature: (IILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDateTimePatternNative
(JNIEnv *env, jclass cls, jint dateStyle, jint timeStyle, jstring jlangtag) {
jstring ret = NULL;
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
convertDateFormatterStyle(dateStyle),
convertDateFormatterStyle(timeStyle));
if (df != NULL) {
char buf[BUFLEN];
CFStringRef formatStr = CFDateFormatterGetFormat(df);
CFStringGetCString(formatStr, buf, BUFLEN, kCFStringEncodingUTF8);
ret = (*env)->NewStringUTF(env, buf);
CFRelease(df);
}
CFRelease(cflocale);
}
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getCalendarID
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarID
(JNIEnv *env, jclass cls, jstring jlangtag) {
jstring ret = NULL;
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
char buf[BUFLEN];
CFTypeRef calid = CFLocaleGetValue(cflocale, kCFLocaleCalendarIdentifier);
CFStringGetCString((CFStringRef)calid, buf, BUFLEN, kCFStringEncodingUTF8);
ret = (*env)->NewStringUTF(env, buf);
CFRelease(cflocale);
}
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getAmPmStrings
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getAmPmStrings
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray ampms) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
char buf[BUFLEN];
CFStringRef amStr = CFDateFormatterCopyProperty(df, kCFDateFormatterAMSymbol);
if (amStr != NULL) {
CFStringGetCString(amStr, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(amStr);
(*env)->SetObjectArrayElement(env, ampms, 0, (*env)->NewStringUTF(env, buf));
}
CFStringRef pmStr = CFDateFormatterCopyProperty(df, kCFDateFormatterPMSymbol);
if (pmStr != NULL) {
CFStringGetCString(pmStr, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(pmStr);
(*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewStringUTF(env, buf));
}
CFRelease(df);
}
CFRelease(cflocale);
}
return ampms;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getEras
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getEras
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray eras) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
CFArrayRef cferas = CFDateFormatterCopyProperty(df, kCFDateFormatterEraSymbols);
if (cferas != NULL) {
copyArrayElements(env, cferas, eras, 0, 0, CFArrayGetCount(cferas));
CFRelease(cferas);
}
CFRelease(df);
}
CFRelease(cflocale);
}
return eras;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getMonths
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonths
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray months) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
CFArrayRef cfmonths = CFDateFormatterCopyProperty(df, kCFDateFormatterMonthSymbols);
if (cfmonths != NULL) {
copyArrayElements(env, cfmonths, months, 0, 0, CFArrayGetCount(cfmonths));
CFRelease(cfmonths);
}
CFRelease(df);
}
CFRelease(cflocale);
}
return months;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getShortMonths
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortMonths
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray smonths) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
CFArrayRef cfsmonths = CFDateFormatterCopyProperty(df, kCFDateFormatterShortMonthSymbols);
if (cfsmonths != NULL) {
copyArrayElements(env, cfsmonths, smonths, 0, 0, CFArrayGetCount(cfsmonths));
CFRelease(cfsmonths);
}
CFRelease(df);
}
CFRelease(cflocale);
}
return smonths;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getWeekdays
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getWeekdays
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray wdays) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
CFArrayRef cfwdays = CFDateFormatterCopyProperty(df, kCFDateFormatterWeekdaySymbols);
if (cfwdays != NULL) {
copyArrayElements(env, cfwdays, wdays, 0, 1, CFArrayGetCount(cfwdays));
CFRelease(cfwdays);
}
CFRelease(df);
}
CFRelease(cflocale);
}
return wdays;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getShortWeekdays
* Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortWeekdays
(JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray swdays) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFDateFormatterRef df = CFDateFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFDateFormatterFullStyle,
kCFDateFormatterFullStyle);
if (df != NULL) {
CFArrayRef cfswdays = CFDateFormatterCopyProperty(df, kCFDateFormatterShortWeekdaySymbols);
if (cfswdays != NULL) {
copyArrayElements(env, cfswdays, swdays, 0, 1, CFArrayGetCount(cfswdays));
CFRelease(cfswdays);
}
CFRelease(df);
}
CFRelease(cflocale);
}
return swdays;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getNumberPatternNative
* Signature: (ILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNumberPatternNative
(JNIEnv *env, jclass cls, jint numberStyle, jstring jlangtag) {
jstring ret = NULL;
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
cflocale,
convertNumberFormatterStyle(numberStyle));
if (nf != NULL) {
char buf[BUFLEN];
CFStringRef formatStr = CFNumberFormatterGetFormat(nf);
CFStringGetCString(formatStr, buf, BUFLEN, kCFStringEncodingUTF8);
ret = (*env)->NewStringUTF(env, buf);
CFRelease(nf);
}
CFRelease(cflocale);
}
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getCurrencySymbol
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCurrencySymbol
(JNIEnv *env, jclass cls, jstring jlangtag, jstring currencySymbol) {
return getNumberSymbolString(env, currencySymbol, kCFNumberFormatterCurrencySymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getDecimalSeparator
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDecimalSeparator
(JNIEnv *env, jclass cls, jstring jlangtag, jchar decimalSeparator) {
return getNumberSymbolChar(decimalSeparator, kCFNumberFormatterDecimalSeparator);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getGroupingSeparator
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getGroupingSeparator
(JNIEnv *env, jclass cls, jstring jlangtag, jchar groupingSeparator) {
return getNumberSymbolChar(groupingSeparator, kCFNumberFormatterGroupingSeparator);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getInfinity
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInfinity
(JNIEnv *env, jclass cls, jstring jlangtag, jstring infinity) {
return getNumberSymbolString(env, infinity, kCFNumberFormatterInfinitySymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getInternationalCurrencySymbol
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInternationalCurrencySymbol
(JNIEnv *env, jclass cls, jstring jlangtag, jstring internationalCurrencySymbol) {
return getNumberSymbolString(env, internationalCurrencySymbol, kCFNumberFormatterInternationalCurrencySymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getMinusSign
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMinusSign
(JNIEnv *env, jclass cls, jstring jlangtag, jchar minusSign) {
return getNumberSymbolChar(minusSign, kCFNumberFormatterMinusSign);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getMonetaryDecimalSeparator
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonetaryDecimalSeparator
(JNIEnv *env, jclass cls, jstring jlangtag, jchar monetaryDecimalSeparator) {
return getNumberSymbolChar(monetaryDecimalSeparator, kCFNumberFormatterCurrencyDecimalSeparator);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getNaN
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNaN
(JNIEnv *env, jclass cls, jstring jlangtag, jstring nan) {
return getNumberSymbolString(env, nan, kCFNumberFormatterNaNSymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getPercent
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPercent
(JNIEnv *env, jclass cls, jstring jlangtag, jchar percent) {
return getNumberSymbolChar(percent, kCFNumberFormatterPercentSymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getPerMill
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPerMill
(JNIEnv *env, jclass cls, jstring jlangtag, jchar perMill) {
return getNumberSymbolChar(perMill, kCFNumberFormatterPerMillSymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getZeroDigit
* Signature: (Ljava/lang/String;C)C
*/
JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getZeroDigit
(JNIEnv *env, jclass cls, jstring jlangtag, jchar zeroDigit) {
return getNumberSymbolChar(zeroDigit, kCFNumberFormatterZeroSymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getExponentSeparator
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getExponentSeparator
(JNIEnv *env, jclass cls, jstring jlangtag, jstring exponent) {
return getNumberSymbolString(env, exponent, kCFNumberFormatterExponentSymbol);
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getCalendarInt
* Signature: (Ljava/lang/String;I)I
*/
JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarInt
(JNIEnv *env, jclass cls, jstring jlangtag, jint type) {
jint ret = 0;
CFCalendarRef cfcal = CFCalendarCopyCurrent();
if (cfcal != NULL) {
switch (type) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK:
ret = CFCalendarGetFirstWeekday(cfcal);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_MINIMALDAYSINFIRSTWEEK:
ret = CFCalendarGetMinimumDaysInFirstWeek(cfcal);
break;
default:
ret = 0;
}
CFRelease(cfcal);
}
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getDisplayString
* Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDisplayString
(JNIEnv *env, jclass cls, jstring jlangtag, jint type, jstring value) {
jstring ret = NULL;
const char *clangtag = (*env)->GetStringUTFChars(env, jlangtag, 0);
if (clangtag != NULL) {
const char *cvalue = (*env)->GetStringUTFChars(env, value, 0);
if (cvalue != NULL) {
CFStringRef cflangtag =
CFStringCreateWithCString(kCFAllocatorDefault, clangtag, kCFStringEncodingUTF8);
if (cflangtag != NULL) {
CFLocaleRef cflocale = CFLocaleCreate(kCFAllocatorDefault, cflangtag);
if (cflocale != NULL) {
CFStringRef cfvalue =
CFStringCreateWithCString(kCFAllocatorDefault, cvalue, kCFStringEncodingUTF8);
if (cfvalue != NULL) {
CFStringRef str = NULL;
switch (type) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_LANGUAGE:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleLanguageCode, cfvalue);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_SCRIPT:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleScriptCode, cfvalue);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_REGION:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleCountryCode, cfvalue);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_VARIANT:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleVariantCode, cfvalue);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_CODE:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleCurrencyCode, cfvalue);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_SYMBOL:
str = CFLocaleCopyDisplayNameForPropertyValue(cflocale, kCFLocaleCurrencySymbol, cfvalue);
break;
}
if (str != NULL) {
char buf[BUFLEN];
CFStringGetCString(str, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(str);
ret = (*env)->NewStringUTF(env, buf);
}
CFRelease(cfvalue);
}
CFRelease(cflocale);
}
CFRelease(cflangtag);
}
(*env)->ReleaseStringUTFChars(env, value, cvalue);
}
(*env)->ReleaseStringUTFChars(env, jlangtag, clangtag);
}
return ret;
}
/*
* Class: sun_util_locale_provider_HostLocaleProviderAdapterImpl
* Method: getTimeZoneDisplayString
* Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getTimeZoneDisplayString
(JNIEnv *env, jclass cls, jstring jlangtag, jint type, jstring tzid) {
jstring ret = NULL;
const char *clangtag = (*env)->GetStringUTFChars(env, jlangtag, 0);
if (clangtag != NULL) {
const char *ctzid = (*env)->GetStringUTFChars(env, tzid, 0);
if (ctzid != NULL) {
CFStringRef cflangtag =
CFStringCreateWithCString(kCFAllocatorDefault, clangtag, kCFStringEncodingUTF8);
if (cflangtag != NULL) {
CFLocaleRef cflocale = CFLocaleCreate(kCFAllocatorDefault, cflangtag);
if (cflocale != NULL) {
CFStringRef cftzid =
CFStringCreateWithCString(kCFAllocatorDefault, ctzid, kCFStringEncodingUTF8);
if (cftzid != NULL) {
CFTimeZoneRef cftz = CFTimeZoneCreateWithName(kCFAllocatorDefault, cftzid, false);
if (cftz != NULL) {
CFStringRef str = NULL;
switch (type) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_TZ_SHORT_STANDARD:
str = CFTimeZoneCopyLocalizedName(cftz, kCFTimeZoneNameStyleShortStandard, cflocale);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_TZ_SHORT_DST:
str = CFTimeZoneCopyLocalizedName(cftz, kCFTimeZoneNameStyleShortDaylightSaving, cflocale);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_TZ_LONG_STANDARD:
str = CFTimeZoneCopyLocalizedName(cftz, kCFTimeZoneNameStyleStandard, cflocale);
break;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_TZ_LONG_DST:
str = CFTimeZoneCopyLocalizedName(cftz, kCFTimeZoneNameStyleDaylightSaving, cflocale);
break;
}
if (str != NULL) {
char buf[BUFLEN];
CFStringGetCString(str, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(str);
ret = (*env)->NewStringUTF(env, buf);
}
CFRelease(cftz);
}
CFRelease(cftzid);
}
CFRelease(cflocale);
}
CFRelease(cflangtag);
}
(*env)->ReleaseStringUTFChars(env, tzid, ctzid);
}
(*env)->ReleaseStringUTFChars(env, jlangtag, clangtag);
}
return ret;
}
static CFDateFormatterStyle convertDateFormatterStyle(jint javaStyle) {
switch (javaStyle) {
case 0: // FULL
return kCFDateFormatterFullStyle;
case 1: // LONG
return kCFDateFormatterLongStyle;
case 2: // MEDIUM
return kCFDateFormatterMediumStyle;
case 3: // LONG
return kCFDateFormatterShortStyle;
case -1: // No style
default:
return kCFDateFormatterNoStyle;
}
}
static CFNumberFormatterStyle convertNumberFormatterStyle(jint javaStyle) {
switch (javaStyle) {
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY:
return kCFNumberFormatterCurrencyStyle;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER:
return kCFNumberFormatterDecimalStyle;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER:
return kCFNumberFormatterDecimalStyle;
case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT:
return kCFNumberFormatterPercentStyle;
default:
return kCFNumberFormatterNoStyle;
}
}
static void copyArrayElements(JNIEnv *env, CFArrayRef cfarray, jobjectArray jarray, CFIndex sindex, int dindex, int count) {
char buf[BUFLEN];
for (; count > 0; sindex++, dindex++, count--) {
CFStringGetCString(CFArrayGetValueAtIndex(cfarray, sindex), buf, BUFLEN, kCFStringEncodingUTF8);
(*env)->SetObjectArrayElement(env, jarray, dindex, (*env)->NewStringUTF(env, buf));
}
}
static jstring getNumberSymbolString(JNIEnv *env, jstring jdefault, CFStringRef type) {
char buf[BUFLEN];
jstring ret = jdefault;
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFNumberFormatterDecimalStyle);
if (nf != NULL) {
CFStringRef str = CFNumberFormatterCopyProperty(nf, type);
if (str != NULL) {
CFStringGetCString(str, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(str);
ret = (*env)->NewStringUTF(env, buf);
}
CFRelease(nf);
}
CFRelease(cflocale);
}
return ret;
}
static jchar getNumberSymbolChar(jchar jdefault, CFStringRef type) {
char buf[BUFLEN];
jchar ret = jdefault;
CFLocaleRef cflocale = CFLocaleCopyCurrent();
if (cflocale != NULL) {
CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
cflocale,
kCFNumberFormatterDecimalStyle);
if (nf != NULL) {
CFStringRef str = CFNumberFormatterCopyProperty(nf, type);
if (str != NULL) {
CFStringGetCString(str, buf, BUFLEN, kCFStringEncodingUTF8);
CFRelease(str);
ret = buf[0];
}
CFRelease(nf);
}
CFRelease(cflocale);
}
return ret;
}

View file

@ -41,20 +41,10 @@
package java.text;
import java.lang.ref.SoftReference;
import java.net.URL;
import java.io.InputStream;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.text.spi.BreakIteratorProvider;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.spi.LocaleServiceProvider;
import sun.util.LocaleServiceProviderPool;
import sun.util.resources.LocaleData;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
/**
@ -248,6 +238,7 @@ public abstract class BreakIterator implements Cloneable
* Create a copy of this iterator
* @return A copy of this
*/
@Override
public Object clone()
{
try {
@ -360,8 +351,9 @@ public abstract class BreakIterator implements Cloneable
// abstract methods to an existing class. There is almost ALWAYS a
// better, faster way to do this.
int pos = following(offset);
while (pos >= offset && pos != DONE)
while (pos >= offset && pos != DONE) {
pos = previous();
}
return pos;
}
@ -464,10 +456,7 @@ public abstract class BreakIterator implements Cloneable
*/
public static BreakIterator getWordInstance(Locale locale)
{
return getBreakInstance(locale,
WORD_INDEX,
"WordData",
"WordDictionary");
return getBreakInstance(locale, WORD_INDEX);
}
/**
@ -491,10 +480,7 @@ public abstract class BreakIterator implements Cloneable
*/
public static BreakIterator getLineInstance(Locale locale)
{
return getBreakInstance(locale,
LINE_INDEX,
"LineData",
"LineDictionary");
return getBreakInstance(locale, LINE_INDEX);
}
/**
@ -518,10 +504,7 @@ public abstract class BreakIterator implements Cloneable
*/
public static BreakIterator getCharacterInstance(Locale locale)
{
return getBreakInstance(locale,
CHARACTER_INDEX,
"CharacterData",
"CharacterDictionary");
return getBreakInstance(locale, CHARACTER_INDEX);
}
/**
@ -545,16 +528,10 @@ public abstract class BreakIterator implements Cloneable
*/
public static BreakIterator getSentenceInstance(Locale locale)
{
return getBreakInstance(locale,
SENTENCE_INDEX,
"SentenceData",
"SentenceDictionary");
return getBreakInstance(locale, SENTENCE_INDEX);
}
private static BreakIterator getBreakInstance(Locale locale,
int type,
String dataName,
String dictionaryName) {
private static BreakIterator getBreakInstance(Locale locale, int type) {
if (iterCache[type] != null) {
BreakIteratorCache cache = iterCache[type].get();
if (cache != null) {
@ -564,63 +541,40 @@ public abstract class BreakIterator implements Cloneable
}
}
BreakIterator result = createBreakInstance(locale,
type,
dataName,
dictionaryName);
BreakIterator result = createBreakInstance(locale, type);
BreakIteratorCache cache = new BreakIteratorCache(locale, result);
iterCache[type] = new SoftReference<>(cache);
return result;
}
private static ResourceBundle getBundle(final String baseName, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
public ResourceBundle run() {
return ResourceBundle.getBundle(baseName, locale);
}
});
}
private static BreakIterator createBreakInstance(Locale locale,
int type,
String dataName,
String dictionaryName) {
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(BreakIteratorProvider.class);
if (pool.hasProviders()) {
BreakIterator providersInstance = pool.getLocalizedObject(
BreakIteratorGetter.INSTANCE,
locale, type);
if (providersInstance != null) {
return providersInstance;
int type) {
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(BreakIteratorProvider.class, locale);
BreakIterator iterator = createBreakInstance(adapter, locale, type);
if (iterator == null) {
iterator = createBreakInstance(LocaleProviderAdapter.forJRE(), locale, type);
}
return iterator;
}
ResourceBundle bundle = getBundle(
"sun.text.resources.BreakIteratorInfo", locale);
String[] classNames = bundle.getStringArray("BreakIteratorClasses");
String dataFile = bundle.getString(dataName);
try {
if (classNames[type].equals("RuleBasedBreakIterator")) {
return new RuleBasedBreakIterator(dataFile);
}
else if (classNames[type].equals("DictionaryBasedBreakIterator")) {
String dictionaryFile = bundle.getString(dictionaryName);
return new DictionaryBasedBreakIterator(dataFile, dictionaryFile);
}
else {
throw new IllegalArgumentException("Invalid break iterator class \"" +
classNames[type] + "\"");
}
}
catch (Exception e) {
throw new InternalError(e.toString(), e);
private static BreakIterator createBreakInstance(LocaleProviderAdapter adapter, Locale locale, int type) {
BreakIteratorProvider breakIteratorProvider = adapter.getBreakIteratorProvider();
BreakIterator iterator = null;
switch (type) {
case CHARACTER_INDEX:
iterator = breakIteratorProvider.getCharacterInstance(locale);
break;
case WORD_INDEX:
iterator = breakIteratorProvider.getWordInstance(locale);
break;
case LINE_INDEX:
iterator = breakIteratorProvider.getLineInstance(locale);
break;
case SENTENCE_INDEX:
iterator = breakIteratorProvider.getSentenceInstance(locale);
break;
}
return iterator;
}
/**
@ -661,57 +615,4 @@ public abstract class BreakIterator implements Cloneable
return (BreakIterator) iter.clone();
}
}
static long getLong(byte[] buf, int offset) {
long num = buf[offset]&0xFF;
for (int i = 1; i < 8; i++) {
num = num<<8 | (buf[offset+i]&0xFF);
}
return num;
}
static int getInt(byte[] buf, int offset) {
int num = buf[offset]&0xFF;
for (int i = 1; i < 4; i++) {
num = num<<8 | (buf[offset+i]&0xFF);
}
return num;
}
static short getShort(byte[] buf, int offset) {
short num = (short)(buf[offset]&0xFF);
num = (short)(num<<8 | (buf[offset+1]&0xFF));
return num;
}
/**
* Obtains a BreakIterator instance from a BreakIteratorProvider
* implementation.
*/
private static class BreakIteratorGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<BreakIteratorProvider, BreakIterator> {
private static final BreakIteratorGetter INSTANCE =
new BreakIteratorGetter();
public BreakIterator getObject(BreakIteratorProvider breakIteratorProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 1;
switch ((Integer)params[0]) {
case CHARACTER_INDEX:
return breakIteratorProvider.getCharacterInstance(locale);
case WORD_INDEX:
return breakIteratorProvider.getWordInstance(locale);
case LINE_INDEX:
return breakIteratorProvider.getLineInstance(locale);
case SENTENCE_INDEX:
return breakIteratorProvider.getSentenceInstance(locale);
default:
assert false : "should not happen";
}
return null;
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
@ -38,14 +38,14 @@
package java.text;
import java.lang.ref.SoftReference;
import java.text.spi.CollatorProvider;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.spi.LocaleServiceProvider;
import sun.misc.SoftCache;
import sun.util.resources.LocaleData;
import sun.util.LocaleServiceProviderPool;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
/**
@ -231,60 +231,36 @@ public abstract class Collator
* @see java.util.Locale
* @see java.util.ResourceBundle
*/
public static synchronized
Collator getInstance(Locale desiredLocale)
{
Collator result = (Collator) cache.get(desiredLocale);
if (result != null) {
return (Collator)result.clone(); // make the world safe
}
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CollatorProvider.class);
if (pool.hasProviders()) {
Collator providersInstance = pool.getLocalizedObject(
CollatorGetter.INSTANCE,
desiredLocale,
public static Collator getInstance(Locale desiredLocale) {
SoftReference<Collator> ref = cache.get(desiredLocale);
Collator result = (ref != null) ? ref.get() : null;
if (result == null) {
LocaleProviderAdapter adapter;
adapter = LocaleProviderAdapter.getAdapter(CollatorProvider.class,
desiredLocale);
if (providersInstance != null) {
return providersInstance;
CollatorProvider provider = adapter.getCollatorProvider();
result = provider.getInstance(desiredLocale);
if (result == null) {
result = LocaleProviderAdapter.forJRE()
.getCollatorProvider().getInstance(desiredLocale);
}
while (true) {
if (ref != null) {
// Remove the empty SoftReference if any
cache.remove(desiredLocale, ref);
}
ref = cache.putIfAbsent(desiredLocale, new SoftReference<>(result));
if (ref == null) {
break;
}
Collator cachedColl = ref.get();
if (cachedColl != null) {
result = cachedColl;
break;
}
}
// Load the resource of the desired locale from resource
// manager.
String colString = "";
try {
ResourceBundle resource = LocaleData.getCollationData(desiredLocale);
colString = resource.getString("Rule");
} catch (MissingResourceException e) {
// Use default values
}
try
{
result = new RuleBasedCollator( CollationRules.DEFAULTRULES +
colString,
CANONICAL_DECOMPOSITION );
}
catch(ParseException foo)
{
// predefined tables should contain correct grammar
try {
result = new RuleBasedCollator( CollationRules.DEFAULTRULES );
} catch (ParseException bar) {
// do nothing
}
}
// Now that RuleBasedCollator adds expansions for pre-composed characters
// into their decomposed equivalents, the default collators don't need
// to have decomposition turned on. Laura, 5/5/98, bug 4114077
result.setDecomposition(NO_DECOMPOSITION);
cache.put(desiredLocale,result);
return (Collator)result.clone();
return (Collator) result.clone(); // make the world safe
}
/**
@ -323,6 +299,7 @@ public abstract class Collator
* @see java.util.Comparator
* @since 1.2
*/
@Override
public int compare(Object o1, Object o2) {
return compare((String)o1, (String)o2);
}
@ -387,8 +364,9 @@ public abstract class Collator
if ((newStrength != PRIMARY) &&
(newStrength != SECONDARY) &&
(newStrength != TERTIARY) &&
(newStrength != IDENTICAL))
(newStrength != IDENTICAL)) {
throw new IllegalArgumentException("Incorrect comparison level.");
}
strength = newStrength;
}
@ -429,8 +407,9 @@ public abstract class Collator
public synchronized void setDecomposition(int decompositionMode) {
if ((decompositionMode != NO_DECOMPOSITION) &&
(decompositionMode != CANONICAL_DECOMPOSITION) &&
(decompositionMode != FULL_DECOMPOSITION))
(decompositionMode != FULL_DECOMPOSITION)) {
throw new IllegalArgumentException("Wrong decomposition mode.");
}
decmp = decompositionMode;
}
@ -456,6 +435,7 @@ public abstract class Collator
/**
* Overrides Cloneable
*/
@Override
public Object clone()
{
try {
@ -471,11 +451,18 @@ public abstract class Collator
* @return true if this Collator is the same as that Collator;
* false otherwise.
*/
@Override
public boolean equals(Object that)
{
if (this == that) return true;
if (that == null) return false;
if (getClass() != that.getClass()) return false;
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Collator other = (Collator) that;
return ((strength == other.strength) &&
(decmp == other.decmp));
@ -484,6 +471,7 @@ public abstract class Collator
/**
* Generates the hash code for this Collator.
*/
@Override
abstract public int hashCode();
/**
@ -500,7 +488,8 @@ public abstract class Collator
private int strength = 0;
private int decmp = 0;
private static SoftCache cache = new SoftCache();
private static final ConcurrentMap<Locale, SoftReference<Collator>> cache
= new ConcurrentHashMap<>();
//
// FIXME: These three constants should be removed.
@ -523,31 +512,4 @@ public abstract class Collator
* @see java.text.Collator#compare
*/
final static int GREATER = 1;
/**
* Obtains a Collator instance from a CollatorProvider
* implementation.
*/
private static class CollatorGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<CollatorProvider, Collator> {
private static final CollatorGetter INSTANCE = new CollatorGetter();
public Collator getObject(CollatorProvider collatorProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 1;
Collator result = collatorProvider.getInstance(locale);
if (result != null) {
// put this Collator instance in the cache for two locales, one
// is for the desired locale, and the other is for the actual
// locale where the provider is found, which may be a fall back locale.
cache.put((Locale)params[0], result);
cache.put(locale, result);
return (Collator)result.clone();
}
return null;
}
}
}

View file

@ -50,7 +50,8 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.TimeZone;
import java.util.spi.LocaleServiceProvider;
import sun.util.LocaleServiceProviderPool;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
/**
* {@code DateFormat} is an abstract class for date/time formatting subclasses which
@ -752,28 +753,29 @@ public abstract class DateFormat extends Format {
} else {
dateStyle = -1;
}
try {
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(DateFormatProvider.class);
if (pool.hasProviders()) {
DateFormat providersInstance = pool.getLocalizedObject(
DateFormatGetter.INSTANCE,
loc,
timeStyle,
dateStyle,
flags);
if (providersInstance != null) {
return providersInstance;
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc);
DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc);
if (dateFormat == null) {
dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc);
}
return dateFormat;
}
return new SimpleDateFormat(timeStyle, dateStyle, loc);
} catch (MissingResourceException e) {
return new SimpleDateFormat("M/d/yy h:mm a");
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) {
DateFormatProvider provider = adapter.getDateFormatProvider();
DateFormat dateFormat;
if (timeStyle == -1) {
dateFormat = provider.getDateInstance(dateStyle, loc);
} else {
if (dateStyle == -1) {
dateFormat = provider.getTimeInstance(timeStyle, loc);
} else {
dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc);
}
}
return dateFormat;
}
/**
* Create a new date format.
@ -871,6 +873,7 @@ public abstract class DateFormat extends Format {
* resolved.
* @return resolved DateFormat.Field constant
*/
@Override
protected Object readResolve() throws InvalidObjectException {
if (this.getClass() != DateFormat.Field.class) {
throw new InvalidObjectException("subclass didn't correctly implement readResolve");
@ -994,37 +997,4 @@ public abstract class DateFormat extends Format {
*/
public final static Field TIME_ZONE = new Field("time zone", -1);
}
/**
* Obtains a DateFormat instance from a DateFormatProvider
* implementation.
*/
private static class DateFormatGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<DateFormatProvider, DateFormat> {
private static final DateFormatGetter INSTANCE = new DateFormatGetter();
public DateFormat getObject(DateFormatProvider dateFormatProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 3;
int timeStyle = (Integer)params[0];
int dateStyle = (Integer)params[1];
int flags = (Integer)params[2];
switch (flags) {
case 1:
return dateFormatProvider.getTimeInstance(timeStyle, locale);
case 2:
return dateFormatProvider.getDateInstance(dateStyle, locale);
case 3:
return dateFormatProvider.getDateTimeInstance(dateStyle, timeStyle, locale);
default:
assert false : "should not happen";
}
return null;
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -44,17 +44,14 @@ import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.text.spi.DateFormatSymbolsProvider;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.spi.LocaleServiceProvider;
import sun.util.LocaleServiceProviderPool;
import sun.util.TimeZoneNameUtility;
import sun.util.calendar.ZoneInfo;
import sun.util.resources.LocaleData;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
import sun.util.locale.provider.TimeZoneNameUtility;
/**
* <code>DateFormatSymbols</code> is a public class for encapsulating
@ -227,7 +224,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* Unlocalized date-time pattern characters. For example: 'y', 'd', etc.
* All locales use the same these unlocalized pattern characters.
*/
static final String patternChars = "GyMdkHmsSEDFwWahKzZYuX";
static final String patternChars = "GyMdkHmsSEDFwWahKzZYuXL";
static final int PATTERN_ERA = 0; // G
static final int PATTERN_YEAR = 1; // y
@ -251,6 +248,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
static final int PATTERN_WEEK_YEAR = 19; // Y
static final int PATTERN_ISO_DAY_OF_WEEK = 20; // u
static final int PATTERN_ISO_ZONE = 21; // X
static final int PATTERN_MONTH_STANDALONE = 22; // L
/**
* Localized date-time pattern characters. For example, a locale may
@ -326,7 +324,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
if (dfs != null) {
return dfs;
}
return (DateFormatSymbols) getCachedInstance(locale).clone();
throw new RuntimeException("DateFormatSymbols instance creation failed.");
}
/**
@ -340,46 +338,18 @@ public class DateFormatSymbols implements Serializable, Cloneable {
if (dfs != null) {
return dfs;
}
return getCachedInstance(locale);
throw new RuntimeException("DateFormatSymbols instance creation failed.");
}
private static DateFormatSymbols getProviderInstance(Locale locale) {
DateFormatSymbols providersInstance = null;
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(DateFormatSymbolsProvider.class);
if (pool.hasProviders()) {
providersInstance = pool.getLocalizedObject(
DateFormatSymbolsGetter.INSTANCE, locale);
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatSymbolsProvider.class, locale);
DateFormatSymbolsProvider provider = adapter.getDateFormatSymbolsProvider();
DateFormatSymbols dfsyms = provider.getInstance(locale);
if (dfsyms == null) {
provider = LocaleProviderAdapter.forJRE().getDateFormatSymbolsProvider();
dfsyms = provider.getInstance(locale);
}
return providersInstance;
}
/**
* Returns a cached DateFormatSymbols if it's found in the
* cache. Otherwise, this method returns a newly cached instance
* for the given locale.
*/
private static DateFormatSymbols getCachedInstance(Locale locale) {
SoftReference<DateFormatSymbols> ref = cachedInstances.get(locale);
DateFormatSymbols dfs = null;
if (ref == null || (dfs = ref.get()) == null) {
dfs = new DateFormatSymbols(locale);
ref = new SoftReference<DateFormatSymbols>(dfs);
SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref);
if (x != null) {
DateFormatSymbols y = x.get();
if (y != null) {
dfs = y;
} else {
// Replace the empty SoftReference with ref.
cachedInstances.put(locale, ref);
}
}
}
return dfs;
return dfsyms;
}
/**
@ -400,6 +370,17 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* Gets month strings. For example: "January", "February", etc.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, this method returns month names in the
* formatting form. For example, the preferred month name for
* January in the Czech language is <em>ledna</em> in the
* formatting form, while it is <em>leden</em> in the stand-alone
* form. This method returns {@code "ledna"} in this case. Refer
* to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> for more details.
*
* @return the month strings.
*/
public String[] getMonths() {
@ -416,6 +397,17 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* Gets short month strings. For example: "Jan", "Feb", etc.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, This method returns short month names in
* the formatting form. For example, the preferred abbreviation
* for January in the Catalan language is <em>de gen.</em> in the
* formatting form, while it is <em>gen.</em> in the stand-alone
* form. This method returns {@code "de gen."} in this case. Refer
* to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> for more details.
*
* @return the short month strings.
*/
public String[] getShortMonths() {
@ -645,7 +637,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* Cache to hold DateFormatSymbols instances per Locale.
*/
private static final ConcurrentMap<Locale, SoftReference<DateFormatSymbols>> cachedInstances
= new ConcurrentHashMap<Locale, SoftReference<DateFormatSymbols>>(3);
= new ConcurrentHashMap<>(3);
private transient int lastZoneIndex = 0;
@ -661,7 +653,15 @@ public class DateFormatSymbols implements Serializable, Cloneable {
}
// Initialize the fields from the ResourceBundle for locale.
ResourceBundle resource = LocaleData.getDateFormatData(locale);
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatSymbolsProvider.class, locale);
// Avoid any potential recursions
switch (adapter.getAdapterType()) {
case HOST:
case SPI:
adapter = LocaleProviderAdapter.getResourceBundleBased();
break;
}
ResourceBundle resource = adapter.getLocaleData().getDateFormatData(locale);
eras = resource.getStringArray("Eras");
months = resource.getStringArray("MonthNames");
@ -672,6 +672,17 @@ public class DateFormatSymbols implements Serializable, Cloneable {
// Day of week names are stored in a 1-based array.
weekdays = toOneBasedArray(resource.getStringArray("DayNames"));
shortWeekdays = toOneBasedArray(resource.getStringArray("DayAbbreviations"));
// Put a clone in the cache
ref = new SoftReference<>((DateFormatSymbols)this.clone());
SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref);
if (x != null) {
DateFormatSymbols y = x.get();
if (y == null) {
// Replace the empty SoftReference with ref.
cachedInstances.put(locale, ref);
}
}
}
private static String[] toOneBasedArray(String[] src) {
@ -730,7 +741,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
}
}
private final String[][] getZoneStringsImpl(boolean needsCopy) {
private String[][] getZoneStringsImpl(boolean needsCopy) {
if (zoneStrings == null) {
zoneStrings = TimeZoneNameUtility.getZoneStrings(locale);
}
@ -747,7 +758,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
return aCopy;
}
private final boolean isSubclassObject() {
private boolean isSubclassObject() {
return !getClass().getName().equals("java.text.DateFormatSymbols");
}
@ -757,7 +768,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* @param src the source DateFormatSymbols.
* @param dst the target DateFormatSymbols.
*/
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst)
private void copyMembers(DateFormatSymbols src, DateFormatSymbols dst)
{
dst.eras = Arrays.copyOf(src.eras, src.eras.length);
dst.months = Arrays.copyOf(src.months, src.months.length);
@ -786,23 +797,4 @@ public class DateFormatSymbols implements Serializable, Cloneable {
}
stream.defaultWriteObject();
}
/**
* Obtains a DateFormatSymbols instance from a DateFormatSymbolsProvider
* implementation.
*/
private static class DateFormatSymbolsGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<DateFormatSymbolsProvider,
DateFormatSymbols> {
private static final DateFormatSymbolsGetter INSTANCE =
new DateFormatSymbolsGetter();
public DateFormatSymbols getObject(DateFormatSymbolsProvider dateFormatSymbolsProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 0;
return dateFormatSymbolsProvider.getInstance(locale);
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -38,12 +38,13 @@
package java.text;
import java.io.InvalidObjectException;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.spi.NumberFormatProvider;
import java.util.ArrayList;
import java.util.Currency;
import java.util.Locale;
@ -52,7 +53,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import sun.util.resources.LocaleData;
import sun.util.locale.provider.LocaleProviderAdapter;
/**
* <code>DecimalFormat</code> is a concrete subclass of
@ -398,7 +399,14 @@ public class DecimalFormat extends NumberFormat {
String pattern = cachedLocaleData.get(def);
if (pattern == null) { /* cache miss */
// Get the pattern for the default locale.
ResourceBundle rb = LocaleData.getNumberFormatData(def);
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class, def);
switch (adapter.getAdapterType()) {
case HOST:
case SPI:
adapter = LocaleProviderAdapter.getResourceBundleBased();
break;
}
ResourceBundle rb = adapter.getLocaleData().getNumberFormatData(def);
String[] all = rb.getStringArray("NumberPatterns");
pattern = all[0];
/* update cache */
@ -406,7 +414,7 @@ public class DecimalFormat extends NumberFormat {
}
// Always applyPattern after the symbols are set
this.symbols = new DecimalFormatSymbols(def);
this.symbols = DecimalFormatSymbols.getInstance(def);
applyPattern(pattern, false);
}
@ -431,7 +439,7 @@ public class DecimalFormat extends NumberFormat {
*/
public DecimalFormat(String pattern) {
// Always applyPattern after the symbols are set
this.symbols = new DecimalFormatSymbols(Locale.getDefault(Locale.Category.FORMAT));
this.symbols = DecimalFormatSymbols.getInstance(Locale.getDefault(Locale.Category.FORMAT));
applyPattern(pattern, false);
}
@ -485,6 +493,7 @@ public class DecimalFormat extends NumberFormat {
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
@Override
public final StringBuffer format(Object number,
StringBuffer toAppendTo,
FieldPosition pos) {
@ -517,6 +526,7 @@ public class DecimalFormat extends NumberFormat {
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
public StringBuffer format(double number, StringBuffer result,
FieldPosition fieldPosition) {
fieldPosition.setBeginIndex(0);
@ -618,6 +628,7 @@ public class DecimalFormat extends NumberFormat {
* @return The formatted number string
* @see java.text.FieldPosition
*/
@Override
public StringBuffer format(long number, StringBuffer result,
FieldPosition fieldPosition) {
fieldPosition.setBeginIndex(0);
@ -832,6 +843,7 @@ public class DecimalFormat extends NumberFormat {
* @return AttributedCharacterIterator describing the formatted value.
* @since 1.4
*/
@Override
public AttributedCharacterIterator formatToCharacterIterator(Object obj) {
CharacterIteratorFieldDelegate delegate =
new CharacterIteratorFieldDelegate();
@ -1257,6 +1269,7 @@ public class DecimalFormat extends NumberFormat {
* @exception NullPointerException if <code>text</code> or
* <code>pos</code> is null.
*/
@Override
public Number parse(String text, ParsePosition pos) {
// special case NaN
if (text.regionMatches(pos.index, symbols.getNaN(), 0, symbols.getNaN().length())) {
@ -1890,6 +1903,7 @@ public class DecimalFormat extends NumberFormat {
/**
* Standard override; no change in semantics.
*/
@Override
public Object clone() {
DecimalFormat other = (DecimalFormat) super.clone();
other.symbols = (DecimalFormatSymbols) symbols.clone();
@ -1900,6 +1914,7 @@ public class DecimalFormat extends NumberFormat {
/**
* Overrides equals
*/
@Override
public boolean equals(Object obj)
{
if (obj == null) return false;
@ -1939,6 +1954,7 @@ public class DecimalFormat extends NumberFormat {
/**
* Overrides hashCode
*/
@Override
public int hashCode() {
return super.hashCode() * 37 + positivePrefix.hashCode();
// just enough fields for a reasonable distribution
@ -2668,6 +2684,7 @@ public class DecimalFormat extends NumberFormat {
* 309 is used. Negative input values are replaced with 0.
* @see NumberFormat#setMaximumIntegerDigits
*/
@Override
public void setMaximumIntegerDigits(int newValue) {
maximumIntegerDigits = Math.min(Math.max(0, newValue), MAXIMUM_INTEGER_DIGITS);
super.setMaximumIntegerDigits((maximumIntegerDigits > DOUBLE_INTEGER_DIGITS) ?
@ -2687,6 +2704,7 @@ public class DecimalFormat extends NumberFormat {
* 309 is used. Negative input values are replaced with 0.
* @see NumberFormat#setMinimumIntegerDigits
*/
@Override
public void setMinimumIntegerDigits(int newValue) {
minimumIntegerDigits = Math.min(Math.max(0, newValue), MAXIMUM_INTEGER_DIGITS);
super.setMinimumIntegerDigits((minimumIntegerDigits > DOUBLE_INTEGER_DIGITS) ?
@ -2706,6 +2724,7 @@ public class DecimalFormat extends NumberFormat {
* 340 is used. Negative input values are replaced with 0.
* @see NumberFormat#setMaximumFractionDigits
*/
@Override
public void setMaximumFractionDigits(int newValue) {
maximumFractionDigits = Math.min(Math.max(0, newValue), MAXIMUM_FRACTION_DIGITS);
super.setMaximumFractionDigits((maximumFractionDigits > DOUBLE_FRACTION_DIGITS) ?
@ -2725,6 +2744,7 @@ public class DecimalFormat extends NumberFormat {
* 340 is used. Negative input values are replaced with 0.
* @see NumberFormat#setMinimumFractionDigits
*/
@Override
public void setMinimumFractionDigits(int newValue) {
minimumFractionDigits = Math.min(Math.max(0, newValue), MAXIMUM_FRACTION_DIGITS);
super.setMinimumFractionDigits((minimumFractionDigits > DOUBLE_FRACTION_DIGITS) ?
@ -2744,6 +2764,7 @@ public class DecimalFormat extends NumberFormat {
* 309 is used.
* @see #setMaximumIntegerDigits
*/
@Override
public int getMaximumIntegerDigits() {
return maximumIntegerDigits;
}
@ -2756,6 +2777,7 @@ public class DecimalFormat extends NumberFormat {
* 309 is used.
* @see #setMinimumIntegerDigits
*/
@Override
public int getMinimumIntegerDigits() {
return minimumIntegerDigits;
}
@ -2768,6 +2790,7 @@ public class DecimalFormat extends NumberFormat {
* 340 is used.
* @see #setMaximumFractionDigits
*/
@Override
public int getMaximumFractionDigits() {
return maximumFractionDigits;
}
@ -2780,6 +2803,7 @@ public class DecimalFormat extends NumberFormat {
* 340 is used.
* @see #setMinimumFractionDigits
*/
@Override
public int getMinimumFractionDigits() {
return minimumFractionDigits;
}
@ -2794,6 +2818,7 @@ public class DecimalFormat extends NumberFormat {
* @return the currency used by this decimal format, or <code>null</code>
* @since 1.4
*/
@Override
public Currency getCurrency() {
return symbols.getCurrency();
}
@ -2810,6 +2835,7 @@ public class DecimalFormat extends NumberFormat {
* @exception NullPointerException if <code>currency</code> is null
* @since 1.4
*/
@Override
public void setCurrency(Currency currency) {
if (currency != symbols.getCurrency()) {
symbols.setCurrency(currency);
@ -2826,6 +2852,7 @@ public class DecimalFormat extends NumberFormat {
* @see #setRoundingMode(RoundingMode)
* @since 1.6
*/
@Override
public RoundingMode getRoundingMode() {
return roundingMode;
}
@ -2838,6 +2865,7 @@ public class DecimalFormat extends NumberFormat {
* @exception NullPointerException if <code>roundingMode</code> is null.
* @since 1.6
*/
@Override
public void setRoundingMode(RoundingMode roundingMode) {
if (roundingMode == null) {
throw new NullPointerException();
@ -2847,35 +2875,6 @@ public class DecimalFormat extends NumberFormat {
digitList.setRoundingMode(roundingMode);
}
/**
* Adjusts the minimum and maximum fraction digits to values that
* are reasonable for the currency's default fraction digits.
*/
void adjustForCurrencyDefaultFractionDigits() {
Currency currency = symbols.getCurrency();
if (currency == null) {
try {
currency = Currency.getInstance(symbols.getInternationalCurrencySymbol());
} catch (IllegalArgumentException e) {
}
}
if (currency != null) {
int digits = currency.getDefaultFractionDigits();
if (digits != -1) {
int oldMinDigits = getMinimumFractionDigits();
// Common patterns are "#.##", "#.00", "#".
// Try to adjust all of them in a reasonable way.
if (oldMinDigits == getMaximumFractionDigits()) {
setMinimumFractionDigits(digits);
setMaximumFractionDigits(digits);
} else {
setMinimumFractionDigits(Math.min(digits, oldMinDigits));
setMaximumFractionDigits(digits);
}
}
}
}
/**
* Reads the default serializable fields from the stream and performs
* validations and adjustments for older serialized versions. The
@ -3270,5 +3269,5 @@ public class DecimalFormat extends NumberFormat {
* Cache to hold the NumberPattern of a Locale.
*/
private static final ConcurrentMap<Locale, String> cachedLocaleData
= new ConcurrentHashMap<Locale, String>(3);
= new ConcurrentHashMap<>(3);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -44,11 +44,12 @@ import java.io.Serializable;
import java.text.spi.DecimalFormatSymbolsProvider;
import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.concurrent.ConcurrentHashMap;
import sun.util.LocaleServiceProviderPool;
import sun.util.resources.LocaleData;
import java.util.concurrent.ConcurrentMap;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
/**
* This class represents the set of symbols (such as the decimal separator,
@ -87,6 +88,14 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
* implementations. For full locale coverage, use the
* {@link #getInstance(Locale) getInstance} method.
* If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
* for the numbering system, the instance is initialized with the specified numbering
* system if the JRE implementation supports it. For example,
* <pre>
* NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
* </pre>
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* instead of the Latin numbering system.
*
* @exception NullPointerException if <code>locale</code> is null
*/
@ -135,26 +144,29 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* as for those supported by installed
* {@link java.text.spi.DecimalFormatSymbolsProvider
* DecimalFormatSymbolsProvider} implementations.
* If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
* for the numbering system, the instance is initialized with the specified numbering
* system if the JRE implementation supports it. For example,
* <pre>
* NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
* </pre>
* This may return a {@code NumberFormat} instance with the Thai numbering system,
* instead of the Latin numbering system.
* @param locale the desired locale.
* @return a <code>DecimalFormatSymbols</code> instance.
* @exception NullPointerException if <code>locale</code> is null
* @since 1.6
*/
public static final DecimalFormatSymbols getInstance(Locale locale) {
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
if (pool.hasProviders()) {
DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
DecimalFormatSymbolsGetter.INSTANCE, locale);
if (providersInstance != null) {
return providersInstance;
LocaleProviderAdapter adapter;
adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
DecimalFormatSymbolsProvider provider = adapter.getDecimalFormatSymbolsProvider();
DecimalFormatSymbols dfsyms = provider.getInstance(locale);
if (dfsyms == null) {
provider = LocaleProviderAdapter.forJRE().getDecimalFormatSymbolsProvider();
dfsyms = provider.getInstance(locale);
}
}
return new DecimalFormatSymbols(locale);
return dfsyms;
}
/**
@ -474,6 +486,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
* Standard override.
*/
@Override
public Object clone() {
try {
return (DecimalFormatSymbols)super.clone();
@ -486,6 +499,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
* Override equals.
*/
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) return true;
@ -512,6 +526,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
/**
* Override hashCode.
*/
@Override
public int hashCode() {
int result = zeroDigit;
result = result * 37 + groupingSeparator;
@ -529,16 +544,30 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
boolean needCacheUpdate = false;
Object[] data = cachedLocaleData.get(locale);
if (data == null) { /* cache miss */
// When numbering system is thai (Locale's extension contains u-nu-thai),
// we read the data from th_TH_TH.
Locale lookupLocale = locale;
String numberType = locale.getUnicodeLocaleType("nu");
if (numberType != null && numberType.equals("thai")) {
lookupLocale = new Locale("th", "TH", "TH");
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
// Avoid potential recursions
switch (adapter.getAdapterType()) {
case HOST:
case SPI:
adapter = LocaleProviderAdapter.getResourceBundleBased();
break;
}
ResourceBundle rb = adapter.getLocaleData().getNumberFormatData(locale);
data = new Object[3];
ResourceBundle rb = LocaleData.getNumberFormatData(lookupLocale);
String numberType = locale.getUnicodeLocaleType("nu");
StringBuilder numElemKey =
new StringBuilder(numberType != null ?
numberType : rb.getString("DefaultNumberingSystem"));
if (numElemKey.length() != 0) {
numElemKey.append(".");
}
numElemKey.append("NumberElements");
try {
data[0] = rb.getStringArray(numElemKey.toString());
} catch (MissingResourceException mre) {
// numberType must be bogus. Use the last resort numbering system.
data[0] = rb.getStringArray("NumberElements");
}
needCacheUpdate = true;
}
@ -561,7 +590,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
// Check for empty country string separately because it's a valid
// country ID for Locale (and used for the C locale), but not a valid
// ISO 3166 country code, and exceptions are expensive.
if (!"".equals(locale.getCountry())) {
if (locale.getCountry().length() > 0) {
try {
currency = Currency.getInstance(locale);
} catch (IllegalArgumentException e) {
@ -813,25 +842,6 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* cache to hold the NumberElements and the Currency
* of a Locale.
*/
private static final ConcurrentHashMap<Locale, Object[]> cachedLocaleData = new ConcurrentHashMap<Locale, Object[]>(3);
/**
* Obtains a DecimalFormatSymbols instance from a DecimalFormatSymbolsProvider
* implementation.
*/
private static class DecimalFormatSymbolsGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<DecimalFormatSymbolsProvider,
DecimalFormatSymbols> {
private static final DecimalFormatSymbolsGetter INSTANCE =
new DecimalFormatSymbolsGetter();
public DecimalFormatSymbols getObject(
DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 0;
return decimalFormatSymbolsProvider.getInstance(locale);
}
}
private static final ConcurrentMap<Locale, Object[]> cachedLocaleData
= new ConcurrentHashMap<>(3);
}

View file

@ -54,7 +54,8 @@ import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.spi.LocaleServiceProvider;
import sun.util.LocaleServiceProviderPool;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleServiceProviderPool;
import sun.util.resources.LocaleData;
/**
@ -232,6 +233,7 @@ public abstract class NumberFormat extends Format {
* mode being set to RoundingMode.UNNECESSARY
* @see java.text.FieldPosition
*/
@Override
public StringBuffer format(Object number,
StringBuffer toAppendTo,
FieldPosition pos) {
@ -272,6 +274,7 @@ public abstract class NumberFormat extends Format {
* error, returns null.
* @exception NullPointerException if <code>pos</code> is null.
*/
@Override
public final Object parseObject(String source, ParsePosition pos) {
return parse(source, pos);
}
@ -501,16 +504,18 @@ public abstract class NumberFormat extends Format {
}
/**
* Overrides hashCode
* Overrides hashCode.
*/
@Override
public int hashCode() {
return maximumIntegerDigits * 37 + maxFractionDigits;
// just enough fields for a reasonable distribution
}
/**
* Overrides equals
* Overrides equals.
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
@ -531,8 +536,9 @@ public abstract class NumberFormat extends Format {
}
/**
* Overrides Cloneable
* Overrides Cloneable.
*/
@Override
public Object clone() {
NumberFormat other = (NumberFormat) super.clone();
return other;
@ -741,42 +747,36 @@ public abstract class NumberFormat extends Format {
private static NumberFormat getInstance(Locale desiredLocale,
int choice) {
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(NumberFormatProvider.class);
if (pool.hasProviders()) {
NumberFormat providersInstance = pool.getLocalizedObject(
NumberFormatGetter.INSTANCE,
desiredLocale,
choice);
if (providersInstance != null) {
return providersInstance;
LocaleProviderAdapter adapter;
adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
desiredLocale);
NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
if (numberFormat == null) {
numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
desiredLocale, choice);
}
return numberFormat;
}
/* try the cache first */
String[] numberPatterns = cachedLocaleData.get(desiredLocale);
if (numberPatterns == null) { /* cache miss */
ResourceBundle resource = LocaleData.getNumberFormatData(desiredLocale);
numberPatterns = resource.getStringArray("NumberPatterns");
/* update cache */
cachedLocaleData.put(desiredLocale, numberPatterns);
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
Locale locale, int choice) {
NumberFormatProvider provider = adapter.getNumberFormatProvider();
NumberFormat numberFormat = null;
switch (choice) {
case NUMBERSTYLE:
numberFormat = provider.getNumberInstance(locale);
break;
case PERCENTSTYLE:
numberFormat = provider.getPercentInstance(locale);
break;
case CURRENCYSTYLE:
numberFormat = provider.getCurrencyInstance(locale);
break;
case INTEGERSTYLE:
numberFormat = provider.getIntegerInstance(locale);
break;
}
DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(desiredLocale);
int entry = (choice == INTEGERSTYLE) ? NUMBERSTYLE : choice;
DecimalFormat format = new DecimalFormat(numberPatterns[entry], symbols);
if (choice == INTEGERSTYLE) {
format.setMaximumFractionDigits(0);
format.setDecimalSeparatorAlwaysShown(false);
format.setParseIntegerOnly(true);
} else if (choice == CURRENCYSTYLE) {
format.adjustForCurrencyDefaultFractionDigits();
}
return format;
return numberFormat;
}
/**
@ -841,11 +841,6 @@ public abstract class NumberFormat extends Format {
stream.defaultWriteObject();
}
/**
* Cache to hold the NumberPatterns of a Locale.
*/
private static final Hashtable<Locale, String[]> cachedLocaleData = new Hashtable<>(3);
// Constants used by factory methods to specify a style of format.
private static final int NUMBERSTYLE = 0;
private static final int CURRENCYSTYLE = 1;
@ -1056,6 +1051,7 @@ public abstract class NumberFormat extends Format {
* @throws InvalidObjectException if the constant could not be resolved.
* @return resolved NumberFormat.Field constant
*/
@Override
protected Object readResolve() throws InvalidObjectException {
if (this.getClass() != NumberFormat.Field.class) {
throw new InvalidObjectException("subclass didn't correctly implement readResolve");
@ -1127,36 +1123,4 @@ public abstract class NumberFormat extends Format {
*/
public static final Field EXPONENT_SIGN = new Field("exponent sign");
}
/**
* Obtains a NumberFormat instance from a NumberFormatProvider implementation.
*/
private static class NumberFormatGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<NumberFormatProvider,
NumberFormat> {
private static final NumberFormatGetter INSTANCE = new NumberFormatGetter();
public NumberFormat getObject(NumberFormatProvider numberFormatProvider,
Locale locale,
String key,
Object... params) {
assert params.length == 1;
int choice = (Integer)params[0];
switch (choice) {
case NUMBERSTYLE:
return numberFormatProvider.getNumberInstance(locale);
case PERCENTSTYLE:
return numberFormatProvider.getPercentInstance(locale);
case CURRENCYSTYLE:
return numberFormatProvider.getCurrencyInstance(locale);
case INTEGERSTYLE:
return numberFormatProvider.getIntegerInstance(locale);
default:
assert false : choice;
}
return null;
}
}
}

View file

@ -41,22 +41,19 @@ package java.text;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import static java.text.DateFormatSymbols.*;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.CalendarUtils;
import sun.util.calendar.ZoneInfoFile;
import sun.util.resources.LocaleData;
import static java.text.DateFormatSymbols.*;
/**
* <code>SimpleDateFormat</code> is a concrete class for formatting and
@ -117,95 +114,100 @@ import static java.text.DateFormatSymbols.*;
* <td><code>2009</code>; <code>09</code>
* <tr bgcolor="#eeeeff">
* <td><code>M</code>
* <td>Month in year
* <td>Month in year (context sensitive)
* <td><a href="#month">Month</a>
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
* <tr>
* <td><code>L</code>
* <td>Month in year (standalone form)
* <td><a href="#month">Month</a>
* <td><code>July</code>; <code>Jul</code>; <code>07</code>
* <tr bgcolor="#eeeeff">
* <td><code>w</code>
* <td>Week in year
* <td><a href="#number">Number</a>
* <td><code>27</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>W</code>
* <td>Week in month
* <td><a href="#number">Number</a>
* <td><code>2</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>D</code>
* <td>Day in year
* <td><a href="#number">Number</a>
* <td><code>189</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>d</code>
* <td>Day in month
* <td><a href="#number">Number</a>
* <td><code>10</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>F</code>
* <td>Day of week in month
* <td><a href="#number">Number</a>
* <td><code>2</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>E</code>
* <td>Day name in week
* <td><a href="#text">Text</a>
* <td><code>Tuesday</code>; <code>Tue</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>u</code>
* <td>Day number of week (1 = Monday, ..., 7 = Sunday)
* <td><a href="#number">Number</a>
* <td><code>1</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>a</code>
* <td>Am/pm marker
* <td><a href="#text">Text</a>
* <td><code>PM</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>H</code>
* <td>Hour in day (0-23)
* <td><a href="#number">Number</a>
* <td><code>0</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>k</code>
* <td>Hour in day (1-24)
* <td><a href="#number">Number</a>
* <td><code>24</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>K</code>
* <td>Hour in am/pm (0-11)
* <td><a href="#number">Number</a>
* <td><code>0</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>h</code>
* <td>Hour in am/pm (1-12)
* <td><a href="#number">Number</a>
* <td><code>12</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>m</code>
* <td>Minute in hour
* <td><a href="#number">Number</a>
* <td><code>30</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>s</code>
* <td>Second in minute
* <td><a href="#number">Number</a>
* <td><code>55</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>S</code>
* <td>Millisecond
* <td><a href="#number">Number</a>
* <td><code>978</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>z</code>
* <td>Time zone
* <td><a href="#timezone">General time zone</a>
* <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
* <tr>
* <tr bgcolor="#eeeeff">
* <td><code>Z</code>
* <td>Time zone
* <td><a href="#rfc822timezone">RFC 822 time zone</a>
* <td><code>-0800</code>
* <tr bgcolor="#eeeeff">
* <tr>
* <td><code>X</code>
* <td>Time zone
* <td><a href="#iso8601timezone">ISO 8601 time zone</a>
@ -270,7 +272,17 @@ import static java.text.DateFormatSymbols.*;
* <li><strong><a name="month">Month:</a></strong>
* If the number of pattern letters is 3 or more, the month is
* interpreted as <a href="#text">text</a>; otherwise,
* it is interpreted as a <a href="#number">number</a>.<br><br></li>
* it is interpreted as a <a href="#number">number</a>.<br>
* <ul>
* <li>Letter <em>M</em> produces context-sensitive month names, such as the
* embedded form of names. If a {@code DateFormatSymbols} has been set
* explicitly with constructor {@link #SimpleDateFormat(String,
* DateFormatSymbols)} or method {@link
* #setDateFormatSymbols(DateFormatSymbols)}, the month names given by
* the {@code DateFormatSymbols} are used.</li>
* <li>Letter <em>L</em> produces the standalone form of month names.</li>
* </ul>
* <br></li>
* <li><strong><a name="timezone">General time zone:</a></strong>
* Time zones are interpreted as <a href="#text">text</a> if they have
* names. For time zones representing a GMT offset value, the
@ -458,6 +470,11 @@ public class SimpleDateFormat extends DateFormat {
*/
transient private boolean hasFollowingMinusSign = false;
/**
* True if standalone form needs to be used.
*/
transient private boolean forceStandaloneForm = false;
/**
* The compiled pattern.
*/
@ -501,17 +518,11 @@ public class SimpleDateFormat extends DateFormat {
// GMT-minutes. For instance, in France the time zone is GMT+60.
private static final String GMT = "GMT";
/**
* Cache to hold the DateTimePatterns of a Locale.
*/
private static final ConcurrentMap<Locale, String[]> cachedLocaleData
= new ConcurrentHashMap<Locale, String[]>(3);
/**
* Cache NumberFormat instances with Locale key.
*/
private static final ConcurrentMap<Locale, NumberFormat> cachedNumberFormatData
= new ConcurrentHashMap<Locale, NumberFormat>(3);
= new ConcurrentHashMap<>(3);
/**
* The Locale used to instantiate this
@ -541,7 +552,9 @@ public class SimpleDateFormat extends DateFormat {
* class.
*/
public SimpleDateFormat() {
this(SHORT, SHORT, Locale.getDefault(Locale.Category.FORMAT));
this("", Locale.getDefault(Locale.Category.FORMAT));
applyPatternImpl(LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale)
.getDateTimePattern(SHORT, SHORT, calendar));
}
/**
@ -608,51 +621,6 @@ public class SimpleDateFormat extends DateFormat {
useDateFormatSymbols = true;
}
/* Package-private, called by DateFormat factory methods */
SimpleDateFormat(int timeStyle, int dateStyle, Locale loc) {
if (loc == null) {
throw new NullPointerException();
}
this.locale = loc;
// initialize calendar and related fields
initializeCalendar(loc);
/* try the cache first */
String[] dateTimePatterns = cachedLocaleData.get(loc);
if (dateTimePatterns == null) { /* cache miss */
ResourceBundle r = LocaleData.getDateFormatData(loc);
if (!isGregorianCalendar()) {
try {
dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
} catch (MissingResourceException e) {
}
}
if (dateTimePatterns == null) {
dateTimePatterns = r.getStringArray("DateTimePatterns");
}
/* update cache */
cachedLocaleData.putIfAbsent(loc, dateTimePatterns);
}
formatData = DateFormatSymbols.getInstanceRef(loc);
if ((timeStyle >= 0) && (dateStyle >= 0)) {
Object[] dateTimeArgs = {dateTimePatterns[timeStyle],
dateTimePatterns[dateStyle + 4]};
pattern = MessageFormat.format(dateTimePatterns[8], dateTimeArgs);
}
else if (timeStyle >= 0) {
pattern = dateTimePatterns[timeStyle];
}
else if (dateStyle >= 0) {
pattern = dateTimePatterns[dateStyle + 4];
}
else {
throw new IllegalArgumentException("No date or time style specified");
}
initialize(loc);
}
/* Initialize compiledPattern and numberFormat fields */
private void initialize(Locale loc) {
// Verify and compile the given pattern.
@ -750,10 +718,10 @@ public class SimpleDateFormat extends DateFormat {
private char[] compile(String pattern) {
int length = pattern.length();
boolean inQuote = false;
StringBuilder compiledPattern = new StringBuilder(length * 2);
StringBuilder compiledCode = new StringBuilder(length * 2);
StringBuilder tmpBuffer = null;
int count = 0;
int lastTag = -1;
int count = 0, tagcount = 0;
int lastTag = -1, prevTag = -1;
for (int i = 0; i < length; i++) {
char c = pattern.charAt(i);
@ -766,21 +734,25 @@ public class SimpleDateFormat extends DateFormat {
if (c == '\'') {
i++;
if (count != 0) {
encode(lastTag, count, compiledPattern);
encode(lastTag, count, compiledCode);
tagcount++;
prevTag = lastTag;
lastTag = -1;
count = 0;
}
if (inQuote) {
tmpBuffer.append(c);
} else {
compiledPattern.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | c));
compiledCode.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | c));
}
continue;
}
}
if (!inQuote) {
if (count != 0) {
encode(lastTag, count, compiledPattern);
encode(lastTag, count, compiledCode);
tagcount++;
prevTag = lastTag;
lastTag = -1;
count = 0;
}
@ -795,14 +767,14 @@ public class SimpleDateFormat extends DateFormat {
if (len == 1) {
char ch = tmpBuffer.charAt(0);
if (ch < 128) {
compiledPattern.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | ch));
compiledCode.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | ch));
} else {
compiledPattern.append((char)(TAG_QUOTE_CHARS << 8 | 1));
compiledPattern.append(ch);
compiledCode.append((char)(TAG_QUOTE_CHARS << 8 | 1));
compiledCode.append(ch);
}
} else {
encode(TAG_QUOTE_CHARS, len, compiledPattern);
compiledPattern.append(tmpBuffer);
encode(TAG_QUOTE_CHARS, len, compiledCode);
compiledCode.append(tmpBuffer);
}
inQuote = false;
}
@ -814,13 +786,15 @@ public class SimpleDateFormat extends DateFormat {
}
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
if (count != 0) {
encode(lastTag, count, compiledPattern);
encode(lastTag, count, compiledCode);
tagcount++;
prevTag = lastTag;
lastTag = -1;
count = 0;
}
if (c < 128) {
// In most cases, c would be a delimiter, such as ':'.
compiledPattern.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | c));
compiledCode.append((char)(TAG_QUOTE_ASCII_CHAR << 8 | c));
} else {
// Take any contiguous non-ASCII alphabet characters and
// put them in a single TAG_QUOTE_CHARS.
@ -831,9 +805,9 @@ public class SimpleDateFormat extends DateFormat {
break;
}
}
compiledPattern.append((char)(TAG_QUOTE_CHARS << 8 | (j - i)));
compiledCode.append((char)(TAG_QUOTE_CHARS << 8 | (j - i)));
for (; i < j; i++) {
compiledPattern.append(pattern.charAt(i));
compiledCode.append(pattern.charAt(i));
}
i--;
}
@ -850,7 +824,9 @@ public class SimpleDateFormat extends DateFormat {
count++;
continue;
}
encode(lastTag, count, compiledPattern);
encode(lastTag, count, compiledCode);
tagcount++;
prevTag = lastTag;
lastTag = tag;
count = 1;
}
@ -860,20 +836,24 @@ public class SimpleDateFormat extends DateFormat {
}
if (count != 0) {
encode(lastTag, count, compiledPattern);
encode(lastTag, count, compiledCode);
tagcount++;
prevTag = lastTag;
}
forceStandaloneForm = (tagcount == 1 && prevTag == PATTERN_MONTH);
// Copy the compiled pattern to a char array
int len = compiledPattern.length();
int len = compiledCode.length();
char[] r = new char[len];
compiledPattern.getChars(0, len, r, 0);
compiledCode.getChars(0, len, r, 0);
return r;
}
/**
* Encodes the given tag and length and puts encoded char(s) into buffer.
*/
private static final void encode(int tag, int length, StringBuilder buffer) {
private static void encode(int tag, int length, StringBuilder buffer) {
if (tag == PATTERN_ISO_ZONE && length >= 4) {
throw new IllegalArgumentException("invalid ISO 8601 format: length=" + length);
}
@ -941,6 +921,7 @@ public class SimpleDateFormat extends DateFormat {
* @return the formatted date-time string.
* @exception NullPointerException if the given {@code date} is {@code null}.
*/
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo,
FieldPosition pos)
{
@ -999,6 +980,7 @@ public class SimpleDateFormat extends DateFormat {
* @return AttributedCharacterIterator describing the formatted value.
* @since 1.4
*/
@Override
public AttributedCharacterIterator formatToCharacterIterator(Object obj) {
StringBuffer sb = new StringBuffer();
CharacterIteratorFieldDelegate delegate = new
@ -1022,47 +1004,84 @@ public class SimpleDateFormat extends DateFormat {
}
// Map index into pattern character string to Calendar field number
private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD =
{
Calendar.ERA, Calendar.YEAR, Calendar.MONTH, Calendar.DATE,
Calendar.HOUR_OF_DAY, Calendar.HOUR_OF_DAY, Calendar.MINUTE,
Calendar.SECOND, Calendar.MILLISECOND, Calendar.DAY_OF_WEEK,
Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK_IN_MONTH,
Calendar.WEEK_OF_YEAR, Calendar.WEEK_OF_MONTH,
Calendar.AM_PM, Calendar.HOUR, Calendar.HOUR, Calendar.ZONE_OFFSET,
private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD = {
Calendar.ERA,
Calendar.YEAR,
Calendar.MONTH,
Calendar.DATE,
Calendar.HOUR_OF_DAY,
Calendar.HOUR_OF_DAY,
Calendar.MINUTE,
Calendar.SECOND,
Calendar.MILLISECOND,
Calendar.DAY_OF_WEEK,
Calendar.DAY_OF_YEAR,
Calendar.DAY_OF_WEEK_IN_MONTH,
Calendar.WEEK_OF_YEAR,
Calendar.WEEK_OF_MONTH,
Calendar.AM_PM,
Calendar.HOUR,
Calendar.HOUR,
Calendar.ZONE_OFFSET,
// Pseudo Calendar fields
CalendarBuilder.WEEK_YEAR,
CalendarBuilder.ISO_DAY_OF_WEEK,
Calendar.ZONE_OFFSET
Calendar.ZONE_OFFSET,
CalendarBuilder.WEEK_YEAR, // Pseudo Calendar field
CalendarBuilder.ISO_DAY_OF_WEEK, // Pseudo Calendar field
Calendar.ZONE_OFFSET,
Calendar.MONTH
};
// Map index into pattern character string to DateFormat field number
private static final int[] PATTERN_INDEX_TO_DATE_FORMAT_FIELD = {
DateFormat.ERA_FIELD, DateFormat.YEAR_FIELD, DateFormat.MONTH_FIELD,
DateFormat.DATE_FIELD, DateFormat.HOUR_OF_DAY1_FIELD,
DateFormat.HOUR_OF_DAY0_FIELD, DateFormat.MINUTE_FIELD,
DateFormat.SECOND_FIELD, DateFormat.MILLISECOND_FIELD,
DateFormat.DAY_OF_WEEK_FIELD, DateFormat.DAY_OF_YEAR_FIELD,
DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD, DateFormat.WEEK_OF_YEAR_FIELD,
DateFormat.WEEK_OF_MONTH_FIELD, DateFormat.AM_PM_FIELD,
DateFormat.HOUR1_FIELD, DateFormat.HOUR0_FIELD,
DateFormat.TIMEZONE_FIELD, DateFormat.TIMEZONE_FIELD,
DateFormat.YEAR_FIELD, DateFormat.DAY_OF_WEEK_FIELD,
DateFormat.TIMEZONE_FIELD
DateFormat.ERA_FIELD,
DateFormat.YEAR_FIELD,
DateFormat.MONTH_FIELD,
DateFormat.DATE_FIELD,
DateFormat.HOUR_OF_DAY1_FIELD,
DateFormat.HOUR_OF_DAY0_FIELD,
DateFormat.MINUTE_FIELD,
DateFormat.SECOND_FIELD,
DateFormat.MILLISECOND_FIELD,
DateFormat.DAY_OF_WEEK_FIELD,
DateFormat.DAY_OF_YEAR_FIELD,
DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD,
DateFormat.WEEK_OF_YEAR_FIELD,
DateFormat.WEEK_OF_MONTH_FIELD,
DateFormat.AM_PM_FIELD,
DateFormat.HOUR1_FIELD,
DateFormat.HOUR0_FIELD,
DateFormat.TIMEZONE_FIELD,
DateFormat.TIMEZONE_FIELD,
DateFormat.YEAR_FIELD,
DateFormat.DAY_OF_WEEK_FIELD,
DateFormat.TIMEZONE_FIELD,
DateFormat.MONTH_FIELD
};
// Maps from DecimalFormatSymbols index to Field constant
private static final Field[] PATTERN_INDEX_TO_DATE_FORMAT_FIELD_ID = {
Field.ERA, Field.YEAR, Field.MONTH, Field.DAY_OF_MONTH,
Field.HOUR_OF_DAY1, Field.HOUR_OF_DAY0, Field.MINUTE,
Field.SECOND, Field.MILLISECOND, Field.DAY_OF_WEEK,
Field.DAY_OF_YEAR, Field.DAY_OF_WEEK_IN_MONTH,
Field.WEEK_OF_YEAR, Field.WEEK_OF_MONTH,
Field.AM_PM, Field.HOUR1, Field.HOUR0, Field.TIME_ZONE,
Field.ERA,
Field.YEAR,
Field.MONTH,
Field.DAY_OF_MONTH,
Field.HOUR_OF_DAY1,
Field.HOUR_OF_DAY0,
Field.MINUTE,
Field.SECOND,
Field.MILLISECOND,
Field.DAY_OF_WEEK,
Field.DAY_OF_YEAR,
Field.DAY_OF_WEEK_IN_MONTH,
Field.WEEK_OF_YEAR,
Field.WEEK_OF_MONTH,
Field.AM_PM,
Field.HOUR1,
Field.HOUR0,
Field.TIME_ZONE,
Field.YEAR, Field.DAY_OF_WEEK,
Field.TIME_ZONE
Field.TIME_ZONE,
Field.YEAR,
Field.DAY_OF_WEEK,
Field.TIME_ZONE,
Field.MONTH
};
/**
@ -1094,7 +1113,8 @@ public class SimpleDateFormat extends DateFormat {
}
int style = (count >= 4) ? Calendar.LONG : Calendar.SHORT;
if (!useDateFormatSymbols && field != CalendarBuilder.ISO_DAY_OF_WEEK) {
if (!useDateFormatSymbols && field < Calendar.ZONE_OFFSET
&& patternCharIndex != PATTERN_MONTH_STANDALONE) {
current = calendar.getDisplayName(field, style, locale);
}
@ -1106,20 +1126,23 @@ public class SimpleDateFormat extends DateFormat {
case PATTERN_ERA: // 'G'
if (useDateFormatSymbols) {
String[] eras = formatData.getEras();
if (value < eras.length)
if (value < eras.length) {
current = eras[value];
}
if (current == null)
}
if (current == null) {
current = "";
}
break;
case PATTERN_WEEK_YEAR: // 'Y'
case PATTERN_YEAR: // 'y'
if (calendar instanceof GregorianCalendar) {
if (count != 2)
if (count != 2) {
zeroPaddingNumber(value, count, maxIntCount, buffer);
else // count == 2
zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
} else {
zeroPaddingNumber(value, 2, 2, buffer);
} // clip 1996 to 96
} else {
if (current == null) {
zeroPaddingNumber(value, style == Calendar.LONG ? 1 : count,
@ -1128,7 +1151,7 @@ public class SimpleDateFormat extends DateFormat {
}
break;
case PATTERN_MONTH: // 'M'
case PATTERN_MONTH: // 'M' (context seinsive)
if (useDateFormatSymbols) {
String[] months;
if (count >= 4) {
@ -1141,6 +1164,32 @@ public class SimpleDateFormat extends DateFormat {
} else {
if (count < 3) {
current = null;
} else if (forceStandaloneForm) {
current = calendar.getDisplayName(field, style | 0x8000, locale);
if (current == null) {
current = calendar.getDisplayName(field, style, locale);
}
}
}
if (current == null) {
zeroPaddingNumber(value+1, count, maxIntCount, buffer);
}
break;
case PATTERN_MONTH_STANDALONE: // 'L'
assert current == null;
if (locale == null) {
String[] months;
if (count >= 4) {
months = formatData.getMonths();
current = months[value];
} else if (count == 3) {
months = formatData.getShortMonths();
current = months[value];
}
} else {
if (count >= 3) {
current = calendar.getDisplayName(field, style | 0x8000, locale);
}
}
if (current == null) {
@ -1150,12 +1199,13 @@ public class SimpleDateFormat extends DateFormat {
case PATTERN_HOUR_OF_DAY1: // 'k' 1-based. eg, 23:59 + 1 hour =>> 24:59
if (current == null) {
if (value == 0)
if (value == 0) {
zeroPaddingNumber(calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1,
count, maxIntCount, buffer);
else
} else {
zeroPaddingNumber(value, count, maxIntCount, buffer);
}
}
break;
case PATTERN_DAY_OF_WEEK: // 'E'
@ -1180,12 +1230,13 @@ public class SimpleDateFormat extends DateFormat {
case PATTERN_HOUR1: // 'h' 1-based. eg, 11PM + 1 hour =>> 12 AM
if (current == null) {
if (value == 0)
if (value == 0) {
zeroPaddingNumber(calendar.getLeastMaximum(Calendar.HOUR) + 1,
count, maxIntCount, buffer);
else
} else {
zeroPaddingNumber(value, count, maxIntCount, buffer);
}
}
break;
case PATTERN_ZONE_NAME: // 'z'
@ -1289,7 +1340,7 @@ public class SimpleDateFormat extends DateFormat {
/**
* Formats a number with the specified minimum and maximum number of digits.
*/
private final void zeroPaddingNumber(int value, int minDigits, int maxDigits, StringBuffer buffer)
private void zeroPaddingNumber(int value, int minDigits, int maxDigits, StringBuffer buffer)
{
// Optimization for 1, 2 and 4 digit numbers. This should
// cover most cases of formatting date/time related items.
@ -1371,6 +1422,7 @@ public class SimpleDateFormat extends DateFormat {
* error, returns null.
* @exception NullPointerException if <code>text</code> or <code>pos</code> is null.
*/
@Override
public Date parse(String text, ParsePosition pos)
{
checkNegativeNumberExpression();
@ -1504,7 +1556,9 @@ public class SimpleDateFormat extends DateFormat {
int i = 0;
int count = data.length;
if (field == Calendar.DAY_OF_WEEK) i = 1;
if (field == Calendar.DAY_OF_WEEK) {
i = 1;
}
// There may be multiple strings in the data[] array which begin with
// the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
@ -1767,7 +1821,9 @@ public class SimpleDateFormat extends DateFormat {
return -1;
}
char c = text.charAt(pos.index);
if (c != ' ' && c != '\t') break;
if (c != ' ' && c != '\t') {
break;
}
++pos.index;
}
@ -1912,8 +1968,9 @@ public class SimpleDateFormat extends DateFormat {
}
}
// [We computed 'value' above.]
if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY)+1)
if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1) {
value = 0;
}
calb.set(Calendar.HOUR_OF_DAY, value);
return pos.index;
@ -1966,8 +2023,9 @@ public class SimpleDateFormat extends DateFormat {
}
}
// [We computed 'value' above.]
if (value == calendar.getLeastMaximum(Calendar.HOUR)+1)
if (value == calendar.getLeastMaximum(Calendar.HOUR) + 1) {
value = 0;
}
calb.set(Calendar.HOUR, value);
return pos.index;
@ -2111,19 +2169,12 @@ public class SimpleDateFormat extends DateFormat {
return -1;
}
private final String getCalendarName() {
return calendar.getClass().getName();
}
/**
* Returns true if the DateFormatSymbols has been set explicitly or locale
* is null.
*/
private boolean useDateFormatSymbols() {
if (useDateFormatSymbols) {
return true;
}
return isGregorianCalendar() || locale == null;
}
private boolean isGregorianCalendar() {
return "java.util.GregorianCalendar".equals(getCalendarName());
return useDateFormatSymbols || locale == null;
}
/**
@ -2138,13 +2189,14 @@ public class SimpleDateFormat extends DateFormat {
for (int i = 0; i < pattern.length(); ++i) {
char c = pattern.charAt(i);
if (inQuote) {
if (c == '\'')
if (c == '\'') {
inQuote = false;
}
}
else {
if (c == '\'')
if (c == '\'') {
inQuote = true;
else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
int ci = from.indexOf(c);
if (ci >= 0) {
// patternChars is longer than localPatternChars due
@ -2162,8 +2214,9 @@ public class SimpleDateFormat extends DateFormat {
}
result.append(c);
}
if (inQuote)
if (inQuote) {
throw new IllegalArgumentException("Unfinished quote in pattern");
}
return result.toString();
}
@ -2196,6 +2249,10 @@ public class SimpleDateFormat extends DateFormat {
*/
public void applyPattern(String pattern)
{
applyPatternImpl(pattern);
}
private void applyPatternImpl(String pattern) {
compiledPattern = compile(pattern);
this.pattern = pattern;
}
@ -2246,6 +2303,7 @@ public class SimpleDateFormat extends DateFormat {
*
* @return a clone of this <code>SimpleDateFormat</code>
*/
@Override
public Object clone() {
SimpleDateFormat other = (SimpleDateFormat) super.clone();
other.formatData = (DateFormatSymbols) formatData.clone();
@ -2257,6 +2315,7 @@ public class SimpleDateFormat extends DateFormat {
*
* @return the hash code value for this <code>SimpleDateFormat</code> object.
*/
@Override
public int hashCode()
{
return pattern.hashCode();
@ -2270,9 +2329,12 @@ public class SimpleDateFormat extends DateFormat {
* @return true if the given object is equal to this
* <code>SimpleDateFormat</code>
*/
@Override
public boolean equals(Object obj)
{
if (!super.equals(obj)) return false; // super does class check
if (!super.equals(obj)) {
return false; // super does class check
}
SimpleDateFormat that = (SimpleDateFormat) obj;
return (pattern.equals(that.pattern)
&& formatData.equals(that.formatData));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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,7 +34,17 @@ import java.util.spi.LocaleServiceProvider;
* provide instances of the
* {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} class.
*
* <p>The requested {@code Locale} may contain an <a
* href="../../util/Locale.html#def_locale_extension"> extension</a> for
* specifying the desired numbering system. For example, {@code "ar-u-nu-arab"}
* (in the BCP 47 language tag form) specifies Arabic with the Arabic-Indic
* digits and symbols, while {@code "ar-u-nu-latn"} specifies Arabic with the
* Latin digits and symbols. Refer to the <em>Unicode Locale Data Markup
* Language (LDML)</em> specification for numbering systems.
*
* @since 1.6
* @see Locale#forLanguageTag(String)
* @see Locale#getExtension(char)
*/
public abstract class DecimalFormatSymbolsProvider extends LocaleServiceProvider {

View file

@ -53,9 +53,11 @@ import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.spi.CalendarDataProvider;
import sun.util.BuddhistCalendar;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.ZoneInfo;
import sun.util.resources.LocaleData;
import sun.util.locale.provider.CalendarDataUtility;
/**
* The <code>Calendar</code> class is an abstract class that provides methods
@ -707,17 +709,24 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* getDisplayNames} indicating names in all styles, such as
* "January" and "Jan".
*
* @see #SHORT_FORMAT
* @see #LONG_FORMAT
* @see #SHORT_STANDALONE
* @see #LONG_STANDALONE
* @see #SHORT
* @see #LONG
* @since 1.6
*/
public static final int ALL_STYLES = 0;
static final int STANDALONE_MASK = 0x8000;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a short name, such as "Jan".
* getDisplayNames} equivalent to {@link #SHORT_FORMAT}.
*
* @see #SHORT_STANDALONE
* @see #LONG
* @since 1.6
*/
@ -726,13 +735,64 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a long name, such as "January".
* getDisplayNames} equivalent to {@link #LONG_FORMAT}.
*
* @see #LONG_STANDALONE
* @see #SHORT
* @since 1.6
*/
public static final int LONG = 2;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a short name used for format.
*
* @see #SHORT_STANDALONE
* @see #LONG_FORMAT
* @see #LONG_STANDALONE
* @since 1.8
*/
public static final int SHORT_FORMAT = 1;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a long name used for format.
*
* @see #LONG_STANDALONE
* @see #SHORT_FORMAT
* @see #SHORT_STANDALONE
* @since 1.8
*/
public static final int LONG_FORMAT = 2;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a short name used independently,
* such as a month abbreviation as calendar headers.
*
* @see #SHORT_FORMAT
* @see #LONG_FORMAT
* @see #LONG_STANDALONE
* @since 1.8
*/
public static final int SHORT_STANDALONE = SHORT | STANDALONE_MASK;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a long name used independently,
* such as a month name as calendar headers.
*
* @see #LONG_FORMAT
* @see #SHORT_FORMAT
* @see #SHORT_STANDALONE
* @since 1.8
*/
public static final int LONG_STANDALONE = LONG | STANDALONE_MASK;
// Internal notes:
// Calendar contains two kinds of time representations: current "time" in
// milliseconds, and a set of calendar "fields" representing the current time.
@ -750,6 +810,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* <code>ERA</code> through <code>DST_OFFSET</code>.
* @serial
*/
@SuppressWarnings("ProtectedField")
protected int fields[];
/**
@ -760,6 +821,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* <code>ERA</code> through <code>DST_OFFSET</code>.
* @serial
*/
@SuppressWarnings("ProtectedField")
protected boolean isSet[];
/**
@ -775,6 +837,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @see #isTimeSet
* @serial
*/
@SuppressWarnings("ProtectedField")
protected long time;
/**
@ -783,6 +846,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @see #time
* @serial
*/
@SuppressWarnings("ProtectedField")
protected boolean isTimeSet;
/**
@ -792,6 +856,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* <code>time</code>.
* @serial
*/
@SuppressWarnings("ProtectedField")
protected boolean areFieldsSet;
/**
@ -910,6 +975,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
static final long serialVersionUID = -1807547505821590642L;
// Mask values for calendar fields
@SuppressWarnings("PointlessBitwiseExpression")
final static int ERA_MASK = (1 << ERA);
final static int YEAR_MASK = (1 << YEAR);
final static int MONTH_MASK = (1 << MONTH);
@ -1018,27 +1084,38 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
{
Calendar cal = null;
if (aLocale.hasExtensions()) {
String caltype = aLocale.getUnicodeLocaleType("ca");
if (caltype == null) {
// Calendar type is not specified.
// If the specified locale is a Thai locale,
// returns a BuddhistCalendar instance.
if ("th".equals(aLocale.getLanguage())
&& ("TH".equals(aLocale.getCountry()))) {
if (caltype != null) {
switch (caltype) {
case "buddhist":
cal = new BuddhistCalendar(zone, aLocale);
} else {
cal = new GregorianCalendar(zone, aLocale);
}
} else if (caltype.equals("japanese")) {
break;
case "japanese":
cal = new JapaneseImperialCalendar(zone, aLocale);
} else if (caltype.equals("buddhist")) {
break;
case "gregory":
cal = new GregorianCalendar(zone, aLocale);
break;
}
}
}
if (cal == null) {
// If no known calendar type is explicitly specified,
// perform the traditional way to create a Calendar:
// create a BuddhistCalendar for th_TH locale,
// a JapaneseImperialCalendar for ja_JP_JP locale, or
// a GregorianCalendar for any other locales.
// NOTE: The language, country and variant strings are interned.
if (aLocale.getLanguage() == "th" && aLocale.getCountry() == "TH") {
cal = new BuddhistCalendar(zone, aLocale);
} else if (aLocale.getVariant() == "JP" && aLocale.getLanguage() == "ja"
&& aLocale.getCountry() == "JP") {
cal = new JapaneseImperialCalendar(zone, aLocale);
} else {
// Unsupported calendar type.
// Use Gregorian calendar as a fallback.
cal = new GregorianCalendar(zone, aLocale);
}
}
return cal;
}
@ -1393,10 +1470,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* the calendar field for which the string representation
* is returned
* @param style
* the style applied to the string representation; one of
* {@link #SHORT} or {@link #LONG}.
* the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}.
* @param locale
* the locale for the string representation
* (any calendar types specified by {@code locale} are ignored)
* @return the string representation of the given
* <code>field</code> in the given <code>style</code>, or
* <code>null</code> if no string representation is
@ -1410,11 +1489,18 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @since 1.6
*/
public String getDisplayName(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale,
if (!checkDisplayNameParams(field, style, SHORT, LONG, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
// the standalone styles are supported only through CalendarDataProviders.
if (isStandaloneStyle(style)) {
return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
field, get(field),
style, locale);
}
DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
String[] strings = getFieldStrings(field, style, symbols);
if (strings != null) {
@ -1453,8 +1539,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param field
* the calendar field for which the display names are returned
* @param style
* the style applied to the display names; one of {@link
* #SHORT}, {@link #LONG}, or {@link #ALL_STYLES}.
* the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}.
* @param locale
* the locale for the display names
* @return a <code>Map</code> containing all display names in
@ -1474,23 +1561,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
// ALL_STYLES
if (style == ALL_STYLES) {
Map<String,Integer> shortNames = getDisplayNamesImpl(field, SHORT, locale);
if (field == ERA || field == AM_PM) {
return shortNames;
if (style == ALL_STYLES || isStandaloneStyle(style)) {
return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
}
Map<String,Integer> longNames = getDisplayNamesImpl(field, LONG, locale);
if (shortNames == null) {
return longNames;
}
if (longNames != null) {
shortNames.putAll(longNames);
}
return shortNames;
}
// SHORT or LONG
return getDisplayNamesImpl(field, style, locale);
}
@ -1513,8 +1586,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle,
Locale locale, int fieldMask) {
int baseStyle = getBaseStyle(style); // Ignore the standalone mask
if (field < 0 || field >= fields.length ||
style < minStyle || style > maxStyle) {
baseStyle < minStyle || baseStyle > maxStyle) {
throw new IllegalArgumentException();
}
if (locale == null) {
@ -1524,6 +1598,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
}
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
int baseStyle = getBaseStyle(style); // ignore the standalone mask
String[] strings = null;
switch (field) {
case ERA:
@ -1531,11 +1606,11 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
break;
case MONTH:
strings = (style == LONG) ? symbols.getMonths() : symbols.getShortMonths();
strings = (baseStyle == LONG) ? symbols.getMonths() : symbols.getShortMonths();
break;
case DAY_OF_WEEK:
strings = (style == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
strings = (baseStyle == LONG) ? symbols.getWeekdays() : symbols.getShortWeekdays();
break;
case AM_PM:
@ -1554,8 +1629,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
*/
protected void complete()
{
if (!isTimeSet)
if (!isTimeSet) {
updateTime();
}
if (!areFieldsSet || !areAllFieldsSet) {
computeFields(); // fills in unset fields
areAllFieldsSet = areFieldsSet = true;
@ -1689,7 +1765,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* Returns whether the specified <code>field</code> is on in the
* <code>fieldMask</code>.
*/
static final boolean isFieldSet(int fieldMask, int field) {
static boolean isFieldSet(int fieldMask, int field) {
return (fieldMask & (1 << field)) != 0;
}
@ -1865,19 +1941,48 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
return fieldMask;
}
int getBaseStyle(int style) {
return style & ~STANDALONE_MASK;
}
boolean isStandaloneStyle(int style) {
return (style & STANDALONE_MASK) != 0;
}
/**
* Returns the pseudo-time-stamp for two fields, given their
* individual pseudo-time-stamps. If either of the fields
* is unset, then the aggregate is unset. Otherwise, the
* aggregate is the later of the two stamps.
*/
private static final int aggregateStamp(int stamp_a, int stamp_b) {
private static int aggregateStamp(int stamp_a, int stamp_b) {
if (stamp_a == UNSET || stamp_b == UNSET) {
return UNSET;
}
return (stamp_a > stamp_b) ? stamp_a : stamp_b;
}
/**
* Returns the calendar type of this {@code Calendar}. Calendar types are
* defined by the <em>Unicode Locale Data Markup Language (LDML)</em>
* specification.
*
* <p>The default implementation of this method returns the class name of
* this {@code Calendar} instance. Any subclasses that implement
* LDML-defined calendar systems should override this method to return
* appropriate calendar types.
*
* @return the LDML-defined calendar type or the class name of this
* {@code Calendar} instance
* @since 1.8
* @see <a href="Locale.html#def_extensions">Locale extensions</a>
* @see Locale.Builder#setLocale(Locale)
* @see Locale.Builder#setUnicodeLocaleKeyword(String, String)
*/
public String getCalendarType() {
return this.getClass().getName();
}
/**
* Compares this <code>Calendar</code> to the specified
* <code>Object</code>. The result is <code>true</code> if and only if
@ -1900,9 +2005,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @return <code>true</code> if this object is equal to <code>obj</code>;
* <code>false</code> otherwise.
*/
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
}
try {
Calendar that = (Calendar)obj;
return compareTo(getMillisOf(that)) == 0 &&
@ -1924,6 +2032,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @return a hash code value for this object.
* @since 1.2
*/
@Override
public int hashCode() {
// 'otheritems' represents the hash code for the previous versions.
int otheritems = (lenient ? 1 : 0)
@ -1995,6 +2104,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* any invalid calendar values.
* @since 1.5
*/
@Override
public int compareTo(Calendar anotherCalendar) {
return compareTo(getMillisOf(anotherCalendar));
}
@ -2468,8 +2578,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
// if we're counting weeks, set the day of the week to Sunday. We know the
// last week of a month or year will contain the first day of the week.
if (field == WEEK_OF_YEAR || field == WEEK_OF_MONTH)
if (field == WEEK_OF_YEAR || field == WEEK_OF_MONTH) {
work.set(DAY_OF_WEEK, firstDayOfWeek);
}
// now try each value from getLeastMaximum() to getMaximum() one by one until
// we get a value that normalizes to another value. The last value that
@ -2494,6 +2605,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
*
* @return a copy of this object.
*/
@Override
public Object clone()
{
try {
@ -2531,7 +2643,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @exception IndexOutOfBoundsException if <code>field</code> is negative,
* equal to or greater then <code>FIELD_COUNT</code>.
*/
static final String getFieldName(int field) {
static String getFieldName(int field) {
return FIELD_NAME[field];
}
@ -2543,6 +2655,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
*
* @return a string representation of this calendar.
*/
@Override
public String toString() {
// NOTE: BuddhistCalendar.toString() interprets the string
// produced by this method so that the Gregorian year number
@ -2567,7 +2680,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
// =======================privates===============================
private static final void appendValue(StringBuilder sb, String item, boolean valid, long value) {
private static void appendValue(StringBuilder sb, String item, boolean valid, long value) {
sb.append(item).append('=');
if (valid) {
sb.append(value);
@ -2587,10 +2700,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/* try to get the Locale data from the cache */
int[] data = cachedLocaleData.get(desiredLocale);
if (data == null) { /* cache miss */
ResourceBundle bundle = LocaleData.getCalendarData(desiredLocale);
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(CalendarDataProvider.class, desiredLocale);
CalendarDataProvider provider = adapter.getCalendarDataProvider();
data = new int[2];
data[0] = Integer.parseInt(bundle.getString("firstDayOfWeek"));
data[1] = Integer.parseInt(bundle.getString("minimalDaysInFirstWeek"));
data[0] = provider.getFirstDayOfWeek(desiredLocale);
data[1] = provider.getMinimalDaysInFirstWeek(desiredLocale);
assert data[0] != 0 && data[1] != 0;
cachedLocaleData.putIfAbsent(desiredLocale, data);
}
firstDayOfWeek = data[0];
@ -2614,7 +2729,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
return (thisTime > t) ? 1 : (thisTime == t) ? 0 : -1;
}
private static final long getMillisOf(Calendar calendar) {
private static long getMillisOf(Calendar calendar) {
if (calendar.isTimeSet) {
return calendar.time;
}
@ -2627,7 +2742,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* Adjusts the stamp[] values before nextStamp overflow. nextStamp
* is set to the next stamp value upon the return.
*/
private final void adjustStamp() {
private void adjustStamp() {
int max = MINIMUM_USER_STAMP;
int newStamp = MINIMUM_USER_STAMP;
@ -2752,6 +2867,8 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
new ProtectionDomain(null, perms)
});
}
private CalendarAccessControlContext() {
}
}
/**
@ -2771,14 +2888,19 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
if (serialVersionOnStream >= 2)
{
isTimeSet = true;
if (fields == null) fields = new int[FIELD_COUNT];
if (isSet == null) isSet = new boolean[FIELD_COUNT];
if (fields == null) {
fields = new int[FIELD_COUNT];
}
if (isSet == null) {
isSet = new boolean[FIELD_COUNT];
}
}
else if (serialVersionOnStream >= 0)
{
for (int i=0; i<FIELD_COUNT; ++i)
for (int i=0; i<FIELD_COUNT; ++i) {
stamp[i] = isSet[i] ? COMPUTED : UNSET;
}
}
serialVersionOnStream = currentSerialVersion;
@ -2787,6 +2909,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
try {
zi = AccessController.doPrivileged(
new PrivilegedExceptionAction<ZoneInfo>() {
@Override
public ZoneInfo run() throws Exception {
return (ZoneInfo) input.readObject();
}

View file

@ -36,15 +36,11 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.spi.CurrencyNameProvider;
import java.util.spi.LocaleServiceProvider;
import sun.util.LocaleServiceProviderPool;
import sun.util.locale.provider.LocaleServiceProviderPool;
import sun.util.logging.PlatformLogger;
import sun.util.resources.LocaleData;
import sun.util.resources.OpenListResourceBundle;
/**
@ -191,15 +187,16 @@ public final class Currency implements Serializable {
private static final int VALID_FORMAT_VERSION = 1;
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
String homeDir = System.getProperty("java.home");
try {
String dataFile = homeDir + File.separator +
"lib" + File.separator + "currency.data";
DataInputStream dis = new DataInputStream(
try (DataInputStream dis = new DataInputStream(
new BufferedInputStream(
new FileInputStream(dataFile)));
new FileInputStream(dataFile)))) {
if (dis.readInt() != MAGIC_NUMBER) {
throw new InternalError("Currency data is possibly corrupted");
}
@ -221,7 +218,7 @@ public final class Currency implements Serializable {
otherCurrencies = dis.readUTF();
otherCurrenciesDFD = readIntArray(dis, ocCount);
otherCurrenciesNumericCode = readIntArray(dis, ocCount);
dis.close();
}
} catch (IOException e) {
throw new InternalError(e);
}
@ -344,10 +341,10 @@ public final class Currency implements Serializable {
* @param locale the locale for whose country a <code>Currency</code>
* instance is needed
* @return the <code>Currency</code> instance for the country of the given
* locale, or null
* locale, or {@code null}
* @exception NullPointerException if <code>locale</code> or its country
* code is null
* @exception IllegalArgumentException if the country of the given locale
* code is {@code null}
* @exception IllegalArgumentException if the country of the given {@code locale}
* is not a supported ISO 3166 country code.
*/
public static Currency getInstance(Locale locale) {
@ -368,7 +365,7 @@ public final class Currency implements Serializable {
char finalChar = (char) ((tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) + 'A');
int defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT;
int numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT;
StringBuffer sb = new StringBuffer(country);
StringBuilder sb = new StringBuilder(country);
sb.append(finalChar);
return getInstance(sb.toString(), defaultFractionDigits, numericCode);
} else {
@ -470,34 +467,18 @@ public final class Currency implements Serializable {
* @exception NullPointerException if <code>locale</code> is null
*/
public String getSymbol(Locale locale) {
try {
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
if (pool.hasProviders()) {
// Assuming that all the country locales include necessary currency
// symbols in the Java runtime's resources, so there is no need to
// examine whether Java runtime's currency resource bundle is missing
// names. Therefore, no resource bundle is provided for calling this
// method.
String symbol = pool.getLocalizedObject(
CurrencyNameGetter.INSTANCE,
locale, (OpenListResourceBundle)null,
currencyCode, SYMBOL);
locale, currencyCode, SYMBOL);
if (symbol != null) {
return symbol;
}
}
ResourceBundle bundle = LocaleData.getCurrencyNames(locale);
return bundle.getString(currencyCode);
} catch (MissingResourceException e) {
// use currency code as symbol of last resort
return currencyCode;
}
}
/**
* Gets the default number of fraction digits used with this currency.
@ -546,31 +527,14 @@ public final class Currency implements Serializable {
* @since 1.7
*/
public String getDisplayName(Locale locale) {
try {
OpenListResourceBundle bundle = LocaleData.getCurrencyNames(locale);
String result = null;
String bundleKey = currencyCode.toLowerCase(Locale.ROOT);
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
if (pool.hasProviders()) {
result = pool.getLocalizedObject(
String result = pool.getLocalizedObject(
CurrencyNameGetter.INSTANCE,
locale, bundleKey, bundle, currencyCode, DISPLAYNAME);
}
if (result == null) {
result = bundle.getString(bundleKey);
}
locale, currencyCode, DISPLAYNAME);
if (result != null) {
return result;
}
} catch (MissingResourceException e) {
// fall through
}
// use currency code as symbol of last resort
return currencyCode;
@ -581,6 +545,7 @@ public final class Currency implements Serializable {
*
* @return the ISO 4217 currency code of this currency
*/
@Override
public String toString() {
return currencyCode;
}
@ -623,6 +588,7 @@ public final class Currency implements Serializable {
String> {
private static final CurrencyNameGetter INSTANCE = new CurrencyNameGetter();
@Override
public String getObject(CurrencyNameProvider currencyNameProvider,
Locale locale,
String key,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -40,6 +40,7 @@ package java.util;
import java.io.IOException;
import java.io.ObjectInputStream;
import sun.util.locale.provider.CalendarDataUtility;
import sun.util.calendar.BaseCalendar;
import sun.util.calendar.CalendarDate;
import sun.util.calendar.CalendarSystem;
@ -492,6 +493,7 @@ public class GregorianCalendar extends Calendar {
};
// Proclaim serialization compatibility with JDK 1.1
@SuppressWarnings("FieldNameHidesFieldInSuperclass")
static final long serialVersionUID = -8125100834729963327L;
// Reference to the sun.util.calendar.Gregorian instance (singleton).
@ -765,9 +767,9 @@ public class GregorianCalendar extends Calendar {
// Set the cutover year (in the Gregorian year numbering)
gregorianCutoverYear = d.getYear();
BaseCalendar jcal = getJulianCalendarSystem();
d = (BaseCalendar.Date) jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
jcal.getCalendarDateFromFixedDate(d, gregorianCutoverDate - 1);
BaseCalendar julianCal = getJulianCalendarSystem();
d = (BaseCalendar.Date) julianCal.newCalendarDate(TimeZone.NO_TIMEZONE);
julianCal.getCalendarDateFromFixedDate(d, gregorianCutoverDate - 1);
gregorianCutoverYearJulian = d.getNormalizedYear();
if (time < gregorianCutover) {
@ -821,6 +823,17 @@ public class GregorianCalendar extends Calendar {
return gregorian ? (year%100 != 0) || (year%400 == 0) : true;
}
/**
* Returns {@code "gregory"} as the calendar type.
*
* @return {@code "gregory"}
* @since 1.8
*/
@Override
public String getCalendarType() {
return "gregory";
}
/**
* Compares this <code>GregorianCalendar</code> to the specified
* <code>Object</code>. The result is <code>true</code> if and
@ -2920,7 +2933,7 @@ public class GregorianCalendar extends Calendar {
* Returns the Julian calendar system instance (singleton). 'jcal'
* and 'jeras' are set upon the return.
*/
synchronized private static BaseCalendar getJulianCalendarSystem() {
private static synchronized BaseCalendar getJulianCalendarSystem() {
if (jcal == null) {
jcal = (JulianCalendar) CalendarSystem.forName("julian");
jeras = jcal.getEras();
@ -2944,7 +2957,7 @@ public class GregorianCalendar extends Calendar {
* Determines if the specified year (normalized) is the Gregorian
* cutover year. This object must have been normalized.
*/
private final boolean isCutoverYear(int normalizedYear) {
private boolean isCutoverYear(int normalizedYear) {
int cutoverYear = (calsys == gcal) ? gregorianCutoverYear : gregorianCutoverYearJulian;
return normalizedYear == cutoverYear;
}
@ -2971,8 +2984,8 @@ public class GregorianCalendar extends Calendar {
}
}
// January 1 of the normalized year should exist.
BaseCalendar jcal = getJulianCalendarSystem();
return jcal.getFixedDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1, null);
BaseCalendar juliancal = getJulianCalendarSystem();
return juliancal.getFixedDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1, null);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -27,6 +27,7 @@ package java.util;
import java.io.IOException;
import java.io.ObjectInputStream;
import sun.util.locale.provider.CalendarDataUtility;
import sun.util.calendar.BaseCalendar;
import sun.util.calendar.CalendarDate;
import sun.util.calendar.CalendarSystem;
@ -35,7 +36,6 @@ import sun.util.calendar.Era;
import sun.util.calendar.Gregorian;
import sun.util.calendar.LocalGregorianCalendar;
import sun.util.calendar.ZoneInfo;
import sun.util.resources.LocaleData;
/**
* <code>JapaneseImperialCalendar</code> implements a Japanese
@ -301,6 +301,17 @@ class JapaneseImperialCalendar extends Calendar {
setTimeInMillis(System.currentTimeMillis());
}
/**
* Returns {@code "japanese"} as the calendar type of this {@code
* JapaneseImperialCalendar}.
*
* @return {@code "japanese"}
*/
@Override
public String getCalendarType() {
return "japanese";
}
/**
* Compares this <code>JapaneseImperialCalendar</code> to the specified
* <code>Object</code>. The result is <code>true</code> if and
@ -941,35 +952,20 @@ class JapaneseImperialCalendar extends Calendar {
return null;
}
int fieldValue = get(field);
// "GanNen" is supported only in the LONG style.
if (field == YEAR
&& (style == SHORT || get(YEAR) != 1 || get(ERA) == 0)) {
&& (getBaseStyle(style) == SHORT || fieldValue != 1 || get(ERA) == 0)) {
return null;
}
ResourceBundle rb = LocaleData.getDateFormatData(locale);
String name = null;
String key = getKey(field, style);
if (key != null) {
String[] strings = rb.getStringArray(key);
if (field == YEAR) {
if (strings.length > 0) {
name = strings[0];
}
} else {
int index = get(field);
// If the ERA value is out of range for strings, then
String name = CalendarDataUtility.retrieveFieldValueName("japanese", field, fieldValue, style, locale);
// If the ERA value is null, then
// try to get its name or abbreviation from the Era instance.
if (field == ERA && index >= strings.length && index < eras.length) {
Era era = eras[index];
if (name == null && field == ERA && fieldValue < eras.length) {
Era era = eras[fieldValue];
name = (style == SHORT) ? era.getAbbreviation() : era.getName();
} else {
if (field == DAY_OF_WEEK) {
--index;
}
name = strings[index];
}
}
}
return name;
}
@ -979,83 +975,27 @@ class JapaneseImperialCalendar extends Calendar {
ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
if (style == ALL_STYLES) {
Map<String,Integer> shortNames = getDisplayNamesImpl(field, SHORT, locale);
if (field == AM_PM) {
return shortNames;
}
Map<String,Integer> longNames = getDisplayNamesImpl(field, LONG, locale);
if (shortNames == null) {
return longNames;
}
if (longNames != null) {
shortNames.putAll(longNames);
}
return shortNames;
}
// SHORT or LONG
return getDisplayNamesImpl(field, style, locale);
}
private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
ResourceBundle rb = LocaleData.getDateFormatData(locale);
String key = getKey(field, style);
Map<String,Integer> map = new HashMap<>();
if (key != null) {
String[] strings = rb.getStringArray(key);
if (field == YEAR) {
if (strings.length > 0) {
map.put(strings[0], 1);
}
} else {
int base = (field == DAY_OF_WEEK) ? 1 : 0;
for (int i = 0; i < strings.length; i++) {
map.put(strings[i], base + i);
}
Map<String, Integer> names = CalendarDataUtility.retrieveFieldValueNames("japanese", field, style, locale);
// If strings[] has fewer than eras[], get more names from eras[].
if (field == ERA && strings.length < eras.length) {
for (int i = strings.length; i < eras.length; i++) {
if (field == ERA) {
int size = names.size();
if (style == ALL_STYLES) {
size /= 2; // SHORT and LONG
}
if (size < eras.length) {
int baseStyle = getBaseStyle(style);
for (int i = size; i < eras.length; i++) {
Era era = eras[i];
String name = (style == SHORT) ? era.getAbbreviation() : era.getName();
map.put(name, i);
if (baseStyle == ALL_STYLES || baseStyle == SHORT) {
names.put(era.getAbbreviation(), i);
}
if (baseStyle == ALL_STYLES || baseStyle == LONG) {
names.put(era.getName(), i);
}
}
}
}
return map.size() > 0 ? map : null;
}
private String getKey(int field, int style) {
String className = JapaneseImperialCalendar.class.getName();
StringBuilder key = new StringBuilder();
switch (field) {
case ERA:
key.append(className);
if (style == SHORT) {
key.append(".short");
}
key.append(".Eras");
break;
case YEAR:
key.append(className).append(".FirstYear");
break;
case MONTH:
key.append(style == SHORT ? "MonthAbbreviations" : "MonthNames");
break;
case DAY_OF_WEEK:
key.append(style == SHORT ? "DayAbbreviations" : "DayNames");
break;
case AM_PM:
key.append("AmPmMarkers");
break;
}
return key.length() > 0 ? key.toString() : null;
return names;
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -50,7 +50,7 @@ import java.text.MessageFormat;
import java.util.spi.LocaleNameProvider;
import sun.security.action.GetPropertyAction;
import sun.util.LocaleServiceProviderPool;
import sun.util.locale.provider.LocaleServiceProviderPool;
import sun.util.locale.BaseLocale;
import sun.util.locale.InternalLocaleBuilder;
import sun.util.locale.LanguageTag;
@ -59,8 +59,7 @@ import sun.util.locale.LocaleObjectCache;
import sun.util.locale.LocaleSyntaxException;
import sun.util.locale.LocaleUtils;
import sun.util.locale.ParseStatus;
import sun.util.locale.UnicodeLocaleExtension;
import sun.util.resources.LocaleData;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.resources.OpenListResourceBundle;
/**
@ -965,7 +964,7 @@ public final class Locale implements Cloneable, Serializable {
return result;
}
private static final String[] getISO2Table(String table) {
private static String[] getISO2Table(String table) {
int len = table.length() / 5;
String[] isoTable = new String[len];
for (int i = 0, j = 0; i < len; i++, j += 5) {
@ -1033,6 +1032,30 @@ public final class Locale implements Cloneable, Serializable {
return baseLocale.getVariant();
}
/**
* Returns {@code true} if this {@code Locale} has any <a href="#def_extensions">
* extensions</a>.
*
* @return {@code true} if this {@code Locale} has any extensions
* @since 1.8
*/
public boolean hasExtensions() {
return localeExtensions != null;
}
/**
* Returns a copy of this {@code Locale} with no <a href="#def_extensions">
* extensions</a>. If this {@code Locale} has no extensions, this {@code Locale}
* is returned.
*
* @return a copy of this {@code Locale} with no extensions, or {@code this}
* if {@code this} has no extensions
* @since 1.8
*/
public Locale stripExtensions() {
return hasExtensions() ? Locale.getInstance(baseLocale, null) : this;
}
/**
* Returns the extension (or private use) value associated with
* the specified key, or null if there is no extension
@ -1052,7 +1075,7 @@ public final class Locale implements Cloneable, Serializable {
if (!LocaleExtensions.isValidKey(key)) {
throw new IllegalArgumentException("Ill-formed extension key: " + key);
}
return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key);
return hasExtensions() ? localeExtensions.getExtensionValue(key) : null;
}
/**
@ -1065,7 +1088,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public Set<Character> getExtensionKeys() {
if (localeExtensions == null) {
if (!hasExtensions()) {
return Collections.emptySet();
}
return localeExtensions.getKeys();
@ -1080,7 +1103,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public Set<String> getUnicodeLocaleAttributes() {
if (localeExtensions == null) {
if (!hasExtensions()) {
return Collections.emptySet();
}
return localeExtensions.getUnicodeLocaleAttributes();
@ -1101,10 +1124,10 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public String getUnicodeLocaleType(String key) {
if (!UnicodeLocaleExtension.isKey(key)) {
if (!isUnicodeExtensionKey(key)) {
throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key);
}
return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key);
return hasExtensions() ? localeExtensions.getUnicodeLocaleType(key) : null;
}
/**
@ -1285,6 +1308,10 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public String toLanguageTag() {
if (languageTag != null) {
return languageTag;
}
LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions);
StringBuilder buf = new StringBuilder();
@ -1328,7 +1355,13 @@ public final class Locale implements Cloneable, Serializable {
buf.append(subtag);
}
return buf.toString();
String langTag = buf.toString();
synchronized (this) {
if (languageTag == null) {
languageTag = langTag;
}
}
return languageTag;
}
/**
@ -1514,7 +1547,7 @@ public final class Locale implements Cloneable, Serializable {
return country3;
}
private static final String getISO3Code(String iso2Code, String table) {
private static String getISO3Code(String iso2Code, String table) {
int codeLength = iso2Code.length();
if (codeLength == 0) {
return "";
@ -1640,33 +1673,16 @@ public final class Locale implements Cloneable, Serializable {
throw new NullPointerException();
}
try {
OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
String key = (type == DISPLAY_VARIANT ? "%%"+code : code);
String result = null;
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(LocaleNameProvider.class);
if (pool.hasProviders()) {
result = pool.getLocalizedObject(
String key = (type == DISPLAY_VARIANT ? "%%"+code : code);
String result = pool.getLocalizedObject(
LocaleNameGetter.INSTANCE,
inLocale, bundle, key,
type, code);
}
if (result == null) {
result = bundle.getString(key);
}
inLocale, key, type, code);
if (result != null) {
return result;
}
}
catch (Exception e) {
// just fall through
}
return code;
}
@ -1690,7 +1706,7 @@ public final class Locale implements Cloneable, Serializable {
if (baseLocale.getVariant().length() == 0)
return "";
OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
OpenListResourceBundle bundle = LocaleProviderAdapter.forJRE().getLocaleData().getLocaleNames(inLocale);
String names[] = getDisplayVariantArray(bundle, inLocale);
@ -1748,7 +1764,7 @@ public final class Locale implements Cloneable, Serializable {
* @throws NullPointerException if <code>inLocale</code> is <code>null</code>
*/
public String getDisplayName(Locale inLocale) {
OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
OpenListResourceBundle bundle = LocaleProviderAdapter.forJRE().getLocaleData().getLocaleNames(inLocale);
String languageName = getDisplayLanguage(inLocale);
String scriptName = getDisplayScript(inLocale);
@ -1794,9 +1810,7 @@ public final class Locale implements Cloneable, Serializable {
names.add(countryName);
}
if (variantNames.length != 0) {
for (String var : variantNames) {
names.add(var);
}
names.addAll(Arrays.asList(variantNames));
}
// The first one in the main name
@ -1843,6 +1857,7 @@ public final class Locale implements Cloneable, Serializable {
/**
* Overrides Cloneable.
*/
@Override
public Object clone()
{
try {
@ -1910,6 +1925,8 @@ public final class Locale implements Cloneable, Serializable {
private volatile static Locale defaultDisplayLocale = null;
private volatile static Locale defaultFormatLocale = null;
private transient volatile String languageTag;
/**
* Return an array of the display names of the variant.
* @param bundle the ResourceBundle to use to get the display names
@ -1945,9 +1962,11 @@ public final class Locale implements Cloneable, Serializable {
// If we have no list patterns, compose the list in a simple,
// non-localized way.
if (listPattern == null || listCompositionPattern == null) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
for (int i = 0; i < stringList.length; ++i) {
if (i>0) result.append(',');
if (i > 0) {
result.append(',');
}
result.append(stringList[i]);
}
return result.toString();
@ -1994,6 +2013,13 @@ public final class Locale implements Cloneable, Serializable {
return composeList(format, newList);
}
// Duplicate of sun.util.locale.UnicodeLocaleExtension.isKey in order to
// avoid its class loading.
private static boolean isUnicodeExtensionKey(String s) {
// 2alphanum
return (s.length() == 2) && LocaleUtils.isAlphaNumericString(s);
}
/**
* @serialField language String
* language subtag in lower case. (See <a href="java/util/Locale.html#getLanguage()">getLanguage()</a>)
@ -2136,6 +2162,7 @@ public final class Locale implements Cloneable, Serializable {
implements LocaleServiceProviderPool.LocalizedObjectGetter<LocaleNameProvider, String> {
private static final LocaleNameGetter INSTANCE = new LocaleNameGetter();
@Override
public String getObject(LocaleNameProvider localeNameProvider,
Locale locale,
String key,

View file

@ -46,7 +46,7 @@ import java.util.concurrent.ConcurrentHashMap;
import sun.misc.SharedSecrets;
import sun.misc.JavaAWTAccess;
import sun.security.action.GetPropertyAction;
import sun.util.TimeZoneNameUtility;
import sun.util.locale.provider.TimeZoneNameUtility;
import sun.util.calendar.ZoneInfo;
import sun.util.calendar.ZoneInfoFile;
@ -403,7 +403,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
String id = getID();
String[] names = getDisplayNames(id, locale);
if (names == null) {
if (id.startsWith("GMT")) {
if (id.startsWith("GMT") && id.length() > 3) {
char sign = id.charAt(3);
if (sign == '+' || sign == '-') {
return id;

View file

@ -0,0 +1,299 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.util.spi;
import java.util.Calendar;
import java.util.Map;
import java.util.Locale;
/**
* An abstract class for service providers that provide localized {@link
* Calendar} parameters and string representations (display names) of {@code
* Calendar} field values.
*
* <p><a name="calendartypes"><b>Calendar Types</b></a>
*
* <p>Calendar types are used to specify calendar systems for which the {@link
* #getDisplayName(String, int, int, int, Locale) getDisplayName} and {@link
* #getDisplayNames(String, int, int, Locale) getDisplayNames} methods provide
* calendar field value names. See {@link Calendar#getCalendarType()} for details.
*
* <p><b>Calendar Fields</b>
*
* <p>Calendar fields are specified with the constants defined in {@link
* Calendar}. The following are calendar-common fields and their values to be
* supported for each calendar system.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Field values">
* <tr>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#MONTH}</td>
* <td valign="top">{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}</td>
* <td>Month numbering is 0-based (e.g., 0 - January, ..., 11 -
* December). Some calendar systems have 13 months. Month
* names need to be supported in both the formatting and
* stand-alone forms if required by the supported locales. If there's
* no distinction in the two forms, the same names should be returned
* in both of the forms.</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#DAY_OF_WEEK}</td>
* <td valign="top">{@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}</td>
* <td>Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday,
* ..., 7 - Saturday).</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#AM_PM}</td>
* <td valign="top">{@link Calendar#AM} to {@link Calendar#PM}</td>
* <td>0 - AM, 1 - PM</td>
* </tr>
* </table>
*
* <p style="margin-top:20px">The following are calendar-specific fields and their values to be supported.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Calendar type and field values">
* <tr>
* <th>Calendar Type</th>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "gregory"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>{@link java.util.GregorianCalendar#BC} (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>{@link java.util.GregorianCalendar#AD} (CE)</td>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "buddhist"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>BC (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>B.E. (Buddhist Era)</td>
* </tr>
* <tr>
* <td rowspan="6" valign="top">{@code "japanese"}</td>
* <td rowspan="5" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>Seireki (Before Meiji)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>Meiji</td>
* </tr>
* <tr>
* <td>2</td>
* <td>Taisho</td>
* </tr>
* <tr>
* <td>3</td>
* <td>Showa</td>
* </tr>
* <tr>
* <td>4</td>
* <td >Heisei</td>
* </tr>
* <tr>
* <td>{@link Calendar#YEAR}</td>
* <td>1</td>
* <td>the first year in each era. It should be returned when a long
* style ({@link Calendar#LONG_FORMAT} or {@link Calendar#LONG_STANDALONE}) is
* specified. See also the <a href="../../text/SimpleDateFormat.html#year">
* Year representation in {@code SimpleDateFormat}</a>.</td>
* </tr>
* </table>
*
* <p>Calendar field value names for {@code "gregory"} must be consistent with
* the date-time symbols provided by {@link java.text.spi.DateFormatSymbolsProvider}.
*
* <p>Time zone names are supported by {@link TimeZoneNameProvider}.
*
* @author Masayoshi Okutsu
* @since 1.8
* @see Locale#getUnicodeLocaleType(String)
*/
public abstract class CalendarDataProvider extends LocaleServiceProvider {
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
*/
protected CalendarDataProvider() {
}
/**
* Returns the first day of a week in the given {@code locale}. This
* information is required by {@link Calendar} to support operations on the
* week-related calendar fields.
*
* @param locale
* the desired locale
* @return the first day of a week; one of {@link Calendar#SUNDAY} ..
* {@link Calendar#SATURDAY},
* or 0 if the value isn't available for the {@code locale}
* @throws NullPointerException
* if {@code locale} is {@code null}.
* @see java.util.Calendar#getFirstDayOfWeek()
* @see <a href="../Calendar.html#first_week">First Week</a>
*/
public abstract int getFirstDayOfWeek(Locale locale);
/**
* Returns the minimal number of days required in the first week of a
* year. This information is required by {@link Calendar} to determine the
* first week of a year. Refer to the description of <a
* href="../Calendar.html#first_week"> how {@code Calendar} determines
* the first week</a>.
*
* @param locale
* the desired locale
* @return the minimal number of days of the first week,
* or 0 if the value isn't available for the {@code locale}
* @throws NullPointerException
* if {@code locale} is {@code null}.
* @see java.util.Calendar#getMinimalDaysInFirstWeek()
*/
public abstract int getMinimalDaysInFirstWeek(Locale locale);
/**
* Returns the string representation (display name) of the calendar
* <code>field value</code> in the given <code>style</code> and
* <code>locale</code>. If no string representation is
* applicable, <code>null</code> is returned.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are
* specified.
*
* <p>{@code value} is the numeric representation of the {@code field} value.
* For example, if {@code field} is {@link Calendar#DAY_OF_WEEK}, the valid
* values are {@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}
* (inclusive).
*
* <p>{@code style} gives the style of the string representation. It is one
* of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return {@code "Sunday"}.
* <pre>
* getDisplayName("gregory", Calendar.DAY_OF_WEEK, Calendar.SUNDAY,
* Calendar.LONG_STANDALONE, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the {@code Calendar} field index,
* such as {@link Calendar#DAY_OF_WEEK}
* @param value
* the value of the {@code Calendar field},
* such as {@link Calendar#MONDAY}
* @param style
* the string representation style: one of {@link
* Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or
* {@link Calendar#LONG_STANDALONE}
* @param locale
* the desired locale
* @return the string representation of the {@code field value}, or {@code
* null} if the string representation is not applicable or
* the given calendar type is unknown
* @throws IllegalArgumentException
* if {@code field} or {@code style} is invalid
* @throws NullPointerException if {@code locale} is {@code null}
* @see TimeZoneNameProvider
* @see java.util.Calendar#get(int)
* @see java.util.Calendar#getDisplayName(int, int, Locale)
*/
public abstract String getDisplayName(String calendarType,
int field, int value,
int style, Locale locale);
/**
* Returns a {@code Map} containing all string representations (display
* names) of the {@code Calendar} {@code field} in the given {@code style}
* and {@code locale} and their corresponding field values.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are specified.
*
* <p>{@code style} gives the style of the string representation. It must be
* one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link
* Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return a {@code Map} containing
* {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link
* Calendar#JANUARY}, {@code "February"} to {@link Calendar#FEBRUARY},
* {@code "Feb"} to {@link Calendar#FEBRUARY}, and so on.
* <pre>
* getDisplayNames("gregory", Calendar.MONTH, Calendar.ALL_STYLES, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the calendar field for which the display names are returned
* @param style
* the style applied to the display names; one of
* {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT}
* ({@link Calendar#SHORT SHORT}), {@link
* Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
* @param locale
* the desired locale
* @return a {@code Map} containing all display names of {@code field} in
* {@code style} and {@code locale} and their {@code field} values,
* or {@code null} if no display names are defined for {@code field}
* @throws NullPointerException
* if {@code locale} is {@code null}
* @see Calendar#getDisplayNames(int, int, Locale)
*/
public abstract Map<String, Integer> getDisplayNames(String calendarType,
int field, int style,
Locale locale);
}

View file

@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.Currency;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle.Control;
/**
* An abstract class for service providers that
@ -109,11 +110,13 @@ public abstract class CurrencyNameProvider extends LocaleServiceProvider {
}
// Check whether the locale is valid
List<Locale> avail = Arrays.asList(getAvailableLocales());
if (!avail.contains(locale)) {
throw new IllegalArgumentException("The locale is not available");
}
Control c = Control.getNoFallbackControl(Control.FORMAT_DEFAULT);
for (Locale l : getAvailableLocales()) {
if (c.getCandidateLocales("", l).contains(locale)) {
return null;
}
}
throw new IllegalArgumentException("The locale is not available");
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -83,11 +83,13 @@ import java.util.Locale;
* service provider methods when needed to support the requested locale.
* The methods first check whether the Java runtime environment itself
* supports the requested locale, and use its support if available.
* Otherwise, they call the <code>getAvailableLocales()</code> methods of
* installed providers for the appropriate interface to find one that
* Otherwise, they call the {@link #isSupportedLocale(Locale) isSupportedLocale}
* methods of installed providers for the appropriate interface to find one that
* supports the requested locale. If such a provider is found, its other
* methods are called to obtain the requested object or name. When checking
* whether a locale is supported, the locale's extensions are ignored.
* whether a locale is supported, the <a href="../Locale.html#def_extensions">
* locale's extensions</a> are ignored by default. (If locale's extensions should
* also be checked, the {@code isSupportedLocale} method must be overridden.)
* If neither the Java runtime environment itself nor an installed provider
* supports the requested locale, the methods go through a list of candidate
* locales and repeat the availability check for each until a match is found.
@ -96,9 +98,9 @@ import java.util.Locale;
* {@link java.util.ResourceBundle.Control#getCandidateLocales getCandidateLocales}
* for the details). Even if a locale is resolved from the candidate list,
* methods that return requested objects or names are invoked with the original
* requested locale including extensions. The Java runtime environment must
* support the root locale for all locale sensitive services in order to
* guarantee that this process terminates.
* requested locale including {@code Locale} extensions. The Java runtime
* environment must support the root locale for all locale sensitive services in
* order to guarantee that this process terminates.
* <p>
* Providers of names (but not providers of other objects) are allowed to
* return null for some name requests even for locales that they claim to
@ -110,6 +112,22 @@ import java.util.Locale;
* feasible to cover them completely. If the Java runtime environment or a
* provider returns null instead of a name, the lookup will proceed as
* described above as if the locale was not supported.
* <p>
* Starting from JDK8, the search order of locale sensitive services can
* be configured by using the "java.locale.providers" system property.
* This system property declares the user's preferred order for looking up
* the locale sensitive services separated by a comma. It is only read at
* the Java runtime startup, so the later call to System.setProperty() won't
* affect the order.
* <p>
* For example, if the following is specified in the property:
* <pre>
* java.locale.providers=SPI,JRE
* </pre>
* where "SPI" represents the locale sensitive services implemented in the
* installed SPI providers, and "JRE" represents the locale sensitive services
* in the Java Runtime Environment, the locale sensitive services in the SPI
* providers are looked up first.
*
* @since 1.6
*/
@ -124,15 +142,52 @@ public abstract class LocaleServiceProvider {
/**
* Returns an array of all locales for which this locale service provider
* can provide localized objects or names.
* <p>
* <b>Note:</b> Extensions in a <code>Locale</code> are ignored during
* service provider lookup. So the array returned by this method should
* not include two or more <code>Locale</code> objects only differing in
* their extensions.
* can provide localized objects or names. This information is used to
* compose {@code getAvailableLocales()} values of the locale-dependent
* services, such as {@code DateFormat.getAvailableLocales()}.
*
* <p>The array returned by this method should not include two or more
* {@code Locale} objects only differing in their extensions.
*
* @return An array of all locales for which this locale service provider
* can provide localized objects or names.
*/
public abstract Locale[] getAvailableLocales();
/**
* Returns {@code true} if the given {@code locale} is supported by
* this locale service provider. The given {@code locale} may contain
* <a href="../Locale.html#def_extensions">extensions<a/> that should be
* taken into account for the support determination.
*
* <p>The default implementation returns {@code true} if the given {@code locale}
* is equal to any of the available {@code Locale}s returned by
* {@link #getAvailableLocales()} with ignoring any extensions in both the
* given {@code locale} and the available locales. Concrete locale service
* provider implementations should override this method if those
* implementations are {@code Locale} extensions-aware. For example,
* {@code DecimalFormatSymbolsProvider} implementations will need to check
* extensions in the given {@code locale} to see if any numbering system is
* specified and can be supported. However, {@code CollatorProvider}
* implementations may not be affected by any particular numbering systems,
* and in that case, extensions for numbering systems should be ignored.
*
* @param locale a {@code Locale} to be tested
* @return {@code true} if the given {@code locale} is supported by this
* provider; {@code false} otherwise.
* @throws NullPointerException
* if the given {@code locale} is {@code null}
* @see Locale#hasExtensions()
* @see Locale#stripExtensions()
* @since 1.8
*/
public boolean isSupportedLocale(Locale locale) {
locale = locale.stripExtensions(); // throws NPE if locale == null
for (Locale available : getAvailableLocales()) {
if (locale.equals(available.stripExtensions())) {
return true;
}
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, 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,10 +36,13 @@ import java.util.*;
import java.beans.*;
import java.text.*;
import java.io.*;
import java.util.HashMap;
import sun.util.resources.LocaleData;
import java.text.spi.DateFormatProvider;
import java.text.spi.NumberFormatProvider;
import javax.accessibility.*;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleResources;
import sun.util.locale.provider.LocaleServiceProviderPool;
/**
@ -946,11 +949,12 @@ public class JSpinner extends JComponent implements Accessible
// This is here until SimpleDateFormat gets a constructor that
// takes a Locale: 4923525
private static String getDefaultPattern(Locale loc) {
ResourceBundle r = LocaleData.getDateFormatData(loc);
String[] dateTimePatterns = r.getStringArray("DateTimePatterns");
Object[] dateTimeArgs = {dateTimePatterns[DateFormat.SHORT],
dateTimePatterns[DateFormat.SHORT + 4]};
return MessageFormat.format(dateTimePatterns[8], dateTimeArgs);
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc);
LocaleResources lr = adapter.getLocaleResources(loc);
if (lr == null) {
lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc);
}
return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null);
}
/**
@ -1125,8 +1129,14 @@ public class JSpinner extends JComponent implements Accessible
// takes a Locale: 4923525
private static String getDefaultPattern(Locale locale) {
// Get the pattern for the default locale.
ResourceBundle rb = LocaleData.getNumberFormatData(locale);
String[] all = rb.getStringArray("NumberPatterns");
LocaleProviderAdapter adapter;
adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
locale);
LocaleResources lr = adapter.getLocaleResources(locale);
if (lr == null) {
lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
}
String[] all = lr.getNumberPatterns();
return all[0];
}

View file

@ -1,54 +0,0 @@
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class CollationData_de extends EmptyListResourceBundle {
// This bundle is empty because the default rule is
// adequate for this locale.
// The bundle is necessary to prevent the resource
// bundle lookup from falling back to the default
// locale.
}

View file

@ -1,54 +0,0 @@
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class CollationData_en extends EmptyListResourceBundle {
// This bundle is empty because the default rule is
// adequate for this locale.
// The bundle is necessary to prevent the resource
// bundle lookup from falling back to the default
// locale.
}

View file

@ -1,54 +0,0 @@
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class CollationData_it extends EmptyListResourceBundle {
// This bundle is empty because the default rule is
// adequate for this locale.
// The bundle is necessary to prevent the resource
// bundle lookup from falling back to the default
// locale.
}

View file

@ -1,54 +0,0 @@
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class CollationData_nl extends EmptyListResourceBundle {
// This bundle is empty because the default rule is
// adequate for this locale.
// The bundle is necessary to prevent the resource
// bundle lookup from falling back to the default
// locale.
}

View file

@ -1,54 +0,0 @@
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class CollationData_pt extends EmptyListResourceBundle {
// This bundle is empty because the default rule is
// adequate for this locale.
// The bundle is necessary to prevent the resource
// bundle lookup from falling back to the default
// locale.
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2012, 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
@ -119,19 +119,19 @@ public class FormatData extends ListResourceBundle {
"AD"
}
},
{ "sun.util.BuddhistCalendar.Eras",
{ "buddhist.Eras",
new String[] { // Thai Buddhist calendar era strings
"BC", // BC
"B.E." // Buddhist Era
}
},
{ "sun.util.BuddhistCalendar.short.Eras",
{ "buddhist.short.Eras",
new String[] { // Thai Buddhist calendar era strings
"BC", // BC
"B.E." // Buddhist Era
}
},
{ "java.util.JapaneseImperialCalendar.Eras",
{ "japanese.Eras",
new String[] { // Japanese imperial calendar era strings
"",
"Meiji",
@ -140,7 +140,7 @@ public class FormatData extends ListResourceBundle {
"Heisei",
}
},
{ "java.util.JapaneseImperialCalendar.short.Eras",
{ "japanese.short.Eras",
new String[] { // Japanese imperial calendar era abbreviations
"",
"M",
@ -149,7 +149,7 @@ public class FormatData extends ListResourceBundle {
"H",
}
},
{ "java.util.JapaneseImperialCalendar.FirstYear",
{ "japanese.FirstYear",
new String[] { // Japanese imperial calendar year name
// empty in English
}
@ -161,6 +161,7 @@ public class FormatData extends ListResourceBundle {
"#,##0%" // percent pattern
}
},
{ "DefaultNumberingSystem", "" },
{ "NumberElements",
new String[] {
".", // decimal separator
@ -176,42 +177,591 @@ public class FormatData extends ListResourceBundle {
"\ufffd" // NaN
}
},
{ "DateTimePatterns",
{ "arab.NumberElements",
new String[] {
"\u066b",
"\u066c",
"\u061b",
"\u066a",
"\u0660",
"#",
"-",
"\u0627\u0633",
"\u0609",
"\u221e",
"NaN",
}
},
{ "arabext.NumberElements",
new String[] {
"\u066b",
"\u066c",
"\u061b",
"\u066a",
"\u06f0",
"#",
"-",
"\u00d7\u06f1\u06f0^",
"\u0609",
"\u221e",
"NaN",
}
},
{ "bali.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1b50",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "beng.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u09e6",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "cham.NumberElements",
new String[] {
".",
",",
";",
"%",
"\uaa50",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "deva.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0966",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "fullwide.NumberElements",
new String[] {
".",
",",
";",
"%",
"\uff10",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "gujr.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0ae6",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "guru.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0a66",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "java.NumberElements",
new String[] {
".",
",",
";",
"%",
"\ua9d0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "kali.NumberElements",
new String[] {
".",
",",
";",
"%",
"\ua900",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "khmr.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u17e0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "knda.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0ce6",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "laoo.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0ed0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "lana.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1a80",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "lanatham.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1a90",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "latn.NumberElements",
new String[] {
".", // decimal separator
",", // group (thousands) separator
";", // list separator
"%", // percent sign
"0", // native 0 digit
"#", // pattern digit
"-", // minus sign
"E", // exponential
"\u2030", // per mille
"\u221e", // infinity
"\ufffd" // NaN
}
},
{ "lepc.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1c40",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "limb.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1946",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "mlym.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0d66",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "mong.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1810",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "mtei.NumberElements",
new String[] {
".",
",",
";",
"%",
"\uabf0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "mymr.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1040",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "mymrshan.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1090",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "nkoo.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u07c0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "olck.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1c50",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "orya.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0b66",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "saur.NumberElements",
new String[] {
".",
",",
";",
"%",
"\ua8d0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "sund.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u1bb0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "talu.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u19d0",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "tamldec.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0be6",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "telu.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0c66",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "thai.NumberElements",
new String[] {
".", // decimal separator
",", // group (thousands) separator
";", // list separator
"%", // percent sign
"\u0E50", // native 0 digit
"#", // pattern digit
"-", // minus sign
"E", // exponential
"\u2030", // per mille
"\u221e", // infinity
"\ufffd" // NaN
}
},
{ "tibt.NumberElements",
new String[] {
".",
",",
";",
"%",
"\u0f20",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "vaii.NumberElements",
new String[] {
".",
",",
";",
"%",
"\ua620",
"#",
"-",
"E",
"\u2030",
"\u221e",
"NaN",
}
},
{ "TimePatterns",
new String[] {
"h:mm:ss a z", // full time pattern
"h:mm:ss a z", // long time pattern
"h:mm:ss a", // medium time pattern
"h:mm a", // short time pattern
}
},
{ "DatePatterns",
new String[] {
"EEEE, MMMM d, yyyy", // full date pattern
"MMMM d, yyyy", // long date pattern
"MMM d, yyyy", // medium date pattern
"M/d/yy", // short date pattern
}
},
{ "DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},
{ "sun.util.BuddhistCalendar.DateTimePatterns",
{ "buddhist.TimePatterns",
new String[] {
"H:mm:ss z", // full time pattern
"H:mm:ss z", // long time pattern
"H:mm:ss", // medium time pattern
"H:mm", // short time pattern
}
},
{ "buddhist.DatePatterns",
new String[] {
"EEEE d MMMM G yyyy", // full date pattern
"d MMMM yyyy", // long date pattern
"d MMM yyyy", // medium date pattern
"d/M/yyyy", // short date pattern
}
},
{ "buddhist.DateTimePatterns",
new String[] {
"{1}, {0}" // date-time pattern
}
},
{ "java.util.JapaneseImperialCalendar.DateTimePatterns",
{ "japanese.TimePatterns",
new String[] {
"h:mm:ss a z", // full time pattern
"h:mm:ss a z", // long time pattern
"h:mm:ss a", // medium time pattern
"h:mm a", // short time pattern
}
},
{ "japanese.DatePatterns",
new String[] {
"GGGG yyyy MMMM d (EEEE)", // full date pattern
"GGGG yyyy MMMM d", // long date pattern
"GGGG yyyy MMM d", // medium date pattern
"Gy.MM.dd", // short date pattern
}
},
{ "japanese.DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_AE extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_BH extends EmptyListResourceBundle {
}

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_EG extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_KW extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_LY extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_MA extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_OM extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_QA extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_SA extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_SD extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_TN extends EmptyListResourceBundle {
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
* (C) Copyright IBM Corp. 1998 - All Rights Reserved
*
* The original version of this source code and documentation
* is copyrighted and owned by Taligent, Inc., a wholly-owned
* subsidiary of IBM. These materials are provided under terms
* of a License Agreement between Taligent and Sun. This technology
* is protected by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_ar_YE extends EmptyListResourceBundle {
}

View file

@ -1,70 +0,0 @@
/*
* Copyright (c) 1997, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of the Unicode data files and any associated documentation (the
* "Data Files") or Unicode software and any associated documentation
* (the "Software") to deal in the Data Files or Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, and/or sell copies of the Data
* Files or Software, and to permit persons to whom the Data Files or
* Software are furnished to do so, provided that (a) the above copyright
* notice(s) and this permission notice appear with all copies of the
* Data Files or Software, (b) both the above copyright notice(s) and
* this permission notice appear in associated documentation, and (c)
* there is clear notice in each modified Data File or in the Software as
* well as in the documentation associated with the Data File(s) or
* Software that the data or software has been modified.
*
* THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
* ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
* SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in these Data Files or Software without prior
* written authorization of the copyright holder.
*/
// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_sr_Latn_BA extends EmptyListResourceBundle {
}

View file

@ -1,70 +0,0 @@
/*
* Copyright (c) 1997, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of the Unicode data files and any associated documentation (the
* "Data Files") or Unicode software and any associated documentation
* (the "Software") to deal in the Data Files or Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, and/or sell copies of the Data
* Files or Software, and to permit persons to whom the Data Files or
* Software are furnished to do so, provided that (a) the above copyright
* notice(s) and this permission notice appear with all copies of the
* Data Files or Software, (b) both the above copyright notice(s) and
* this permission notice appear in associated documentation, and (c)
* there is clear notice in each modified Data File or in the Software as
* well as in the documentation associated with the Data File(s) or
* Software that the data or software has been modified.
*
* THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
* ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
* SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in these Data Files or Software without prior
* written authorization of the copyright holder.
*/
// Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
package sun.text.resources;
import sun.util.EmptyListResourceBundle;
public class FormatData_sr_Latn_RS extends EmptyListResourceBundle {
}

View file

@ -1,67 +0,0 @@
/*
* Copyright (c) 2002, 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
package sun.text.resources;
import java.util.ListResourceBundle;
/*
* This class implements the th_TH_TH requirement that native Thai
* digits be used in the corresponding locale.
*
* @author John O'Conner
* @since 1.4.1
*
*/
public class FormatData_th_TH_TH extends ListResourceBundle {
/**
* Overrides ListResourceBundle
*/
protected final Object[][] getContents() {
return new Object[][] {
{ "NumberElements",
new String[] {
".", // decimal separator
",", // group (thousands) separator
";", // list separator
"%", // percent sign
"\u0E50", // native 0 digit
"#", // pattern digit
"-", // minus sign
"E", // exponential
"\u2030", // per mille
"\u221e", // infinity
"\ufffd" // NaN
}
},
};
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ar;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ar;
import java.util.ListResourceBundle;
@ -126,16 +126,24 @@ public class FormatData_ar extends ListResourceBundle {
"#,##0%" // percent pattern
}
},
{ "DateTimePatterns",
{ "TimePatterns",
new String[] {
"z hh:mm:ss a", // full time pattern
"z hh:mm:ss a", // long time pattern
"hh:mm:ss a", // medium time pattern
"hh:mm a", // short time pattern
}
},
{ "DatePatterns",
new String[] {
"dd MMMM, yyyy", // full date pattern
"dd MMMM, yyyy", // long date pattern
"dd/MM/yyyy", // medium date pattern
"dd/MM/yy", // short date pattern
}
},
{ "DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, 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
@ -40,7 +40,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ar;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, 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
@ -40,7 +40,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ar;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, 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
@ -40,7 +40,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ar;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.be;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.be;
import java.util.ListResourceBundle;
@ -128,16 +128,24 @@ public class FormatData_be extends ListResourceBundle {
"\ufffd" // NaN
}
},
{ "DateTimePatterns",
{ "TimePatterns",
new String[] {
"H.mm.ss z", // full time pattern
"H.mm.ss z", // long time pattern
"H.mm.ss", // medium time pattern
"H.mm", // short time pattern
}
},
{ "DatePatterns",
new String[] {
"EEEE, d, MMMM yyyy", // full date pattern
"EEEE, d, MMMM yyyy", // long date pattern
"d.M.yyyy", // medium date pattern
"d.M.yy", // short date pattern
}
},
{ "DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.be;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.bg;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.bg;
import java.util.ListResourceBundle;
@ -128,16 +128,24 @@ public class FormatData_bg extends ListResourceBundle {
"\ufffd" // NaN
}
},
{ "DateTimePatterns",
{ "TimePatterns",
new String[] {
"HH:mm:ss zzzz", // full time pattern
"HH:mm:ss z", // long time pattern
"HH:mm:ss", // medium time pattern
"HH:mm", // short time pattern
}
},
{ "DatePatterns",
new String[] {
"dd MMMM y, EEEE", // full date pattern
"dd MMMM y", // long date pattern
"dd.MM.yyyy", // medium date pattern
"dd.MM.yy", // short date pattern
}
},
{ "DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.bg;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ca;
import java.util.ListResourceBundle;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
@ -41,7 +41,7 @@
*
*/
package sun.text.resources;
package sun.text.resources.ca;
import java.util.ListResourceBundle;
@ -52,6 +52,23 @@ public class FormatData_ca extends ListResourceBundle {
protected final Object[][] getContents() {
return new Object[][] {
{ "MonthNames",
new String[] {
"de gener",
"de febrer",
"de mar\u00e7",
"d\u2019abril",
"de maig",
"de juny",
"de juliol",
"d\u2019agost",
"de setembre",
"d\u2019octubre",
"de novembre",
"de desembre",
"",
}
},
{ "standalone.MonthNames",
new String[] {
"gener", // january
"febrer", // february
@ -69,6 +86,23 @@ public class FormatData_ca extends ListResourceBundle {
}
},
{ "MonthAbbreviations",
new String[] {
"de gen.",
"de febr.",
"de mar\u00e7",
"d\u2019abr.",
"de maig",
"de juny",
"de jul.",
"d\u2019ag.",
"de set.",
"d\u2019oct.",
"de nov.",
"de des.",
"",
}
},
{ "standalone.MonthAbbreviations",
new String[] {
"gen.", // abb january
"feb.", // abb february
@ -122,16 +156,24 @@ public class FormatData_ca extends ListResourceBundle {
"\ufffd" // NaN
}
},
{ "DateTimePatterns",
{ "TimePatterns",
new String[] {
"HH:mm:ss z", // full time pattern
"HH:mm:ss z", // long time pattern
"HH:mm:ss", // medium time pattern
"HH:mm", // short time pattern
}
},
{ "DatePatterns",
new String[] {
"EEEE, d' / 'MMMM' / 'yyyy", // full date pattern
"d' / 'MMMM' / 'yyyy", // long date pattern
"dd/MM/yyyy", // medium date pattern
"dd/MM/yy", // short date pattern
}
},
{ "DateTimePatterns",
new String[] {
"{1} {0}" // date-time pattern
}
},

Some files were not shown because too many files have changed in this diff Show more