Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
07653a70
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
07653a70
编写于
11月 30, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
a9865f97
2cbe17d4
变更
84
隐藏空白更改
内联
并排
Showing
84 changed file
with
2586 addition
and
987 deletion
+2586
-987
.hgtags
.hgtags
+2
-0
make/common/Defs-linux.gmk
make/common/Defs-linux.gmk
+12
-15
make/java/java/FILES_java.gmk
make/java/java/FILES_java.gmk
+2
-0
makefiles/CompileDemos.gmk
makefiles/CompileDemos.gmk
+2
-2
makefiles/CompileLaunchers.gmk
makefiles/CompileLaunchers.gmk
+1
-1
makefiles/CompileNativeLibraries.gmk
makefiles/CompileNativeLibraries.gmk
+51
-207
makefiles/CreateJars.gmk
makefiles/CreateJars.gmk
+38
-11
makefiles/GensrcIcons.gmk
makefiles/GensrcIcons.gmk
+11
-7
makefiles/GensrcLocaleDataMetaInfo.gmk
makefiles/GensrcLocaleDataMetaInfo.gmk
+3
-2
makefiles/Import.gmk
makefiles/Import.gmk
+5
-4
src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
...n/util/locale/provider/HostLocaleProviderAdapterImpl.java
+25
-10
src/share/bin/java.c
src/share/bin/java.c
+35
-1
src/share/bin/wildcard.c
src/share/bin/wildcard.c
+5
-0
src/share/classes/com/sun/naming/internal/ResourceManager.java
...hare/classes/com/sun/naming/internal/ResourceManager.java
+1
-2
src/share/classes/java/lang/Boolean.java
src/share/classes/java/lang/Boolean.java
+14
-1
src/share/classes/java/lang/Byte.java
src/share/classes/java/lang/Byte.java
+21
-0
src/share/classes/java/lang/Character.java
src/share/classes/java/lang/Character.java
+21
-0
src/share/classes/java/lang/Double.java
src/share/classes/java/lang/Double.java
+20
-0
src/share/classes/java/lang/Float.java
src/share/classes/java/lang/Float.java
+20
-0
src/share/classes/java/lang/Integer.java
src/share/classes/java/lang/Integer.java
+21
-0
src/share/classes/java/lang/Long.java
src/share/classes/java/lang/Long.java
+21
-0
src/share/classes/java/lang/Short.java
src/share/classes/java/lang/Short.java
+21
-0
src/share/classes/java/lang/annotation/Native.java
src/share/classes/java/lang/annotation/Native.java
+43
-0
src/share/classes/java/util/Calendar.java
src/share/classes/java/util/Calendar.java
+2
-5
src/share/classes/java/util/logging/FileHandler.java
src/share/classes/java/util/logging/FileHandler.java
+56
-29
src/share/classes/java/util/spi/CalendarDataProvider.java
src/share/classes/java/util/spi/CalendarDataProvider.java
+3
-221
src/share/classes/java/util/spi/CalendarNameProvider.java
src/share/classes/java/util/spi/CalendarNameProvider.java
+264
-0
src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
+0
-1
src/share/classes/javax/net/ssl/HostnameVerifier.java
src/share/classes/javax/net/ssl/HostnameVerifier.java
+1
-0
src/share/classes/javax/net/ssl/HttpsURLConnection.java
src/share/classes/javax/net/ssl/HttpsURLConnection.java
+1
-1
src/share/classes/javax/net/ssl/KeyManagerFactory.java
src/share/classes/javax/net/ssl/KeyManagerFactory.java
+1
-0
src/share/classes/javax/net/ssl/SSLContext.java
src/share/classes/javax/net/ssl/SSLContext.java
+0
-1
src/share/classes/javax/net/ssl/SSLContextSpi.java
src/share/classes/javax/net/ssl/SSLContextSpi.java
+0
-1
src/share/classes/javax/net/ssl/SSLEngineResult.java
src/share/classes/javax/net/ssl/SSLEngineResult.java
+1
-0
src/share/classes/javax/net/ssl/SSLParameters.java
src/share/classes/javax/net/ssl/SSLParameters.java
+0
-2
src/share/classes/javax/net/ssl/SSLPermission.java
src/share/classes/javax/net/ssl/SSLPermission.java
+0
-5
src/share/classes/javax/net/ssl/SSLServerSocketFactory.java
src/share/classes/javax/net/ssl/SSLServerSocketFactory.java
+6
-0
src/share/classes/javax/net/ssl/SSLSession.java
src/share/classes/javax/net/ssl/SSLSession.java
+0
-1
src/share/classes/javax/net/ssl/SSLSocket.java
src/share/classes/javax/net/ssl/SSLSocket.java
+0
-3
src/share/classes/javax/net/ssl/SSLSocketFactory.java
src/share/classes/javax/net/ssl/SSLSocketFactory.java
+9
-0
src/share/classes/javax/net/ssl/TrustManagerFactory.java
src/share/classes/javax/net/ssl/TrustManagerFactory.java
+1
-0
src/share/classes/javax/net/ssl/X509KeyManager.java
src/share/classes/javax/net/ssl/X509KeyManager.java
+0
-1
src/share/classes/sun/launcher/LauncherHelper.java
src/share/classes/sun/launcher/LauncherHelper.java
+165
-74
src/share/classes/sun/launcher/resources/launcher.properties
src/share/classes/sun/launcher/resources/launcher.properties
+4
-1
src/share/classes/sun/security/krb5/Config.java
src/share/classes/sun/security/krb5/Config.java
+10
-9
src/share/classes/sun/tools/jar/Main.java
src/share/classes/sun/tools/jar/Main.java
+2
-2
src/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java
...es/sun/util/locale/provider/AuxLocaleProviderAdapter.java
+5
-0
src/share/classes/sun/util/locale/provider/CalendarDataProviderImpl.java
...es/sun/util/locale/provider/CalendarDataProviderImpl.java
+1
-149
src/share/classes/sun/util/locale/provider/CalendarDataUtility.java
...classes/sun/util/locale/provider/CalendarDataUtility.java
+54
-8
src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java
...es/sun/util/locale/provider/CalendarNameProviderImpl.java
+234
-0
src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
...es/sun/util/locale/provider/JRELocaleProviderAdapter.java
+22
-5
src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
...asses/sun/util/locale/provider/LocaleProviderAdapter.java
+9
-0
src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java
...es/sun/util/locale/provider/SPILocaleProviderAdapter.java
+64
-19
src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
+1
-1
src/share/native/sun/security/pkcs11/wrapper/p11_mutex.c
src/share/native/sun/security/pkcs11/wrapper/p11_mutex.c
+24
-6
src/solaris/bin/java_md_solinux.c
src/solaris/bin/java_md_solinux.c
+2
-0
src/solaris/classes/sun/java2d/xr/XRRenderer.java
src/solaris/classes/sun/java2d/xr/XRRenderer.java
+38
-17
src/solaris/classes/sun/java2d/xr/XRUtils.java
src/solaris/classes/sun/java2d/xr/XRUtils.java
+2
-2
src/solaris/native/java/lang/java_props_macosx.c
src/solaris/native/java/lang/java_props_macosx.c
+13
-18
src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
...n/util/locale/provider/HostLocaleProviderAdapterImpl.java
+36
-16
test/ProblemList.txt
test/ProblemList.txt
+3
-3
test/TEST.ROOT
test/TEST.ROOT
+1
-1
test/java/lang/HashCode.java
test/java/lang/HashCode.java
+67
-8
test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java
...java/nio/channels/AsynchronousChannelGroup/Unbounded.java
+19
-0
test/java/util/PluggableLocale/CalendarDataProviderTest.java
test/java/util/PluggableLocale/CalendarDataProviderTest.java
+3
-48
test/java/util/PluggableLocale/CalendarDataProviderTest.sh
test/java/util/PluggableLocale/CalendarDataProviderTest.sh
+1
-1
test/java/util/PluggableLocale/CalendarNameProviderTest.java
test/java/util/PluggableLocale/CalendarNameProviderTest.java
+104
-0
test/java/util/PluggableLocale/CalendarNameProviderTest.sh
test/java/util/PluggableLocale/CalendarNameProviderTest.sh
+27
-0
test/java/util/PluggableLocale/CurrencyNameProviderTest.sh
test/java/util/PluggableLocale/CurrencyNameProviderTest.sh
+1
-1
test/java/util/PluggableLocale/GenericTest.java
test/java/util/PluggableLocale/GenericTest.java
+2
-0
test/java/util/PluggableLocale/barprovider.jar
test/java/util/PluggableLocale/barprovider.jar
+0
-0
test/java/util/PluggableLocale/fooprovider.jar
test/java/util/PluggableLocale/fooprovider.jar
+0
-0
test/java/util/PluggableLocale/providersrc/CalendarDataProviderImpl.java
...PluggableLocale/providersrc/CalendarDataProviderImpl.java
+0
-58
test/java/util/PluggableLocale/providersrc/CalendarNameProviderImpl.java
...PluggableLocale/providersrc/CalendarNameProviderImpl.java
+102
-0
test/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java
...luggableLocale/providersrc/CurrencyNameProviderImpl2.java
+14
-5
test/java/util/PluggableLocale/providersrc/Makefile
test/java/util/PluggableLocale/providersrc/Makefile
+8
-1
test/java/util/PluggableLocale/providersrc/java.util.spi.CalendarNameProvider
...ableLocale/providersrc/java.util.spi.CalendarNameProvider
+7
-0
test/java/util/logging/CheckLockLocationTest.java
test/java/util/logging/CheckLockLocationTest.java
+210
-0
test/sun/security/krb5/config/DNS.java
test/sun/security/krb5/config/DNS.java
+38
-0
test/sun/security/krb5/config/NamingManager.java
test/sun/security/krb5/config/NamingManager.java
+60
-0
test/sun/security/krb5/config/dns.sh
test/sun/security/krb5/config/dns.sh
+41
-0
test/tools/jar/JarBackSlash.java
test/tools/jar/JarBackSlash.java
+135
-0
test/tools/launcher/FXLauncherTest.java
test/tools/launcher/FXLauncherTest.java
+307
-0
test/tools/launcher/TestHelper.java
test/tools/launcher/TestHelper.java
+10
-0
未找到文件。
.hgtags
浏览文件 @
07653a70
...
...
@@ -186,3 +186,5 @@ cec8fa02f15634acd7d02d04b0b2d8c044cdbaaa jdk8-b60
50b8b17449d200c66bfd68fb4f3a9197432c9e2b jdk8-b62
f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64
130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
make/common/Defs-linux.gmk
浏览文件 @
07653a70
...
...
@@ -111,21 +111,18 @@ _JUNK_ := $(shell \
# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# Default OBJCOPY comes from GNU Binutils on Linux:
DEF_OBJCOPY=/usr/bin/objcopy
ifdef CROSS_COMPILE_ARCH
# don't try to generate .debuginfo files when cross compiling
_JUNK_ := $(shell \
echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \
"skipping .debuginfo generation.")
OBJCOPY=
ifndef CROSS_COMPILE_ARCH
# Default OBJCOPY comes from GNU Binutils on Linux:
DEF_OBJCOPY=/usr/bin/objcopy
else
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
# disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
# Assume objcopy is part of the cross-compilation toolkit
DEF_OBJCOPY=$(COMPILER_PATH)/objcopy
endif
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
# disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
# Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
...
...
@@ -137,7 +134,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.
You may need to set ALT_OBJCOPY.
")
ENABLE_FULL_DEBUG_SYMBOLS=0
else
_JUNK_ := $(shell \
...
...
make/java/java/FILES_java.gmk
浏览文件 @
07653a70
...
...
@@ -206,6 +206,7 @@ JAVA_JAVA_java = \
sun/util/locale/provider/BreakIteratorProviderImpl.java \
sun/util/locale/provider/CalendarDataProviderImpl.java \
sun/util/locale/provider/CalendarDataUtility.java \
sun/util/locale/provider/CalendarNameProviderImpl.java \
sun/util/locale/provider/CollationRules.java \
sun/util/locale/provider/CollatorProviderImpl.java \
sun/util/locale/provider/CurrencyNameProviderImpl.java \
...
...
@@ -396,6 +397,7 @@ JAVA_JAVA_java = \
java/util/prefs/Base64.java \
java/util/prefs/XmlSupport.java \
java/util/spi/CalendarDataProvider.java \
java/util/spi/CalendarNameProvider.java \
java/util/spi/CurrencyNameProvider.java \
java/util/spi/LocaleNameProvider.java \
java/util/spi/LocaleServiceProvider.java \
...
...
makefiles/CompileDemos.gmk
浏览文件 @
07653a70
...
...
@@ -166,9 +166,9 @@ $(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*))
$(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html))
$(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,README*))
$(eval $(call SetupDemo,TransparentRuler,jfc,,transparentruler.Ruler,,,README*))
$(eval $(call SetupDemo,jconsole-plugin,scripting,
-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar
,,,,*.xml *.txt,,,,Main-Class: \n))
$(eval $(call SetupDemo,jconsole-plugin,scripting,,,,,*.xml *.txt,,,,Main-Class: \n))
$(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*))
$(eval $(call SetupDemo,JTop,management,
-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar
,JTop,,,README*))
$(eval $(call SetupDemo,JTop,management,,JTop,,,README*))
$(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*))
$(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*))
$(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n))
...
...
makefiles/CompileLaunchers.gmk
浏览文件 @
07653a70
...
...
@@ -238,7 +238,7 @@ $(eval $(call SetupLauncher,jar,\
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
$(eval $(call SetupLauncher,jarsigner,\
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jar
S
igner.Main"$(COMMA) }'))
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jar
s
igner.Main"$(COMMA) }'))
$(eval $(call SetupLauncher,javac,\
-DEXPAND_CLASSPATH_WILDCARDS \
...
...
makefiles/CompileNativeLibraries.gmk
浏览文件 @
07653a70
...
...
@@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
LANG:=C,\
CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
LDFLAGS:=-nostdlib -r -arch
i386 -arch
x86_64,\
LDFLAGS:=-nostdlib -r -arch x86_64,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
$(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
...
...
@@ -240,7 +240,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \
LDFLAGS_SUFFIX_solaris:=-l
nsl -lsocket
-lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
LDFLAGS_SUFFIX_solaris:=-l
socket -lnsl
-lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
-framework CoreFoundation \
...
...
@@ -300,6 +300,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX:=$(BUILD_LIBMLIB_LDLIBS) \
$(LDFLAGS_JDKLIB_SUFFIX),\
LDFLAGS_SUFFIX_solaris:=-lc, \
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=mlib_image.dll" \
...
...
@@ -428,6 +429,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_solaris:=-lc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v))
$(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
...
...
@@ -710,7 +712,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT,\
LDFLAGS:=$(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_solaris:=-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
LDFLAGS_SUFFIX_linux:=-ljvm $(LIBM) $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_solaris:=-ljvm $(LIBM) $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_solaris:=-ljvm $(LIBM) $(LIBDL) -ljava
-lc
,\
LDFLAGS_SUFFIX_macosx:=-lmlib_image -ljvm $(LIBM) \
-framework Cocoa \
-framework OpenGL \
...
...
@@ -903,57 +905,34 @@ endif
##########################################################################################
BUILD_LIBZIP_FILES:=\
CRC32.c \
Adler32.c \
Deflater.c \
Inflater.c \
ZipFile.c \
zip_util.c
BUILD_LIBZIP_EXCLUDES :=
ifeq ($(USE_EXTERNAL_LIBZ),true)
LIBZ:=-lz
LIBZ := -lz
LIBZIP_EXCLUDES += zlib-1.2.5
else
BUILD_LIBZIP_FILES += \
compress.c \
deflate.c \
gzclose.c \
gzlib.c \
gzread.c \
gzwrite.c \
infback.c \
inffast.c \
inflate.c \
inftrees.c \
trees.c \
uncompr.c \
zadler32.c \
zcrc32.c \
zutil.c
LIBZ_INCLUDE:=-I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
endif
BUILD_LIBZIP_REORDER:=
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
endif
BUILD_LIBZIP_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
BUILD_LIBZIP_REORDER
:=
$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
BUILD_LIBZIP_REORDER
:=
$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
endif
endif
ifeq ($(LIBZIP_CAN_USE_MMAP), true)
BUILD_LIBZIP_MMAP
:=
-DUSE_MMAP
BUILD_LIBZIP_MMAP
:=
-DUSE_MMAP
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
LIBRARY:=zip,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip \
$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5,\
INCLUDE_FILES:=$(BUILD_LIBZIP_FILES), \
LANG:=C,\
OPTIMIZATION:=LOW, \
SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip,\
EXCLUDES:=$(LIBZIP_EXCLUDES),\
CFLAGS:=$(CFLAGS_JDKLIB) \
$(
LIBZ_INCLUDE
) \
$(
ZLIB_CPPFLAGS
) \
-I$(JDK_TOPDIR)/src/share/native/java/io \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\
CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\
...
...
@@ -966,7 +945,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
-export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
$(WIN_JAVA_LIB),\
LDFLAGS_SUFFIX_linux:=-ljvm -ljava $(LIBZ),\
LDFLAGS_SUFFIX_solaris:=-ljvm -ljava $(LIBZ),\
LDFLAGS_SUFFIX_solaris:=-ljvm -ljava $(LIBZ)
-lc
,\
LDFLAGS_SUFFIX_macosx:=$(LIBZ) -ljava -ljvm,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
...
...
@@ -1144,9 +1123,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_linux:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=$(LIBDL)
-lc
,\
LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
LDFLAGS_SUFFIX:=,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=jdwp.dll" \
...
...
@@ -1186,7 +1164,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_windows:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
LDFLAGS_SUFFIX
:=
,\
LDFLAGS_SUFFIX
_solaris:=-lc
,\
EXCLUDE_FILES:=$(LIBJAAS_EXCLUDE_FILES),\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS) \
...
...
@@ -1217,7 +1195,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT,\
LDFLAGS_SUFFIX_linux:=$(LIBDL),\
LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
LDFLAGS_SUFFIX_macosx:= $(LIBDL),\
LDFLAGS_SUFFIX
:=
,\
LDFLAGS_SUFFIX
_solaris:=-lc
,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=jsdt.dll" \
...
...
@@ -1237,15 +1215,7 @@ ifdef OPENJDK
$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS,\
LIBRARY:=lcms,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms \
$(JDK_TOPDIR)/src/share/native/sun/java2d/,\
INCLUDE_FILES:=cmscam02.c cmscgats.c cmscnvrt.c cmserr.c \
cmsgamma.c cmsgmt.c cmsintrp.c cmsio0.c \
cmsio1.c cmslut.c cmsmd5.c cmsmtrx.c \
cmsnamed.c cmsopt.c cmspack.c cmspcs.c \
cmsplugin.c cmsps2.c cmssamp.c cmssm.c \
cmstypes.c cmsvirt.c cmswtpnt.c cmsxform.c \
LCMS.c,\
SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms,\
LANG:=C,\
OPTIMIZATION:=LOW, \
CFLAGS:=$(filter-out -xc99=%none,$(CFLAGS_JDKLIB)) \
...
...
@@ -1259,7 +1229,7 @@ ifdef OPENJDK
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_solaris:=/usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2,\
LDFLAGS_windows:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
LDFLAGS_SUFFIX_solaris:=-lawt -ljava -ljvm,\
LDFLAGS_SUFFIX_solaris:=-lawt -ljava -ljvm
-lc
,\
LDFLAGS_SUFFIX_macosx:=$(LIBM) -lawt -ljava -ljvm,\
LDFLAGS_SUFFIX_linux:=-lm -lawt -ljava -ljvm,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
...
...
@@ -1626,7 +1596,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT,\
-framework Cocoa -framework Security -framework ApplicationServices,\
LDFLAGS_SUFFIX:=$(LIBINSTRUMENT_LDFLAGS_SUFFIX),\
LDFLAGS_SUFFIX_macosx:=-liconv $(LIBZ),\
LDFLAGS_SUFFIX_solaris:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
LDFLAGS_SUFFIX_solaris:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL)
-lc
,\
LDFLAGS_SUFFIX_linux:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
...
...
@@ -1716,10 +1686,6 @@ BUILD_LIBHPROF_CFLAGS:=-I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
BUILD_LIBHPROF_LDFLAGS:=
ifeq ($(OPENJDK_TARGET_OS),solaris)
BUILD_LIBHPROF_LDFLAGS += -lsocket -lnsl -lc
endif
LIBHPROF_OPTIMIZATION:=HIGHEST
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
ifeq ($(ENABLE_DEBUG_SYMBOLS), yes)
...
...
@@ -1727,10 +1693,6 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
endif
endif
ifneq ($(OPENJDK_TARGET_OS),windows)
BUILD_LIBHPROF_LDFLAGS += $(LIBDL)
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBHPROF,\
LIBRARY:=hprof, \
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
...
...
@@ -1744,7 +1706,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBHPROF,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_windows:=wsock32.lib winmm.lib advapi32.lib,\
LDFLAGS_SUFFIX:=$(BUILD_LIBHPROF_LDFLAGS),\
LDFLAGS_SUFFIX_linux:=$(LIBDL),\
LDFLAGS_SUFFIX_macosx:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=-lsocket -lnsl $(LIBDL) -lc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=hprof.dll" \
...
...
@@ -1768,6 +1732,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO,\
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_solaris:=-lc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=java_crw_demo.dll" \
...
...
@@ -2010,7 +1975,7 @@ $(BUILD_LIBNIO) : $(BUILD_LIBNET)
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS_API),posix)
# TODO make this work on macosx
ifneq ($(OPENJDK_TARGET_OS),macosx)
SCTP_WERROR := -Werror
...
...
@@ -2038,7 +2003,6 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix)
LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
INCLUDE_FILES:=SctpNet.c SctpChannelImpl.c SctpServerChannelImpl.c,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
BUILD_LIBRARIES += $(BUILD_LIBSCTP)
...
...
@@ -2109,7 +2073,7 @@ endif
ifneq ($(USE_EXTERNAL_LIBZ),true)
BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
LIBJLI_CFLAGS += $(
LIBZ_INCLUDE
)
LIBJLI_CFLAGS += $(
ZLIB_CPPFLAGS
)
BUILD_LIBJLI_FILES += \
inflate.c \
inftrees.c \
...
...
@@ -2392,7 +2356,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
LANG:=C,\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) $(LIBAWT_HEADLESS_CFLAGS),\
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers,
\
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
...
...
@@ -2402,8 +2366,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN).,\
REORDER:=$(LIBAWT_HEADLESS_REORDER), \
LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX)
,
\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,
\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX)
-lc,
\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless))
$(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
...
...
@@ -2420,8 +2384,14 @@ LIBSPLASHSCREEN_DIRS:=\
$(JDK_TOPDIR)/src/share/native/sun/awt/giflib \
$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
else
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
endif
LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \
$(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir))
...
...
@@ -2447,104 +2417,11 @@ else
LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
endif
LIBSPLASHSCREEN_FILES:=\
java_awt_SplashScreen.c \
splashscreen_gfx_impl.c \
splashscreen_gif.c \
splashscreen_impl.c \
splashscreen_jpeg.c \
splashscreen_png.c \
png.c \
pngerror.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c \
dgif_lib.c \
gif_err.c \
gifalloc.c \
jcomapi.c \
jdapimin.c \
jdapistd.c \
jdcoefct.c \
jdcolor.c \
jddctmgr.c \
jdhuff.c \
jdinput.c \
jdmainct.c \
jdmarker.c \
jdmaster.c \
jdmerge.c \
jdphuff.c \
jdpostct.c \
jdsample.c \
jerror.c \
jidctflt.c \
jidctfst.c \
jidctint.c \
jidctred.c \
jmemmgr.c \
jmemnobs.c \
jquant1.c \
jquant2.c \
jutils.c \
jcapimin.c \
jcapistd.c \
jccoefct.c \
jccolor.c \
jcdctmgr.c \
jchuff.c \
jcinit.c \
jcmainct.c \
jcmarker.c \
jcmaster.c \
jcparam.c \
jcphuff.c \
jcprepct.c \
jcsample.c \
jctrans.c \
jdtrans.c \
jfdctflt.c \
jfdctfst.c \
jfdctint.c
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_FILES += splashscreen_sys.c
else
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
LIBSPLASHSCREEN_FILES += splashscreen_sys.m
endif
LIBSPLASHSCREEN_LDFLAGS_SUFFIX:=
ifneq ($(USE_EXTERNAL_LIBZ),true)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
LIBSPLASHSCREEN_CFLAGS += $(LIBZ_INCLUDE)
LIBSPLASHSCREEN_FILES += \
compress.c \
deflate.c \
gzclose.c \
gzlib.c \
gzread.c \
gzwrite.c \
infback.c \
inffast.c \
inflate.c \
inftrees.c \
trees.c \
uncompr.c \
zadler32.c \
zcrc32.c \
zutil.c
LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
...
...
@@ -2564,7 +2441,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
LIBRARY:=splashscreen,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(LIBSPLASHSCREEN_DIRS),\
INCLUDE_FILES:=$(LIBSPLASHSCREEN_FILES)
,\
EXCLUDE_FILES:=imageioJPEG.c jpegdecoder.c pngtest.c
,\
LANG:=C,\
OPTIMIZATION:=LOW, \
CFLAGS:=$(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB),\
...
...
@@ -2572,6 +2449,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ),\
LDFLAGS_SUFFIX_solaris:=-lc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=splashscreen.dll" \
...
...
@@ -2647,6 +2525,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_posix:=$(LIBDL), \
LDFLAGS_SUFFIX_windows:=winscard.lib,\
LDFLAGS_SUFFIX_solaris:=-lc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=j2pcsc.dll" \
...
...
@@ -2673,7 +2552,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX:=$(LIBDL), \
LDFLAGS_SUFFIX:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=-lc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss))
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
...
...
@@ -2684,14 +2564,13 @@ endif
BUILD_LIBKRB5_NAME:=
ifeq ($(OPENJDK_TARGET_OS), windows)
BUILD_LIBKRB5_NAME:=w2k_lsa_auth
BUILD_LIBKRB5_FILES:=NativeCreds.c WindowsDirectory.c
BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
BUILD_LIBKRB5_LIBS:=advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
else ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBKRB5_NAME:=osxkrb5
BUILD_LIBKRB5_
FILES:=nativeccache.c
BUILD_LIBKRB5_
SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5
BUILD_LIBKRB5_LIBS:=-framework Kerberos
endif
...
...
@@ -2699,9 +2578,7 @@ ifneq ($(BUILD_LIBKRB5_NAME),)
$(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\
LIBRARY:=$(BUILD_LIBKRB5_NAME),\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
$(BUILD_LIBKRB5_SRC) ,\
INCLUDE_FILES:=$(BUILD_LIBKRB5_FILES),\
SRC:=$(BUILD_LIBKRB5_SRC),\
LANG:=C,\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \
...
...
@@ -2767,7 +2644,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_posix:=$(LIBDL), \
LDFLAGS_SUFFIX_posix:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=-lc,\
VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
RC_FLAGS:=$(RC_FLAGS)\
-D "JDK_FNAME=j2pkcs11.dll" \
...
...
@@ -3071,18 +2949,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAPPLESCRIPTENGINE_FILES:=\
AppleScriptEngine.m \
AppleScriptExecutionContext.m \
AS_NS_ConversionUtils.m \
NS_Java_ConversionUtils.m
$(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\
LIBRARY:=AppleScriptEngine,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/apple/applescript,\
LANG:=C,\
INCLUDE_FILES:=$(LIBAPPLESCRIPTENGINE_FILES),\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
...
...
@@ -3107,18 +2978,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSXAPP_FILES:=\
NSApplicationAWT.m \
QueuingApplicationDelegate.m \
PropertiesUtilities.m \
ThreadUtilities.m
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\
LIBRARY:=osxapp,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/sun/osxapp,\
LANG:=C,\
INCLUDE_FILES:=$(LIBOSXAPP_FILES),\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
...
...
@@ -3151,14 +3015,6 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSX_FILES:=\
Dispatch.m \
CFileManager.m \
KeystoreImpl.m \
JavaAppLauncher.m \
MacOSXPreferencesFile.m \
SCDynamicStoreConfig.m
LIBOSX_DIRS:=\
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
$(JDK_TOPDIR)/src/macosx/native/java/util \
...
...
@@ -3171,7 +3027,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(LIBOSX_DIRS),\
LANG:=C,\
INCLUDE_FILES:=$(LIBOSX_FILES),\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \
$(foreach dir,$(LIBOSX_DIRS),-I$(dir)) \
...
...
@@ -3341,22 +3196,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSXUI_FILES:=\
AquaFileView.m \
AquaLookAndFeel.m \
AquaNativeResources.m \
JRSUIConstantSync.m \
JRSUIController.m \
JRSUIFocus.m \
ScreenPopupFactory.m \
ScreenMenu.m
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\
LIBRARY:=osxui,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/com/apple/laf,\
LANG:=C,\
INCLUDE_FILES:=$(LIBOSXUI_FILES),\
OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
...
...
makefiles/CreateJars.gmk
浏览文件 @
07653a70
...
...
@@ -271,7 +271,7 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
RT_JAR_EXCLUDES += com/sun/nio/sctp \
sun/nio/ch/sctp
\
sun/nio/ch/sctp
endif
# Find all files in the classes dir to use as dependencies. This could be more fine granular.
...
...
@@ -419,6 +419,23 @@ $(eval $(call SetupArchive,BUILD_JSSE_JAR,,\
JARS+=$(IMAGES_OUTPUTDIR)/lib/jsse.jar
##########################################################################################
# Create manifest for security jars
#
# Include these extra attributes for now, should probably take out.
#
JCE_MANIFEST := $(IMAGES_OUTPUTDIR)/lib/_the.security.manifest.mf
$(JCE_MANIFEST): $(MAINMANIFEST)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
$(MAINMANIFEST) >> $@.tmp
$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
$(MV) $@.tmp $@
##########################################################################################
SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
...
...
@@ -440,8 +457,11 @@ else
SUFFIXES:=.class,\
INCLUDES:=sun/security/pkcs11,\
JAR:=$(SUNPKCS11_JAR_DST), \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNPKCS11_JAR_DST): $(JCE_MANIFEST)
endif
JARS += $(SUNPKCS11_JAR_DST)
...
...
@@ -452,9 +472,9 @@ SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar
ifndef OPENJDK
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(MKDIR) -p $(@D)
$(RM) $@
...
...
@@ -462,13 +482,16 @@ $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
else
$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes, \
SUFFIXES:=.class,\
INCLUDES:=sun/security/ec,\
JAR:=$(SUNEC_JAR_DST), \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNEC_JAR_DST): $(JCE_MANIFEST)
endif
JARS += $(SUNEC_JAR_DST)
...
...
@@ -505,9 +528,11 @@ else
SUFFIXES:=.class,\
INCLUDES:= com/sun/crypto/provider,\
JAR:=$(SUNJCE_PROVIDER_JAR_DST), \
MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNJCE_PROVIDER_JAR_DST): $(JCE_MANIFEST)
endif
JARS += $(SUNJCE_PROVIDER_JAR_DST)
...
...
@@ -516,9 +541,9 @@ JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar
ifndef OPENJDK
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
$(JCE_JAR_DST) : $(JCE_JAR_SRC)
$(JCE_JAR_DST) : $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(MKDIR) -p $(@D)
$(RM) $@
...
...
@@ -526,14 +551,16 @@ $(JCE_JAR_DST) : $(JCE_JAR_SRC)
else
$(eval $(call SetupArchive,BUILD_JCE_JAR,,\
$(eval $(call SetupArchive,BUILD_JCE_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes, \
SUFFIXES:=.class,\
INCLUDES:= javax/crypto sun/security/internal,\
JAR:=$(JCE_JAR_DST), \
MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \
EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true))
$(JCE_JAR_DST): $(JCE_MANIFEST)
endif
JARS += $(JCE_JAR_DST)
...
...
makefiles/GensrcIcons.gmk
浏览文件 @
07653a70
...
...
@@ -109,13 +109,17 @@ $(foreach I,$(GENSRC_X11_ICONS_SRC), $(eval $(call SetupGensrcX11Icon,$(notdir $
ifeq ($(OPENJDK_TARGET_OS),macosx)
GENSRC_OSX_ICONS = $(GENSRC_OSX_ICONS_DST)/AWTIconData.h
GENSRC_OSX_ICONS_SRC =
GENSRC_OSX_ICONS_TMP = $(JDK_OUTPUTDIR)/gensrc
GENSRC_OSX_ICONS_DST = $(GENSRC_OSX_ICONS_TMP)/sun/osxapp
$(GENSRC_OSX_ICONS_DST)/AWTIconData.h: \
$(JDK_TOPDIR)/src/macosx/native/sun/osxapp/resource/icons/JavaApp.icns
GENSRC_OSX_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
GENSRC_OSX_ICONS_DST := $(GENSRC_OSX_ICONS_TMP)/sun/osxapp
GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h
ifdef OPENJDK
GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/src/macosx/native/sun/osxapp/resource/icons/JavaApp.icns
else
GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/src/closed/macosx/native/sun/osxapp/resource/icons/JavaApp.icns
endif
$(GENSRC_OSX_ICONS_DST)/AWTIconData.h: $(GENSRC_OSX_ICONS_SRC)
$(RM) $@ $@.tmp
$(MKDIR) -p $(dir $@)
$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
...
...
makefiles/GensrcLocaleDataMetaInfo.gmk
浏览文件 @
07653a70
...
...
@@ -68,8 +68,9 @@ define CaptureLocale
ALL_US_LOCALES += $$($1_US_LOCALES)
ALL_NON_US_LOCALES += $$($1_NON_US_LOCALES)
SED_ARGS+= -e 's/$$(HASH)$1_USLocales$$(HASH)/ $$($1_US_LOCALES)/g'
SED_ARGS+= -e 's/$$(HASH)$1_NonUSLocales$$(HASH)/ $$($1_NON_US_LOCALES)/g'
# Don't sed in a space if there are no locales.
SED_ARGS+= -e 's/$$(HASH)$1_USLocales$$(HASH)/$$(if $$($1_US_LOCALES),$$(SPACE)$$($1_US_LOCALES),)/g'
SED_ARGS+= -e 's/$$(HASH)$1_NonUSLocales$$(HASH)/$$(if $$($1_NON_US_LOCALES),$$(SPACE)$$($1_NON_US_LOCALES),)/g'
endef
#sun.text.resources.FormatData
...
...
makefiles/Import.gmk
浏览文件 @
07653a70
...
...
@@ -121,7 +121,7 @@ endef
endif
define CopyDir
$1_SRC_FILES := $(shell $(FIND) $2 -type f -a
! -name "wb.jar"
)
$1_SRC_FILES := $(shell $(FIND) $2 -type f -a
\( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \)
)
$1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
IMPORT_TARGET_FILES += $$($1_DST_FILES)
$3/% : $2/%
...
...
@@ -134,9 +134,10 @@ endef
#
# Import hotspot
#
$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib))
HOTSPOT_IMPORT_FILES:=$(addprefix $(LIBRARY_PREFIX), jvm.* saproc.* jsig.* sawindbg.* jvm_db.* jvm_dtrace.*) \
Xusage.txt sa-jdi.jar
$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
$(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
...
...
src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
浏览文件 @
07653a70
...
...
@@ -41,6 +41,7 @@ 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.CalendarNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleNameProvider
;
import
java.util.spi.TimeZoneNameProvider
;
...
...
@@ -324,25 +325,39 @@ public class HostLocaleProviderAdapterImpl {
}
@Override
public
String
getDisplayName
(
String
calType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
return
null
;
public
int
getFirstDayOfWeek
(
Locale
locale
)
{
return
getCalendarInt
(
locale
.
toLanguageTag
(),
CD_FIRSTDAYOFWEEK
);
}
@Override
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calType
,
int
field
,
int
style
,
Locale
locale
)
{
return
null
;
public
int
getMinimalDaysInFirstWeek
(
Locale
locale
)
{
return
getCalendarInt
(
locale
.
toLanguageTag
(),
CD_MINIMALDAYSINFIRSTWEEK
);
}
};
}
public
static
CalendarNameProvider
getCalendarNameProvider
()
{
return
new
CalendarNameProvider
()
{
@Override
public
int
getFirstDayOfWeek
(
Locale
locale
)
{
return
get
CalendarInt
(
locale
.
toLanguageTag
(),
CD_FIRSTDAYOFWEEK
);
public
Locale
[]
getAvailableLocales
(
)
{
return
get
SupportedCalendarLocales
(
);
}
@Override
public
int
getMinimalDaysInFirstWeek
(
Locale
locale
)
{
return
getCalendarInt
(
locale
.
toLanguageTag
(),
CD_MINIMALDAYSINFIRSTWEEK
);
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
;
}
};
}
...
...
src/share/bin/java.c
浏览文件 @
07653a70
...
...
@@ -105,6 +105,7 @@ static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
InvocationFunctions
*
ifn
);
static
jstring
NewPlatformString
(
JNIEnv
*
env
,
char
*
s
);
static
jclass
LoadMainClass
(
JNIEnv
*
env
,
int
mode
,
char
*
name
);
static
jclass
GetApplicationClass
(
JNIEnv
*
env
);
static
void
TranslateApplicationArgs
(
int
jargc
,
const
char
**
jargv
,
int
*
pargc
,
char
***
pargv
);
static
jboolean
AddApplicationOptions
(
int
cpathc
,
const
char
**
cpathv
);
...
...
@@ -346,6 +347,7 @@ JavaMain(void * _args)
JavaVM
*
vm
=
0
;
JNIEnv
*
env
=
0
;
jclass
mainClass
=
NULL
;
jclass
appClass
=
NULL
;
// actual application class being launched
jmethodID
mainID
;
jobjectArray
mainArgs
;
int
ret
=
0
;
...
...
@@ -419,10 +421,28 @@ JavaMain(void * _args)
* all environments,
* 2) Remove the vestages of maintaining main_class through
* the environment (and remove these comments).
*
* This method also correctly handles launching existing JavaFX
* applications that may or may not have a Main-Class manifest entry.
*/
mainClass
=
LoadMainClass
(
env
,
mode
,
what
);
CHECK_EXCEPTION_NULL_LEAVE
(
mainClass
);
PostJVMInit
(
env
,
mainClass
,
vm
);
/*
* In some cases when launching an application that needs a helper, e.g., a
* JavaFX application with no main method, the mainClass will not be the
* applications own main class but rather a helper class. To keep things
* consistent in the UI we need to track and report the application main class.
*/
appClass
=
GetApplicationClass
(
env
);
NULL_CHECK
(
appClass
);
/*
* PostJVMInit uses the class name as the application name for GUI purposes,
* for example, on OSX this sets the application name in the menu bar for
* both SWT and JavaFX. So we'll pass the actual application class here
* instead of mainClass as that may be a launcher or helper class instead
* of the application class.
*/
PostJVMInit
(
env
,
appClass
,
vm
);
/*
* The LoadMainClass not only loads the main class, it will also ensure
* that the main method's signature is correct, therefore further checking
...
...
@@ -1215,6 +1235,20 @@ LoadMainClass(JNIEnv *env, int mode, char *name)
return
(
jclass
)
result
;
}
static
jclass
GetApplicationClass
(
JNIEnv
*
env
)
{
jmethodID
mid
;
jobject
result
;
jclass
cls
=
GetLauncherHelperClass
(
env
);
NULL_CHECK0
(
cls
);
NULL_CHECK0
(
mid
=
(
*
env
)
->
GetStaticMethodID
(
env
,
cls
,
"getApplicationClass"
,
"()Ljava/lang/Class;"
));
return
(
*
env
)
->
CallStaticObjectMethod
(
env
,
cls
,
mid
);
}
/*
* For tools, convert command line args thus:
* javac -cp foo:foo/"*" -J-ms32m ...
...
...
src/share/bin/wildcard.c
浏览文件 @
07653a70
...
...
@@ -356,8 +356,13 @@ wildcardFileList(const char *wildcard)
const
char
*
basename
;
FileList
fl
=
FileList_new
(
16
);
WildcardIterator
it
=
WildcardIterator_for
(
wildcard
);
if
(
it
==
NULL
)
{
FileList_free
(
fl
);
return
NULL
;
}
while
((
basename
=
WildcardIterator_next
(
it
))
!=
NULL
)
if
(
isJarFileName
(
basename
))
FileList_add
(
fl
,
wildcardConcat
(
wildcard
,
basename
));
...
...
src/share/classes/com/sun/naming/internal/ResourceManager.java
浏览文件 @
07653a70
...
...
@@ -560,8 +560,7 @@ public final class ResourceManager {
}
}
finally
{
while
(
resources
.
hasMore
())
{
InputStream
istream
=
(
InputStream
)
resources
.
next
();
istream
.
close
();
resources
.
next
().
close
();
}
}
...
...
src/share/classes/java/lang/Boolean.java
浏览文件 @
07653a70
...
...
@@ -196,11 +196,24 @@ public final class Boolean implements java.io.Serializable,
* {@code true}; returns the integer {@code 1237} if this
* object represents {@code false}.
*/
@Override
public
int
hashCode
()
{
return
value
?
1231
:
1237
;
return
Boolean
.
hashCode
(
value
)
;
}
/**
* Returns a hash code for a {@code boolean} value; compatible with
* {@code Boolean.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code boolean} value.
*/
public
static
int
hashCode
(
boolean
value
)
{
return
value
?
1231
:
1237
;
}
/**
* Returns {@code true} if and only if the argument is not
* {@code null} and is a {@code Boolean} object that
* represents the same {@code boolean} value as this object.
...
...
src/share/classes/java/lang/Byte.java
浏览文件 @
07653a70
...
...
@@ -389,7 +389,20 @@ public final class Byte extends Number implements Comparable<Byte> {
*
* @return a hash code value for this {@code Byte}
*/
@Override
public
int
hashCode
()
{
return
Byte
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code byte} value; compatible with
* {@code Byte.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code byte} value.
*/
public
static
int
hashCode
(
byte
value
)
{
return
(
int
)
value
;
}
...
...
@@ -494,6 +507,14 @@ public final class Byte extends Number implements Comparable<Byte> {
*/
public
static
final
int
SIZE
=
8
;
/**
* The number of bytes used to represent a {@code byte} value in two's
* complement binary form.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/** use serialVersionUID from JDK 1.1. for interoperability */
private
static
final
long
serialVersionUID
=
-
7183698231559129828L
;
}
src/share/classes/java/lang/Character.java
浏览文件 @
07653a70
...
...
@@ -4588,7 +4588,20 @@ class Character implements java.io.Serializable, Comparable<Character> {
*
* @return a hash code value for this {@code Character}
*/
@Override
public
int
hashCode
()
{
return
Character
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code char} value; compatible with
* {@code Character.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code char} value.
*/
public
static
int
hashCode
(
char
value
)
{
return
(
int
)
value
;
}
...
...
@@ -7157,6 +7170,14 @@ class Character implements java.io.Serializable, Comparable<Character> {
*/
public
static
final
int
SIZE
=
16
;
/**
* The number of bytes used to represent a {@code char} value in unsigned
* binary form.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* Returns the value obtained by reversing the order of the bytes in the
* specified <tt>char</tt> value.
...
...
src/share/classes/java/lang/Double.java
浏览文件 @
07653a70
...
...
@@ -122,6 +122,13 @@ public final class Double extends Number implements Comparable<Double> {
*/
public
static
final
int
SIZE
=
64
;
/**
* The number of bytes used to represent a {@code double} value.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* The {@code Class} instance representing the primitive type
* {@code double}.
...
...
@@ -740,7 +747,20 @@ public final class Double extends Number implements Comparable<Double> {
*
* @return a {@code hash code} value for this object.
*/
@Override
public
int
hashCode
()
{
return
Double
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code double} value; compatible with
* {@code Double.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code double} value.
*/
public
static
int
hashCode
(
double
value
)
{
long
bits
=
doubleToLongBits
(
value
);
return
(
int
)(
bits
^
(
bits
>>>
32
));
}
...
...
src/share/classes/java/lang/Float.java
浏览文件 @
07653a70
...
...
@@ -120,6 +120,13 @@ public final class Float extends Number implements Comparable<Float> {
*/
public
static
final
int
SIZE
=
32
;
/**
* The number of bytes used to represent a {@code float} value.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* The {@code Class} instance representing the primitive type
* {@code float}.
...
...
@@ -648,7 +655,20 @@ public final class Float extends Number implements Comparable<Float> {
*
* @return a hash code value for this object.
*/
@Override
public
int
hashCode
()
{
return
Float
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code float} value; compatible with
* {@code Float.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code float} value.
*/
public
static
int
hashCode
(
float
value
)
{
return
floatToIntBits
(
value
);
}
...
...
src/share/classes/java/lang/Integer.java
浏览文件 @
07653a70
...
...
@@ -918,7 +918,20 @@ public final class Integer extends Number implements Comparable<Integer> {
* primitive {@code int} value represented by this
* {@code Integer} object.
*/
@Override
public
int
hashCode
()
{
return
Integer
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code int} value; compatible with
* {@code Integer.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code int} value.
*/
public
static
int
hashCode
(
int
value
)
{
return
value
;
}
...
...
@@ -1284,6 +1297,14 @@ public final class Integer extends Number implements Comparable<Integer> {
*/
public
static
final
int
SIZE
=
32
;
/**
* The number of bytes used to represent a {@code int} value in two's
* complement binary form.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* Returns an {@code int} value with at most a single one-bit, in the
* position of the highest-order ("leftmost") one-bit in the specified
...
...
src/share/classes/java/lang/Long.java
浏览文件 @
07653a70
...
...
@@ -1021,7 +1021,20 @@ public final class Long extends Number implements Comparable<Long> {
*
* @return a hash code value for this object.
*/
@Override
public
int
hashCode
()
{
return
Long
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code long} value; compatible with
* {@code Long.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code long} value.
*/
public
static
int
hashCode
(
long
value
)
{
return
(
int
)(
value
^
(
value
>>>
32
));
}
...
...
@@ -1306,6 +1319,14 @@ public final class Long extends Number implements Comparable<Long> {
*/
public
static
final
int
SIZE
=
64
;
/**
* The number of bytes used to represent a {@code long} value in two's
* complement binary form.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* Returns a {@code long} value with at most a single one-bit, in the
* position of the highest-order ("leftmost") one-bit in the specified
...
...
src/share/classes/java/lang/Short.java
浏览文件 @
07653a70
...
...
@@ -394,7 +394,20 @@ public final class Short extends Number implements Comparable<Short> {
*
* @return a hash code value for this {@code Short}
*/
@Override
public
int
hashCode
()
{
return
Short
.
hashCode
(
value
);
}
/**
* Returns a hash code for a {@code short} value; compatible with
* {@code Short.hashCode()}.
*
* @since 1.8
*
* @return a hash code value for a {@code short} value.
*/
public
static
int
hashCode
(
short
value
)
{
return
(
int
)
value
;
}
...
...
@@ -457,6 +470,14 @@ public final class Short extends Number implements Comparable<Short> {
*/
public
static
final
int
SIZE
=
16
;
/**
* The number of bytes used to represent a {@code short} value in two's
* complement binary form.
*
* @since 1.8
*/
public
static
final
int
BYTES
=
SIZE
/
Byte
.
SIZE
;
/**
* Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code short} value.
...
...
src/share/classes/java/lang/annotation/Native.java
0 → 100644
浏览文件 @
07653a70
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
java.lang.annotation
;
/**
* Indicates that a field defining a constant value may be referenced
* from native code.
*
* The annotation may be used as a hint by tools that generate native
* header files to determine whether a header file is required, and
* if so, what declarations it should contain.
*
* @since 1.8
*/
@Documented
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
SOURCE
)
public
@interface
Native
{
}
src/share/classes/java/util/Calendar.java
浏览文件 @
07653a70
...
...
@@ -2699,12 +2699,9 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
/* try to get the Locale data from the cache */
int
[]
data
=
cachedLocaleData
.
get
(
desiredLocale
);
if
(
data
==
null
)
{
/* cache miss */
LocaleProviderAdapter
adapter
=
LocaleProviderAdapter
.
getAdapter
(
CalendarDataProvider
.
class
,
desiredLocale
);
CalendarDataProvider
provider
=
adapter
.
getCalendarDataProvider
();
data
=
new
int
[
2
];
data
[
0
]
=
provider
.
getFirstDayOfWeek
(
desiredLocale
);
data
[
1
]
=
provider
.
getMinimalDaysInFirstWeek
(
desiredLocale
);
assert
data
[
0
]
!=
0
&&
data
[
1
]
!=
0
;
data
[
0
]
=
CalendarDataUtility
.
retrieveFirstDayOfWeek
(
desiredLocale
);
data
[
1
]
=
CalendarDataUtility
.
retrieveMinimalDaysInFirstWeek
(
desiredLocale
);
cachedLocaleData
.
putIfAbsent
(
desiredLocale
,
data
);
}
firstDayOfWeek
=
data
[
0
];
...
...
src/share/classes/java/util/logging/FileHandler.java
浏览文件 @
07653a70
...
...
@@ -25,10 +25,19 @@
package
java.util.logging
;
import
java.io.*
;
import
static
java
.
nio
.
file
.
StandardOpenOption
.
CREATE_NEW
;
import
static
java
.
nio
.
file
.
StandardOpenOption
.
WRITE
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileLock
;
import
java.security.*
;
import
java.nio.file.FileAlreadyExistsException
;
import
java.nio.file.Paths
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
/**
* Simple file logging <tt>Handler</tt>.
...
...
@@ -137,14 +146,16 @@ public class FileHandler extends StreamHandler {
private
int
count
;
private
String
pattern
;
private
String
lockFileName
;
private
File
OutputStream
lockStream
;
private
File
Channel
lockFileChannel
;
private
File
files
[];
private
static
final
int
MAX_LOCKS
=
100
;
private
static
java
.
util
.
HashMap
<
String
,
String
>
locks
=
new
java
.
util
.
HashMap
<>();
// A metered stream is a subclass of OutputStream that
// (a) forwards all its output to a target stream
// (b) keeps track of how many bytes have been written
/**
* A metered stream is a subclass of OutputStream that
* (a) forwards all its output to a target stream
* (b) keeps track of how many bytes have been written
*/
private
class
MeteredStream
extends
OutputStream
{
OutputStream
out
;
int
written
;
...
...
@@ -189,9 +200,10 @@ public class FileHandler extends StreamHandler {
setOutputStream
(
meter
);
}
// Private method to configure a FileHandler from LogManager
// properties and/or default values as specified in the class
// javadoc.
/**
* Configure a FileHandler from LogManager properties and/or default values
* as specified in the class javadoc.
*/
private
void
configure
()
{
LogManager
manager
=
LogManager
.
getLogManager
();
...
...
@@ -287,7 +299,8 @@ public class FileHandler extends StreamHandler {
* the caller does not have <tt>LoggingPermission("control")</tt>.
* @exception IllegalArgumentException if pattern is an empty string
*/
public
FileHandler
(
String
pattern
,
boolean
append
)
throws
IOException
,
SecurityException
{
public
FileHandler
(
String
pattern
,
boolean
append
)
throws
IOException
,
SecurityException
{
if
(
pattern
.
length
()
<
1
)
{
throw
new
IllegalArgumentException
();
}
...
...
@@ -376,8 +389,10 @@ public class FileHandler extends StreamHandler {
openFiles
();
}
// Private method to open the set of output files, based on the
// configured instance variables.
/**
* Open the set of output files, based on the configured
* instance variables.
*/
private
void
openFiles
()
throws
IOException
{
LogManager
manager
=
LogManager
.
getLogManager
();
manager
.
checkPermission
();
...
...
@@ -413,18 +428,18 @@ public class FileHandler extends StreamHandler {
// object. Try again.
continue
;
}
FileChannel
fc
;
try
{
lockStream
=
new
FileOutputStream
(
lockFileName
);
fc
=
lockStream
.
getChannel
();
}
catch
(
IOException
ix
)
{
// We got an IOException while trying to open the file.
// Try the next file.
lockFileChannel
=
FileChannel
.
open
(
Paths
.
get
(
lockFileName
),
CREATE_NEW
,
WRITE
);
}
catch
(
FileAlreadyExistsException
ix
)
{
// try the next lock file name in the sequence
continue
;
}
boolean
available
;
try
{
available
=
fc
.
tryLock
()
!=
null
;
available
=
lockFileChannel
.
tryLock
()
!=
null
;
// We got the lock OK.
}
catch
(
IOException
ix
)
{
// We got an IOException while trying to get the lock.
...
...
@@ -440,7 +455,7 @@ public class FileHandler extends StreamHandler {
}
// We failed to get the lock. Try next file.
fc
.
close
();
lockFileChannel
.
close
();
}
}
...
...
@@ -472,8 +487,17 @@ public class FileHandler extends StreamHandler {
setErrorManager
(
new
ErrorManager
());
}
// Generate a filename from a pattern.
private
File
generate
(
String
pattern
,
int
generation
,
int
unique
)
throws
IOException
{
/**
* Generate a file based on a user-supplied pattern, generation number,
* and an integer uniqueness suffix
* @param pattern the pattern for naming the output file
* @param generation the generation number to distinguish rotated logs
* @param unique a unique number to resolve conflicts
* @return the generated File
* @throws IOException
*/
private
File
generate
(
String
pattern
,
int
generation
,
int
unique
)
throws
IOException
{
File
file
=
null
;
String
word
=
""
;
int
ix
=
0
;
...
...
@@ -548,7 +572,9 @@ public class FileHandler extends StreamHandler {
return
file
;
}
// Rotate the set of output files
/**
* Rotate the set of output files
*/
private
synchronized
void
rotate
()
{
Level
oldLevel
=
getLevel
();
setLevel
(
Level
.
OFF
);
...
...
@@ -615,9 +641,8 @@ public class FileHandler extends StreamHandler {
return
;
}
try
{
// Closing the lock file's FileOutputStream will close
// the underlying channel and free any locks.
lockStream
.
close
();
// Close the lock file channel (which also will free any locks)
lockFileChannel
.
close
();
}
catch
(
Exception
ex
)
{
// Problems closing the stream. Punt.
}
...
...
@@ -626,7 +651,7 @@ public class FileHandler extends StreamHandler {
}
new
File
(
lockFileName
).
delete
();
lockFileName
=
null
;
lock
Stream
=
null
;
lock
FileChannel
=
null
;
}
private
static
class
InitializationErrorManager
extends
ErrorManager
{
...
...
@@ -636,6 +661,8 @@ public class FileHandler extends StreamHandler {
}
}
// Private native method to check if we are in a set UID program.
/**
* check if we are in a set UID program.
*/
private
static
native
boolean
isSetUID
();
}
src/share/classes/java/util/spi/CalendarDataProvider.java
浏览文件 @
07653a70
...
...
@@ -26,125 +26,15 @@
package
java.util.spi
;
import
java.util.Calendar
;
import
java.util.Map
;
import
java.util.Locale
;
/**
* An abstract class for service providers that provide localized {@link
* Calendar} parameters and string representations (display names) of {@code
* Calendar} field values.
*
* <p><a name="calendartypes"><b>Calendar Types</b></a>
*
* <p>Calendar types are used to specify calendar systems for which the {@link
* #getDisplayName(String, int, int, int, Locale) getDisplayName} and {@link
* #getDisplayNames(String, int, int, Locale) getDisplayNames} methods provide
* calendar field value names. See {@link Calendar#getCalendarType()} for details.
*
* <p><b>Calendar Fields</b>
*
* <p>Calendar fields are specified with the constants defined in {@link
* Calendar}. The following are calendar-common fields and their values to be
* supported for each calendar system.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Field values">
* <tr>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#MONTH}</td>
* <td valign="top">{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}</td>
* <td>Month numbering is 0-based (e.g., 0 - January, ..., 11 -
* December). Some calendar systems have 13 months. Month
* names need to be supported in both the formatting and
* stand-alone forms if required by the supported locales. If there's
* no distinction in the two forms, the same names should be returned
* in both of the forms.</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#DAY_OF_WEEK}</td>
* <td valign="top">{@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}</td>
* <td>Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday,
* ..., 7 - Saturday).</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#AM_PM}</td>
* <td valign="top">{@link Calendar#AM} to {@link Calendar#PM}</td>
* <td>0 - AM, 1 - PM</td>
* </tr>
* </table>
*
* <p style="margin-top:20px">The following are calendar-specific fields and their values to be supported.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Calendar type and field values">
* <tr>
* <th>Calendar Type</th>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "gregory"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>{@link java.util.GregorianCalendar#BC} (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>{@link java.util.GregorianCalendar#AD} (CE)</td>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "buddhist"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>BC (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>B.E. (Buddhist Era)</td>
* </tr>
* <tr>
* <td rowspan="6" valign="top">{@code "japanese"}</td>
* <td rowspan="5" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>Seireki (Before Meiji)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>Meiji</td>
* </tr>
* <tr>
* <td>2</td>
* <td>Taisho</td>
* </tr>
* <tr>
* <td>3</td>
* <td>Showa</td>
* </tr>
* <tr>
* <td>4</td>
* <td >Heisei</td>
* </tr>
* <tr>
* <td>{@link Calendar#YEAR}</td>
* <td>1</td>
* <td>the first year in each era. It should be returned when a long
* style ({@link Calendar#LONG_FORMAT} or {@link Calendar#LONG_STANDALONE}) is
* specified. See also the <a href="../../text/SimpleDateFormat.html#year">
* Year representation in {@code SimpleDateFormat}</a>.</td>
* </tr>
* </table>
*
* <p>Calendar field value names for {@code "gregory"} must be consistent with
* the date-time symbols provided by {@link java.text.spi.DateFormatSymbolsProvider}.
*
* <p>Time zone names are supported by {@link TimeZoneNameProvider}.
* An abstract class for service providers that provide locale-dependent {@link
* Calendar} parameters.
*
* @author Masayoshi Okutsu
* @since 1.8
* @see
Locale#getUnicodeLocaleType(String)
* @see
CalendarNameProvider
*/
public
abstract
class
CalendarDataProvider
extends
LocaleServiceProvider
{
...
...
@@ -188,112 +78,4 @@ public abstract class CalendarDataProvider extends LocaleServiceProvider {
* @see java.util.Calendar#getMinimalDaysInFirstWeek()
*/
public
abstract
int
getMinimalDaysInFirstWeek
(
Locale
locale
);
/**
* Returns the string representation (display name) of the calendar
* <code>field value</code> in the given <code>style</code> and
* <code>locale</code>. If no string representation is
* applicable, <code>null</code> is returned.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are
* specified.
*
* <p>{@code value} is the numeric representation of the {@code field} value.
* For example, if {@code field} is {@link Calendar#DAY_OF_WEEK}, the valid
* values are {@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}
* (inclusive).
*
* <p>{@code style} gives the style of the string representation. It is one
* of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return {@code "Sunday"}.
* <pre>
* getDisplayName("gregory", Calendar.DAY_OF_WEEK, Calendar.SUNDAY,
* Calendar.LONG_STANDALONE, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the {@code Calendar} field index,
* such as {@link Calendar#DAY_OF_WEEK}
* @param value
* the value of the {@code Calendar field},
* such as {@link Calendar#MONDAY}
* @param style
* the string representation style: one of {@link
* Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or
* {@link Calendar#LONG_STANDALONE}
* @param locale
* the desired locale
* @return the string representation of the {@code field value}, or {@code
* null} if the string representation is not applicable or
* the given calendar type is unknown
* @throws IllegalArgumentException
* if {@code field} or {@code style} is invalid
* @throws NullPointerException if {@code locale} is {@code null}
* @see TimeZoneNameProvider
* @see java.util.Calendar#get(int)
* @see java.util.Calendar#getDisplayName(int, int, Locale)
*/
public
abstract
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
);
/**
* Returns a {@code Map} containing all string representations (display
* names) of the {@code Calendar} {@code field} in the given {@code style}
* and {@code locale} and their corresponding field values.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are specified.
*
* <p>{@code style} gives the style of the string representation. It must be
* one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link
* Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return a {@code Map} containing
* {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link
* Calendar#JANUARY}, {@code "February"} to {@link Calendar#FEBRUARY},
* {@code "Feb"} to {@link Calendar#FEBRUARY}, and so on.
* <pre>
* getDisplayNames("gregory", Calendar.MONTH, Calendar.ALL_STYLES, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the calendar field for which the display names are returned
* @param style
* the style applied to the display names; one of
* {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT}
* ({@link Calendar#SHORT SHORT}), {@link
* Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
* @param locale
* the desired locale
* @return a {@code Map} containing all display names of {@code field} in
* {@code style} and {@code locale} and their {@code field} values,
* or {@code null} if no display names are defined for {@code field}
* @throws NullPointerException
* if {@code locale} is {@code null}
* @see Calendar#getDisplayNames(int, int, Locale)
*/
public
abstract
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
);
}
src/share/classes/java/util/spi/CalendarNameProvider.java
0 → 100644
浏览文件 @
07653a70
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
java.util.spi
;
import
java.util.Calendar
;
import
java.util.Locale
;
import
java.util.Map
;
/**
* An abstract class for service providers that provide localized string
* representations (display names) of {@code Calendar} field values.
*
* <p><a name="calendartypes"><b>Calendar Types</b></a>
*
* <p>Calendar types are used to specify calendar systems for which the {@link
* #getDisplayName(String, int, int, int, Locale) getDisplayName} and {@link
* #getDisplayNames(String, int, int, Locale) getDisplayNames} methods provide
* calendar field value names. See {@link Calendar#getCalendarType()} for details.
*
* <p><b>Calendar Fields</b>
*
* <p>Calendar fields are specified with the constants defined in {@link
* Calendar}. The following are calendar-common fields and their values to be
* supported for each calendar system.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Field values">
* <tr>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#MONTH}</td>
* <td valign="top">{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}</td>
* <td>Month numbering is 0-based (e.g., 0 - January, ..., 11 -
* December). Some calendar systems have 13 months. Month
* names need to be supported in both the formatting and
* stand-alone forms if required by the supported locales. If there's
* no distinction in the two forms, the same names should be returned
* in both of the forms.</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#DAY_OF_WEEK}</td>
* <td valign="top">{@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}</td>
* <td>Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday,
* ..., 7 - Saturday).</td>
* </tr>
* <tr>
* <td valign="top">{@link Calendar#AM_PM}</td>
* <td valign="top">{@link Calendar#AM} to {@link Calendar#PM}</td>
* <td>0 - AM, 1 - PM</td>
* </tr>
* </table>
*
* <p style="margin-top:20px">The following are calendar-specific fields and their values to be supported.
*
* <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Calendar type and field values">
* <tr>
* <th>Calendar Type</th>
* <th>Field</th>
* <th>Value</th>
* <th>Description</th>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "gregory"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>{@link java.util.GregorianCalendar#BC} (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>{@link java.util.GregorianCalendar#AD} (CE)</td>
* </tr>
* <tr>
* <td rowspan="2" valign="top">{@code "buddhist"}</td>
* <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>BC (BCE)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>B.E. (Buddhist Era)</td>
* </tr>
* <tr>
* <td rowspan="6" valign="top">{@code "japanese"}</td>
* <td rowspan="5" valign="top">{@link Calendar#ERA}</td>
* <td>0</td>
* <td>Seireki (Before Meiji)</td>
* </tr>
* <tr>
* <td>1</td>
* <td>Meiji</td>
* </tr>
* <tr>
* <td>2</td>
* <td>Taisho</td>
* </tr>
* <tr>
* <td>3</td>
* <td>Showa</td>
* </tr>
* <tr>
* <td>4</td>
* <td >Heisei</td>
* </tr>
* <tr>
* <td>{@link Calendar#YEAR}</td>
* <td>1</td>
* <td>the first year in each era. It should be returned when a long
* style ({@link Calendar#LONG_FORMAT} or {@link Calendar#LONG_STANDALONE}) is
* specified. See also the <a href="../../text/SimpleDateFormat.html#year">
* Year representation in {@code SimpleDateFormat}</a>.</td>
* </tr>
* </table>
*
* <p>Calendar field value names for {@code "gregory"} must be consistent with
* the date-time symbols provided by {@link java.text.spi.DateFormatSymbolsProvider}.
*
* <p>Time zone names are supported by {@link TimeZoneNameProvider}.
*
* @author Masayoshi Okutsu
* @since 1.8
* @see CalendarDataProvider
* @see Locale#getUnicodeLocaleType(String)
*/
public
abstract
class
CalendarNameProvider
extends
LocaleServiceProvider
{
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
*/
protected
CalendarNameProvider
()
{
}
/**
* Returns the string representation (display name) of the calendar
* <code>field value</code> in the given <code>style</code> and
* <code>locale</code>. If no string representation is
* applicable, <code>null</code> is returned.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are
* specified.
*
* <p>{@code value} is the numeric representation of the {@code field} value.
* For example, if {@code field} is {@link Calendar#DAY_OF_WEEK}, the valid
* values are {@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}
* (inclusive).
*
* <p>{@code style} gives the style of the string representation. It is one
* of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return {@code "Sunday"}.
* <pre>
* getDisplayName("gregory", Calendar.DAY_OF_WEEK, Calendar.SUNDAY,
* Calendar.LONG_STANDALONE, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the {@code Calendar} field index,
* such as {@link Calendar#DAY_OF_WEEK}
* @param value
* the value of the {@code Calendar field},
* such as {@link Calendar#MONDAY}
* @param style
* the string representation style: one of {@link
* Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or
* {@link Calendar#LONG_STANDALONE}
* @param locale
* the desired locale
* @return the string representation of the {@code field value}, or {@code
* null} if the string representation is not applicable or
* the given calendar type is unknown
* @throws IllegalArgumentException
* if {@code field} or {@code style} is invalid
* @throws NullPointerException if {@code locale} is {@code null}
* @see TimeZoneNameProvider
* @see java.util.Calendar#get(int)
* @see java.util.Calendar#getDisplayName(int, int, Locale)
*/
public
abstract
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
);
/**
* Returns a {@code Map} containing all string representations (display
* names) of the {@code Calendar} {@code field} in the given {@code style}
* and {@code locale} and their corresponding field values.
*
* <p>{@code field} is a {@code Calendar} field index, such as {@link
* Calendar#MONTH}. The time zone fields, {@link Calendar#ZONE_OFFSET} and
* {@link Calendar#DST_OFFSET}, are <em>not</em> supported by this
* method. {@code null} must be returned if any time zone fields are specified.
*
* <p>{@code style} gives the style of the string representation. It must be
* one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link
* Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
*
* <p>For example, the following call will return a {@code Map} containing
* {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link
* Calendar#JANUARY}, {@code "February"} to {@link Calendar#FEBRUARY},
* {@code "Feb"} to {@link Calendar#FEBRUARY}, and so on.
* <pre>
* getDisplayNames("gregory", Calendar.MONTH, Calendar.ALL_STYLES, Locale.ENGLISH);
* </pre>
*
* @param calendarType
* the calendar type. (Any calendar type given by {@code locale}
* is ignored.)
* @param field
* the calendar field for which the display names are returned
* @param style
* the style applied to the display names; one of
* {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT}
* ({@link Calendar#SHORT SHORT}), {@link
* Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link
* Calendar#LONG_STANDALONE}.
* @param locale
* the desired locale
* @return a {@code Map} containing all display names of {@code field} in
* {@code style} and {@code locale} and their {@code field} values,
* or {@code null} if no display names are defined for {@code field}
* @throws NullPointerException
* if {@code locale} is {@code null}
* @see Calendar#getDisplayNames(int, int, Locale)
*/
public
abstract
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
);
}
src/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
浏览文件 @
07653a70
...
...
@@ -29,7 +29,6 @@ import java.util.EventObject;
import
java.security.cert.Certificate
;
import
java.security.Principal
;
import
java.security.cert.X509Certificate
;
import
javax.security.auth.x500.X500Principal
;
/**
* This event indicates that an SSL handshake completed on a given
...
...
src/share/classes/javax/net/ssl/HostnameVerifier.java
浏览文件 @
07653a70
...
...
@@ -40,6 +40,7 @@ package javax.net.ssl;
* verification fail.
*
* @author Brad R. Wetmore
* @see HostnameVerifierFactory
* @since 1.4
*/
...
...
src/share/classes/javax/net/ssl/HttpsURLConnection.java
浏览文件 @
07653a70
...
...
@@ -29,7 +29,6 @@ import java.net.URL;
import
java.net.HttpURLConnection
;
import
java.security.Principal
;
import
java.security.cert.X509Certificate
;
import
javax.security.auth.x500.X500Principal
;
/**
* <code>HttpsURLConnection</code> extends <code>HttpURLConnection</code>
...
...
@@ -196,6 +195,7 @@ class HttpsURLConnection extends HttpURLConnection
*/
private
static
class
DefaultHostnameVerifier
implements
HostnameVerifier
{
@Override
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
false
;
}
...
...
src/share/classes/javax/net/ssl/KeyManagerFactory.java
浏览文件 @
07653a70
...
...
@@ -68,6 +68,7 @@ public class KeyManagerFactory {
public
final
static
String
getDefaultAlgorithm
()
{
String
type
;
type
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
@Override
public
String
run
()
{
return
Security
.
getProperty
(
"ssl.KeyManagerFactory.algorithm"
);
...
...
src/share/classes/javax/net/ssl/SSLContext.java
浏览文件 @
07653a70
...
...
@@ -26,7 +26,6 @@
package
javax.net.ssl
;
import
java.security.*
;
import
java.util.*
;
import
sun.security.jca.GetInstance
;
...
...
src/share/classes/javax/net/ssl/SSLContextSpi.java
浏览文件 @
07653a70
...
...
@@ -25,7 +25,6 @@
package
javax.net.ssl
;
import
java.util.*
;
import
java.security.*
;
/**
...
...
src/share/classes/javax/net/ssl/SSLEngineResult.java
浏览文件 @
07653a70
...
...
@@ -230,6 +230,7 @@ public class SSLEngineResult {
/**
* Returns a String representation of this object.
*/
@Override
public
String
toString
()
{
return
(
"Status = "
+
status
+
" HandshakeStatus = "
+
handshakeStatus
+
...
...
src/share/classes/javax/net/ssl/SSLParameters.java
浏览文件 @
07653a70
...
...
@@ -28,13 +28,11 @@ package javax.net.ssl;
import
java.security.AlgorithmConstraints
;
import
java.util.Map
;
import
java.util.List
;
import
java.util.HashSet
;
import
java.util.HashMap
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.regex.Pattern
;
/**
* Encapsulates parameters for an SSL/TLS connection. The parameters
...
...
src/share/classes/javax/net/ssl/SSLPermission.java
浏览文件 @
07653a70
...
...
@@ -26,11 +26,6 @@
package
javax.net.ssl
;
import
java.security.*
;
import
java.util.Enumeration
;
import
java.util.Hashtable
;
import
java.util.StringTokenizer
;
import
java.security.Permissions
;
import
java.lang.SecurityManager
;
/**
* This class is for various network permissions.
...
...
src/share/classes/javax/net/ssl/SSLServerSocketFactory.java
浏览文件 @
07653a70
...
...
@@ -160,23 +160,27 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory {
new
SocketException
(
reason
.
toString
()).
initCause
(
reason
);
}
@Override
public
ServerSocket
createServerSocket
()
throws
IOException
{
return
throwException
();
}
@Override
public
ServerSocket
createServerSocket
(
int
port
)
throws
IOException
{
return
throwException
();
}
@Override
public
ServerSocket
createServerSocket
(
int
port
,
int
backlog
)
throws
IOException
{
return
throwException
();
}
@Override
public
ServerSocket
createServerSocket
(
int
port
,
int
backlog
,
InetAddress
ifAddress
)
throws
IOException
...
...
@@ -184,10 +188,12 @@ class DefaultSSLServerSocketFactory extends SSLServerSocketFactory {
return
throwException
();
}
@Override
public
String
[]
getDefaultCipherSuites
()
{
return
new
String
[
0
];
}
@Override
public
String
[]
getSupportedCipherSuites
()
{
return
new
String
[
0
];
}
...
...
src/share/classes/javax/net/ssl/SSLSession.java
浏览文件 @
07653a70
...
...
@@ -25,7 +25,6 @@
package
javax.net.ssl
;
import
java.net.InetAddress
;
import
java.security.Principal
;
/**
...
...
src/share/classes/javax/net/ssl/SSLSocket.java
浏览文件 @
07653a70
...
...
@@ -28,9 +28,6 @@ package javax.net.ssl;
import
java.io.IOException
;
import
java.net.*
;
import
java.util.Enumeration
;
import
java.util.Vector
;
/**
* This class extends <code>Socket</code>s and provides secure
...
...
src/share/classes/javax/net/ssl/SSLSocketFactory.java
浏览文件 @
07653a70
...
...
@@ -127,6 +127,7 @@ public abstract class SSLSocketFactory extends SocketFactory
static
String
getSecurityProperty
(
final
String
name
)
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
@Override
public
String
run
()
{
String
s
=
java
.
security
.
Security
.
getProperty
(
name
);
if
(
s
!=
null
)
{
...
...
@@ -247,18 +248,21 @@ class DefaultSSLSocketFactory extends SSLSocketFactory
new
SocketException
(
reason
.
toString
()).
initCause
(
reason
);
}
@Override
public
Socket
createSocket
()
throws
IOException
{
return
throwException
();
}
@Override
public
Socket
createSocket
(
String
host
,
int
port
)
throws
IOException
{
return
throwException
();
}
@Override
public
Socket
createSocket
(
Socket
s
,
String
host
,
int
port
,
boolean
autoClose
)
throws
IOException
...
...
@@ -266,12 +270,14 @@ class DefaultSSLSocketFactory extends SSLSocketFactory
return
throwException
();
}
@Override
public
Socket
createSocket
(
InetAddress
address
,
int
port
)
throws
IOException
{
return
throwException
();
}
@Override
public
Socket
createSocket
(
String
host
,
int
port
,
InetAddress
clientAddress
,
int
clientPort
)
throws
IOException
...
...
@@ -279,6 +285,7 @@ class DefaultSSLSocketFactory extends SSLSocketFactory
return
throwException
();
}
@Override
public
Socket
createSocket
(
InetAddress
address
,
int
port
,
InetAddress
clientAddress
,
int
clientPort
)
throws
IOException
...
...
@@ -286,10 +293,12 @@ class DefaultSSLSocketFactory extends SSLSocketFactory
return
throwException
();
}
@Override
public
String
[]
getDefaultCipherSuites
()
{
return
new
String
[
0
];
}
@Override
public
String
[]
getSupportedCipherSuites
()
{
return
new
String
[
0
];
}
...
...
src/share/classes/javax/net/ssl/TrustManagerFactory.java
浏览文件 @
07653a70
...
...
@@ -65,6 +65,7 @@ public class TrustManagerFactory {
public
final
static
String
getDefaultAlgorithm
()
{
String
type
;
type
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
@Override
public
String
run
()
{
return
Security
.
getProperty
(
"ssl.TrustManagerFactory.algorithm"
);
...
...
src/share/classes/javax/net/ssl/X509KeyManager.java
浏览文件 @
07653a70
...
...
@@ -25,7 +25,6 @@
package
javax.net.ssl
;
import
java.security.KeyManagementException
;
import
java.security.PrivateKey
;
import
java.security.Principal
;
import
java.security.cert.X509Certificate
;
...
...
src/share/classes/sun/launcher/LauncherHelper.java
浏览文件 @
07653a70
...
...
@@ -69,7 +69,6 @@ import java.util.jar.Manifest;
public
enum
LauncherHelper
{
INSTANCE
;
private
static
final
String
MAIN_CLASS
=
"Main-Class"
;
private
static
StringBuilder
outBuf
=
new
StringBuilder
();
private
static
final
String
INDENT
=
" "
;
...
...
@@ -87,6 +86,9 @@ public enum LauncherHelper {
private
static
final
ResourceBundle
RB
=
ResourceBundle
.
getBundle
(
defaultBundleName
);
}
private
static
PrintStream
ostream
;
private
static
final
ClassLoader
scloader
=
ClassLoader
.
getSystemClassLoader
();
private
static
Class
<?>
appClass
;
// application class, for GUI/reporting purposes
/*
* A method called by the launcher to print out the standard settings,
...
...
@@ -114,27 +116,27 @@ public enum LauncherHelper {
long
initialHeapSize
,
long
maxHeapSize
,
long
stackSize
,
boolean
isServer
)
{
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
initOutput
(
printToStderr
)
;
String
opts
[]
=
optionFlag
.
split
(
":"
);
String
optStr
=
(
opts
.
length
>
1
&&
opts
[
1
]
!=
null
)
?
opts
[
1
].
trim
()
:
"all"
;
switch
(
optStr
)
{
case
"vm"
:
printVmSettings
(
ostream
,
initialHeapSize
,
maxHeapSize
,
stackSize
,
isServer
);
printVmSettings
(
initialHeapSize
,
maxHeapSize
,
stackSize
,
isServer
);
break
;
case
"properties"
:
printProperties
(
ostream
);
printProperties
();
break
;
case
"locale"
:
printLocale
(
ostream
);
printLocale
();
break
;
default
:
printVmSettings
(
ostream
,
initialHeapSize
,
maxHeap
Size
,
stackSize
,
isServer
);
printProperties
(
ostream
);
printLocale
(
ostream
);
printVmSettings
(
initialHeapSize
,
maxHeapSize
,
stack
Size
,
isServer
);
printProperties
();
printLocale
();
break
;
}
}
...
...
@@ -142,7 +144,7 @@ public enum LauncherHelper {
/*
* prints the main vm settings subopt/section
*/
private
static
void
printVmSettings
(
PrintStream
ostream
,
private
static
void
printVmSettings
(
long
initialHeapSize
,
long
maxHeapSize
,
long
stackSize
,
boolean
isServer
)
{
...
...
@@ -172,14 +174,14 @@ public enum LauncherHelper {
/*
* prints the properties subopt/section
*/
private
static
void
printProperties
(
PrintStream
ostream
)
{
private
static
void
printProperties
()
{
Properties
p
=
System
.
getProperties
();
ostream
.
println
(
PROP_SETTINGS
);
List
<
String
>
sortedPropertyKeys
=
new
ArrayList
<>();
sortedPropertyKeys
.
addAll
(
p
.
stringPropertyNames
());
Collections
.
sort
(
sortedPropertyKeys
);
for
(
String
x
:
sortedPropertyKeys
)
{
printPropertyValue
(
ostream
,
x
,
p
.
getProperty
(
x
));
printPropertyValue
(
x
,
p
.
getProperty
(
x
));
}
ostream
.
println
();
}
...
...
@@ -188,8 +190,7 @@ public enum LauncherHelper {
return
key
.
endsWith
(
".dirs"
)
||
key
.
endsWith
(
".path"
);
}
private
static
void
printPropertyValue
(
PrintStream
ostream
,
String
key
,
String
value
)
{
private
static
void
printPropertyValue
(
String
key
,
String
value
)
{
ostream
.
print
(
INDENT
+
key
+
" = "
);
if
(
key
.
equals
(
"line.separator"
))
{
for
(
byte
b
:
value
.
getBytes
())
{
...
...
@@ -229,7 +230,7 @@ public enum LauncherHelper {
/*
* prints the locale subopt/section
*/
private
static
void
printLocale
(
PrintStream
ostream
)
{
private
static
void
printLocale
()
{
Locale
locale
=
Locale
.
getDefault
();
ostream
.
println
(
LOCALE_SETTINGS
);
ostream
.
println
(
INDENT
+
"default locale = "
+
...
...
@@ -238,11 +239,11 @@ public enum LauncherHelper {
Locale
.
getDefault
(
Category
.
DISPLAY
).
getDisplayName
());
ostream
.
println
(
INDENT
+
"default format locale = "
+
Locale
.
getDefault
(
Category
.
FORMAT
).
getDisplayName
());
printLocales
(
ostream
);
printLocales
();
ostream
.
println
();
}
private
static
void
printLocales
(
PrintStream
ostream
)
{
private
static
void
printLocales
()
{
Locale
[]
tlocales
=
Locale
.
getAvailableLocales
();
final
int
len
=
tlocales
==
null
?
0
:
tlocales
.
length
;
if
(
len
<
1
)
{
...
...
@@ -370,7 +371,7 @@ public enum LauncherHelper {
* initHelpSystem must be called before using this method.
*/
static
void
printHelpMessage
(
boolean
printToStderr
)
{
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
initOutput
(
printToStderr
)
;
outBuf
=
outBuf
.
append
(
getLocalizedMessage
(
"java.launcher.opt.footer"
,
File
.
pathSeparator
));
ostream
.
println
(
outBuf
.
toString
());
...
...
@@ -380,7 +381,7 @@ public enum LauncherHelper {
* Prints the Xusage text to the desired output stream.
*/
static
void
printXUsageMessage
(
boolean
printToStderr
)
{
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
initOutput
(
printToStderr
)
;
ostream
.
println
(
getLocalizedMessage
(
"java.launcher.X.usage"
,
File
.
pathSeparator
));
if
(
System
.
getProperty
(
"os.name"
).
contains
(
"OS X"
))
{
...
...
@@ -389,36 +390,32 @@ public enum LauncherHelper {
}
}
static
String
getMainClassFromJar
(
PrintStream
ostream
,
String
jarname
)
{
try
{
JarFile
jarFile
=
null
;
try
{
jarFile
=
new
JarFile
(
jarname
);
Manifest
manifest
=
jarFile
.
getManifest
();
if
(
manifest
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error2"
,
jarname
);
}
Attributes
mainAttrs
=
manifest
.
getMainAttributes
();
if
(
mainAttrs
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
String
mainValue
=
mainAttrs
.
getValue
(
MAIN_CLASS
);
if
(
mainValue
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
return
mainValue
.
trim
();
}
finally
{
if
(
jarFile
!=
null
)
{
jarFile
.
close
();
}
static
void
initOutput
(
boolean
printToStderr
)
{
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
}
static
String
getMainClassFromJar
(
String
jarname
)
{
String
mainValue
=
null
;
try
(
JarFile
jarFile
=
new
JarFile
(
jarname
))
{
Manifest
manifest
=
jarFile
.
getManifest
();
if
(
manifest
==
null
)
{
abort
(
null
,
"java.launcher.jar.error2"
,
jarname
);
}
Attributes
mainAttrs
=
manifest
.
getMainAttributes
();
if
(
mainAttrs
==
null
)
{
abort
(
null
,
"java.launcher.jar.error3"
,
jarname
);
}
mainValue
=
mainAttrs
.
getValue
(
MAIN_CLASS
);
if
(
mainValue
==
null
)
{
abort
(
null
,
"java.launcher.jar.error3"
,
jarname
);
}
return
mainValue
.
trim
();
}
catch
(
IOException
ioe
)
{
abort
(
ostream
,
ioe
,
"java.launcher.jar.error1"
,
jarname
);
abort
(
ioe
,
"java.launcher.jar.error1"
,
jarname
);
}
return
null
;
}
// From src/share/bin/java.c:
// enum LaunchMode { LM_UNKNOWN = 0, LM_CLASS, LM_JAR };
...
...
@@ -426,7 +423,7 @@ public enum LauncherHelper {
private
static
final
int
LM_CLASS
=
1
;
private
static
final
int
LM_JAR
=
2
;
static
void
abort
(
PrintStream
ostream
,
Throwable
t
,
String
msgKey
,
Object
...
args
)
{
static
void
abort
(
Throwable
t
,
String
msgKey
,
Object
...
args
)
{
if
(
msgKey
!=
null
)
{
ostream
.
println
(
getLocalizedMessage
(
msgKey
,
args
));
}
...
...
@@ -450,19 +447,22 @@ public enum LauncherHelper {
* b. is there a main
* c. is the main public
* d. is the main static
* c. does the main take a String array for args
* 4. and off we go......
* e. does the main take a String array for args
* 4. if no main method and if the class extends FX Application, then call
* on FXHelper to determine the main class to launch
* 5. and off we go......
*
* @param printToStderr
* @param isJar
* @param name
* @return
* @param printToStderr if set, all output will be routed to stderr
* @param mode LaunchMode as determined by the arguments passed on the
* command line
* @param what either the jar file to launch or the main class when using
* LM_CLASS mode
* @return the application's main class
*/
public
static
Class
<?>
checkAndLoadMain
(
boolean
printToStderr
,
int
mode
,
String
what
)
{
final
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
final
ClassLoader
ld
=
ClassLoader
.
getSystemClassLoader
();
initOutput
(
printToStderr
);
// get the class name
String
cn
=
null
;
switch
(
mode
)
{
...
...
@@ -470,44 +470,75 @@ public enum LauncherHelper {
cn
=
what
;
break
;
case
LM_JAR:
cn
=
getMainClassFromJar
(
ostream
,
what
);
cn
=
getMainClassFromJar
(
what
);
break
;
default
:
// should never happen
throw
new
InternalError
(
""
+
mode
+
": Unknown launch mode"
);
}
cn
=
cn
.
replace
(
'/'
,
'.'
);
Class
<?>
c
=
null
;
Class
<?>
mainClass
=
null
;
try
{
c
=
ld
.
loadClass
(
cn
);
}
catch
(
ClassNotFoundException
cnfe
)
{
abort
(
ostream
,
cnfe
,
"java.launcher.cls.error1"
,
cn
);
mainClass
=
scloader
.
loadClass
(
cn
);
}
catch
(
NoClassDefFoundError
|
ClassNotFoundException
cnfe
)
{
abort
(
cnfe
,
"java.launcher.cls.error1"
,
cn
);
}
getMainMethod
(
ostream
,
c
);
return
c
;
// set to mainClass, FXHelper may return something else
appClass
=
mainClass
;
Method
m
=
getMainMethod
(
mainClass
);
if
(
m
!=
null
)
{
// this will abort if main method has the wrong signature
validateMainMethod
(
m
);
return
mainClass
;
}
// Check if FXHelper can launch it using the FX launcher
Class
<?>
fxClass
=
FXHelper
.
getFXMainClass
(
mainClass
);
if
(
fxClass
!=
null
)
{
return
fxClass
;
}
// not an FX application either, abort with an error
abort
(
null
,
"java.launcher.cls.error4"
,
mainClass
.
getName
(),
FXHelper
.
JAVAFX_APPLICATION_CLASS_NAME
);
return
null
;
// avoid compiler error...
}
/*
* Accessor method called by the launcher after getting the main class via
* checkAndLoadMain(). The "application class" is the class that is finally
* executed to start the application and in this case is used to report
* the correct application name, typically for UI purposes.
*/
public
static
Class
<?>
getApplicationClass
()
{
return
appClass
;
}
static
Method
getMainMethod
(
PrintStream
ostream
,
Class
<?>
clazz
)
{
String
classname
=
clazz
.
getName
();
Method
method
=
null
;
// Check for main method or return null if not found
static
Method
getMainMethod
(
Class
<?>
clazz
)
{
try
{
method
=
clazz
.
getMethod
(
"main"
,
String
[].
class
);
}
catch
(
NoSuchMethodException
nsme
)
{
abort
(
ostream
,
null
,
"java.launcher.cls.error4"
,
classname
);
}
return
clazz
.
getMethod
(
"main"
,
String
[].
class
);
}
catch
(
NoSuchMethodException
nsme
)
{}
return
null
;
}
// Check the signature of main and abort if it's incorrect
static
void
validateMainMethod
(
Method
mainMethod
)
{
/*
* getMethod (above) will choose the correct method, based
* on its name and parameter type, however, we still have to
* ensure that the method is static and returns a void.
*/
int
mod
=
method
.
getModifiers
();
int
mod
=
m
ainM
ethod
.
getModifiers
();
if
(!
Modifier
.
isStatic
(
mod
))
{
abort
(
ostream
,
null
,
"java.launcher.cls.error2"
,
"static"
,
classname
);
abort
(
null
,
"java.launcher.cls.error2"
,
"static"
,
mainMethod
.
getDeclaringClass
().
getName
());
}
if
(
method
.
getReturnType
()
!=
java
.
lang
.
Void
.
TYPE
)
{
abort
(
ostream
,
null
,
"java.launcher.cls.error3"
,
classname
);
if
(
mainMethod
.
getReturnType
()
!=
java
.
lang
.
Void
.
TYPE
)
{
abort
(
null
,
"java.launcher.cls.error3"
,
mainMethod
.
getDeclaringClass
().
getName
());
}
return
method
;
}
private
static
final
String
encprop
=
"sun.jnu.encoding"
;
...
...
@@ -519,7 +550,7 @@ public enum LauncherHelper {
* previously implemented as a native method in the launcher.
*/
static
String
makePlatformString
(
boolean
printToStderr
,
byte
[]
inArray
)
{
final
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
initOutput
(
printToStderr
)
;
if
(
encoding
==
null
)
{
encoding
=
System
.
getProperty
(
encprop
);
isCharsetSupported
=
Charset
.
isSupported
(
encoding
);
...
...
@@ -530,7 +561,7 @@ public enum LauncherHelper {
:
new
String
(
inArray
);
return
out
;
}
catch
(
UnsupportedEncodingException
uee
)
{
abort
(
ostream
,
uee
,
null
);
abort
(
uee
,
null
);
}
return
null
;
// keep the compiler happy
}
...
...
@@ -611,5 +642,65 @@ public enum LauncherHelper {
return
"StdArg{"
+
"arg="
+
arg
+
", needsExpansion="
+
needsExpansion
+
'}'
;
}
}
static
final
class
FXHelper
{
private
static
final
String
JAVAFX_APPLICATION_CLASS_NAME
=
"javafx.application.Application"
;
private
static
final
String
JAVAFX_LAUNCHER_CLASS_NAME
=
"com.sun.javafx.application.LauncherImpl"
;
/*
* FX application launcher and launch method, so we can launch
* applications with no main method.
*/
private
static
Class
<?>
fxLauncherClass
=
null
;
private
static
Method
fxLauncherMethod
=
null
;
/*
* We can assume that the class does NOT have a main method or it would
* have been handled already. We do, however, need to check if the class
* extends Application and the launcher is available and abort with an
* error if it's not.
*/
private
static
Class
<?>
getFXMainClass
(
Class
<?>
mainClass
)
{
// Check if mainClass extends Application
if
(!
doesExtendFXApplication
(
mainClass
))
{
return
null
;
}
// Check for the FX launcher classes
try
{
fxLauncherClass
=
scloader
.
loadClass
(
JAVAFX_LAUNCHER_CLASS_NAME
);
fxLauncherMethod
=
fxLauncherClass
.
getMethod
(
"launchApplication"
,
Class
.
class
,
String
[].
class
);
}
catch
(
ClassNotFoundException
|
NoSuchMethodException
ex
)
{
abort
(
ex
,
"java.launcher.cls.error5"
,
ex
);
}
// That's all, return this class so we can launch later
return
FXHelper
.
class
;
}
/*
* Check if the given class is a JavaFX Application class. This is done
* in a way that does not cause the Application class to load or throw
* ClassNotFoundException if the JavaFX runtime is not available.
*/
private
static
boolean
doesExtendFXApplication
(
Class
<?>
mainClass
)
{
for
(
Class
<?>
sc
=
mainClass
.
getSuperclass
();
sc
!=
null
;
sc
=
sc
.
getSuperclass
())
{
if
(
sc
.
getName
().
equals
(
JAVAFX_APPLICATION_CLASS_NAME
))
{
return
true
;
}
}
return
false
;
}
// preloader ?
public
static
void
main
(
String
...
args
)
throws
Exception
{
// launch appClass via fxLauncherMethod
fxLauncherMethod
.
invoke
(
null
,
new
Object
[]
{
appClass
,
args
});
}
}
}
src/share/classes/sun/launcher/resources/launcher.properties
浏览文件 @
07653a70
...
...
@@ -131,7 +131,10 @@ java.launcher.cls.error3=\
\
public static void main(String[] args)
java.launcher.cls.error4
=
\
Error: Main method not found in class {0}, please define the main method as:
\n\
\
public static void main(String[] args)
\
public static void main(String[] args)
\n\
or a JavaFX application class must extend {1}
java.launcher.cls.error5
=
\
Error: JavaFX runtime components are missing, and are required to run this application
java.launcher.jar.error1
=
\
Error: An unexpected error occurred while trying to open file {0}
java.launcher.jar.error2
=
manifest not found in {0}
...
...
src/share/classes/sun/security/krb5/Config.java
浏览文件 @
07653a70
...
...
@@ -1123,7 +1123,7 @@ public class Config {
*/
private
String
getKDCFromDNS
(
String
realm
)
throws
KrbException
{
// use DNS to locate KDC
String
kdcs
=
null
;
String
kdcs
=
""
;
String
[]
srvs
=
null
;
// locate DNS SRV record using UDP
if
(
DEBUG
)
{
...
...
@@ -1133,7 +1133,7 @@ public class Config {
if
(
srvs
==
null
)
{
// locate DNS SRV record using TCP
if
(
DEBUG
)
{
System
.
out
.
println
(
"getKDCFromDNS using
UD
P"
);
System
.
out
.
println
(
"getKDCFromDNS using
TC
P"
);
}
srvs
=
KrbServiceLocator
.
getKerberosService
(
realm
,
"_tcp"
);
}
...
...
@@ -1142,14 +1142,15 @@ public class Config {
throw
new
KrbException
(
Krb5
.
KRB_ERR_GENERIC
,
"Unable to locate KDC for realm "
+
realm
);
}
if
(
srvs
.
length
==
0
)
{
return
null
;
}
for
(
int
i
=
0
;
i
<
srvs
.
length
;
i
++)
{
String
value
=
srvs
[
i
];
for
(
int
j
=
0
;
j
<
srvs
[
i
].
length
();
j
++)
{
// filter the KDC name
if
(
value
.
charAt
(
j
)
==
':'
)
{
kdcs
=
(
value
.
substring
(
0
,
j
)).
trim
();
}
}
kdcs
+=
srvs
[
i
].
trim
()
+
" "
;
}
kdcs
=
kdcs
.
trim
();
if
(
kdcs
.
equals
(
""
))
{
return
null
;
}
return
kdcs
;
}
...
...
src/share/classes/sun/tools/jar/Main.java
浏览文件 @
07653a70
...
...
@@ -839,8 +839,8 @@ class Main {
void
replaceFSC
(
String
files
[])
{
if
(
files
!=
null
)
{
for
(
String
file
:
files
)
{
file
=
file
.
replace
(
File
.
separatorChar
,
'/'
);
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++
)
{
file
s
[
i
]
=
files
[
i
]
.
replace
(
File
.
separatorChar
,
'/'
);
}
}
}
...
...
src/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java
浏览文件 @
07653a70
...
...
@@ -38,6 +38,7 @@ import java.util.Set;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.spi.CalendarDataProvider
;
import
java.util.spi.CalendarNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleNameProvider
;
import
java.util.spi.LocaleServiceProvider
;
...
...
@@ -135,6 +136,10 @@ public abstract class AuxLocaleProviderAdapter extends LocaleProviderAdapter {
return
getLocaleServiceProvider
(
CalendarDataProvider
.
class
);
}
@Override
public
CalendarNameProvider
getCalendarNameProvider
()
{
return
getLocaleServiceProvider
(
CalendarNameProvider
.
class
);
}
@Override
public
LocaleResources
getLocaleResources
(
Locale
locale
)
{
...
...
src/share/classes/sun/util/locale/provider/CalendarDataProviderImpl.java
浏览文件 @
07653a70
...
...
@@ -24,10 +24,9 @@
*/
package
sun.util.locale.provider
;
import
java.util.Calendar
;
import
static
java
.
util
.
Calendar
.*;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.ResourceBundle
;
import
java.util.Set
;
import
java.util.spi.CalendarDataProvider
;
...
...
@@ -58,115 +57,11 @@ public class CalendarDataProviderImpl extends CalendarDataProvider implements Av
return
getIntData
(
CalendarDataUtility
.
MINIMAL_DAYS_IN_FIRST_WEEK
,
locale
);
}
@Override
public
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
String
name
=
null
;
String
key
=
getKey
(
calendarType
,
field
,
style
);
if
(
key
!=
null
)
{
ResourceBundle
rb
=
LocaleProviderAdapter
.
forType
(
type
).
getLocaleData
().
getDateFormatData
(
locale
);
if
(
rb
.
containsKey
(
key
))
{
String
[]
strings
=
rb
.
getStringArray
(
key
);
if
(
strings
.
length
>
0
)
{
if
(
field
==
DAY_OF_WEEK
||
field
==
YEAR
)
{
--
value
;
}
name
=
strings
[
value
];
// If name is empty in standalone, try its `format' style.
if
(
name
.
length
()
==
0
&&
(
style
==
SHORT_STANDALONE
||
style
==
LONG_STANDALONE
))
{
name
=
getDisplayName
(
calendarType
,
field
,
value
,
style
==
SHORT_STANDALONE
?
SHORT_FORMAT
:
LONG_FORMAT
,
locale
);
}
}
}
}
return
name
;
}
@Override
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
Map
<
String
,
Integer
>
names
;
if
(
style
==
ALL_STYLES
)
{
names
=
getDisplayNamesImpl
(
calendarType
,
field
,
SHORT_FORMAT
,
locale
);
if
(
field
!=
AM_PM
)
{
for
(
int
st
:
new
int
[]
{
SHORT_STANDALONE
,
LONG_FORMAT
,
LONG_STANDALONE
})
{
names
.
putAll
(
getDisplayNamesImpl
(
calendarType
,
field
,
st
,
locale
));
}
}
}
else
{
// specific style
names
=
getDisplayNamesImpl
(
calendarType
,
field
,
style
,
locale
);
}
return
names
.
isEmpty
()
?
null
:
names
;
}
private
Map
<
String
,
Integer
>
getDisplayNamesImpl
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
String
key
=
getKey
(
calendarType
,
field
,
style
);
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
key
!=
null
)
{
ResourceBundle
rb
=
LocaleProviderAdapter
.
forType
(
type
).
getLocaleData
().
getDateFormatData
(
locale
);
if
(
rb
.
containsKey
(
key
))
{
String
[]
strings
=
rb
.
getStringArray
(
key
);
if
(
field
==
YEAR
)
{
if
(
strings
.
length
>
0
)
{
map
.
put
(
strings
[
0
],
1
);
}
}
else
{
int
base
=
(
field
==
DAY_OF_WEEK
)
?
1
:
0
;
for
(
int
i
=
0
;
i
<
strings
.
length
;
i
++)
{
String
name
=
strings
[
i
];
// Ignore any empty string (some standalone month names
// are not defined)
if
(
name
.
length
()
==
0
)
{
continue
;
}
map
.
put
(
name
,
base
+
i
);
}
}
}
}
return
map
;
}
@Override
public
Locale
[]
getAvailableLocales
()
{
return
LocaleProviderAdapter
.
toLocaleArray
(
langtags
);
}
@Override
public
boolean
isSupportedLocale
(
Locale
locale
)
{
if
(
Locale
.
ROOT
.
equals
(
locale
))
{
return
true
;
}
String
calendarType
=
null
;
if
(
locale
.
hasExtensions
())
{
calendarType
=
locale
.
getUnicodeLocaleType
(
"ca"
);
locale
=
locale
.
stripExtensions
();
}
if
(
calendarType
!=
null
)
{
switch
(
calendarType
)
{
case
"buddhist"
:
case
"japanese"
:
case
"gregory"
:
break
;
default
:
// Unknown calendar type
return
false
;
}
}
if
(
langtags
.
contains
(
locale
.
toLanguageTag
()))
{
return
true
;
}
if
(
type
==
LocaleProviderAdapter
.
Type
.
JRE
)
{
String
oldname
=
locale
.
toString
().
replace
(
'_'
,
'-'
);
return
langtags
.
contains
(
oldname
);
}
return
false
;
}
@Override
public
Set
<
String
>
getAvailableLanguageTags
()
{
return
langtags
;
...
...
@@ -178,49 +73,6 @@ public class CalendarDataProviderImpl extends CalendarDataProvider implements Av
String
firstday
=
rb
.
getString
(
key
);
return
Integer
.
parseInt
(
firstday
);
}
// Note that the base bundle of CLDR doesn't have the Calendar week parameters.
return
0
;
}
private
String
getKey
(
String
type
,
int
field
,
int
style
)
{
boolean
standalone
=
(
style
&
0x8000
)
!=
0
;
style
&=
~
0x8000
;
if
(
"gregory"
.
equals
(
type
))
{
type
=
null
;
}
StringBuilder
key
=
new
StringBuilder
();
switch
(
field
)
{
case
ERA:
if
(
type
!=
null
)
{
key
.
append
(
type
).
append
(
'.'
);
}
if
(
style
==
SHORT
)
{
key
.
append
(
"short."
);
}
key
.
append
(
"Eras"
);
break
;
case
YEAR:
key
.
append
(
type
).
append
(
".FirstYear"
);
break
;
case
MONTH:
if
(
standalone
)
{
key
.
append
(
"standalone."
);
}
key
.
append
(
style
==
SHORT
?
"MonthAbbreviations"
:
"MonthNames"
);
break
;
case
DAY_OF_WEEK:
key
.
append
(
style
==
SHORT
?
"DayAbbreviations"
:
"DayNames"
);
break
;
case
AM_PM:
key
.
append
(
"AmPmMarkers"
);
break
;
}
return
key
.
length
()
>
0
?
key
.
toString
()
:
null
;
}
}
src/share/classes/sun/util/locale/provider/CalendarDataUtility.java
浏览文件 @
07653a70
...
...
@@ -25,9 +25,12 @@
package
sun.util.locale.provider
;
import
java.util.Calendar
;
import
static
java
.
util
.
Calendar
.*;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.spi.CalendarDataProvider
;
import
java.util.spi.CalendarNameProvider
;
/**
* {@code CalendarDataUtility} is a utility class for calling the
...
...
@@ -44,16 +47,32 @@ public class CalendarDataUtility {
private
CalendarDataUtility
()
{
}
public
static
String
retrieveFieldValueName
(
String
id
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
public
static
int
retrieveFirstDayOfWeek
(
Locale
locale
)
{
LocaleServiceProviderPool
pool
=
LocaleServiceProviderPool
.
getPool
(
CalendarDataProvider
.
class
);
Integer
value
=
pool
.
getLocalizedObject
(
CalendarWeekParameterGetter
.
INSTANCE
,
locale
,
FIRST_DAY_OF_WEEK
);
return
(
value
!=
null
&&
(
value
>=
SUNDAY
&&
value
<=
SATURDAY
))
?
value
:
SUNDAY
;
}
public
static
int
retrieveMinimalDaysInFirstWeek
(
Locale
locale
)
{
LocaleServiceProviderPool
pool
=
LocaleServiceProviderPool
.
getPool
(
CalendarDataProvider
.
class
);
Integer
value
=
pool
.
getLocalizedObject
(
CalendarWeekParameterGetter
.
INSTANCE
,
locale
,
MINIMAL_DAYS_IN_FIRST_WEEK
);
return
(
value
!=
null
&&
(
value
>=
1
&&
value
<=
7
))
?
value
:
1
;
}
public
static
String
retrieveFieldValueName
(
String
id
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
LocaleServiceProviderPool
pool
=
LocaleServiceProviderPool
.
getPool
(
CalendarNameProvider
.
class
);
return
pool
.
getLocalizedObject
(
CalendarFieldValueNameGetter
.
INSTANCE
,
locale
,
id
,
field
,
value
,
style
);
}
public
static
Map
<
String
,
Integer
>
retrieveFieldValueNames
(
String
id
,
int
field
,
int
style
,
Locale
locale
)
{
LocaleServiceProviderPool
pool
=
LocaleServiceProviderPool
.
getPool
(
Calendar
Data
Provider
.
class
);
LocaleServiceProviderPool
.
getPool
(
Calendar
Name
Provider
.
class
);
return
pool
.
getLocalizedObject
(
CalendarFieldValueNamesMapGetter
.
INSTANCE
,
locale
,
id
,
field
,
style
);
}
...
...
@@ -62,13 +81,13 @@ public class CalendarDataUtility {
* implementation.
*/
private
static
class
CalendarFieldValueNameGetter
implements
LocaleServiceProviderPool
.
LocalizedObjectGetter
<
Calendar
Data
Provider
,
implements
LocaleServiceProviderPool
.
LocalizedObjectGetter
<
Calendar
Name
Provider
,
String
>
{
private
static
final
CalendarFieldValueNameGetter
INSTANCE
=
new
CalendarFieldValueNameGetter
();
@Override
public
String
getObject
(
Calendar
DataProvider
calendarData
Provider
,
public
String
getObject
(
Calendar
NameProvider
calendarName
Provider
,
Locale
locale
,
String
requestID
,
// calendarType
Object
...
params
)
{
...
...
@@ -76,7 +95,7 @@ public class CalendarDataUtility {
int
field
=
(
int
)
params
[
0
];
int
value
=
(
int
)
params
[
1
];
int
style
=
(
int
)
params
[
2
];
return
calendar
Data
Provider
.
getDisplayName
(
requestID
,
field
,
value
,
style
,
locale
);
return
calendar
Name
Provider
.
getDisplayName
(
requestID
,
field
,
value
,
style
,
locale
);
}
}
...
...
@@ -85,20 +104,47 @@ public class CalendarDataUtility {
* implementation.
*/
private
static
class
CalendarFieldValueNamesMapGetter
implements
LocaleServiceProviderPool
.
LocalizedObjectGetter
<
Calendar
Data
Provider
,
implements
LocaleServiceProviderPool
.
LocalizedObjectGetter
<
Calendar
Name
Provider
,
Map
<
String
,
Integer
>>
{
private
static
final
CalendarFieldValueNamesMapGetter
INSTANCE
=
new
CalendarFieldValueNamesMapGetter
();
@Override
public
Map
<
String
,
Integer
>
getObject
(
Calendar
DataProvider
calendarData
Provider
,
public
Map
<
String
,
Integer
>
getObject
(
Calendar
NameProvider
calendarName
Provider
,
Locale
locale
,
String
requestID
,
// calendarType
Object
...
params
)
{
assert
params
.
length
==
2
;
int
field
=
(
int
)
params
[
0
];
int
style
=
(
int
)
params
[
1
];
return
calendarDataProvider
.
getDisplayNames
(
requestID
,
field
,
style
,
locale
);
return
calendarNameProvider
.
getDisplayNames
(
requestID
,
field
,
style
,
locale
);
}
}
private
static
class
CalendarWeekParameterGetter
implements
LocaleServiceProviderPool
.
LocalizedObjectGetter
<
CalendarDataProvider
,
Integer
>
{
private
static
final
CalendarWeekParameterGetter
INSTANCE
=
new
CalendarWeekParameterGetter
();
@Override
public
Integer
getObject
(
CalendarDataProvider
calendarDataProvider
,
Locale
locale
,
String
requestID
,
// resource key
Object
...
params
)
{
assert
params
.
length
==
0
;
int
value
;
switch
(
requestID
)
{
case
FIRST_DAY_OF_WEEK:
value
=
calendarDataProvider
.
getFirstDayOfWeek
(
locale
);
break
;
case
MINIMAL_DAYS_IN_FIRST_WEEK:
value
=
calendarDataProvider
.
getMinimalDaysInFirstWeek
(
locale
);
break
;
default
:
throw
new
InternalError
(
"invalid requestID: "
+
requestID
);
}
return
(
value
!=
0
)
?
value
:
null
;
}
}
}
src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java
0 → 100644
浏览文件 @
07653a70
/*
* 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
static
java
.
util
.
Calendar
.*;
import
java.util.Comparator
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.ResourceBundle
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
java.util.spi.CalendarNameProvider
;
/**
* Concrete implementation of the {@link java.util.spi.CalendarDataProvider
* CalendarDataProvider} class for the JRE LocaleProviderAdapter.
*
* @author Masayoshi Okutsu
* @author Naoto Sato
*/
public
class
CalendarNameProviderImpl
extends
CalendarNameProvider
implements
AvailableLanguageTags
{
private
final
LocaleProviderAdapter
.
Type
type
;
private
final
Set
<
String
>
langtags
;
public
CalendarNameProviderImpl
(
LocaleProviderAdapter
.
Type
type
,
Set
<
String
>
langtags
)
{
this
.
type
=
type
;
this
.
langtags
=
langtags
;
}
@Override
public
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
String
name
=
null
;
String
key
=
getKey
(
calendarType
,
field
,
style
);
if
(
key
!=
null
)
{
ResourceBundle
rb
=
LocaleProviderAdapter
.
forType
(
type
).
getLocaleData
().
getDateFormatData
(
locale
);
if
(
rb
.
containsKey
(
key
))
{
String
[]
strings
=
rb
.
getStringArray
(
key
);
if
(
strings
.
length
>
0
)
{
if
(
field
==
DAY_OF_WEEK
||
field
==
YEAR
)
{
--
value
;
}
name
=
strings
[
value
];
// If name is empty in standalone, try its `format' style.
if
(
name
.
length
()
==
0
&&
(
style
==
SHORT_STANDALONE
||
style
==
LONG_STANDALONE
))
{
name
=
getDisplayName
(
calendarType
,
field
,
value
,
style
==
SHORT_STANDALONE
?
SHORT_FORMAT
:
LONG_FORMAT
,
locale
);
}
}
}
}
return
name
;
}
@Override
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
Map
<
String
,
Integer
>
names
;
if
(
style
==
ALL_STYLES
)
{
names
=
getDisplayNamesImpl
(
calendarType
,
field
,
SHORT_FORMAT
,
locale
);
if
(
field
!=
AM_PM
)
{
for
(
int
st
:
new
int
[]
{
SHORT_STANDALONE
,
LONG_FORMAT
,
LONG_STANDALONE
})
{
names
.
putAll
(
getDisplayNamesImpl
(
calendarType
,
field
,
st
,
locale
));
}
}
}
else
{
// specific style
names
=
getDisplayNamesImpl
(
calendarType
,
field
,
style
,
locale
);
}
return
names
.
isEmpty
()
?
null
:
names
;
}
private
Map
<
String
,
Integer
>
getDisplayNamesImpl
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
String
key
=
getKey
(
calendarType
,
field
,
style
);
Map
<
String
,
Integer
>
map
=
new
TreeMap
<>(
LengthBasedComparator
.
INSTANCE
);
if
(
key
!=
null
)
{
ResourceBundle
rb
=
LocaleProviderAdapter
.
forType
(
type
).
getLocaleData
().
getDateFormatData
(
locale
);
if
(
rb
.
containsKey
(
key
))
{
String
[]
strings
=
rb
.
getStringArray
(
key
);
if
(
field
==
YEAR
)
{
if
(
strings
.
length
>
0
)
{
map
.
put
(
strings
[
0
],
1
);
}
}
else
{
int
base
=
(
field
==
DAY_OF_WEEK
)
?
1
:
0
;
for
(
int
i
=
0
;
i
<
strings
.
length
;
i
++)
{
String
name
=
strings
[
i
];
// Ignore any empty string (some standalone month names
// are not defined)
if
(
name
.
length
()
==
0
)
{
continue
;
}
map
.
put
(
name
,
base
+
i
);
}
}
}
}
return
map
;
}
/**
* Comparator implementation for TreeMap which iterates keys from longest
* to shortest.
*/
private
static
class
LengthBasedComparator
implements
Comparator
<
String
>
{
private
static
final
LengthBasedComparator
INSTANCE
=
new
LengthBasedComparator
();
private
LengthBasedComparator
()
{
}
@Override
public
int
compare
(
String
o1
,
String
o2
)
{
int
n
=
o2
.
length
()
-
o1
.
length
();
return
(
n
==
0
)
?
o1
.
compareTo
(
o2
)
:
n
;
}
}
@Override
public
Locale
[]
getAvailableLocales
()
{
return
LocaleProviderAdapter
.
toLocaleArray
(
langtags
);
}
@Override
public
boolean
isSupportedLocale
(
Locale
locale
)
{
if
(
Locale
.
ROOT
.
equals
(
locale
))
{
return
true
;
}
String
calendarType
=
null
;
if
(
locale
.
hasExtensions
())
{
calendarType
=
locale
.
getUnicodeLocaleType
(
"ca"
);
locale
=
locale
.
stripExtensions
();
}
if
(
calendarType
!=
null
)
{
switch
(
calendarType
)
{
case
"buddhist"
:
case
"japanese"
:
case
"gregory"
:
break
;
default
:
// Unknown calendar type
return
false
;
}
}
if
(
langtags
.
contains
(
locale
.
toLanguageTag
()))
{
return
true
;
}
if
(
type
==
LocaleProviderAdapter
.
Type
.
JRE
)
{
String
oldname
=
locale
.
toString
().
replace
(
'_'
,
'-'
);
return
langtags
.
contains
(
oldname
);
}
return
false
;
}
@Override
public
Set
<
String
>
getAvailableLanguageTags
()
{
return
langtags
;
}
private
int
getIntData
(
String
key
,
Locale
locale
)
{
ResourceBundle
rb
=
LocaleProviderAdapter
.
forType
(
type
).
getLocaleData
().
getCalendarData
(
locale
);
if
(
rb
.
containsKey
(
key
))
{
String
firstday
=
rb
.
getString
(
key
);
return
Integer
.
parseInt
(
firstday
);
}
// Note that the base bundle of CLDR doesn't have the Calendar week parameters.
return
0
;
}
private
String
getKey
(
String
type
,
int
field
,
int
style
)
{
boolean
standalone
=
(
style
&
0x8000
)
!=
0
;
style
&=
~
0x8000
;
if
(
"gregory"
.
equals
(
type
))
{
type
=
null
;
}
StringBuilder
key
=
new
StringBuilder
();
switch
(
field
)
{
case
ERA:
if
(
type
!=
null
)
{
key
.
append
(
type
).
append
(
'.'
);
}
if
(
style
==
SHORT
)
{
key
.
append
(
"short."
);
}
key
.
append
(
"Eras"
);
break
;
case
YEAR:
key
.
append
(
type
).
append
(
".FirstYear"
);
break
;
case
MONTH:
if
(
standalone
)
{
key
.
append
(
"standalone."
);
}
key
.
append
(
style
==
SHORT
?
"MonthAbbreviations"
:
"MonthNames"
);
break
;
case
DAY_OF_WEEK:
key
.
append
(
style
==
SHORT
?
"DayAbbreviations"
:
"DayNames"
);
break
;
case
AM_PM:
key
.
append
(
"AmPmMarkers"
);
break
;
}
return
key
.
length
()
>
0
?
key
.
toString
()
:
null
;
}
}
src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
浏览文件 @
07653a70
...
...
@@ -41,6 +41,7 @@ import java.util.StringTokenizer;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.spi.CalendarDataProvider
;
import
java.util.spi.CalendarNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleNameProvider
;
import
java.util.spi.LocaleServiceProvider
;
...
...
@@ -101,6 +102,8 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter {
return
(
P
)
getTimeZoneNameProvider
();
case
"CalendarDataProvider"
:
return
(
P
)
getCalendarDataProvider
();
case
"CalendarNameProvider"
:
return
(
P
)
getCalendarNameProvider
();
default
:
throw
new
InternalError
(
"should not come down here"
);
}
...
...
@@ -117,6 +120,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter {
private
volatile
LocaleNameProvider
localeNameProvider
=
null
;
private
volatile
TimeZoneNameProvider
timeZoneNameProvider
=
null
;
private
volatile
CalendarDataProvider
calendarDataProvider
=
null
;
private
volatile
CalendarNameProvider
calendarNameProvider
=
null
;
/*
* Getter methods for java.text.spi.* providers
...
...
@@ -252,11 +256,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter {
@Override
public
CalendarDataProvider
getCalendarDataProvider
()
{
if
(
calendarDataProvider
==
null
)
{
Set
<
String
>
set
=
new
HashSet
<>();
set
.
addAll
(
getLanguageTagSet
(
"FormatData"
));
set
.
addAll
(
getLanguageTagSet
(
"CalendarData"
));
CalendarDataProvider
provider
=
new
CalendarDataProviderImpl
(
getAdapterType
(),
set
);
CalendarDataProvider
provider
;
provider
=
new
CalendarDataProviderImpl
(
getAdapterType
(),
getLanguageTagSet
(
"CalendarData"
));
synchronized
(
this
)
{
if
(
calendarDataProvider
==
null
)
{
calendarDataProvider
=
provider
;
...
...
@@ -266,6 +268,21 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter {
return
calendarDataProvider
;
}
@Override
public
CalendarNameProvider
getCalendarNameProvider
()
{
if
(
calendarNameProvider
==
null
)
{
CalendarNameProvider
provider
;
provider
=
new
CalendarNameProviderImpl
(
getAdapterType
(),
getLanguageTagSet
(
"FormatData"
));
synchronized
(
this
)
{
if
(
calendarNameProvider
==
null
)
{
calendarNameProvider
=
provider
;
}
}
}
return
calendarNameProvider
;
}
@Override
public
LocaleResources
getLocaleResources
(
Locale
locale
)
{
LocaleResources
lr
=
localeResourcesMap
.
get
(
locale
);
...
...
src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
浏览文件 @
07653a70
...
...
@@ -38,6 +38,7 @@ import java.util.Locale;
import
java.util.ResourceBundle
;
import
java.util.Set
;
import
java.util.spi.CalendarDataProvider
;
import
java.util.spi.CalendarNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleNameProvider
;
import
java.util.spi.LocaleServiceProvider
;
...
...
@@ -387,6 +388,14 @@ public abstract class LocaleProviderAdapter {
*/
public
abstract
CalendarDataProvider
getCalendarDataProvider
();
/**
* Returns a CalendarNameProvider for this LocaleProviderAdapter, or null if no
* CalendarNameProvider is available.
*
* @return a CalendarNameProvider
*/
public
abstract
CalendarNameProvider
getCalendarNameProvider
();
public
abstract
LocaleResources
getLocaleResources
(
Locale
locale
);
public
abstract
LocaleData
getLocaleData
();
...
...
src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java
浏览文件 @
07653a70
...
...
@@ -28,11 +28,29 @@ package sun.util.locale.provider;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.text.*
;
import
java.text.spi.*
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.spi.*
;
import
java.text.BreakIterator
;
import
java.text.Collator
;
import
java.text.DateFormat
;
import
java.text.DateFormatSymbols
;
import
java.text.DecimalFormatSymbols
;
import
java.text.NumberFormat
;
import
java.text.spi.BreakIteratorProvider
;
import
java.text.spi.CollatorProvider
;
import
java.text.spi.DateFormatProvider
;
import
java.text.spi.DateFormatSymbolsProvider
;
import
java.text.spi.DecimalFormatSymbolsProvider
;
import
java.text.spi.NumberFormatProvider
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.ServiceLoader
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.spi.CalendarDataProvider
;
import
java.util.spi.CalendarNameProvider
;
import
java.util.spi.CurrencyNameProvider
;
import
java.util.spi.LocaleNameProvider
;
import
java.util.spi.LocaleServiceProvider
;
import
java.util.spi.TimeZoneNameProvider
;
/**
* LocaleProviderAdapter implementation for the installed SPI implementations.
...
...
@@ -73,7 +91,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
IllegalAccessException
e
)
{
LocaleServiceProviderPool
.
config
(
SPILocaleProviderAdapter
.
class
,
e
.
toString
());
return
null
;
}
}
}
((
Delegate
)
delegate
).
addImpl
(
provider
);
...
...
@@ -94,7 +112,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
interface
Delegate
<
P
extends
LocaleServiceProvider
>
{
public
void
addImpl
(
P
impl
);
public
P
getImpl
(
Locale
locale
);
}
}
/*
* Obtain the real SPI implementation, using locale fallback
...
...
@@ -119,7 +137,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
BreakIteratorProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -174,7 +192,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
CollatorProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -208,7 +226,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
DateFormatProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -256,7 +274,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
DateFormatSymbolsProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -290,7 +308,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
DecimalFormatSymbolsProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -324,7 +342,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
NumberFormatProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -379,7 +397,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
CalendarDataProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -411,12 +429,39 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
assert
cdp
!=
null
;
return
cdp
.
getMinimalDaysInFirstWeek
(
locale
);
}
}
static
class
CalendarNameProviderDelegate
extends
CalendarNameProvider
implements
Delegate
<
CalendarNameProvider
>
{
private
ConcurrentMap
<
Locale
,
CalendarNameProvider
>
map
=
new
ConcurrentHashMap
<>();
@Override
public
void
addImpl
(
CalendarNameProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
putIfAbsent
(
l
,
impl
);
}
}
@Override
public
CalendarNameProvider
getImpl
(
Locale
locale
)
{
return
SPILocaleProviderAdapter
.
getImpl
(
map
,
locale
);
}
@Override
public
Locale
[]
getAvailableLocales
()
{
return
map
.
keySet
().
toArray
(
new
Locale
[
0
]);
}
@Override
public
boolean
isSupportedLocale
(
Locale
locale
)
{
return
map
.
containsKey
(
locale
);
}
@Override
public
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
Calendar
Data
Provider
cdp
=
getImpl
(
locale
);
Calendar
Name
Provider
cdp
=
getImpl
(
locale
);
assert
cdp
!=
null
;
return
cdp
.
getDisplayName
(
calendarType
,
field
,
value
,
style
,
locale
);
}
...
...
@@ -425,7 +470,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
Calendar
Data
Provider
cdp
=
getImpl
(
locale
);
Calendar
Name
Provider
cdp
=
getImpl
(
locale
);
assert
cdp
!=
null
;
return
cdp
.
getDisplayNames
(
calendarType
,
field
,
style
,
locale
);
}
...
...
@@ -438,7 +483,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
CurrencyNameProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -479,7 +524,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
LocaleNameProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
@@ -534,7 +579,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public
void
addImpl
(
TimeZoneNameProvider
impl
)
{
for
(
Locale
l
:
impl
.
getAvailableLocales
())
{
map
.
put
(
l
,
impl
);
map
.
put
IfAbsent
(
l
,
impl
);
}
}
...
...
src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
浏览文件 @
07653a70
...
...
@@ -571,7 +571,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_releaseCred(JNIEnv *env,
*/
void
inquireCred
(
JNIEnv
*
env
,
jobject
jobj
,
gss_cred_id_t
pCred
,
jint
type
,
void
*
result
)
{
OM_uint32
minor
,
major
=
GSS_C_QOP_DEFAULT
;
OM_uint32
minor
,
major
=
0
;
OM_uint32
routineErr
;
gss_cred_id_t
credHdl
;
...
...
src/share/native/sun/security/pkcs11/wrapper/p11_mutex.c
浏览文件 @
07653a70
...
...
@@ -112,22 +112,34 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
ckpInitArgs
->
UnlockMutex
=
NULL_PTR
;
#else
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"CreateMutex"
,
"Lsun/security/pkcs11/wrapper/CK_CREATEMUTEX;"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jMutexHandler
=
(
*
env
)
->
GetObjectField
(
env
,
jInitArgs
,
fieldID
);
ckpInitArgs
->
CreateMutex
=
(
jMutexHandler
!=
NULL
)
?
&
callJCreateMutex
:
NULL_PTR
;
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"DestroyMutex"
,
"Lsun/security/pkcs11/wrapper/CK_DESTROYMUTEX;"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jMutexHandler
=
(
*
env
)
->
GetObjectField
(
env
,
jInitArgs
,
fieldID
);
ckpInitArgs
->
DestroyMutex
=
(
jMutexHandler
!=
NULL
)
?
&
callJDestroyMutex
:
NULL_PTR
;
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"LockMutex"
,
"Lsun/security/pkcs11/wrapper/CK_LOCKMUTEX;"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jMutexHandler
=
(
*
env
)
->
GetObjectField
(
env
,
jInitArgs
,
fieldID
);
ckpInitArgs
->
LockMutex
=
(
jMutexHandler
!=
NULL
)
?
&
callJLockMutex
:
NULL_PTR
;
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"UnlockMutex"
,
"Lsun/security/pkcs11/wrapper/CK_UNLOCKMUTEX;"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jMutexHandler
=
(
*
env
)
->
GetObjectField
(
env
,
jInitArgs
,
fieldID
);
ckpInitArgs
->
UnlockMutex
=
(
jMutexHandler
!=
NULL
)
?
&
callJUnlockMutex
:
NULL_PTR
;
...
...
@@ -151,13 +163,19 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
/* convert and set the flags field */
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"flags"
,
"J"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jFlags
=
(
*
env
)
->
GetLongField
(
env
,
jInitArgs
,
fieldID
);
ckpInitArgs
->
flags
=
jLongToCKULong
(
jFlags
);
/* pReserved should be NULL_PTR in this version */
fieldID
=
(
*
env
)
->
GetFieldID
(
env
,
jInitArgsClass
,
"pReserved"
,
"Ljava/lang/Object;"
);
if
(
fieldID
==
NULL
)
{
return
NULL
;
}
if
(
fieldID
==
NULL
)
{
free
(
ckpInitArgs
);
return
NULL
;
}
jReserved
=
(
*
env
)
->
GetObjectField
(
env
,
jInitArgs
,
fieldID
);
/* we try to convert the reserved parameter also */
...
...
src/solaris/bin/java_md_solinux.c
浏览文件 @
07653a70
...
...
@@ -478,9 +478,11 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
JLI_TraceLauncher
(
"mustsetenv: %s
\n
"
,
mustsetenv
?
"TRUE"
:
"FALSE"
);
if
(
mustsetenv
==
JNI_FALSE
)
{
JLI_MemFree
(
newargv
);
return
;
}
#else
JLI_MemFree
(
newargv
);
return
;
#endif
/* SETENV_REQUIRED */
}
else
{
/* do the same speculatively or exit */
...
...
src/solaris/classes/sun/java2d/xr/XRRenderer.java
浏览文件 @
07653a70
...
...
@@ -27,7 +27,6 @@ package sun.java2d.xr;
import
java.awt.*
;
import
java.awt.geom.*
;
import
sun.awt.SunToolkit
;
import
sun.java2d.SunGraphics2D
;
import
sun.java2d.loops.*
;
...
...
@@ -39,6 +38,9 @@ import sun.java2d.pipe.SpanIterator;
import
sun.java2d.pipe.ShapeSpanIterator
;
import
sun.java2d.pipe.LoopPipe
;
import
static
sun
.
java2d
.
xr
.
XRUtils
.
clampToShort
;
import
static
sun
.
java2d
.
xr
.
XRUtils
.
clampToUShort
;
/**
* XRender provides only accalerated rectangles. To emulate higher "order"
* geometry we have to pass everything else to DoPath/FillSpans.
...
...
@@ -70,17 +72,16 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe {
public
void
drawLine
(
SunGraphics2D
sg2d
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
Region
compClip
=
sg2d
.
getCompClip
();
int
transX1
=
x1
+
sg2d
.
transX
;
int
transY1
=
y1
+
sg2d
.
transY
;
int
transX2
=
x2
+
sg2d
.
transX
;
int
transY2
=
y2
+
sg2d
.
transY
;
int
transX1
=
Region
.
clipAdd
(
x1
,
sg2d
.
transX
)
;
int
transY1
=
Region
.
clipAdd
(
y1
,
sg2d
.
transY
)
;
int
transX2
=
Region
.
clipAdd
(
x2
,
sg2d
.
transX
)
;
int
transY2
=
Region
.
clipAdd
(
y2
,
sg2d
.
transY
)
;
// Non clipped fast path
if
(
compClip
.
contains
(
transX1
,
transY1
)
&&
compClip
.
contains
(
transX2
,
transY2
))
{
SunToolkit
.
awtLock
();
try
{
SunToolkit
.
awtLock
();
validateSurface
(
sg2d
);
tileManager
.
addLine
(
transX1
,
transY1
,
transX2
,
transY2
);
tileManager
.
fillMask
((
XRSurfaceData
)
sg2d
.
surfaceData
);
...
...
@@ -115,20 +116,40 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe {
draw
(
sg2d
,
new
Polygon
(
xpoints
,
ypoints
,
npoints
));
}
public
synchronized
void
fillRect
(
SunGraphics2D
sg2d
,
int
x
,
int
y
,
int
width
,
int
height
)
{
SunToolkit
.
awtLock
();
try
{
validateSurface
(
sg2d
);
public
void
fillRect
(
SunGraphics2D
sg2d
,
int
x
,
int
y
,
int
width
,
int
height
)
{
x
=
Region
.
clipAdd
(
x
,
sg2d
.
transX
);
y
=
Region
.
clipAdd
(
y
,
sg2d
.
transY
);
XRSurfaceData
xrsd
=
(
XRSurfaceData
)
sg2d
.
surfaceData
;
/*
* Limit x/y to signed short, width/height to unsigned short,
* to match the X11 coordinate limits for rectangles.
* Correct width/height in case x/y have been modified by clipping.
*/
if
(
x
>
Short
.
MAX_VALUE
||
y
>
Short
.
MAX_VALUE
)
{
return
;
}
x
+=
sg2d
.
transform
.
getTranslateX
(
);
y
+=
sg2d
.
transform
.
getTranslateY
(
);
int
x2
=
Region
.
dimAdd
(
x
,
width
);
int
y2
=
Region
.
dimAdd
(
y
,
height
);
tileManager
.
addRect
(
x
,
y
,
width
,
height
);
tileManager
.
fillMask
(
xrsd
);
if
(
x2
<
Short
.
MIN_VALUE
||
y2
<
Short
.
MIN_VALUE
)
{
return
;
}
x
=
clampToShort
(
x
);
y
=
clampToShort
(
y
);
width
=
clampToUShort
(
x2
-
x
);
height
=
clampToUShort
(
y2
-
y
);
if
(
width
==
0
||
height
==
0
)
{
return
;
}
SunToolkit
.
awtLock
();
try
{
validateSurface
(
sg2d
);
tileManager
.
addRect
(
x
,
y
,
width
,
height
);
tileManager
.
fillMask
((
XRSurfaceData
)
sg2d
.
surfaceData
);
}
finally
{
SunToolkit
.
awtUnlock
();
}
...
...
src/solaris/classes/sun/java2d/xr/XRUtils.java
浏览文件 @
07653a70
...
...
@@ -255,7 +255,7 @@ public class XRUtils {
:
(
x
<
Short
.
MIN_VALUE
?
Short
.
MIN_VALUE
:
x
));
}
public
static
shor
t
clampToUShort
(
int
x
)
{
return
(
short
)
(
x
>
65535
?
65535
:
(
x
<
0
)
?
0
:
x
);
public
static
in
t
clampToUShort
(
int
x
)
{
return
(
x
>
65535
?
65535
:
(
x
<
0
)
?
0
:
x
);
}
}
src/solaris/native/java/lang/java_props_macosx.c
浏览文件 @
07653a70
...
...
@@ -145,27 +145,22 @@ PreferredToolkit getPreferredToolkit() {
return
pref
=
HToolkit
;
}
void
setUnknownOSAndVersion
(
java_props_t
*
sprops
)
{
sprops
->
os_name
=
strdup
(
"Unknown"
);
sprops
->
os_version
=
strdup
(
"Unknown"
);
}
void
setOSNameAndVersion
(
java_props_t
*
sprops
)
{
void
*
jrsFwk
=
getJRSFramework
();
if
(
jrsFwk
==
NULL
)
{
setUnknownOSAndVersion
(
sprops
);
return
;
}
/* Don't rely on JRSCopyOSName because there's no guarantee the value will
* remain the same, or even if the JRS functions will continue to be part of
* Mac OS X. So hardcode os_name, and fill in os_version if we can.
*/
sprops
->
os_name
=
strdup
(
"Mac OS X"
);
char
*
(
*
copyOSName
)()
=
dlsym
(
jrsFwk
,
"JRSCopyOSName"
);
char
*
(
*
copyOSVersion
)()
=
dlsym
(
jrsFwk
,
"JRSCopyOSVersion"
);
if
(
copyOSName
==
NULL
||
copyOSVersion
==
NULL
)
{
setUnknownOSAndVersion
(
sprops
);
return
;
void
*
jrsFwk
=
getJRSFramework
();
if
(
jrsFwk
!=
NULL
)
{
char
*
(
*
copyOSVersion
)()
=
dlsym
(
jrsFwk
,
"JRSCopyOSVersion"
);
if
(
copyOSVersion
!=
NULL
)
{
sprops
->
os_version
=
copyOSVersion
();
return
;
}
}
sprops
->
os_name
=
copyOSName
();
sprops
->
os_version
=
copyOSVersion
();
sprops
->
os_version
=
strdup
(
"Unknown"
);
}
...
...
src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
浏览文件 @
07653a70
...
...
@@ -25,7 +25,12 @@
package
sun.util.locale.provider
;
import
java.lang.ref.SoftReference
;
import
java.text.*
;
import
java.text.DateFormat
;
import
java.text.DateFormatSymbols
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.text.NumberFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.spi.DateFormatProvider
;
import
java.text.spi.DateFormatSymbolsProvider
;
import
java.text.spi.DecimalFormatSymbolsProvider
;
...
...
@@ -34,12 +39,13 @@ import java.util.Collections;
import
java.util.HashSet
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Set
;
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.CalendarNameProvider
;
/**
* LocaleProviderdapter implementation for the Windows locale data.
...
...
@@ -88,7 +94,7 @@ public class HostLocaleProviderAdapterImpl {
private
static
final
Set
<
Locale
>
supportedLocaleSet
;
static
{
Set
<
Locale
>
tmpSet
=
new
HashSet
<
Locale
>();
Set
<
Locale
>
tmpSet
=
new
HashSet
<>();
if
(
initialize
())
{
// Assuming the default locales do not include any extensions, so
// no stripping is needed here.
...
...
@@ -258,7 +264,7 @@ public class HostLocaleProviderAdapterImpl {
if
(
ref
==
null
||
(
patterns
=
ref
.
get
())
==
null
)
{
String
langtag
=
locale
.
toLanguageTag
();
patterns
=
new
AtomicReferenceArray
<
String
>(
NF_MAX
+
1
);
patterns
=
new
AtomicReferenceArray
<>(
NF_MAX
+
1
);
for
(
int
i
=
0
;
i
<=
NF_MAX
;
i
++)
{
patterns
.
compareAndSet
(
i
,
null
,
getNumberPattern
(
i
,
langtag
));
}
...
...
@@ -329,18 +335,6 @@ public class HostLocaleProviderAdapterImpl {
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
)
{
int
first
=
getCalendarDataValue
(
...
...
@@ -360,6 +354,32 @@ public class HostLocaleProviderAdapterImpl {
};
}
public
static
CalendarNameProvider
getCalendarNameProvider
()
{
return
new
CalendarNameProvider
()
{
@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
;
}
};
}
private
static
String
convertDateTimePattern
(
String
winPattern
)
{
String
ret
=
winPattern
.
replaceAll
(
"dddd"
,
"EEEE"
);
ret
=
ret
.
replaceAll
(
"ddd"
,
"EEE"
);
...
...
test/ProblemList.txt
浏览文件 @
07653a70
...
...
@@ -148,9 +148,6 @@ java/lang/management/MemoryMXBean/LowMemoryTest2.sh generic-all
# 6959636
javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all
# 7144846
javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
# 7120365
javax/management/remote/mandatory/notif/DiffHBTest.java generic-all
...
...
@@ -376,6 +373,9 @@ java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all
# Filed 6772009
java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
# 8003596
java/util/logging/CheckLockLocationTest.java windows-all
# 7041639, Solaris DSA keypair generation bug
java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all
...
...
test/TEST.ROOT
浏览文件 @
07653a70
...
...
@@ -9,4 +9,4 @@ keys=2d dnd i18n
othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi/Naming
sun/management/jmxremote sun/tools/jstatd
exclusiveAccess.dirs=java/rmi/Naming
java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
test/java/lang/HashCode.java
浏览文件 @
07653a70
...
...
@@ -23,18 +23,20 @@
/*
* @test
* @bug 4245470
* @bug 4245470
7088913
* @summary Test the primitive wrappers hashCode()
*/
import
java.util.Objects
;
import
java.util.Random
;
public
class
HashCode
{
final
Random
rnd
=
new
Random
();
void
test
(
String
args
[])
throws
Exception
{
int
[]
ints
=
{
void
testOrdinals
(
String
args
[])
throws
Exception
{
long
[]
longs
=
{
Long
.
MIN_VALUE
,
Integer
.
MIN_VALUE
,
Short
.
MIN_VALUE
,
Character
.
MIN_VALUE
,
...
...
@@ -44,20 +46,73 @@ public class HashCode {
Character
.
MAX_VALUE
,
Short
.
MAX_VALUE
,
Integer
.
MAX_VALUE
,
Long
.
MAX_VALUE
,
rnd
.
nextInt
(),
};
for
(
int
x
:
int
s
)
{
for
(
long
x
:
long
s
)
{
check
(
new
Long
(
x
).
hashCode
()
==
(
int
)((
long
)
x
^
(
long
)
x
>>>
32
));
check
(
Long
.
valueOf
(
x
).
hashCode
()
==
(
int
)((
long
)
x
^
(
long
)
x
>>>
32
));
check
(
new
Integer
(
x
).
hashCode
()
==
x
);
check
(
Integer
.
valueOf
(
x
).
hashCode
()
==
x
);
check
(
(
new
Long
(
x
)).
hashCode
()
==
Long
.
hashCode
(
x
));
check
(
new
Integer
((
int
)
x
).
hashCode
()
==
(
int
)
x
);
check
(
Integer
.
valueOf
((
int
)
x
).
hashCode
()
==
(
int
)
x
);
check
(
(
new
Integer
((
int
)
x
)).
hashCode
()
==
Integer
.
hashCode
((
int
)
x
));
check
(
new
Short
((
short
)
x
).
hashCode
()
==
(
short
)
x
);
check
(
Short
.
valueOf
((
short
)
x
).
hashCode
()
==
(
short
)
x
);
check
(
(
new
Short
((
short
)
x
)).
hashCode
()
==
Short
.
hashCode
((
short
)
x
));
check
(
new
Character
((
char
)
x
).
hashCode
()
==
(
char
)
x
);
check
(
Character
.
valueOf
((
char
)
x
).
hashCode
()
==
(
char
)
x
);
check
(
(
new
Character
((
char
)
x
)).
hashCode
()
==
Character
.
hashCode
((
char
)
x
));
check
(
new
Byte
((
byte
)
x
).
hashCode
()
==
(
byte
)
x
);
check
(
Byte
.
valueOf
((
byte
)
x
).
hashCode
()
==
(
byte
)
x
);
check
(
(
new
Byte
((
byte
)
x
)).
hashCode
()
==
Byte
.
hashCode
((
byte
)
x
));
}
}
void
testBoolean
()
{
check
(
Boolean
.
FALSE
.
hashCode
()
==
1237
);
check
(
Boolean
.
TRUE
.
hashCode
()
==
1231
);
check
(
Boolean
.
valueOf
(
false
).
hashCode
()
==
1237
);
check
(
Boolean
.
valueOf
(
true
).
hashCode
()
==
1231
);
check
(
(
new
Boolean
(
false
)).
hashCode
()
==
1237
);
check
(
(
new
Boolean
(
true
)).
hashCode
()
==
1231
);
check
(
Boolean
.
hashCode
(
false
)
==
1237
);
check
(
Boolean
.
hashCode
(
true
)
==
1231
);
}
void
testFloat
()
{
float
[]
floats
=
{
Float
.
NaN
,
Float
.
NEGATIVE_INFINITY
,
-
1
f
,
0
f
,
1
f
,
Float
.
POSITIVE_INFINITY
};
for
(
float
f
:
floats
)
{
check
(
Float
.
hashCode
(
f
)
==
Float
.
floatToIntBits
(
f
));
check
(
Float
.
valueOf
(
f
).
hashCode
()
==
Float
.
floatToIntBits
(
f
));
check
(
(
new
Float
(
f
)).
hashCode
()
==
Float
.
floatToIntBits
(
f
));
}
}
void
testDouble
()
{
double
[]
doubles
=
{
Double
.
NaN
,
Double
.
NEGATIVE_INFINITY
,
-
1
f
,
0
f
,
1
f
,
Double
.
POSITIVE_INFINITY
};
for
(
double
d
:
doubles
)
{
long
bits
=
Double
.
doubleToLongBits
(
d
);
int
bitsHash
=
(
int
)(
bits
^(
bits
>>>
32
));
check
(
Double
.
hashCode
(
d
)
==
bitsHash
);
check
(
Double
.
valueOf
(
d
).
hashCode
()
==
bitsHash
);
check
(
(
new
Double
(
d
)).
hashCode
()
==
bitsHash
);
}
}
...
...
@@ -69,12 +124,16 @@ public class HashCode {
void
unexpected
(
Throwable
t
)
{
failed
++;
t
.
printStackTrace
();}
void
check
(
boolean
cond
)
{
if
(
cond
)
pass
();
else
fail
();}
void
equal
(
Object
x
,
Object
y
)
{
if
(
x
==
null
?
y
==
null
:
x
.
equals
(
y
))
pass
();
if
(
Objects
.
equals
(
x
,
y
))
pass
();
else
fail
(
x
+
" not equal to "
+
y
);}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
new
HashCode
().
instanceMain
(
args
);}
public
void
instanceMain
(
String
[]
args
)
throws
Throwable
{
try
{
test
(
args
);}
catch
(
Throwable
t
)
{
unexpected
(
t
);}
try
{
testOrdinals
(
args
);
testBoolean
();
testFloat
();
testDouble
();
}
catch
(
Throwable
t
)
{
unexpected
(
t
);}
System
.
out
.
printf
(
"%nPassed = %d, failed = %d%n%n"
,
passed
,
failed
);
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
}
test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java
浏览文件 @
07653a70
...
...
@@ -36,6 +36,12 @@ public class Unbounded {
// number of concurrent completion handlers
static
final
int
CONCURRENCY_COUNT
=
256
;
// set to true if an I/O operation fails
static
volatile
boolean
failed
;
// set to true when the test is done
static
volatile
boolean
finished
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// all accepted connections are added to a queue
final
ArrayBlockingQueue
<
AsynchronousSocketChannel
>
queue
=
...
...
@@ -51,6 +57,10 @@ public class Unbounded {
listener
.
accept
((
Void
)
null
,
this
);
}
public
void
failed
(
Throwable
exc
,
Void
att
)
{
if
(!
finished
)
{
failed
=
true
;
System
.
err
.
println
(
"accept failed: "
+
exc
);
}
}
});
System
.
out
.
println
(
"Listener created."
);
...
...
@@ -94,6 +104,9 @@ public class Unbounded {
}
}
public
void
failed
(
Throwable
exc
,
AsynchronousSocketChannel
ch
)
{
failed
=
true
;
System
.
err
.
println
(
"read failed: "
+
exc
);
completed
(
0
,
ch
);
}
});
}
...
...
@@ -104,6 +117,7 @@ public class Unbounded {
while
(
remaining
>
0
)
{
AsynchronousSocketChannel
ch
=
queue
.
take
();
ch
.
write
(
ByteBuffer
.
wrap
(
"welcome"
.
getBytes
())).
get
();
ch
.
shutdownOutput
();
ch
.
close
();
remaining
--;
}
...
...
@@ -111,6 +125,11 @@ public class Unbounded {
// wait for all threads to reach the barrier
System
.
out
.
println
(
"Waiting for all threads to reach barrier"
);
barrier
.
await
();
// finish up
finished
=
true
;
listener
.
close
();
if
(
failed
)
throw
new
RuntimeException
(
"I/O operation failed, see log for details"
);
}
}
test/java/util/PluggableLocale/CalendarDataProviderTest.java
浏览文件 @
07653a70
...
...
@@ -36,17 +36,11 @@ import com.bar.CalendarDataProviderImpl;
*
* Test strategy:
* com.bar.CalendarDataProviderImpl supports only ja_JP_kids locale. It returns
* month names only in full-width digits, followed by "gatsu" in Hiragana if
* it's a long style, and also returns unusual week parameter values, WEDNESDAY
* - first day of week, 7 - minimal days in the first week. The standalone
* styles are used because DateFormatSymbols has precedence for the format
* styles.
* unusual week parameter values, WEDNESDAY - first day of week, 7 - minimal
* days in the first week.
*
* A Calendar instance created with ja_JP_kids should use the week parameters
* provided by com.bar.CalendarDataProviderImpl. Calendar.getDisplayName(s)
* should be called with kids to get the month names provided by
* com.bar.CalendarDataProviderImpl. Other display names should be the same as
* what a Calendar constructed with ja_JP returns.
* provided by com.bar.CalendarDataProviderImpl.
*/
public
class
CalendarDataProviderTest
{
...
...
@@ -62,45 +56,6 @@ public class CalendarDataProviderTest {
// check the week parameters
checkResult
(
"firstDayOfWeek"
,
kcal
.
getFirstDayOfWeek
(),
WEDNESDAY
);
checkResult
(
"minimalDaysInFirstWeek"
,
kcal
.
getMinimalDaysInFirstWeek
(),
7
);
// check month names and week day names
Map
<
String
,
Integer
>
mapAllStyles
=
new
HashMap
<>();
for
(
int
style
:
new
int
[]
{
SHORT_STANDALONE
,
LONG_STANDALONE
})
{
// Check month names provided by com.bar.CalendarDataProviderImpl
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
int
month
=
JANUARY
;
month
<=
DECEMBER
;
month
++)
{
kcal
.
set
(
DAY_OF_MONTH
,
1
);
kcal
.
set
(
MONTH
,
month
);
kcal
.
set
(
HOUR_OF_DAY
,
12
);
// avoid any standard-daylight transitions...
kcal
.
getTimeInMillis
();
String
name
=
kcal
.
getDisplayName
(
MONTH
,
style
,
kids
);
checkResult
(
"Month name"
,
name
,
CalendarDataProviderImpl
.
toMonthName
(
kcal
.
get
(
MONTH
)
+
1
,
style
));
// Builds the map with name to its integer value.
map
.
put
(
name
,
kcal
.
get
(
MONTH
));
}
checkResult
((
style
==
SHORT_STANDALONE
?
"Short"
:
"Long"
)
+
" month names map"
,
kcal
.
getDisplayNames
(
MONTH
,
style
,
kids
),
map
);
mapAllStyles
.
putAll
(
map
);
if
(
style
==
LONG_STANDALONE
)
{
checkResult
(
"Short and long month names map"
,
kcal
.
getDisplayNames
(
MONTH
,
ALL_STYLES
,
kids
),
mapAllStyles
);
}
// Check week names: kcal and jcal should return the same names and maps.
for
(
int
dow
=
SUNDAY
;
dow
<=
SATURDAY
;
dow
++)
{
kcal
.
set
(
DAY_OF_WEEK
,
dow
);
jcal
.
setTimeInMillis
(
kcal
.
getTimeInMillis
());
String
name
=
kcal
.
getDisplayName
(
DAY_OF_WEEK
,
style
,
kids
);
checkResult
(
"Day of week name"
,
name
,
jcal
.
getDisplayName
(
DAY_OF_WEEK
,
style
,
Locale
.
JAPAN
));
}
checkResult
(
"Short day of week names"
,
kcal
.
getDisplayNames
(
DAY_OF_WEEK
,
style
,
kids
),
jcal
.
getDisplayNames
(
DAY_OF_WEEK
,
style
,
Locale
.
JAPAN
));
}
}
private
<
T
>
void
checkResult
(
String
msg
,
T
got
,
T
expected
)
{
...
...
test/java/util/PluggableLocale/CalendarDataProviderTest.sh
浏览文件 @
07653a70
...
...
@@ -23,6 +23,6 @@
#!/bin/sh
#
# @test
# @bug 7058206
# @bug 705820
7 800098
6
# @summary CalendarDataProvider tests
# @run shell ExecTest.sh bar CalendarDataProviderTest true
test/java/util/PluggableLocale/CalendarNameProviderTest.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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.
*/
/*
*
*/
import
java.text.*
;
import
java.util.*
;
import
static
java
.
util
.
Calendar
.*;
import
sun.util.locale.provider.*
;
import
sun.util.resources.*
;
import
com.bar.CalendarNameProviderImpl
;
/**
* Test case for CalendarNameProvider.
*
* Test strategy:
* com.bar.CalendarNameProviderImpl supports only ja_JP_kids locale. It returns
* month names only in full-width digits, followed by "gatsu" in Hiragana if
* it's a long style. The standalone styles are used because DateFormatSymbols
* has precedence for the format styles.
*
* Calendar.getDisplayName(s) should be called with kids to get the month
* names provided by com.bar.CalendarNameProviderImpl. Other display names
* should be the same as what a Calendar constructed with ja_JP returns.
*/
public
class
CalendarNameProviderTest
{
public
static
void
main
(
String
[]
s
)
{
new
CalendarNameProviderTest
().
test
();
}
void
test
()
{
Locale
kids
=
new
Locale
(
"ja"
,
"JP"
,
"kids"
);
// test provider's supported locale
Calendar
kcal
=
Calendar
.
getInstance
(
kids
);
Calendar
jcal
=
Calendar
.
getInstance
(
Locale
.
JAPAN
);
// check month names and week day names
Map
<
String
,
Integer
>
mapAllStyles
=
new
HashMap
<>();
for
(
int
style
:
new
int
[]
{
SHORT_STANDALONE
,
LONG_STANDALONE
})
{
// Check month names provided by com.bar.CalendarNameProviderImpl
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
int
month
=
JANUARY
;
month
<=
DECEMBER
;
month
++)
{
kcal
.
set
(
DAY_OF_MONTH
,
1
);
kcal
.
set
(
MONTH
,
month
);
kcal
.
set
(
HOUR_OF_DAY
,
12
);
// avoid any standard-daylight transitions...
kcal
.
getTimeInMillis
();
String
name
=
kcal
.
getDisplayName
(
MONTH
,
style
,
kids
);
checkResult
(
"Month name"
,
name
,
CalendarNameProviderImpl
.
toMonthName
(
kcal
.
get
(
MONTH
)
+
1
,
style
));
// Builds the map with name to its integer value.
map
.
put
(
name
,
kcal
.
get
(
MONTH
));
}
checkResult
((
style
==
SHORT_STANDALONE
?
"Short"
:
"Long"
)
+
" month names map"
,
kcal
.
getDisplayNames
(
MONTH
,
style
,
kids
),
map
);
mapAllStyles
.
putAll
(
map
);
if
(
style
==
LONG_STANDALONE
)
{
checkResult
(
"Short and long month names map"
,
kcal
.
getDisplayNames
(
MONTH
,
ALL_STYLES
,
kids
),
mapAllStyles
);
}
// Check week names: kcal and jcal should return the same names and maps.
for
(
int
dow
=
SUNDAY
;
dow
<=
SATURDAY
;
dow
++)
{
kcal
.
set
(
DAY_OF_WEEK
,
dow
);
jcal
.
setTimeInMillis
(
kcal
.
getTimeInMillis
());
String
name
=
kcal
.
getDisplayName
(
DAY_OF_WEEK
,
style
,
kids
);
checkResult
(
"Day of week name"
,
name
,
jcal
.
getDisplayName
(
DAY_OF_WEEK
,
style
,
Locale
.
JAPAN
));
}
checkResult
(
"Short day of week names"
,
kcal
.
getDisplayNames
(
DAY_OF_WEEK
,
style
,
kids
),
jcal
.
getDisplayNames
(
DAY_OF_WEEK
,
style
,
Locale
.
JAPAN
));
}
}
private
<
T
>
void
checkResult
(
String
msg
,
T
got
,
T
expected
)
{
if
(!
expected
.
equals
(
got
))
{
String
s
=
String
.
format
(
"%s: got='%s', expected='%s'"
,
msg
,
got
,
expected
);
throw
new
RuntimeException
(
s
);
}
}
}
test/java/util/PluggableLocale/CalendarNameProviderTest.sh
0 → 100644
浏览文件 @
07653a70
#
# 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.
#
# 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.
#
# @test
# @bug 8000986
# @summary CalendarNameProvider tests
# @run shell ExecTest.sh bar CalendarNameProviderTest true
test/java/util/PluggableLocale/CurrencyNameProviderTest.sh
浏览文件 @
07653a70
...
...
@@ -23,6 +23,6 @@
#!/bin/sh
#
# @test
# @bug 4052440 8000997
# @bug 4052440
7199750
8000997
# @summary CurrencyNameProvider tests
# @run shell ExecTest.sh bar CurrencyNameProviderTest true
test/java/util/PluggableLocale/GenericTest.java
浏览文件 @
07653a70
...
...
@@ -42,6 +42,7 @@ public class GenericTest {
com
.
bar
.
LocaleNameProviderImpl
localeNP
=
new
com
.
bar
.
LocaleNameProviderImpl
();
com
.
bar
.
TimeZoneNameProviderImpl
tzNP
=
new
com
.
bar
.
TimeZoneNameProviderImpl
();
com
.
bar
.
CalendarDataProviderImpl
calDataP
=
new
com
.
bar
.
CalendarDataProviderImpl
();
com
.
bar
.
CalendarNameProviderImpl
calNameP
=
new
com
.
bar
.
CalendarNameProviderImpl
();
public
static
void
main
(
String
[]
s
)
{
new
GenericTest
();
...
...
@@ -73,6 +74,7 @@ public class GenericTest {
expected
.
addAll
(
Arrays
.
asList
(
localeNP
.
getAvailableLocales
()));
expected
.
addAll
(
Arrays
.
asList
(
tzNP
.
getAvailableLocales
()));
expected
.
addAll
(
Arrays
.
asList
(
calDataP
.
getAvailableLocales
()));
expected
.
addAll
(
Arrays
.
asList
(
calNameP
.
getAvailableLocales
()));
if
(!
result
.
equals
(
expected
))
{
throw
new
RuntimeException
(
"Locale.getAvailableLocales() does not return the union of locales: diff="
+
getDiff
(
result
,
expected
));
...
...
test/java/util/PluggableLocale/barprovider.jar
浏览文件 @
07653a70
无法预览此类型文件
test/java/util/PluggableLocale/fooprovider.jar
浏览文件 @
07653a70
无法预览此类型文件
test/java/util/PluggableLocale/providersrc/CalendarDataProviderImpl.java
浏览文件 @
07653a70
...
...
@@ -47,66 +47,8 @@ public class CalendarDataProviderImpl extends CalendarDataProvider {
return
7
;
}
@Override
public
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
if
(
calendarType
==
null
||
locale
==
null
)
{
throw
new
NullPointerException
();
}
if
(!
Utils
.
supportsLocale
(
Arrays
.
asList
(
avail
),
locale
))
{
throw
new
IllegalArgumentException
(
"locale is not one of available locales: "
+
locale
);
}
if
(
field
!=
MONTH
)
{
return
null
;
}
return
toMonthName
(
value
+
1
,
style
);
}
@Override
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
if
(
calendarType
==
null
||
locale
==
null
)
{
throw
new
NullPointerException
();
}
if
(!
Utils
.
supportsLocale
(
Arrays
.
asList
(
avail
),
locale
))
{
throw
new
IllegalArgumentException
(
"locale is not one of available locales: "
+
locale
);
}
if
(
field
!=
MONTH
)
{
return
null
;
}
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
style
==
LONG_STANDALONE
)
{
style
=
LONG
;
}
else
if
(
style
==
SHORT_STANDALONE
)
{
style
=
SHORT
;
}
for
(
int
month
=
JANUARY
;
month
<=
DECEMBER
;
month
++)
{
if
(
style
==
ALL_STYLES
||
style
==
LONG
)
{
map
.
put
(
toMonthName
(
month
+
1
,
LONG
),
month
);
}
if
(
style
==
ALL_STYLES
||
style
==
SHORT
)
{
map
.
put
(
toMonthName
(
month
+
1
,
SHORT
),
month
);
}
}
return
map
;
}
@Override
public
Locale
[]
getAvailableLocales
()
{
return
avail
.
clone
();
}
// month is 1-based.
public
static
String
toMonthName
(
int
month
,
int
style
)
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
month
>=
10
)
{
sb
.
append
((
char
)(
FULLWIDTH_ZERO
+
1
));
sb
.
appendCodePoint
((
char
)(
FULLWIDTH_ZERO
+
(
month
%
10
)));
}
else
{
sb
.
appendCodePoint
((
char
)(
FULLWIDTH_ZERO
+
month
));
}
if
(
style
==
SHORT
||
style
==
SHORT_STANDALONE
)
{
return
sb
.
toString
();
// full-width digit(s)
}
sb
.
append
(
"\u304c\u3064"
);
// + "gatsu" in Hiragana
return
sb
.
toString
();
}
}
test/java/util/PluggableLocale/providersrc/CalendarNameProviderImpl.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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
com.bar
;
import
com.foobar.Utils
;
import
java.util.Arrays
;
import
static
java
.
util
.
Calendar
.*;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.spi.CalendarNameProvider
;
public
class
CalendarNameProviderImpl
extends
CalendarNameProvider
{
static
final
char
FULLWIDTH_ZERO
=
'\uff10'
;
static
final
Locale
[]
avail
=
{
new
Locale
(
"ja"
,
"JP"
,
"kids"
),
};
@Override
public
String
getDisplayName
(
String
calendarType
,
int
field
,
int
value
,
int
style
,
Locale
locale
)
{
if
(
calendarType
==
null
||
locale
==
null
)
{
throw
new
NullPointerException
();
}
if
(!
Utils
.
supportsLocale
(
Arrays
.
asList
(
avail
),
locale
))
{
throw
new
IllegalArgumentException
(
"locale is not one of available locales: "
+
locale
);
}
if
(
field
!=
MONTH
)
{
return
null
;
}
return
toMonthName
(
value
+
1
,
style
);
}
@Override
public
Map
<
String
,
Integer
>
getDisplayNames
(
String
calendarType
,
int
field
,
int
style
,
Locale
locale
)
{
if
(
calendarType
==
null
||
locale
==
null
)
{
throw
new
NullPointerException
();
}
if
(!
Utils
.
supportsLocale
(
Arrays
.
asList
(
avail
),
locale
))
{
throw
new
IllegalArgumentException
(
"locale is not one of available locales: "
+
locale
);
}
if
(
field
!=
MONTH
)
{
return
null
;
}
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
style
==
LONG_STANDALONE
)
{
style
=
LONG
;
}
else
if
(
style
==
SHORT_STANDALONE
)
{
style
=
SHORT
;
}
for
(
int
month
=
JANUARY
;
month
<=
DECEMBER
;
month
++)
{
if
(
style
==
ALL_STYLES
||
style
==
LONG
)
{
map
.
put
(
toMonthName
(
month
+
1
,
LONG
),
month
);
}
if
(
style
==
ALL_STYLES
||
style
==
SHORT
)
{
map
.
put
(
toMonthName
(
month
+
1
,
SHORT
),
month
);
}
}
return
map
;
}
@Override
public
Locale
[]
getAvailableLocales
()
{
return
avail
.
clone
();
}
// month is 1-based.
public
static
String
toMonthName
(
int
month
,
int
style
)
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
month
>=
10
)
{
sb
.
append
((
char
)(
FULLWIDTH_ZERO
+
1
));
sb
.
appendCodePoint
((
char
)(
FULLWIDTH_ZERO
+
(
month
%
10
)));
}
else
{
sb
.
appendCodePoint
((
char
)(
FULLWIDTH_ZERO
+
month
));
}
if
(
style
==
SHORT
||
style
==
SHORT_STANDALONE
)
{
return
sb
.
toString
();
// full-width digit(s)
}
sb
.
append
(
"\u304c\u3064"
);
// + "gatsu" in Hiragana
return
sb
.
toString
();
}
}
test/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java
浏览文件 @
07653a70
...
...
@@ -32,7 +32,8 @@ import java.util.spi.*;
import
com.foobar.Utils
;
public
class
CurrencyNameProviderImpl2
extends
CurrencyNameProvider
{
static
Locale
[]
avail
=
{
new
Locale
(
"ja"
,
"JP"
,
"tokyo"
)};
static
Locale
[]
avail
=
{
new
Locale
(
"ja"
,
"JP"
,
"tokyo"
),
new
Locale
(
"ja"
,
"JP"
,
"osaka"
),
};
public
Locale
[]
getAvailableLocales
()
{
return
avail
;
}
...
...
@@ -43,8 +44,12 @@ public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
throw
new
IllegalArgumentException
(
"locale is not supported: "
+
locale
);
}
if
(
c
.
equals
(
"JPY"
)
&&
Utils
.
supportsLocale
(
avail
[
0
],
locale
))
{
return
"JPY-tokyo"
;
if
(
c
.
equals
(
"JPY"
))
{
if
(
Utils
.
supportsLocale
(
avail
[
0
],
locale
))
{
return
"JPY-tokyo"
;
}
else
if
(
Utils
.
supportsLocale
(
avail
[
1
],
locale
))
{
return
"JPY-osaka"
;
}
}
return
null
;
}
...
...
@@ -55,8 +60,12 @@ public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
throw
new
IllegalArgumentException
(
"locale is not supported: "
+
locale
);
}
if
(
c
.
equals
(
"JPY"
)
&&
Utils
.
supportsLocale
(
avail
[
0
],
locale
))
{
return
"JPY-tokyo"
;
if
(
c
.
equals
(
"JPY"
))
{
if
(
Utils
.
supportsLocale
(
avail
[
0
],
locale
))
{
return
"JPY-tokyo"
;
}
else
if
(
Utils
.
supportsLocale
(
avail
[
1
],
locale
))
{
return
"JPY-osaka"
;
}
}
return
null
;
}
...
...
test/java/util/PluggableLocale/providersrc/Makefile
浏览文件 @
07653a70
...
...
@@ -20,7 +20,8 @@ BARSERVICES = \
java.util.spi.CurrencyNameProvider
\
java.util.spi.TimeZoneNameProvider
\
java.util.spi.LocaleNameProvider
\
java.util.spi.CalendarDataProvider
java.util.spi.CalendarDataProvider
\
java.util.spi.CalendarNameProvider
FOOFILES_JAVA
=
\
BreakIteratorProviderImpl.java
\
...
...
@@ -39,6 +40,7 @@ BARFILES_JAVA = \
TimeZoneNameProviderImpl.java
\
LocaleNameProviderImpl.java
\
CalendarDataProviderImpl.java
\
CalendarNameProviderImpl.java
\
Utils.java
BARFILES_PROPERTIES
=
\
...
...
@@ -68,3 +70,8 @@ $(DESTDIR)/barprovider.jar: $(BARSERVICES) $(BARFILES_JAVA) $(BARFILES_PROPERTIE
cp
$(BARFILES_PROPERTIES)
$(BARDIR)
/com/bar
rm
-f
$(DESTDIR)
/barprovider.jar
$(BINDIR)
/jar cvf
$(DESTDIR)
/barprovider.jar
-C
$(BARDIR)
.
clean
:
rm
-rf
$(BARDIR)
$(FOODIR)
.PHONY
:
all clean
test/java/util/PluggableLocale/providersrc/java.util.spi.CalendarNameProvider
0 → 100644
浏览文件 @
07653a70
#
#
#
# fully-qualified name of the java.util.spi.CalendarNameProvider
# implementation class
#
com.bar.CalendarNameProviderImpl
test/java/util/logging/CheckLockLocationTest.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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.
*/
/*
* @test
* @bug 6244047
* @author Jim Gish
* @summary throw more precise IOException when pattern specifies invalid directory
*
* @run main/othervm CheckLockLocationTest
*/
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.AccessDeniedException
;
import
java.nio.file.FileSystemException
;
import
java.nio.file.NoSuchFileException
;
import
java.util.logging.FileHandler
;
public
class
CheckLockLocationTest
{
private
static
final
String
NON_WRITABLE_DIR
=
"non-writable-dir"
;
private
static
final
String
NOT_A_DIR
=
"not-a-dir"
;
private
static
final
String
WRITABLE_DIR
=
"writable-dir"
;
private
static
final
String
NON_EXISTENT_DIR
=
"non-existent-dir"
;
public
static
void
main
(
String
...
args
)
throws
IOException
{
// we'll base all file creation attempts on the system temp directory,
// %t and also try specifying non-existent directories and plain files
// that should be directories, and non-writable directories,
// to exercise all code paths of checking the lock location
File
writableDir
=
setup
();
// we now have three files/directories to work with:
// writableDir
// notAdir
// nonWritableDir
// nonExistentDir (which doesn't exist)
runTests
(
writableDir
);
}
/**
* @param writableDir in which log and lock file are created
* @throws SecurityException
* @throws RuntimeException
* @throws IOException
*/
private
static
void
runTests
(
File
writableDir
)
throws
SecurityException
,
RuntimeException
,
IOException
{
// Test 1: make sure we can create FileHandler in writable directory
try
{
new
FileHandler
(
"%t/"
+
WRITABLE_DIR
+
"/log.log"
);
}
catch
(
IOException
ex
)
{
throw
new
RuntimeException
(
"Test failed: should have been able"
+
" to create FileHandler for "
+
"%t/"
+
WRITABLE_DIR
+
"/log.log in writable directory."
,
ex
);
}
finally
{
// the above test leaves files in the directory. Get rid of the
// files created and the directory
delete
(
writableDir
);
}
// Test 2: creating FileHandler in non-writable directory should fail
try
{
new
FileHandler
(
"%t/"
+
NON_WRITABLE_DIR
+
"/log.log"
);
throw
new
RuntimeException
(
"Test failed: should not have been able"
+
" to create FileHandler for "
+
"%t/"
+
NON_WRITABLE_DIR
+
"/log.log in non-writable directory."
);
}
catch
(
IOException
ex
)
{
// check for the right exception
if
(!(
ex
instanceof
AccessDeniedException
))
{
throw
new
RuntimeException
(
"Test failed: Expected exception was not an AccessDeniedException"
,
ex
);
}
}
// Test 3: creating FileHandler in non-directory should fail
try
{
new
FileHandler
(
"%t/"
+
NOT_A_DIR
+
"/log.log"
);
throw
new
RuntimeException
(
"Test failed: should not have been able"
+
" to create FileHandler for "
+
"%t/"
+
NOT_A_DIR
+
"/log.log in non-directory."
);
}
catch
(
IOException
ex
)
{
// check for the right exception
if
(!(
ex
instanceof
FileSystemException
&&
ex
.
getMessage
().
contains
(
"Not a directory"
)))
{
throw
new
RuntimeException
(
"Test failed: Expected exception was not a FileSystemException"
,
ex
);
}
}
// Test 4: make sure we can't create a FileHandler in a non-existent dir
try
{
new
FileHandler
(
"%t/"
+
NON_EXISTENT_DIR
+
"/log.log"
);
throw
new
RuntimeException
(
"Test failed: should not have been able"
+
" to create FileHandler for "
+
"%t/"
+
NON_EXISTENT_DIR
+
"/log.log in a non-existent directory."
);
}
catch
(
IOException
ex
)
{
// check for the right exception
if
(!(
ex
instanceof
NoSuchFileException
))
{
throw
new
RuntimeException
(
"Test failed: Expected exception was not a NoSuchFileException"
,
ex
);
}
}
}
/**
* Setup all the files and directories needed for the tests
*
* @return writable directory created that needs to be deleted when done
* @throws RuntimeException
*/
private
static
File
setup
()
throws
RuntimeException
{
// First do some setup in the temporary directory (using same logic as
// FileHandler for %t pattern)
String
tmpDir
=
System
.
getProperty
(
"java.io.tmpdir"
);
// i.e. %t
if
(
tmpDir
==
null
)
{
tmpDir
=
System
.
getProperty
(
"user.home"
);
}
File
tmpOrHomeDir
=
new
File
(
tmpDir
);
// Create a writable directory here (%t/writable-dir)
File
writableDir
=
new
File
(
tmpOrHomeDir
,
WRITABLE_DIR
);
if
(!
createFile
(
writableDir
,
true
))
{
throw
new
RuntimeException
(
"Test setup failed: unable to create"
+
" writable working directory "
+
writableDir
.
getAbsolutePath
()
);
}
// writableDirectory and its contents will be deleted after the test
// that uses it
// Create a plain file which we will attempt to use as a directory
// (%t/not-a-dir)
File
notAdir
=
new
File
(
tmpOrHomeDir
,
NOT_A_DIR
);
if
(!
createFile
(
notAdir
,
false
))
{
throw
new
RuntimeException
(
"Test setup failed: unable to a plain"
+
" working file "
+
notAdir
.
getAbsolutePath
()
);
}
notAdir
.
deleteOnExit
();
// Create a non-writable directory (%t/non-writable-dir)
File
nonWritableDir
=
new
File
(
tmpOrHomeDir
,
NON_WRITABLE_DIR
);
if
(!
createFile
(
nonWritableDir
,
true
))
{
throw
new
RuntimeException
(
"Test setup failed: unable to create"
+
" a non-"
+
"writable working directory "
+
nonWritableDir
.
getAbsolutePath
()
);
}
nonWritableDir
.
deleteOnExit
();
// make it non-writable
if
(!
nonWritableDir
.
setWritable
(
false
))
{
throw
new
RuntimeException
(
"Test setup failed: unable to make"
+
" working directory "
+
nonWritableDir
.
getAbsolutePath
()
+
" non-writable."
);
}
// make sure non-existent directory really doesn't exist
File
nonExistentDir
=
new
File
(
tmpOrHomeDir
,
NON_EXISTENT_DIR
);
if
(
nonExistentDir
.
exists
())
{
nonExistentDir
.
delete
();
}
return
writableDir
;
}
/**
* @param newFile
* @return true if file already exists or creation succeeded
*/
private
static
boolean
createFile
(
File
newFile
,
boolean
makeDirectory
)
{
if
(
newFile
.
exists
())
{
return
true
;
}
if
(
makeDirectory
)
{
return
newFile
.
mkdir
();
}
else
{
try
{
return
newFile
.
createNewFile
();
}
catch
(
IOException
ioex
)
{
ioex
.
printStackTrace
();
return
false
;
}
}
}
/*
* Recursively delete all files starting at specified file
*/
private
static
void
delete
(
File
f
)
throws
IOException
{
if
(
f
!=
null
&&
f
.
isDirectory
())
{
for
(
File
c
:
f
.
listFiles
())
delete
(
c
);
}
if
(!
f
.
delete
())
throw
new
FileNotFoundException
(
"Failed to delete file: "
+
f
);
}
}
test/sun/security/krb5/config/DNS.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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.
*/
// See dns.sh.
import
sun.security.krb5.Config
;
public
class
DNS
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
setProperty
(
"java.security.krb5.conf"
,
System
.
getProperty
(
"test.src"
,
"."
)
+
"/nothing.conf"
);
Config
config
=
Config
.
getInstance
();
String
kdcs
=
config
.
getKDCList
(
"X"
);
if
(!
kdcs
.
equals
(
"a.com.:88 b.com.:99"
)
&&
!
kdcs
.
equals
(
"a.com. b.com.:99"
))
{
throw
new
Exception
(
"Strange KDC: ["
+
kdcs
+
"]"
);
};
}
}
test/sun/security/krb5/config/NamingManager.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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
javax.naming.spi
;
import
com.sun.jndi.dns.DnsContext
;
import
java.util.Hashtable
;
import
javax.naming.Context
;
import
javax.naming.NamingException
;
import
javax.naming.directory.Attribute
;
import
javax.naming.directory.Attributes
;
import
javax.naming.directory.BasicAttribute
;
import
javax.naming.directory.BasicAttributes
;
/**
* A fake javax.naming.spi.NamingManager. It allows reading a DNS
* record without contacting a real server.
*
* See DNS.java and dns.sh.
*/
public
class
NamingManager
{
NamingManager
()
{}
public
static
Context
getURLContext
(
String
scheme
,
Hashtable
<?,?>
environment
)
throws
NamingException
{
return
new
DnsContext
(
""
,
null
,
new
Hashtable
<
String
,
String
>())
{
public
Attributes
getAttributes
(
String
name
,
String
[]
attrIds
)
throws
NamingException
{
return
new
BasicAttributes
()
{
public
Attribute
get
(
String
attrID
)
{
BasicAttribute
ba
=
new
BasicAttribute
(
attrID
);
ba
.
add
(
"1 1 99 b.com."
);
ba
.
add
(
"0 0 88 a.com."
);
// 2nd has higher priority
return
ba
;
}
};
}
};
}
}
test/sun/security/krb5/config/dns.sh
0 → 100644
浏览文件 @
07653a70
#
# 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.
#
# 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.
#
# @test
# @bug 8002344
# @summary Krb5LoginModule config class does not return proper KDC list from DNS
#
if
[
"
${
TESTJAVA
}
"
=
""
]
;
then
JAVAC_CMD
=
`
which javac
`
TESTJAVA
=
`
dirname
$JAVAC_CMD
`
/..
fi
if
[
"
${
TESTSRC
}
"
=
""
]
;
then
TESTSRC
=
"."
fi
$TESTJAVA
/bin/javac
-d
.
\
${
TESTSRC
}
/NamingManager.java
${
TESTSRC
}
/DNS.java
$TESTJAVA
/bin/java
-Xbootclasspath
/p:. DNS
test/tools/jar/JarBackSlash.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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.
*/
/*
* Portions Copyright (c) 2012 IBM Corporation
*/
/*
* @test
* @bug 7201156
* @summary jar tool fails to convert file separation characters for list and extract
* @author Sean Chou
*/
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.PipedInputStream
;
import
java.io.PipedOutputStream
;
import
java.io.PrintStream
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarOutputStream
;
import
sun.tools.jar.Main
;
public
class
JarBackSlash
{
// used construct an entry JarBackSlash/dir/file.txt
private
static
String
JARBACKSLASH
=
"JarBackSlash"
;
private
static
String
DIR
=
"dir"
;
private
static
String
FILENAME
=
"file.txt"
;
private
static
File
createJarFile
()
throws
IOException
{
File
jarFile
=
File
.
createTempFile
(
"JarBackSlashTest"
,
".jar"
);
jarFile
.
deleteOnExit
();
try
(
JarOutputStream
output
=
new
JarOutputStream
(
new
FileOutputStream
(
jarFile
)))
{
JarEntry
entry
=
new
JarEntry
(
JARBACKSLASH
+
"/"
+
DIR
+
"/"
+
FILENAME
);
output
.
putNextEntry
(
entry
);
}
return
jarFile
;
}
private
static
void
testJarList
(
String
jarFile
)
throws
IOException
{
List
<
String
>
argList
=
new
ArrayList
<
String
>();
argList
.
add
(
"-tvf"
);
argList
.
add
(
jarFile
);
argList
.
add
(
JARBACKSLASH
+
File
.
separatorChar
+
DIR
+
File
.
separatorChar
+
FILENAME
);
String
jarArgs
[]
=
new
String
[
argList
.
size
()];
jarArgs
=
argList
.
toArray
(
jarArgs
);
PipedOutputStream
pipedOutput
=
new
PipedOutputStream
();
PipedInputStream
pipedInput
=
new
PipedInputStream
(
pipedOutput
);
PrintStream
out
=
new
PrintStream
(
pipedOutput
);
Main
jarTool
=
new
Main
(
out
,
System
.
err
,
"jar"
);
if
(!
jarTool
.
run
(
jarArgs
))
{
fail
(
"Could not list jar file."
);
}
out
.
flush
();
check
(
pipedInput
.
available
()
>
0
);
}
private
static
void
testJarExtract
(
String
jarFile
)
throws
IOException
{
List
<
String
>
argList
=
new
ArrayList
<
String
>();
argList
.
add
(
"-xvf"
);
argList
.
add
(
jarFile
);
argList
.
add
(
JARBACKSLASH
+
File
.
separatorChar
+
DIR
+
File
.
separatorChar
+
FILENAME
);
String
jarArgs
[]
=
new
String
[
argList
.
size
()];
jarArgs
=
argList
.
toArray
(
jarArgs
);
PipedOutputStream
pipedOutput
=
new
PipedOutputStream
();
PipedInputStream
pipedInput
=
new
PipedInputStream
(
pipedOutput
);
PrintStream
out
=
new
PrintStream
(
pipedOutput
);
Main
jarTool
=
new
Main
(
out
,
System
.
err
,
"jar"
);
if
(!
jarTool
.
run
(
jarArgs
))
{
fail
(
"Could not list jar file."
);
}
out
.
flush
();
check
(
pipedInput
.
available
()
>
0
);
}
public
static
void
realMain
(
String
[]
args
)
throws
Throwable
{
File
tmpJarFile
=
createJarFile
();
String
tmpJarFilePath
=
tmpJarFile
.
getAbsolutePath
();
testJarList
(
tmpJarFilePath
);
testJarExtract
(
tmpJarFilePath
);
}
//--------------------- Infrastructure ---------------------------
static
volatile
int
passed
=
0
,
failed
=
0
;
static
void
pass
()
{
passed
++;}
static
void
fail
()
{
failed
++;
Thread
.
dumpStack
();}
static
void
fail
(
String
msg
)
{
System
.
out
.
println
(
msg
);
fail
();}
static
void
unexpected
(
Throwable
t
)
{
failed
++;
t
.
printStackTrace
();}
static
void
check
(
boolean
cond
)
{
if
(
cond
)
pass
();
else
fail
();}
static
void
equal
(
Object
x
,
Object
y
)
{
if
(
x
==
null
?
y
==
null
:
x
.
equals
(
y
))
pass
();
else
fail
(
x
+
" not equal to "
+
y
);}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
try
{
realMain
(
args
);}
catch
(
Throwable
t
)
{
unexpected
(
t
);}
System
.
out
.
println
(
"\nPassed = "
+
passed
+
" failed = "
+
failed
);
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
}
test/tools/launcher/FXLauncherTest.java
0 → 100644
浏览文件 @
07653a70
/*
* 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.
*
* 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.
*/
/*
* @test
* @bug 8001533
* @summary Test launching FX application with java -jar
* Test uses main method and blank main method, a jfx app class and an incorrest
* jfx app class, a main-class for the manifest, a bogus one and none.
* All should execute except the incorrect fx app class entries.
* @run main FXLauncherTest
*/
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FXLauncherTest
extends
TestHelper
{
private
static
final
String
FX_MARKER_CLASS
=
"javafx.application.Application"
;
private
static
void
line
()
{
System
.
out
.
println
(
"_____________________________________________"
);
}
private
static
File
MainJavaFile
=
null
;
private
static
final
File
FXtestJar
=
new
File
(
"fxtest.jar"
);
private
static
final
File
ManifestFile
=
new
File
(
"manifest.txt"
);
private
static
final
File
ScratchDir
=
new
File
(
"."
);
/* standard main class can be used as java main for fx app class */
static
final
String
StdMainClass
=
"helloworld.HelloWorld"
;
static
int
testcount
=
0
;
/* a main method and a blank. */
static
final
String
[]
MAIN_METHODS
=
{
"public static void main(String[] args) { launch(args); }"
,
" "
};
// Array of parameters to pass to fx application.
static
final
String
[]
APP_PARMS
=
{
"one"
,
"two"
};
// Create fx java file for test application
static
void
createJavaFile
(
String
mainmethod
)
{
try
{
String
mainClass
=
"HelloWorld"
;
List
<
String
>
contents
=
new
ArrayList
<>();
contents
.
add
(
"package helloworld;"
);
contents
.
add
(
"import javafx.application.Application;"
);
contents
.
add
(
"import javafx.event.ActionEvent;"
);
contents
.
add
(
"import javafx.event.EventHandler;"
);
contents
.
add
(
"import javafx.scene.Scene;"
);
contents
.
add
(
"import javafx.scene.control.Button;"
);
contents
.
add
(
"import javafx.scene.layout.StackPane;"
);
contents
.
add
(
"import javafx.stage.Stage;"
);
contents
.
add
(
"public class HelloWorld extends Application {"
);
contents
.
add
(
mainmethod
);
contents
.
add
(
"@Override"
);
contents
.
add
(
"public void start(Stage primaryStage) {"
);
contents
.
add
(
" primaryStage.setTitle(\"Hello World!\");"
);
contents
.
add
(
" Button btn = new Button();"
);
contents
.
add
(
" btn.setText(\"Say 'Hello World'\");"
);
contents
.
add
(
" btn.setOnAction(new EventHandler<ActionEvent>() {"
);
contents
.
add
(
" @Override"
);
contents
.
add
(
" public void handle(ActionEvent event) {"
);
contents
.
add
(
" System.out.println(\"Hello World!\");"
);
contents
.
add
(
" }"
);
contents
.
add
(
" });"
);
contents
.
add
(
" StackPane root = new StackPane();"
);
contents
.
add
(
" root.getChildren().add(btn);"
);
contents
.
add
(
" primaryStage.setScene(new Scene(root, 300, 250));"
);
contents
.
add
(
"// primaryStage.show(); no GUI for auto tests. "
);
contents
.
add
(
" System.out.println(\"HelloWorld.primaryStage.show();\");"
);
contents
.
add
(
" System.out.println(\"Parameters:\");"
);
contents
.
add
(
" for(String p : getParameters().getUnnamed())"
);
contents
.
add
(
" System.out.println(\"parameter: \" + p );"
);
contents
.
add
(
" System.exit(0);"
);
contents
.
add
(
"}"
);
contents
.
add
(
"}"
);
// Create and compile java source.
MainJavaFile
=
new
File
(
mainClass
+
JAVA_FILE_EXT
);
createFile
(
MainJavaFile
,
contents
);
compile
(
"-d"
,
"."
,
mainClass
+
JAVA_FILE_EXT
);
}
catch
(
java
.
io
.
IOException
ioe
)
{
ioe
.
printStackTrace
();
throw
new
RuntimeException
(
"Failed creating HelloWorld."
);
}
}
/*
* Create class to extend fx java file for test application
* TODO: make test to create java file and this extension of the java file
* and jar them together an run app via this java class.
*/
static
void
createExtJavaFile
(
String
mainmethod
)
{
try
{
String
mainClass
=
"ExtHello"
;
List
<
String
>
contents
=
new
ArrayList
<>();
contents
.
add
(
"package helloworld;"
);
contents
.
add
(
"public class ExtHello extends HelloWorld {"
);
contents
.
add
(
mainmethod
);
contents
.
add
(
"}"
);
// Create and compile java source.
MainJavaFile
=
new
File
(
mainClass
+
JAVA_FILE_EXT
);
createFile
(
MainJavaFile
,
contents
);
compile
(
"-cp"
,
"."
,
"-d"
,
"."
,
mainClass
+
JAVA_FILE_EXT
);
}
catch
(
java
.
io
.
IOException
ioe
)
{
ioe
.
printStackTrace
();
throw
new
RuntimeException
(
"Failed creating HelloWorld."
);
}
}
// Create manifest for test fx application
static
List
<
String
>
createManifestContents
(
String
mainclassentry
)
{
List
<
String
>
mcontents
=
new
ArrayList
<>();
mcontents
.
add
(
"Manifest-Version: 1.0"
);
mcontents
.
add
(
"Created-By: FXLauncherTest"
);
mcontents
.
add
(
"Main-Class: "
+
mainclassentry
);
return
mcontents
;
}
// Method to marshal createJar to TestHelper.createJar()
static
void
createJar
(
File
theJar
,
File
manifestFile
)
{
createJar
(
"cvmf"
,
manifestFile
.
getName
(),
theJar
.
getAbsolutePath
(),
"helloworld"
);
}
static
void
saveFile
(
String
tname
,
int
testcount
,
File
srcFile
)
{
File
newFile
=
new
File
(
tname
+
"-"
+
testcount
+
"-"
+
srcFile
.
getName
());
System
.
out
.
println
(
"renaming "
+
srcFile
.
getName
()
+
" to "
+
newFile
.
getName
());
srcFile
.
renameTo
(
newFile
);
}
static
void
cleanupFiles
()
throws
IOException
{
for
(
File
f
:
ScratchDir
.
listFiles
())
{
recursiveDelete
(
f
);
}
}
static
void
checkStatus
(
TestResult
tr
,
String
testName
,
int
testCount
,
String
mainclass
)
throws
Exception
{
if
(
tr
.
testStatus
)
{
System
.
out
.
println
(
"PASS: "
+
testName
+
":"
+
testCount
+
" : test with "
+
mainclass
);
cleanupFiles
();
}
else
{
saveFile
(
testName
,
testcount
,
FXtestJar
);
System
.
out
.
println
(
"FAIL: "
+
testName
+
":"
+
testCount
+
" : test with "
+
mainclass
);
cleanupFiles
();
System
.
err
.
println
(
tr
);
throw
new
Exception
(
"Failed: "
+
testName
+
":"
+
testCount
);
}
}
/*
* Set Main-Class and iterate main_methods.
* Try launching with both -jar and -cp methods.
* All cases should run.
*/
@Test
static
void
testBasicFXApp
()
throws
Exception
{
testBasicFXApp
(
true
);
testBasicFXApp
(
false
);
}
static
void
testBasicFXApp
(
boolean
useCP
)
throws
Exception
{
String
testname
=
"testBasicFXApp"
;
for
(
String
mm
:
MAIN_METHODS
)
{
testcount
++;
line
();
System
.
out
.
println
(
"test# "
+
testcount
+
"- Main method: "
+
mm
+
"; MF main class: "
+
StdMainClass
);
createJavaFile
(
mm
);
createFile
(
ManifestFile
,
createManifestContents
(
StdMainClass
));
createJar
(
FXtestJar
,
ManifestFile
);
String
sTestJar
=
FXtestJar
.
getAbsolutePath
();
TestResult
tr
;
if
(
useCP
)
{
tr
=
doExec
(
javaCmd
,
"-cp"
,
sTestJar
,
StdMainClass
,
APP_PARMS
[
0
],
APP_PARMS
[
1
]);
testname
=
testname
.
concat
(
"_useCP"
);
}
else
{
tr
=
doExec
(
javaCmd
,
"-jar"
,
sTestJar
,
APP_PARMS
[
0
],
APP_PARMS
[
1
]);
}
tr
.
checkPositive
();
if
(
tr
.
testStatus
&&
tr
.
contains
(
"HelloWorld.primaryStage.show()"
))
{
for
(
String
p
:
APP_PARMS
)
{
if
(!
tr
.
contains
(
p
))
{
System
.
err
.
println
(
"ERROR: Did not find "
+
p
+
" in output!"
);
}
}
}
checkStatus
(
tr
,
testname
,
testcount
,
StdMainClass
);
}
}
/*
* Set Main-Class and iterate main methods.
* Main class extends another class that extends Application.
* Try launching with both -jar and -cp methods.
* All cases should run.
*/
@Test
static
void
testExtendFXApp
()
throws
Exception
{
testExtendFXApp
(
true
);
testExtendFXApp
(
false
);
}
static
void
testExtendFXApp
(
boolean
useCP
)
throws
Exception
{
String
testname
=
"testExtendFXApp"
;
for
(
String
mm
:
MAIN_METHODS
)
{
testcount
++;
line
();
System
.
out
.
println
(
"test# "
+
testcount
+
"- Main method: "
+
mm
+
"; MF main class: "
+
StdMainClass
);
createJavaFile
(
mm
);
createExtJavaFile
(
mm
);
createFile
(
ManifestFile
,
createManifestContents
(
StdMainClass
));
createJar
(
FXtestJar
,
ManifestFile
);
String
sTestJar
=
FXtestJar
.
getAbsolutePath
();
TestResult
tr
;
if
(
useCP
)
{
tr
=
doExec
(
javaCmd
,
"-cp"
,
sTestJar
,
StdMainClass
,
APP_PARMS
[
0
],
APP_PARMS
[
1
]);
testname
=
testname
.
concat
(
"_useCP"
);
}
else
{
tr
=
doExec
(
javaCmd
,
"-jar"
,
sTestJar
,
APP_PARMS
[
0
],
APP_PARMS
[
1
]);
}
tr
.
checkPositive
();
if
(
tr
.
testStatus
&&
tr
.
contains
(
"HelloWorld.primaryStage.show()"
))
{
for
(
String
p
:
APP_PARMS
)
{
if
(!
tr
.
contains
(
p
))
{
System
.
err
.
println
(
"ERROR: Did not find "
+
p
+
" in output!"
);
}
}
}
checkStatus
(
tr
,
testname
,
testcount
,
StdMainClass
);
}
}
/*
* test to ensure that we don't load any extraneous fx jars when
* launching a standard java application
*/
@Test
static
void
testExtraneousJars
()
throws
Exception
{
String
testname
=
"testExtraneousJars"
;
testcount
++;
line
();
System
.
out
.
println
(
"test# "
+
testcount
);
TestResult
tr
=
doExec
(
javacCmd
,
"-J-verbose:class"
,
"-version"
);
if
(!
tr
.
notContains
(
"jfxrt.jar"
))
{
System
.
out
.
println
(
"testing for extraneous jfxrt jar"
);
System
.
out
.
println
(
tr
);
throw
new
Exception
(
"jfxrt.jar is being loaded by javac!!!"
);
}
checkStatus
(
tr
,
testname
,
testcount
,
StdMainClass
);
}
public
static
void
main
(
String
...
args
)
throws
Exception
{
//check if fx is part of jdk
Class
<?>
fxClass
=
null
;
try
{
fxClass
=
Class
.
forName
(
FX_MARKER_CLASS
);
}
catch
(
ClassNotFoundException
ex
)
{
// do nothing
}
if
(
fxClass
!=
null
)
{
FXLauncherTest
fxt
=
new
FXLauncherTest
();
fxt
.
run
(
args
);
if
(
testExitValue
>
0
)
{
System
.
out
.
println
(
"Total of "
+
testExitValue
+
" failed. Test cases covered: "
+
FXLauncherTest
.
testcount
);
System
.
exit
(
1
);
}
else
{
System
.
out
.
println
(
"All tests pass. Test cases covered: "
+
FXLauncherTest
.
testcount
);
}
}
else
{
System
.
err
.
println
(
"Warning: JavaFX components missing or not supported"
);
System
.
err
.
println
(
" test passes vacuosly."
);
}
}
}
test/tools/launcher/TestHelper.java
浏览文件 @
07653a70
...
...
@@ -559,6 +559,16 @@ public class TestHelper {
return
false
;
}
boolean
notContains
(
String
str
)
{
for
(
String
x
:
testOutput
)
{
if
(
x
.
contains
(
str
))
{
appendError
(
"string <"
+
str
+
"> found"
);
return
false
;
}
}
return
true
;
}
boolean
matches
(
String
stringToMatch
)
{
for
(
String
x
:
testOutput
)
{
if
(
x
.
matches
(
stringToMatch
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录