Merge
This commit is contained in:
commit
99c7a955ec
jdk
make
com/sun/java/pack
common
java
java
jli
nio
text/base
util
zip
sun
tools
Makefile
cldrconverter
src/build/tools
cldrconverter
AbstractLDMLHandler.javaBundle.javaBundleGenerator.javaCLDRConverter.javaCalendarType.javaContainer.javaCopyrightHeaders.javaEntry.javaIgnoredContainer.javaKeyContainer.javaLDMLParseHandler.javaMetaZonesParseHandler.javaNumberingSystemsParseHandler.javaResourceBundleGenerator.javaStringArrayElement.javaStringArrayEntry.javaStringEntry.javaSupplementDataParseHandler.java
generatebreakiteratordata
makefiles
CompileJavaClasses.gmkCreateJars.gmkGendataBreakIterator.gmkGenerateJavaSources.gmkGensrcCLDR.gmkGensrcLocaleDataMetaInfo.gmkGensrcProperties.gmkTools.gmk
src
macosx
classes
com/apple/laf
sun
java2d/opengl
lwawt
nio/ch
util/locale/provider
native/sun
awt
java2d/opengl
osxapp
util/locale/provider
share/classes
com/sun
crypto/provider
java/util/jar/pack
jmx
security/auth/module
java
@ -77,8 +77,8 @@ ifeq ($(STANDALONE),true)
|
||||
OTHER_CXXFLAGS += $(ZINCLUDE)
|
||||
LDDFLAGS += $(ZIPOBJS)
|
||||
else
|
||||
LDDFLAGS += -lz
|
||||
OTHER_CXXFLAGS += -DSYSTEM_ZLIB
|
||||
LDDFLAGS += $(ZLIB_LIBS)
|
||||
OTHER_CXXFLAGS += $(ZLIB_CFLAGS) -DSYSTEM_ZLIB
|
||||
endif
|
||||
else
|
||||
OTHER_CXXFLAGS += -DNO_ZLIB -DUNPACK_JNI
|
||||
|
@ -91,7 +91,7 @@ ifeq ($(PLATFORM), macosx)
|
||||
LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a
|
||||
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_LDLIBS += -lz
|
||||
OTHER_LDLIBS += $(ZLIB_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -125,6 +125,26 @@ ifeq ($(PLATFORM), windows)
|
||||
OTHER_LDLIBS += jli.lib
|
||||
endif
|
||||
|
||||
#
|
||||
# Applications expect to be able to link against libjawt without invoking
|
||||
# System.loadLibrary("jawt") first. This was the behaviour described in the
|
||||
# devloper documentation of JAWT and what worked with OpenJDK6.
|
||||
#
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||
LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)
|
||||
LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)
|
||||
else # ! ARCH_DATA_MODEL 64-bit
|
||||
LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)
|
||||
LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)
|
||||
endif # ARCH_DATA_MODEL
|
||||
endif # PLATFORM SOLARIS
|
||||
ifeq ($(PLATFORM), linux)
|
||||
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)
|
||||
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)
|
||||
endif # PLATFORM LINUX
|
||||
|
||||
|
||||
#
|
||||
# Launcher specific files.
|
||||
#
|
||||
|
@ -160,7 +160,7 @@ JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
|
||||
|
||||
# Needed for javadoc to ensure it builds documentation
|
||||
# against the newly built classes
|
||||
JAVADOCFLAGS += -bootclasspath $(CLASSBINDIR)
|
||||
JAVADOCFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE_PATH)"
|
||||
|
||||
# Needed for JAVADOC and BOOT_JAVACFLAGS
|
||||
NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
|
||||
|
@ -129,6 +129,11 @@ endif
|
||||
BUILD_HEADLESS = true
|
||||
LIBM=-lm
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# GCC29_COMPILER_PATH: is the path to where the gcc 2.9 compiler is installed
|
||||
# NOTE: Must end with / so that it could be empty, allowing PATH usage.
|
||||
ifdef ALT_GCC29_COMPILER_PATH
|
||||
|
@ -143,6 +143,11 @@ else
|
||||
_CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include
|
||||
endif
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# Import JDK images allow for partial builds, components not built are
|
||||
# imported (or copied from) these import areas when needed.
|
||||
|
||||
|
@ -140,6 +140,11 @@ BUILD_HEADLESS = true
|
||||
|
||||
_CUPS_HEADERS_PATH=/opt/sfw/cups/include
|
||||
|
||||
# Set ZLIB_LIBS if not already set
|
||||
ifeq ("$(ZLIB_LIBS)", "")
|
||||
ZLIB_LIBS=-lz
|
||||
endif
|
||||
|
||||
# Import JDK images allow for partial builds, components not built are
|
||||
# imported (or copied from) these import areas when needed.
|
||||
|
||||
|
@ -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
|
||||
|
@ -78,4 +78,5 @@ FILES_c = \
|
||||
AtomicLong.c \
|
||||
Version.c \
|
||||
VM.c \
|
||||
VMSupport.c
|
||||
VMSupport.c \
|
||||
HostLocaleProviderAdapter_md.c
|
||||
|
@ -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 \
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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! -- //@\" "
|
||||
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
|
||||
|
||||
for FILE in $RESOURCE_NAMES
|
||||
# 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
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -46,6 +46,8 @@ include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
|
||||
else # SYSTEM_ZLIB
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
endif #SYSTEM_ZLIB
|
||||
LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
|
||||
|
||||
@ -162,7 +164,7 @@ OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_INCLUDES += -I$(ZIP_SRC)
|
||||
else # !SYSTEM_ZLIB
|
||||
LDLIBS += -lz
|
||||
LDLIBS += $(ZLIB_LIBS)
|
||||
endif # SYSTEM_ZLIB
|
||||
|
||||
#
|
||||
|
@ -277,7 +277,6 @@ FILES_java += \
|
||||
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
|
||||
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
|
||||
\
|
||||
sun/nio/fs/GnomeFileTypeDetector.java \
|
||||
sun/nio/fs/BsdFileStore.java \
|
||||
sun/nio/fs/BsdFileSystem.java \
|
||||
sun/nio/fs/BsdFileSystemProvider.java \
|
||||
@ -312,7 +311,6 @@ FILES_c += \
|
||||
UnixAsynchronousServerSocketChannelImpl.c \
|
||||
UnixAsynchronousSocketChannelImpl.c \
|
||||
\
|
||||
GnomeFileTypeDetector.c \
|
||||
BsdNativeDispatcher.c \
|
||||
MacOSXNativeDispatcher.c \
|
||||
UnixCopyFile.c \
|
||||
@ -329,7 +327,6 @@ FILES_export += \
|
||||
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
|
||||
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
|
||||
\
|
||||
sun/nio/fs/GnomeFileTypeDetector.java \
|
||||
sun/nio/fs/BsdNativeDispatcher.java \
|
||||
sun/nio/fs/UnixCopyFile.java \
|
||||
sun/nio/fs/UnixNativeDispatcher.java
|
||||
|
@ -121,10 +121,6 @@ SUNWprivate_1.1 {
|
||||
Java_sun_nio_fs_BsdNativeDispatcher_getfsstat;
|
||||
Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry;
|
||||
Java_sun_nio_fs_BsdNativeDispatcher_endfsstat;
|
||||
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
|
||||
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
|
||||
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
|
||||
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_init;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
|
||||
@ -170,7 +166,6 @@ SUNWprivate_1.1 {
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
|
||||
Java_sun_nio_fs_UnixCopyFile_transfer;
|
||||
handleSocketError;
|
||||
|
||||
|
@ -143,6 +143,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
|
||||
Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
|
||||
Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
|
||||
Java_sun_nio_fs_LinuxNativeDispatcher_getmntent;
|
||||
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_init;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
|
||||
@ -189,7 +190,6 @@ SUNWprivate_1.1 {
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
|
||||
Java_sun_nio_fs_UnixCopyFile_transfer;
|
||||
handleSocketError;
|
||||
|
||||
|
@ -169,10 +169,10 @@ SUNWprivate_1.1 {
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
|
||||
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
|
||||
Java_sun_nio_fs_UnixCopyFile_transfer;
|
||||
Java_sun_nio_fs_SolarisNativeDispatcher_init;
|
||||
Java_sun_nio_fs_SolarisNativeDispatcher_facl;
|
||||
Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent;
|
||||
Java_sun_nio_fs_SolarisWatchService_init;
|
||||
Java_sun_nio_fs_SolarisWatchService_portCreate;
|
||||
Java_sun_nio_fs_SolarisWatchService_portAssociate;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -56,6 +56,10 @@ ifneq ($(PLATFORM), windows)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# Library to compile.
|
||||
#
|
||||
@ -90,7 +94,7 @@ endif
|
||||
# Link to JVM library for JVM_Zip* functions
|
||||
#
|
||||
ifeq ($(SYSTEM_ZLIB),true)
|
||||
OTHER_LDLIBS = -lz
|
||||
OTHER_LDLIBS = $(ZLIB_LIBS)
|
||||
else
|
||||
OTHER_LDLIBS = $(JVMLIB)
|
||||
endif
|
||||
|
@ -378,3 +378,22 @@ if [ "${ZERO_BUILD}" = true ] ; then
|
||||
export LLVM_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
# Export variables for system zlib
|
||||
# ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and
|
||||
# link against zlib
|
||||
pkgconfig=$(which pkg-config 2>/dev/null)
|
||||
if [ -x "${pkgconfig}" ] ; then
|
||||
if [ "${ZLIB_CFLAGS}" = "" ] ; then
|
||||
ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib)
|
||||
fi
|
||||
if [ "${ZLIB_LIBS}" = "" ] ; then
|
||||
ZLIB_LIBS=$("${pkgconfig}" --libs zlib)
|
||||
fi
|
||||
fi
|
||||
if [ "${ZLIB_LIBS}" = "" ] ; then
|
||||
ZLIB_LIBS="-lz"
|
||||
fi
|
||||
export ZLIB_CFLAGS
|
||||
export ZLIB_LIBS
|
||||
|
||||
|
@ -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
107
jdk/make/sun/cldr/Makefile
Normal 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
|
@ -30,6 +30,13 @@ PRODUCT = sun
|
||||
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# libjawt links to other programs, but nothing links to it directly. An RPATH
|
||||
# entry has been added to the launcher so third-party programs linked against
|
||||
# it will be able to find it no matter where the JDK or the third-party program
|
||||
# is located.
|
||||
#
|
||||
|
||||
#
|
||||
# Files
|
||||
#
|
||||
|
@ -126,7 +126,8 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
|
||||
ifneq ($(SYSTEM_ZLIB),true)
|
||||
CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
|
||||
else
|
||||
OTHER_LDLIBS += -lz
|
||||
OTHER_CFLAGS += $(ZLIB_CFLAGS)
|
||||
OTHER_LDLIBS += $(ZLIB_LIBS)
|
||||
endif
|
||||
|
||||
# Shun the less than portable MMX assembly code in pnggccrd.c,
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -36,6 +36,7 @@ include $(BUILDDIR)/common/Defs.gmk
|
||||
SUBDIRS = \
|
||||
addjsum \
|
||||
buildmetaindex \
|
||||
cldrconverter \
|
||||
commentchecker \
|
||||
compile_font_config \
|
||||
compile_properties \
|
||||
|
43
jdk/make/tools/cldrconverter/Makefile
Normal file
43
jdk/make/tools/cldrconverter/Makefile
Normal 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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
542
jdk/make/tools/src/build/tools/cldrconverter/Bundle.java
Normal file
542
jdk/make/tools/src/build/tools/cldrconverter/Bundle.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
615
jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
Normal file
615
jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
Normal 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 \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("-", "_");
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
54
jdk/make/tools/src/build/tools/cldrconverter/Container.java
Normal file
54
jdk/make/tools/src/build/tools/cldrconverter/Container.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
@ -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() {
|
||||
}
|
||||
}
|
||||
|
42
jdk/make/tools/src/build/tools/cldrconverter/Entry.java
Normal file
42
jdk/make/tools/src/build/tools/cldrconverter/Entry.java
Normal 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();
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
public class EmptyListResourceBundle extends ListResourceBundle {
|
||||
@Override
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {};
|
||||
IgnoredContainer(String qName, Container parent) {
|
||||
super(qName, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
void addCharacters(char[] characters, int start, int length) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
package sun.text.resources;
|
||||
KeyContainer(String qName, Container parent, String key) {
|
||||
super(qName, parent);
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
import sun.util.EmptyListResourceBundle;
|
||||
String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public class FormatData_fr_LU extends EmptyListResourceBundle {
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
StringEntry(String qName, Container parent, String key) {
|
||||
super(qName, parent, key);
|
||||
}
|
||||
|
||||
import sun.util.EmptyListResourceBundle;
|
||||
StringEntry(String qName, Container parent, String key, String value) {
|
||||
super(qName, parent, key);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public class FormatData_ar_DZ extends EmptyListResourceBundle {
|
||||
@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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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,43 +79,33 @@ 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),
|
||||
rules.getString("CharacterBreakRules"),
|
||||
classNames[0]);
|
||||
} else if (key.endsWith("WordData")) {
|
||||
generateDataFile(info.getString(key),
|
||||
rules.getString("WordBreakRules"),
|
||||
classNames[1]);
|
||||
} else if (key.endsWith("LineData")) {
|
||||
generateDataFile(info.getString(key),
|
||||
rules.getString("LineBreakRules"),
|
||||
classNames[2]);
|
||||
} else if (key.endsWith("SentenceData")) {
|
||||
generateDataFile(info.getString(key),
|
||||
rules.getString("SentenceBreakRules"),
|
||||
classNames[3]);
|
||||
}
|
||||
}
|
||||
if (info.containsKey("CharacterData")) {
|
||||
generateDataFile(info.getString("CharacterData"),
|
||||
rules.getString("CharacterBreakRules"),
|
||||
classNames[0]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new InternalError(e.toString());
|
||||
if (info.containsKey("WordData")) {
|
||||
generateDataFile(info.getString("WordData"),
|
||||
rules.getString("WordBreakRules"),
|
||||
classNames[1]);
|
||||
}
|
||||
if (info.containsKey("LineData")) {
|
||||
generateDataFile(info.getString("LineData"),
|
||||
rules.getString("LineBreakRules"),
|
||||
classNames[2]);
|
||||
}
|
||||
if (info.containsKey("SentenceData")) {
|
||||
generateDataFile(info.getString("SentenceData"),
|
||||
rules.getString("SentenceBreakRules"),
|
||||
classNames[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,8 @@ ifeq ($(OPENJDK_TARGET_OS),macosx)
|
||||
EXFILES+= $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
|
||||
$(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
|
||||
$(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
|
||||
$(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java
|
||||
$(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
|
||||
$(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
|
||||
|
||||
# JObjC.jar contains 1.5 byte-code...so skip it here :-(
|
||||
# MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
|
||||
|
@ -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 \
|
||||
|
@ -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) \
|
||||
|
@ -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 && \
|
||||
|
39
jdk/makefiles/GensrcCLDR.gmk
Normal file
39
jdk/makefiles/GensrcCLDR.gmk
Normal 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)
|
@ -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
|
||||
|
||||
###
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -34,7 +34,7 @@ import javax.swing.plaf.ComponentUI;
|
||||
|
||||
import sun.lwawt.macosx.CMenuItem;
|
||||
|
||||
class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
|
||||
final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
|
||||
ScreenMenuPropertyListener fListener;
|
||||
JMenuItem fMenuItem;
|
||||
|
||||
@ -96,21 +96,31 @@ class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListen
|
||||
fMenuItem.removeComponentListener(this);
|
||||
}
|
||||
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
if (ks == null) {
|
||||
setShortcut(null);
|
||||
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
|
||||
final MenuComponentPeer peer = menuItem.getPeer();
|
||||
if (!(peer instanceof CMenuItem)) {
|
||||
//Is it possible?
|
||||
return;
|
||||
}
|
||||
|
||||
final MenuComponentPeer peer = getPeer();
|
||||
if (peer instanceof CMenuItem) {
|
||||
final CMenuItem ourPeer = (CMenuItem)peer;
|
||||
ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
|
||||
final CMenuItem cmi = (CMenuItem) peer;
|
||||
if (ks == null) {
|
||||
cmi.setLabel(label);
|
||||
} else {
|
||||
setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
|
||||
cmi.setLabel(label, ks.getKeyChar(), ks.getKeyCode(),
|
||||
ks.getModifiers());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setLabel(final String label) {
|
||||
syncLabelAndKS(this, label, fMenuItem.getAccelerator());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
fMenuItem.doClick(0); // This takes care of all the different events
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
|
||||
|
||||
import sun.lwawt.macosx.*;
|
||||
|
||||
class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
|
||||
final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
|
||||
JMenuItem fMenuItem;
|
||||
MenuContainer fParent;
|
||||
|
||||
@ -110,19 +110,14 @@ class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener,
|
||||
super.removeNotify();
|
||||
}
|
||||
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
if (ks == null) {
|
||||
setShortcut(null);
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public synchronized void setLabel(final String label) {
|
||||
ScreenMenuItem.syncLabelAndKS(this, label, fMenuItem.getAccelerator());
|
||||
}
|
||||
|
||||
final MenuComponentPeer peer = getPeer();
|
||||
if (peer instanceof CMenuItem) {
|
||||
final CMenuItem ourPeer = (CMenuItem)peer;
|
||||
ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
|
||||
} else {
|
||||
setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
|
||||
}
|
||||
@Override
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
@ -31,8 +31,12 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
import java.awt.ImageCapabilities;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -44,6 +48,7 @@ import java.awt.image.WritableRaster;
|
||||
|
||||
import sun.awt.CGraphicsConfig;
|
||||
import sun.awt.CGraphicsDevice;
|
||||
import sun.awt.TextureSizeConstraining;
|
||||
import sun.awt.image.OffScreenImage;
|
||||
import sun.awt.image.SunVolatileImage;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
@ -65,7 +70,7 @@ import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
|
||||
import sun.lwawt.macosx.CPlatformView;
|
||||
|
||||
public class CGLGraphicsConfig extends CGraphicsConfig
|
||||
implements OGLGraphicsConfig
|
||||
implements OGLGraphicsConfig, TextureSizeConstraining
|
||||
{
|
||||
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
|
||||
private static final int kOpenGLSwapInterval = 0; // TODO
|
||||
@ -242,6 +247,8 @@ public class CGLGraphicsConfig extends CGraphicsConfig
|
||||
} finally {
|
||||
rq.unlock();
|
||||
}
|
||||
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -478,4 +485,50 @@ public class CGLGraphicsConfig extends CGraphicsConfig
|
||||
public void removeDeviceEventListener(AccelDeviceEventListener l) {
|
||||
AccelDeviceEventNotifier.removeListener(l);
|
||||
}
|
||||
|
||||
private static final Rectangle totalDisplayBounds = new Rectangle();
|
||||
|
||||
private static void updateTotalDisplayBounds() {
|
||||
synchronized (totalDisplayBounds) {
|
||||
Rectangle virtualBounds = new Rectangle();
|
||||
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
|
||||
for (GraphicsConfiguration gc : gd.getConfigurations()) {
|
||||
virtualBounds = virtualBounds.union(gc.getBounds());
|
||||
}
|
||||
}
|
||||
totalDisplayBounds.setBounds(virtualBounds);
|
||||
}
|
||||
}
|
||||
|
||||
// 7160609: GL still fails to create a square texture of this size,
|
||||
// so we use this value to cap the total display bounds.
|
||||
native private static int getMaxTextureSize();
|
||||
|
||||
@Override
|
||||
public int getMaxTextureWidth() {
|
||||
int width;
|
||||
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.width == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
width = totalDisplayBounds.width;
|
||||
}
|
||||
|
||||
return Math.min(width, getMaxTextureSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTextureHeight() {
|
||||
int height;
|
||||
|
||||
synchronized (totalDisplayBounds) {
|
||||
if (totalDisplayBounds.height == 0) {
|
||||
updateTotalDisplayBounds();
|
||||
}
|
||||
height = totalDisplayBounds.height;
|
||||
}
|
||||
|
||||
return Math.min(height, getMaxTextureSize());
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
* Note that we call setVisible() at the end of initialization.
|
||||
*/
|
||||
public final void initialize() {
|
||||
platformComponent.initialize(target, this, getPlatformWindow());
|
||||
platformComponent.initialize(getPlatformWindow());
|
||||
initializeImpl();
|
||||
setVisible(target.isVisible());
|
||||
}
|
||||
|
@ -338,6 +338,18 @@ public class LWWindowPeer
|
||||
h = MINIMUM_HEIGHT;
|
||||
}
|
||||
|
||||
if (graphicsConfig instanceof TextureSizeConstraining) {
|
||||
final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
|
||||
final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
|
||||
|
||||
if (w > maxW) {
|
||||
w = maxW;
|
||||
}
|
||||
if (h > maxH) {
|
||||
h = maxH;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't post ComponentMoved/Resized and Paint events
|
||||
// until we've got a notification from the delegate
|
||||
setBounds(x, y, w, h, op, false, false);
|
||||
@ -405,14 +417,33 @@ public class LWWindowPeer
|
||||
|
||||
@Override
|
||||
public void updateMinimumSize() {
|
||||
Dimension d = null;
|
||||
final Dimension min;
|
||||
if (getTarget().isMinimumSizeSet()) {
|
||||
d = getTarget().getMinimumSize();
|
||||
min = getTarget().getMinimumSize();
|
||||
min.width = Math.max(min.width, MINIMUM_WIDTH);
|
||||
min.height = Math.max(min.height, MINIMUM_HEIGHT);
|
||||
} else {
|
||||
min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
|
||||
}
|
||||
if (d == null) {
|
||||
d = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
|
||||
|
||||
final int maxW, maxH;
|
||||
if (graphicsConfig instanceof TextureSizeConstraining) {
|
||||
maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
|
||||
maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
|
||||
} else {
|
||||
maxW = maxH = Integer.MAX_VALUE;
|
||||
}
|
||||
platformWindow.setMinimumSize(d.width, d.height);
|
||||
|
||||
final Dimension max;
|
||||
if (getTarget().isMaximumSizeSet()) {
|
||||
max = getTarget().getMaximumSize();
|
||||
max.width = Math.min(max.width, maxW);
|
||||
max.height = Math.min(max.height, maxH);
|
||||
} else {
|
||||
max = new Dimension(maxW, maxH);
|
||||
}
|
||||
|
||||
platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,15 +23,38 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package sun.lwawt;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* Can be used to store information about native resource related to the
|
||||
* lightweight component.
|
||||
*/
|
||||
public interface PlatformComponent {
|
||||
|
||||
public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow);
|
||||
/**
|
||||
* Initializes platform component.
|
||||
*
|
||||
* @param platformWindow already initialized {@code PlatformWindow}.
|
||||
*/
|
||||
void initialize(PlatformWindow platformWindow);
|
||||
|
||||
public void setBounds(int x, int y, int w, int h);
|
||||
/**
|
||||
* Moves and resizes this component. The new location of the top-left corner
|
||||
* is specified by {@code x} and {@code y}, and the new size is specified by
|
||||
* {@code w} and {@code h}. The location is specified relative to the {@code
|
||||
* platformWindow}.
|
||||
*
|
||||
* @param x the X location of the component
|
||||
* @param y the Y location of the component
|
||||
* @param w the width of the component
|
||||
* @param h the height of the component
|
||||
*/
|
||||
void setBounds(int x, int y, int w, int h);
|
||||
|
||||
public void dispose();
|
||||
/**
|
||||
* Releases all of the native resources used by this {@code
|
||||
* PlatformComponent}.
|
||||
*/
|
||||
void dispose();
|
||||
}
|
||||
|
@ -131,7 +131,10 @@ public interface PlatformWindow {
|
||||
|
||||
public void setResizable(boolean resizable);
|
||||
|
||||
public void setMinimumSize(int width, int height);
|
||||
/**
|
||||
* Applies the minimum and maximum size to the platform window.
|
||||
*/
|
||||
public void setSizeConstraints(int minW, int minH, int maxW, int maxH);
|
||||
|
||||
/**
|
||||
* Transforms the given Graphics object according to the native
|
||||
|
@ -33,8 +33,8 @@ package sun.lwawt.macosx;
|
||||
public class CFRetainedResource {
|
||||
private static native void nativeCFRelease(final long ptr, final boolean disposeOnAppKitThread);
|
||||
|
||||
final boolean disposeOnAppKitThread;
|
||||
protected long ptr;
|
||||
private final boolean disposeOnAppKitThread;
|
||||
protected volatile long ptr;
|
||||
|
||||
/**
|
||||
* @param ptr CFRetained native object pointer
|
||||
|
@ -30,12 +30,14 @@ import java.awt.peer.*;
|
||||
import java.awt.BufferCapabilities.FlipContents;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.*;
|
||||
import java.security.AccessController;
|
||||
import java.util.List;
|
||||
import java.io.*;
|
||||
|
||||
import sun.awt.CausedFocusEvent.Cause;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.security.action.GetBooleanAction;
|
||||
|
||||
class CFileDialog implements FileDialogPeer {
|
||||
|
||||
@ -53,11 +55,14 @@ class CFileDialog implements FileDialogPeer {
|
||||
if (title == null) {
|
||||
title = " ";
|
||||
}
|
||||
Boolean chooseDirectories = AccessController.doPrivileged(
|
||||
new GetBooleanAction("apple.awt.fileDialogForDirectories"));
|
||||
|
||||
String[] userFileNames = nativeRunFileDialog(title,
|
||||
dialogMode,
|
||||
target.isMultipleMode(),
|
||||
navigateApps,
|
||||
chooseDirectories,
|
||||
target.getFilenameFilter() != null,
|
||||
target.getDirectory(),
|
||||
target.getFile());
|
||||
@ -142,7 +147,8 @@ class CFileDialog implements FileDialogPeer {
|
||||
}
|
||||
|
||||
private native String[] nativeRunFileDialog(String title, int mode,
|
||||
boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter,
|
||||
boolean multipleMode, boolean shouldNavigateApps,
|
||||
boolean canChooseDirectories, boolean hasFilenameFilter,
|
||||
String directory, String file);
|
||||
|
||||
@Override
|
||||
|
@ -23,27 +23,24 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package sun.lwawt.macosx;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
|
||||
import sun.lwawt.PlatformComponent;
|
||||
import sun.lwawt.PlatformWindow;
|
||||
import sun.lwawt.LWComponentPeer;
|
||||
|
||||
import sun.lwawt.macosx.CFRetainedResource;
|
||||
/**
|
||||
* On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
|
||||
* can be used from JAWT.
|
||||
*/
|
||||
final class CPlatformComponent extends CFRetainedResource
|
||||
implements PlatformComponent {
|
||||
|
||||
public class CPlatformComponent extends CFRetainedResource implements PlatformComponent {
|
||||
private volatile PlatformWindow platformWindow;
|
||||
|
||||
Component target;
|
||||
LWComponentPeer peer;
|
||||
PlatformWindow platformWindow;
|
||||
|
||||
private native long nativeCreateComponent(long windowLayer);
|
||||
private native long nativeSetBounds(long ptr, int x, int y, int width, int height);
|
||||
|
||||
public CPlatformComponent() {
|
||||
CPlatformComponent() {
|
||||
super(0, true);
|
||||
}
|
||||
|
||||
@ -51,27 +48,28 @@ public class CPlatformComponent extends CFRetainedResource implements PlatformCo
|
||||
return ptr;
|
||||
}
|
||||
|
||||
public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow) {
|
||||
this.target = target;
|
||||
this.peer = peer;
|
||||
@Override
|
||||
public void initialize(final PlatformWindow platformWindow) {
|
||||
this.platformWindow = platformWindow;
|
||||
|
||||
long windowLayerPtr = platformWindow.getLayerPtr();
|
||||
setPtr(nativeCreateComponent(windowLayerPtr));
|
||||
setPtr(nativeCreateComponent(platformWindow.getLayerPtr()));
|
||||
}
|
||||
|
||||
// TODO: visibility, z-order
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
public void setBounds(final int x, final int y, final int w, final int h) {
|
||||
// translates values from the coordinate system of the top-level window
|
||||
// to the coordinate system of the content view
|
||||
Insets insets = platformWindow.getPeer().getInsets();
|
||||
nativeSetBounds(getPointer(), x - insets.left, y - insets.top, width, height);
|
||||
final Insets insets = platformWindow.getPeer().getInsets();
|
||||
nativeSetBounds(getPointer(), x - insets.left, y - insets.top, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private native long nativeCreateComponent(long windowLayer);
|
||||
|
||||
private native void nativeSetBounds(long ptr, int x, int y, int w, int h);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
|
||||
public void setResizable(boolean resizable) {}
|
||||
|
||||
@Override
|
||||
public void setMinimumSize(int width, int height) {}
|
||||
public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {}
|
||||
|
||||
@Override
|
||||
public Graphics transformGraphics(Graphics g) {
|
||||
|
@ -672,20 +672,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
// Re-apply the size constraints and the size to ensure the space
|
||||
// occupied by the grow box is counted properly
|
||||
setMinimumSize(1, 1); // the method ignores its arguments
|
||||
peer.updateMinimumSize();
|
||||
|
||||
Rectangle bounds = peer.getBounds();
|
||||
setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumSize(int width, int height) {
|
||||
//TODO width, height should be used
|
||||
//NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below
|
||||
final long nsWindowPtr = getNSWindowPtr();
|
||||
final Dimension min = target.getMinimumSize();
|
||||
final Dimension max = target.getMaximumSize();
|
||||
nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight());
|
||||
public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
|
||||
nativeSetNSWindowMinMax(getNSWindowPtr(), minW, minH, maxW, maxH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,8 @@ package sun.nio.ch;
|
||||
import sun.misc.*;
|
||||
import java.io.IOException;
|
||||
import java.io.FileDescriptor;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/*
|
||||
* struct kevent { // 32-bit 64-bit
|
||||
@ -100,6 +101,18 @@ class KQueueArrayWrapper {
|
||||
kq = init();
|
||||
}
|
||||
|
||||
// Used to update file description registrations
|
||||
private static class Update {
|
||||
SelChImpl channel;
|
||||
int events;
|
||||
Update(SelChImpl channel, int events) {
|
||||
this.channel = channel;
|
||||
this.events = events;
|
||||
}
|
||||
}
|
||||
|
||||
private LinkedList<Update> updateList = new LinkedList<Update>();
|
||||
|
||||
void initInterrupt(int fd0, int fd1) {
|
||||
outgoingInterruptFD = fd1;
|
||||
incomingInterruptFD = fd0;
|
||||
@ -137,14 +150,41 @@ class KQueueArrayWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
void setInterest(int fd, int events) {
|
||||
register0(kq, fd, events & POLLIN, events & POLLOUT);
|
||||
void setInterest(SelChImpl channel, int events) {
|
||||
synchronized (updateList) {
|
||||
// update existing registration
|
||||
updateList.add(new Update(channel, events));
|
||||
}
|
||||
}
|
||||
|
||||
void release(int fd) {
|
||||
register0(kq, fd, 0, 0);
|
||||
void release(SelChImpl channel) {
|
||||
synchronized (updateList) {
|
||||
// flush any pending updates
|
||||
for (Iterator<Update> it = updateList.iterator(); it.hasNext();) {
|
||||
if (it.next().channel == channel) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// remove
|
||||
register0(kq, channel.getFDVal(), 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void updateRegistrations() {
|
||||
synchronized (updateList) {
|
||||
Update u = null;
|
||||
while ((u = updateList.poll()) != null) {
|
||||
SelChImpl ch = u.channel;
|
||||
if (!ch.isOpen())
|
||||
continue;
|
||||
|
||||
register0(kq, ch.getFDVal(), u.events & POLLIN, u.events & POLLOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void close() throws IOException {
|
||||
if (keventArray != null) {
|
||||
keventArray.free();
|
||||
@ -157,6 +197,7 @@ class KQueueArrayWrapper {
|
||||
}
|
||||
|
||||
int poll(long timeout) {
|
||||
updateRegistrations();
|
||||
int updated = kevent0(kq, keventArrayAddress, NUM_KEVENTS, timeout);
|
||||
return updated;
|
||||
}
|
||||
@ -173,4 +214,3 @@ class KQueueArrayWrapper {
|
||||
long timeout);
|
||||
private static native void interrupt(int fd);
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,6 @@ class KQueueSelectorImpl
|
||||
FileDispatcherImpl.closeIntFD(fd0);
|
||||
FileDispatcherImpl.closeIntFD(fd1);
|
||||
if (kqueueWrapper != null) {
|
||||
kqueueWrapper.release(fd0);
|
||||
kqueueWrapper.close();
|
||||
kqueueWrapper = null;
|
||||
selectedKeys = null;
|
||||
@ -220,7 +219,7 @@ class KQueueSelectorImpl
|
||||
protected void implDereg(SelectionKeyImpl ski) throws IOException {
|
||||
int fd = ski.channel.getFDVal();
|
||||
fdMap.remove(Integer.valueOf(fd));
|
||||
kqueueWrapper.release(fd);
|
||||
kqueueWrapper.release(ski.channel);
|
||||
totalChannels--;
|
||||
keys.remove(ski);
|
||||
selectedKeys.remove(ski);
|
||||
@ -234,8 +233,7 @@ class KQueueSelectorImpl
|
||||
public void putEventOps(SelectionKeyImpl ski, int ops) {
|
||||
if (closed)
|
||||
throw new ClosedSelectorException();
|
||||
int fd = IOUtil.fdVal(ski.channel.getFD());
|
||||
kqueueWrapper.setInterest(fd, ops);
|
||||
kqueueWrapper.setInterest(ski.channel, ops);
|
||||
}
|
||||
|
||||
|
||||
@ -254,4 +252,3 @@ class KQueueSelectorImpl
|
||||
Util.load();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
@ -78,11 +78,10 @@
|
||||
|
||||
// translates values to the coordinate system of the "root" layer
|
||||
CGFloat newY = windowLayer.bounds.size.height - rect.origin.y - rect.size.height;
|
||||
CGRect newRect = CGRectMake(rect.origin.x, newY, rect.size.width, rect.size.height);
|
||||
|
||||
// REMIND: why do we need to inverse position?
|
||||
CGRect newRect = CGRectMake(-rect.origin.x, -newY, rect.size.width, rect.size.height);
|
||||
layer.frame = newRect;
|
||||
|
||||
layer.bounds = newRect;
|
||||
[AWTSurfaceLayers repaintLayersRecursively:layer];
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,9 @@
|
||||
// Should we navigate into apps?
|
||||
BOOL fNavigateApps;
|
||||
|
||||
// Can the dialog choose directories ?
|
||||
BOOL fChooseDirectories;
|
||||
|
||||
// Contains the absolute paths of the selected files as URLs
|
||||
NSArray *fURLs;
|
||||
}
|
||||
@ -65,6 +68,7 @@
|
||||
mode:(jint)inMode
|
||||
multipleMode:(BOOL)inMultipleMode
|
||||
shouldNavigate:(BOOL)inNavigateApps
|
||||
canChooseDirectories:(BOOL)inChooseDirectories
|
||||
withEnv:(JNIEnv*)env;
|
||||
|
||||
// Invoked from the main thread
|
||||
|
@ -43,6 +43,7 @@
|
||||
mode:(jint)inMode
|
||||
multipleMode:(BOOL)inMultipleMode
|
||||
shouldNavigate:(BOOL)inNavigateApps
|
||||
canChooseDirectories:(BOOL)inChooseDirectories
|
||||
withEnv:(JNIEnv*)env;
|
||||
{
|
||||
if (self == [super init]) {
|
||||
@ -57,6 +58,7 @@
|
||||
fMode = inMode;
|
||||
fMultipleMode = inMultipleMode;
|
||||
fNavigateApps = inNavigateApps;
|
||||
fChooseDirectories = inChooseDirectories;
|
||||
fPanelResult = NSCancelButton;
|
||||
}
|
||||
|
||||
@ -109,7 +111,7 @@
|
||||
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
||||
[openPanel setAllowsMultipleSelection:fMultipleMode];
|
||||
[openPanel setCanChooseFiles:YES];
|
||||
[openPanel setCanChooseDirectories:NO];
|
||||
[openPanel setCanChooseDirectories:fChooseDirectories];
|
||||
[openPanel setCanCreateDirectories:YES];
|
||||
}
|
||||
|
||||
@ -182,7 +184,8 @@
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog
|
||||
(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode,
|
||||
jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file)
|
||||
jboolean navigateApps, jboolean chooseDirectories, jboolean hasFilter,
|
||||
jstring directory, jstring file)
|
||||
{
|
||||
jobjectArray returnValue = NULL;
|
||||
|
||||
@ -200,6 +203,7 @@ JNF_COCOA_ENTER(env);
|
||||
mode:mode
|
||||
multipleMode:multipleMode
|
||||
shouldNavigate:navigateApps
|
||||
canChooseDirectories:chooseDirectories
|
||||
withEnv:env];
|
||||
|
||||
[JNFRunLoop performOnMainThread:@selector(safeSaveOrLoad)
|
||||
|
@ -447,3 +447,20 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
|
||||
return cglinfo->context->caps;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
|
||||
(JNIEnv *env, jclass cglgc)
|
||||
{
|
||||
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
|
||||
|
||||
__block int max = 0;
|
||||
|
||||
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
|
||||
[sharedContext makeCurrentContext];
|
||||
j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
|
||||
}];
|
||||
|
||||
return (jint)max;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
@interface NSApplicationAWT : NSApplication {
|
||||
NSString *fApplicationName;
|
||||
BOOL fUseDefaultIcon;
|
||||
NSWindow *eventTransparentWindow;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,6 @@ BOOL postEventDuringEventSynthesis = NO;
|
||||
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
fApplicationName = nil;
|
||||
fUseDefaultIcon = NO;
|
||||
|
||||
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
|
||||
// So, we need to call it ourselves to ensure the app is set up properly.
|
||||
@ -147,10 +146,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
if (appName != NULL) {
|
||||
fApplicationName = [NSString stringWithUTF8String:appName];
|
||||
unsetenv(envVar);
|
||||
|
||||
// If this environment variable was set we were launched from the command line, so we
|
||||
// should use a generic app icon if one wasn't set.
|
||||
fUseDefaultIcon = YES;
|
||||
}
|
||||
|
||||
// If it wasn't specified as an argument, see if it was specified as a system property.
|
||||
@ -171,9 +166,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
if (lastPeriod.location != NSNotFound) {
|
||||
fApplicationName = [fApplicationName substringFromIndex:lastPeriod.location + 1];
|
||||
}
|
||||
// If this environment variable was set we were launched from the command line, so we
|
||||
// should use a generic app icon if one wasn't set.
|
||||
fUseDefaultIcon = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,8 +258,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
// If the icon file wasn't specified as an argument and we need to get an icon
|
||||
// we'll use the generic java app icon.
|
||||
NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"];
|
||||
if (fUseDefaultIcon && (theIconPath == nil)) {
|
||||
theIconPath = defaultIconPath;
|
||||
if (theIconPath == nil) {
|
||||
NSString* bundleIcon = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIconFile"];
|
||||
if (bundleIcon == nil) {
|
||||
theIconPath = defaultIconPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the dock icon if we have an icon name.
|
||||
|
@ -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;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -37,6 +37,7 @@
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Rijndael --pronounced Reindaal-- is a symmetric cipher with a 128-bit
|
||||
@ -54,7 +55,12 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
private Object[] sessionK = null;
|
||||
private int[] K = null;
|
||||
|
||||
/** (ROUNDS-1) * 4 */
|
||||
/** Cipher encryption/decryption key */
|
||||
// skip re-generating Session and Sub keys if the cipher key is
|
||||
// the same
|
||||
private byte[] lastKey = null;
|
||||
|
||||
/** ROUNDS * 4 */
|
||||
private int limit = 0;
|
||||
|
||||
AESCrypt() {
|
||||
@ -82,41 +88,45 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
key.length + " bytes");
|
||||
}
|
||||
|
||||
// generate session key and reset sub key.
|
||||
sessionK = makeKey(key);
|
||||
setSubKey(decrypting);
|
||||
if (!Arrays.equals(key, lastKey)) {
|
||||
// re-generate session key 'sessionK' when cipher key changes
|
||||
makeSessionKey(key);
|
||||
lastKey = key.clone(); // save cipher key
|
||||
}
|
||||
|
||||
// set sub key to the corresponding session Key
|
||||
this.K = (int[]) sessionK[(decrypting? 1:0)];
|
||||
}
|
||||
|
||||
private void setSubKey(boolean decrypting) {
|
||||
int[][] Kd = (int[][]) sessionK[decrypting ? 1 : 0];
|
||||
int rounds = Kd.length;
|
||||
this.K = new int[rounds*4];
|
||||
for(int i=0; i<rounds; i++) {
|
||||
for(int j=0; j<4; j++) {
|
||||
K[i*4 + j] = Kd[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand an int[(ROUNDS+1)][4] into int[(ROUNDS+1)*4].
|
||||
* For decryption round keys, need to rotate right by 4 ints.
|
||||
* @param kr The round keys for encryption or decryption.
|
||||
* @param decrypting True if 'kr' is for decryption and false otherwise.
|
||||
*/
|
||||
private static final int[] expandToSubKey(int[][] kr, boolean decrypting) {
|
||||
int total = kr.length;
|
||||
int[] expK = new int[total*4];
|
||||
if (decrypting) {
|
||||
int j0 = K[K.length-4];
|
||||
int j1 = K[K.length-3];
|
||||
int j2 = K[K.length-2];
|
||||
int j3 = K[K.length-1];
|
||||
|
||||
for (int i=this.K.length-1; i>3; i--) {
|
||||
this.K[i] = this.K[i-4];
|
||||
// decrypting, rotate right by 4 ints
|
||||
// i.e. i==0
|
||||
for(int j=0; j<4; j++) {
|
||||
expK[j] = kr[total-1][j];
|
||||
}
|
||||
for(int i=1; i<total; i++) {
|
||||
for(int j=0; j<4; j++) {
|
||||
expK[i*4 + j] = kr[i-1][j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// encrypting, straight expansion
|
||||
for(int i=0; i<total; i++) {
|
||||
for(int j=0; j<4; j++) {
|
||||
expK[i*4 + j] = kr[i][j];
|
||||
}
|
||||
}
|
||||
K[0] = j0;
|
||||
K[1] = j1;
|
||||
K[2] = j2;
|
||||
K[3] = j3;
|
||||
}
|
||||
|
||||
ROUNDS_12 = (rounds>=13);
|
||||
ROUNDS_14 = (rounds==15);
|
||||
|
||||
rounds--;
|
||||
limit=rounds*4;
|
||||
return expK;
|
||||
}
|
||||
|
||||
private static int[]
|
||||
@ -566,10 +576,10 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
/**
|
||||
* Expand a user-supplied key material into a session key.
|
||||
*
|
||||
* @param key The 128/192/256-bit user-key to use.
|
||||
* @param k The 128/192/256-bit cipher key to use.
|
||||
* @exception InvalidKeyException If the key is invalid.
|
||||
*/
|
||||
private static Object[] makeKey(byte[] k) throws InvalidKeyException {
|
||||
private void makeSessionKey(byte[] k) throws InvalidKeyException {
|
||||
if (k == null) {
|
||||
throw new InvalidKeyException("Empty key");
|
||||
}
|
||||
@ -639,10 +649,18 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
U4[ tt & 0xFF];
|
||||
}
|
||||
}
|
||||
// assemble the encryption (Ke) and decryption (Kd) round keys into
|
||||
// one sessionKey object
|
||||
Object[] result = new Object[] {Ke, Kd};
|
||||
return result;
|
||||
|
||||
// assemble the encryption (Ke) and decryption (Kd) round keys
|
||||
// and expand them into arrays of ints.
|
||||
int[] expandedKe = expandToSubKey(Ke, false); // decrypting==false
|
||||
int[] expandedKd = expandToSubKey(Kd, true); // decrypting==true
|
||||
|
||||
ROUNDS_12 = (ROUNDS>=12);
|
||||
ROUNDS_14 = (ROUNDS==14);
|
||||
limit = ROUNDS*4;
|
||||
|
||||
// store the expanded sub keys into 'sessionK'
|
||||
sessionK = new Object[] { expandedKe, expandedKd };
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,6 +207,22 @@ class ClassWriter {
|
||||
m);
|
||||
}
|
||||
|
||||
private void reorderBSMandICS(Attribute.Holder h) {
|
||||
Attribute bsmAttr = h.getAttribute(Package.attrBootstrapMethodsEmpty);
|
||||
if (bsmAttr == null) return;
|
||||
|
||||
Attribute icsAttr = h.getAttribute(Package.attrInnerClassesEmpty);
|
||||
if (icsAttr == null) return;
|
||||
|
||||
int bsmidx = h.attributes.indexOf(bsmAttr);
|
||||
int icsidx = h.attributes.indexOf(icsAttr);
|
||||
if (bsmidx > icsidx) {
|
||||
h.attributes.remove(bsmAttr);
|
||||
h.attributes.add(icsidx, bsmAttr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// handy buffer for collecting attrs
|
||||
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||
DataOutputStream bufOut = new DataOutputStream(buf);
|
||||
@ -216,6 +232,11 @@ class ClassWriter {
|
||||
writeShort(0); // attribute size
|
||||
return;
|
||||
}
|
||||
// there may be cases if an InnerClass attribute is explicit, then the
|
||||
// ordering could be wrong, fix the ordering before we write it out.
|
||||
if (h instanceof Package.Class)
|
||||
reorderBSMandICS(h);
|
||||
|
||||
writeShort(h.attributes.size());
|
||||
for (Attribute a : h.attributes) {
|
||||
a.finishRefs(cpIndex);
|
||||
|
@ -169,7 +169,7 @@ public abstract class MXBeanMapping {
|
||||
return (Class<?>) javaType;
|
||||
try {
|
||||
String className = openType.getClassName();
|
||||
return Class.forName(className, false, null);
|
||||
return Class.forName(className, false, MXBeanMapping.class.getClassLoader());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e); // should not happen
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ public final class IIOPHelper {
|
||||
AccessController.doPrivileged(new PrivilegedAction<IIOPProxy>() {
|
||||
public IIOPProxy run() {
|
||||
try {
|
||||
Class<?> c = Class.forName(IMPL_CLASS, true, null);
|
||||
Class<?> c = Class.forName(IMPL_CLASS, true,
|
||||
IIOPHelper.class.getClassLoader());
|
||||
return (IIOPProxy)c.newInstance();
|
||||
} catch (ClassNotFoundException cnf) {
|
||||
return null;
|
||||
|
@ -458,6 +458,10 @@ public class Krb5LoginModule implements LoginModule {
|
||||
useKeyTab = "true".equalsIgnoreCase((String)options.get("useKeyTab"));
|
||||
ticketCacheName = (String)options.get("ticketCache");
|
||||
keyTabName = (String)options.get("keyTab");
|
||||
if (keyTabName != null) {
|
||||
keyTabName = sun.security.krb5.internal.ktab.KeyTab.normalize(
|
||||
keyTabName);
|
||||
}
|
||||
princName = (String)options.get("principal");
|
||||
refreshKrb5Config =
|
||||
"true".equalsIgnoreCase((String)options.get("refreshKrb5Config"));
|
||||
|
@ -150,7 +150,7 @@ import sun.util.logging.PlatformLogger;
|
||||
* import java.awt.event.*;
|
||||
* import java.io.Serializable;
|
||||
*
|
||||
* class MyApp java.io.Serializable
|
||||
* class MyApp implements java.io.Serializable
|
||||
* {
|
||||
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
|
||||
* Button aButton = new Button();
|
||||
|
@ -36,6 +36,8 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.util.EmptyStackException;
|
||||
|
||||
import sun.awt.dnd.SunDropTargetEvent;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
@ -464,7 +466,9 @@ public class EventQueue {
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
return MOVE;
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
return DRAG;
|
||||
// Return -1 for SunDropTargetEvent since they are usually synchronous
|
||||
// and we don't want to skip them by coalescing with MouseEvent or other drag events
|
||||
return e instanceof SunDropTargetEvent ? -1 : DRAG;
|
||||
default:
|
||||
return e instanceof PeerEvent ? PEER : -1;
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
|
||||
throw new IntrospectionException("bad write method arg count: "
|
||||
+ writeMethod);
|
||||
}
|
||||
if (propertyType != null && propertyType != params[0]) {
|
||||
if (propertyType != null && !params[0].isAssignableFrom(propertyType)) {
|
||||
throw new IntrospectionException("type mismatch between read and write methods");
|
||||
}
|
||||
propertyType = params[0];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -711,7 +711,10 @@ public class File
|
||||
|
||||
/**
|
||||
* Tests whether the application can read the file denoted by this
|
||||
* abstract pathname.
|
||||
* abstract pathname. On some platforms it may be possible to start the
|
||||
* Java virtual machine with special privileges that allow it to read
|
||||
* files that are marked as unreadable. Consequently this method may return
|
||||
* {@code true} even though the file does not have read permissions.
|
||||
*
|
||||
* @return <code>true</code> if and only if the file specified by this
|
||||
* abstract pathname exists <em>and</em> can be read by the
|
||||
@ -732,7 +735,10 @@ public class File
|
||||
|
||||
/**
|
||||
* Tests whether the application can modify the file denoted by this
|
||||
* abstract pathname.
|
||||
* abstract pathname. On some platforms it may be possible to start the
|
||||
* Java virtual machine with special privileges that allow it to modify
|
||||
* files that are marked read-only. Consequently this method may return
|
||||
* {@code true} even though the file is marked read-only.
|
||||
*
|
||||
* @return <code>true</code> if and only if the file system actually
|
||||
* contains a file denoted by this abstract pathname <em>and</em>
|
||||
@ -1351,9 +1357,11 @@ public class File
|
||||
|
||||
/**
|
||||
* Marks the file or directory named by this abstract pathname so that
|
||||
* only read operations are allowed. After invoking this method the file
|
||||
* or directory is guaranteed not to change until it is either deleted or
|
||||
* marked to allow write access. Whether or not a read-only file or
|
||||
* only read operations are allowed. After invoking this method the file
|
||||
* or directory will not change until it is either deleted or marked
|
||||
* to allow write access. On some platforms it may be possible to start the
|
||||
* Java virtual machine with special privileges that allow it to modify
|
||||
* files that are marked read-only. Whether or not a read-only file or
|
||||
* directory may be deleted depends upon the underlying system.
|
||||
*
|
||||
* @return <code>true</code> if and only if the operation succeeded;
|
||||
@ -1376,7 +1384,9 @@ public class File
|
||||
|
||||
/**
|
||||
* Sets the owner's or everybody's write permission for this abstract
|
||||
* pathname.
|
||||
* pathname. On some platforms it may be possible to start the Java virtual
|
||||
* machine with special privileges that allow it to modify files that
|
||||
* disallow write operations.
|
||||
*
|
||||
* <p> The {@link java.nio.file.Files} class defines methods that operate on
|
||||
* file attributes including file permissions. This may be used when finer
|
||||
@ -1414,7 +1424,9 @@ public class File
|
||||
|
||||
/**
|
||||
* A convenience method to set the owner's write permission for this abstract
|
||||
* pathname.
|
||||
* pathname. On some platforms it may be possible to start the Java virtual
|
||||
* machine with special privileges that allow it to modify files that
|
||||
* disallow write operations.
|
||||
*
|
||||
* <p> An invocation of this method of the form <tt>file.setWritable(arg)</tt>
|
||||
* behaves in exactly the same way as the invocation
|
||||
@ -1443,7 +1455,9 @@ public class File
|
||||
|
||||
/**
|
||||
* Sets the owner's or everybody's read permission for this abstract
|
||||
* pathname.
|
||||
* pathname. On some platforms it may be possible to start the Java virtual
|
||||
* machine with special privileges that allow it to read files that are
|
||||
* marked as unreadable.
|
||||
*
|
||||
* <p> The {@link java.nio.file.Files} class defines methods that operate on
|
||||
* file attributes including file permissions. This may be used when finer
|
||||
@ -1484,7 +1498,9 @@ public class File
|
||||
|
||||
/**
|
||||
* A convenience method to set the owner's read permission for this abstract
|
||||
* pathname.
|
||||
* pathname. On some platforms it may be possible to start the Java virtual
|
||||
* machine with special privileges that allow it to read files that that are
|
||||
* marked as unreadable.
|
||||
*
|
||||
* <p>An invocation of this method of the form <tt>file.setReadable(arg)</tt>
|
||||
* behaves in exactly the same way as the invocation
|
||||
@ -1516,7 +1532,9 @@ public class File
|
||||
|
||||
/**
|
||||
* Sets the owner's or everybody's execute permission for this abstract
|
||||
* pathname.
|
||||
* pathname. On some platforms it may be possible to start the Java virtual
|
||||
* machine with special privileges that allow it to execute files that are
|
||||
* not marked executable.
|
||||
*
|
||||
* <p> The {@link java.nio.file.Files} class defines methods that operate on
|
||||
* file attributes including file permissions. This may be used when finer
|
||||
@ -1556,8 +1574,10 @@ public class File
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience method to set the owner's execute permission for this abstract
|
||||
* pathname.
|
||||
* A convenience method to set the owner's execute permission for this
|
||||
* abstract pathname. On some platforms it may be possible to start the Java
|
||||
* virtual machine with special privileges that allow it to execute files
|
||||
* that are not marked executable.
|
||||
*
|
||||
* <p>An invocation of this method of the form <tt>file.setExcutable(arg)</tt>
|
||||
* behaves in exactly the same way as the invocation
|
||||
@ -1589,7 +1609,10 @@ public class File
|
||||
|
||||
/**
|
||||
* Tests whether the application can execute the file denoted by this
|
||||
* abstract pathname.
|
||||
* abstract pathname. On some platforms it may be possible to start the
|
||||
* Java virtual machine with special privileges that allow it to execute
|
||||
* files that are not marked executable. Consequently this method may return
|
||||
* {@code true} even though the file does not have execute permissions.
|
||||
*
|
||||
* @return <code>true</code> if and only if the abstract pathname exists
|
||||
* <em>and</em> the application is allowed to execute the file
|
||||
|
@ -228,7 +228,8 @@ public final
|
||||
* ensure it's ok to access the bootstrap class loader.
|
||||
*
|
||||
* @param name fully qualified name of the desired class
|
||||
* @param initialize whether the class must be initialized
|
||||
* @param initialize if {@code true} the class will be initialized.
|
||||
* See Section 12.4 of <em>The Java Language Specification</em>.
|
||||
* @param loader class loader from which the class must be loaded
|
||||
* @return class object representing the desired class
|
||||
*
|
||||
@ -605,7 +606,7 @@ public final
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = ClassLoader.getCallerClassLoader();
|
||||
if (ccl != null && ccl != cl && !cl.isAncestor(ccl)) {
|
||||
if (ClassLoader.needsClassLoaderPermissionCheck(ccl, cl)) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
}
|
||||
@ -2170,8 +2171,7 @@ public final
|
||||
if (s != null) {
|
||||
s.checkMemberAccess(this, which);
|
||||
ClassLoader cl = getClassLoader0();
|
||||
if ((ccl != null) && (ccl != cl) &&
|
||||
((cl == null) || !cl.isAncestor(ccl))) {
|
||||
if (sun.reflect.misc.ReflectUtil.needsPackageAccessCheck(ccl, cl)) {
|
||||
String name = this.getName();
|
||||
int i = name.lastIndexOf('.');
|
||||
if (i != -1) {
|
||||
|
@ -1403,7 +1403,7 @@ public abstract class ClassLoader {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = getCallerClassLoader();
|
||||
if (ccl != null && !isAncestor(ccl)) {
|
||||
if (needsClassLoaderPermissionCheck(ccl, this)) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
}
|
||||
@ -1473,7 +1473,7 @@ public abstract class ClassLoader {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = getCallerClassLoader();
|
||||
if (ccl != null && ccl != scl && !scl.isAncestor(ccl)) {
|
||||
if (needsClassLoaderPermissionCheck(ccl, scl)) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
}
|
||||
@ -1523,6 +1523,23 @@ public abstract class ClassLoader {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tests if class loader access requires "getClassLoader" permission
|
||||
// check. A class loader 'from' can access class loader 'to' if
|
||||
// class loader 'from' is same as class loader 'to' or an ancestor
|
||||
// of 'to'. The class loader in a system domain can access
|
||||
// any class loader.
|
||||
static boolean needsClassLoaderPermissionCheck(ClassLoader from,
|
||||
ClassLoader to)
|
||||
{
|
||||
if (from == to)
|
||||
return false;
|
||||
|
||||
if (from == null)
|
||||
return false;
|
||||
|
||||
return !to.isAncestor(from);
|
||||
}
|
||||
|
||||
// Returns the invoker's class loader, or null if none.
|
||||
// NOTE: This must always be invoked when there is exactly one intervening
|
||||
// frame from the core libraries on the stack between this method's
|
||||
|
@ -1449,8 +1449,7 @@ class Thread implements Runnable {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
ClassLoader ccl = ClassLoader.getCallerClassLoader();
|
||||
if (ccl != null && ccl != contextClassLoader &&
|
||||
!contextClassLoader.isAncestor(ccl)) {
|
||||
if (ClassLoader.needsClassLoaderPermissionCheck(ccl, contextClassLoader)) {
|
||||
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package java.lang.annotation;
|
||||
/**
|
||||
* A meta-annotation to indicate which annotation type should be used
|
||||
* as a container for repeated values of the annotation type modified
|
||||
* by the {@code ContainerAnnotation} annotation.
|
||||
* by the {@code ContainedBy} annotation.
|
||||
*
|
||||
* @since 1.8
|
||||
* @jls 9.6 Annotation Types
|
||||
@ -37,7 +37,7 @@ package java.lang.annotation;
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
public @interface ContainerAnnotation {
|
||||
public @interface ContainedBy {
|
||||
/**
|
||||
* The annotation type to use to store repeated values of another
|
||||
* annotation.
|
@ -576,16 +576,16 @@ public class ManagementFactory {
|
||||
Class<T> mxbeanInterface)
|
||||
throws java.io.IOException {
|
||||
|
||||
final Class<?> interfaceClass = mxbeanInterface;
|
||||
// Only allow MXBean interfaces from rt.jar loaded by the
|
||||
// bootstrap class loader
|
||||
final ClassLoader loader =
|
||||
final Class<?> cls = mxbeanInterface;
|
||||
ClassLoader loader =
|
||||
AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
public ClassLoader run() {
|
||||
return interfaceClass.getClassLoader();
|
||||
return cls.getClassLoader();
|
||||
}
|
||||
});
|
||||
if (loader != null) {
|
||||
if (!sun.misc.VM.isSystemDomainLoader(loader)) {
|
||||
throw new IllegalArgumentException(mxbeanName +
|
||||
" is not a platform MXBean");
|
||||
}
|
||||
@ -593,10 +593,10 @@ public class ManagementFactory {
|
||||
try {
|
||||
final ObjectName objName = new ObjectName(mxbeanName);
|
||||
// skip the isInstanceOf check for LoggingMXBean
|
||||
String intfName = interfaceClass.getName();
|
||||
String intfName = mxbeanInterface.getName();
|
||||
if (!connection.isInstanceOf(objName, intfName)) {
|
||||
throw new IllegalArgumentException(mxbeanName +
|
||||
" is not an instance of " + interfaceClass);
|
||||
" is not an instance of " + mxbeanInterface);
|
||||
}
|
||||
|
||||
final Class[] interfaces;
|
||||
|
@ -363,7 +363,8 @@ enum PlatformComponent {
|
||||
try {
|
||||
// Lazy loading the MXBean interface only when it is needed
|
||||
return (Class<? extends PlatformManagedObject>)
|
||||
Class.forName(mxbeanInterfaceName, false, null);
|
||||
Class.forName(mxbeanInterfaceName, false,
|
||||
PlatformManagedObject.class.getClassLoader());
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
|
@ -888,6 +888,8 @@ public abstract class $Type$Buffer
|
||||
*/
|
||||
public $Type$Buffer put(String src, int start, int end) {
|
||||
checkBounds(start, end - start, src.length());
|
||||
if (end - start > remaining())
|
||||
throw new BufferOverflowException();
|
||||
for (int i = start; i < end; i++)
|
||||
this.put(src.charAt(i));
|
||||
return this;
|
||||
|
@ -90,27 +90,26 @@ public abstract class AbstractSelectableChannel
|
||||
// -- Utility methods for the key set --
|
||||
|
||||
private void addKey(SelectionKey k) {
|
||||
synchronized (keyLock) {
|
||||
int i = 0;
|
||||
if ((keys != null) && (keyCount < keys.length)) {
|
||||
// Find empty element of key array
|
||||
for (i = 0; i < keys.length; i++)
|
||||
if (keys[i] == null)
|
||||
break;
|
||||
} else if (keys == null) {
|
||||
keys = new SelectionKey[3];
|
||||
} else {
|
||||
// Grow key array
|
||||
int n = keys.length * 2;
|
||||
SelectionKey[] ks = new SelectionKey[n];
|
||||
for (i = 0; i < keys.length; i++)
|
||||
ks[i] = keys[i];
|
||||
keys = ks;
|
||||
i = keyCount;
|
||||
}
|
||||
keys[i] = k;
|
||||
keyCount++;
|
||||
assert Thread.holdsLock(keyLock);
|
||||
int i = 0;
|
||||
if ((keys != null) && (keyCount < keys.length)) {
|
||||
// Find empty element of key array
|
||||
for (i = 0; i < keys.length; i++)
|
||||
if (keys[i] == null)
|
||||
break;
|
||||
} else if (keys == null) {
|
||||
keys = new SelectionKey[3];
|
||||
} else {
|
||||
// Grow key array
|
||||
int n = keys.length * 2;
|
||||
SelectionKey[] ks = new SelectionKey[n];
|
||||
for (i = 0; i < keys.length; i++)
|
||||
ks[i] = keys[i];
|
||||
keys = ks;
|
||||
i = keyCount;
|
||||
}
|
||||
keys[i] = k;
|
||||
keyCount++;
|
||||
}
|
||||
|
||||
private SelectionKey findKey(Selector sel) {
|
||||
@ -190,11 +189,11 @@ public abstract class AbstractSelectableChannel
|
||||
Object att)
|
||||
throws ClosedChannelException
|
||||
{
|
||||
if (!isOpen())
|
||||
throw new ClosedChannelException();
|
||||
if ((ops & ~validOps()) != 0)
|
||||
throw new IllegalArgumentException();
|
||||
synchronized (regLock) {
|
||||
if (!isOpen())
|
||||
throw new ClosedChannelException();
|
||||
if ((ops & ~validOps()) != 0)
|
||||
throw new IllegalArgumentException();
|
||||
if (blocking)
|
||||
throw new IllegalBlockingModeException();
|
||||
SelectionKey k = findKey(sel);
|
||||
@ -204,8 +203,12 @@ public abstract class AbstractSelectableChannel
|
||||
}
|
||||
if (k == null) {
|
||||
// New registration
|
||||
k = ((AbstractSelector)sel).register(this, ops, att);
|
||||
addKey(k);
|
||||
synchronized (keyLock) {
|
||||
if (!isOpen())
|
||||
throw new ClosedChannelException();
|
||||
k = ((AbstractSelector)sel).register(this, ops, att);
|
||||
addKey(k);
|
||||
}
|
||||
}
|
||||
return k;
|
||||
}
|
||||
@ -275,9 +278,9 @@ public abstract class AbstractSelectableChannel
|
||||
public final SelectableChannel configureBlocking(boolean block)
|
||||
throws IOException
|
||||
{
|
||||
if (!isOpen())
|
||||
throw new ClosedChannelException();
|
||||
synchronized (regLock) {
|
||||
if (!isOpen())
|
||||
throw new ClosedChannelException();
|
||||
if (blocking == block)
|
||||
return this;
|
||||
if (block && haveValidKeys())
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user