Merge
This commit is contained in:
commit
6ee248ddf1
1
.hgtags
1
.hgtags
@ -323,3 +323,4 @@ c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
|
|||||||
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
||||||
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
||||||
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
|
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
|
||||||
|
2050b3a0aadcb0e024bf798197421d58e54ec8bf jdk9-b81
|
||||||
|
@ -323,3 +323,4 @@ d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
|
|||||||
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
||||||
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
||||||
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
|
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
|
||||||
|
b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
|
||||||
|
@ -4364,7 +4364,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
|||||||
#CUSTOM_AUTOCONF_INCLUDE
|
#CUSTOM_AUTOCONF_INCLUDE
|
||||||
|
|
||||||
# Do not change or remove the following line, it is needed for consistency checks:
|
# Do not change or remove the following line, it is needed for consistency checks:
|
||||||
DATE_WHEN_GENERATED=1435822080
|
DATE_WHEN_GENERATED=1441958217
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
@ -38307,6 +38307,48 @@ $as_echo "$as_me: Rewriting OBJCOPY to \"$new_complete\"" >&6;}
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||||
|
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||||
|
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||||
|
# - version number is last blank separate word on first line
|
||||||
|
# - version number formats that have been seen:
|
||||||
|
# - <major>.<minor>
|
||||||
|
# - <major>.<minor>.<micro>
|
||||||
|
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||||
|
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||||
|
OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||||
|
-e 's/.* //' \
|
||||||
|
-e '/^[01]\./b bad' \
|
||||||
|
-e '/^2\./{' \
|
||||||
|
-e ' s/^2\.//' \
|
||||||
|
-e ' /^[0-9]$/b bad' \
|
||||||
|
-e ' /^[0-9]\./b bad' \
|
||||||
|
-e ' /^1[0-9]$/b bad' \
|
||||||
|
-e ' /^1[0-9]\./b bad' \
|
||||||
|
-e ' /^20\./b bad' \
|
||||||
|
-e ' /^21\.0$/b bad' \
|
||||||
|
-e ' /^21\.0\./b bad' \
|
||||||
|
-e '}' \
|
||||||
|
-e ':good' \
|
||||||
|
-e 's/.*/VALID_VERSION/p' \
|
||||||
|
-e 'q' \
|
||||||
|
-e ':bad' \
|
||||||
|
-e 's/.*/BAD_VERSION/p' \
|
||||||
|
-e 'q'`
|
||||||
|
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||||
|
OBJCOPY=
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&5
|
||||||
|
$as_echo "$as_me: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&2;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: objcopy reports version $OBJCOPY_VERSION" >&5
|
||||||
|
$as_echo "$as_me: objcopy reports version $OBJCOPY_VERSION" >&6;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&5
|
||||||
|
$as_echo "$as_me: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&6;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&5
|
||||||
|
$as_echo "$as_me: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&6;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: Solaris 11 Update 1 contains the correct version" >&5
|
||||||
|
$as_echo "$as_me: Note: Solaris 11 Update 1 contains the correct version" >&6;}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -30,25 +30,6 @@
|
|||||||
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
||||||
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
||||||
|
|
||||||
# When calling macros, the spaces between arguments are
|
|
||||||
# often semantically important! Sometimes we need to subst
|
|
||||||
# spaces and commas, therefore we need the following macros.
|
|
||||||
X:=
|
|
||||||
SPACE:=$(X) $(X)
|
|
||||||
COMMA:=,
|
|
||||||
DOLLAR:=$$
|
|
||||||
HASH:=\#
|
|
||||||
LEFT_PAREN:=(
|
|
||||||
RIGHT_PAREN:=)
|
|
||||||
SQUOTE:='
|
|
||||||
#'
|
|
||||||
DQUOTE:="
|
|
||||||
#"
|
|
||||||
define NEWLINE
|
|
||||||
|
|
||||||
|
|
||||||
endef
|
|
||||||
|
|
||||||
# The command line given to configure.
|
# The command line given to configure.
|
||||||
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
||||||
|
|
||||||
|
@ -586,6 +586,43 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
|||||||
# Only call fixup if objcopy was found.
|
# Only call fixup if objcopy was found.
|
||||||
if test -n "$OBJCOPY"; then
|
if test -n "$OBJCOPY"; then
|
||||||
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
||||||
|
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||||
|
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||||
|
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||||
|
# - version number is last blank separate word on first line
|
||||||
|
# - version number formats that have been seen:
|
||||||
|
# - <major>.<minor>
|
||||||
|
# - <major>.<minor>.<micro>
|
||||||
|
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||||
|
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||||
|
[ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||||
|
-e 's/.* //' \
|
||||||
|
-e '/^[01]\./b bad' \
|
||||||
|
-e '/^2\./{' \
|
||||||
|
-e ' s/^2\.//' \
|
||||||
|
-e ' /^[0-9]$/b bad' \
|
||||||
|
-e ' /^[0-9]\./b bad' \
|
||||||
|
-e ' /^1[0-9]$/b bad' \
|
||||||
|
-e ' /^1[0-9]\./b bad' \
|
||||||
|
-e ' /^20\./b bad' \
|
||||||
|
-e ' /^21\.0$/b bad' \
|
||||||
|
-e ' /^21\.0\./b bad' \
|
||||||
|
-e '}' \
|
||||||
|
-e ':good' \
|
||||||
|
-e 's/.*/VALID_VERSION/p' \
|
||||||
|
-e 'q' \
|
||||||
|
-e ':bad' \
|
||||||
|
-e 's/.*/BAD_VERSION/p' \
|
||||||
|
-e 'q'` ]
|
||||||
|
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||||
|
OBJCOPY=
|
||||||
|
AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.])
|
||||||
|
AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION])
|
||||||
|
AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version])
|
||||||
|
AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version])
|
||||||
|
AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -323,3 +323,4 @@ d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
|
|||||||
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
||||||
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
||||||
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
|
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
|
||||||
|
45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
|
||||||
|
@ -483,3 +483,4 @@ e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
|
|||||||
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
||||||
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
||||||
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
|
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
|
||||||
|
4142c190cd5ca4fb70ec367b4f97ef936272d8ef jdk9-b81
|
||||||
|
@ -323,3 +323,4 @@ be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
|
|||||||
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
||||||
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
||||||
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
|
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
|
||||||
|
6a418934997fc4b56664b88f8417e2f0fe658091 jdk9-b81
|
||||||
|
@ -326,3 +326,4 @@ bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
|
|||||||
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
||||||
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
||||||
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
|
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
|
||||||
|
139338618c77d793ab8b550f06819ddb8381316f jdk9-b81
|
||||||
|
@ -323,3 +323,4 @@ f376824d4940f45719d91838f3f6249f873440db jdk9-b72
|
|||||||
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
||||||
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
||||||
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
|
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
|
||||||
|
fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
|
||||||
|
@ -38,7 +38,9 @@ include SetupJavaCompilers.gmk
|
|||||||
|
|
||||||
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
|
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
|
||||||
SETUP := GENERATE_OLDBYTECODE, \
|
SETUP := GENERATE_OLDBYTECODE, \
|
||||||
ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
|
ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
|
||||||
|
$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||||
|
$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
|
||||||
SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
|
SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
|
||||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
|
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
|
||||||
COPY := boot.modules ext.modules))
|
COPY := boot.modules ext.modules))
|
||||||
@ -126,11 +128,11 @@ TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
|
|||||||
build.tools.cldrconverter.CLDRConverter
|
build.tools.cldrconverter.CLDRConverter
|
||||||
|
|
||||||
TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
|
TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
|
||||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||||
build.tools.module.GenJdepsModulesXml
|
build.tools.module.GenJdepsModulesXml
|
||||||
|
|
||||||
TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||||
build.tools.module.ImageBuilder
|
build.tools.module.ImageBuilder
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@ -157,28 +159,6 @@ $(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
|
|||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
# Tools needed on solaris because OBJCOPY is broken.
|
|
||||||
|
|
||||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
|
||||||
$(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
|
|
||||||
SRC := $(JDK_TOPDIR)/make/src/native/add_gnu_debuglink, \
|
|
||||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
|
||||||
LDFLAGS := -lelf, \
|
|
||||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
|
|
||||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
|
||||||
PROGRAM := add_gnu_debuglink))
|
|
||||||
|
|
||||||
$(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
|
|
||||||
SRC := $(JDK_TOPDIR)/make/src/native/fix_empty_sec_hdr_flags, \
|
|
||||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
|
||||||
LDFLAGS := -lelf, \
|
|
||||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
|
|
||||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
|
||||||
PROGRAM := fix_empty_sec_hdr_flags))
|
|
||||||
|
|
||||||
BUILD_TOOLS_JDK += $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
|
$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
|
||||||
|
|
||||||
java-tools: $(BUILD_TOOLS_JDK)
|
java-tools: $(BUILD_TOOLS_JDK)
|
||||||
|
@ -77,9 +77,9 @@ $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
|
|||||||
$(ECHO) Generating beaninfo
|
$(ECHO) Generating beaninfo
|
||||||
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
|
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
|
||||||
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
|
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
|
||||||
-sourcepath "$(subst $(SPACE),$(PATH_SEP),\
|
-sourcepath $(call PathList,\
|
||||||
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
|
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
|
||||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base)" \
|
$(SUPPORT_OUTPUTDIR)/gensrc/java.base) \
|
||||||
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
|
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
|
||||||
-x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
|
-x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
|
||||||
-t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
|
-t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
|
||||||
|
@ -28,9 +28,6 @@ include NativeCompilation.gmk
|
|||||||
# Prepare the find cache.
|
# Prepare the find cache.
|
||||||
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
|
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
|
||||||
|
|
||||||
# Build tools
|
|
||||||
include Tools.gmk
|
|
||||||
|
|
||||||
# When building a legacy overlay image (on solaris 64 bit), the launchers
|
# When building a legacy overlay image (on solaris 64 bit), the launchers
|
||||||
# need to be built with a different rpath and a different output dir.
|
# need to be built with a different rpath and a different output dir.
|
||||||
ifeq ($(OVERLAY_IMAGES), true)
|
ifeq ($(OVERLAY_IMAGES), true)
|
||||||
|
@ -27,9 +27,6 @@ include $(SPEC)
|
|||||||
include MakeBase.gmk
|
include MakeBase.gmk
|
||||||
include NativeCompilation.gmk
|
include NativeCompilation.gmk
|
||||||
|
|
||||||
# Build tools
|
|
||||||
include Tools.gmk
|
|
||||||
|
|
||||||
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
|
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||||
|
|
||||||
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
|
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -39,6 +39,7 @@ SUNWprivate_1.1 {
|
|||||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||||
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||||
|
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||||
@ -56,6 +57,7 @@ SUNWprivate_1.1 {
|
|||||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||||
|
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,8 +28,7 @@
|
|||||||
SUNWprivate_1.1 {
|
SUNWprivate_1.1 {
|
||||||
global:
|
global:
|
||||||
JNI_OnLoad;
|
JNI_OnLoad;
|
||||||
Java_java_net_AbstractPlainDatagramSocketImpl_init;
|
Java_java_net_PlainDatagramSocketImpl_dataAvailable;
|
||||||
Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable;
|
|
||||||
Java_java_net_PlainSocketImpl_socketListen;
|
Java_java_net_PlainSocketImpl_socketListen;
|
||||||
Java_java_net_PlainDatagramSocketImpl_getTTL;
|
Java_java_net_PlainDatagramSocketImpl_getTTL;
|
||||||
Java_java_net_PlainDatagramSocketImpl_init;
|
Java_java_net_PlainDatagramSocketImpl_init;
|
||||||
|
@ -31,8 +31,9 @@ include RMICompilation.gmk
|
|||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
|
BTRMIC_CP := $(call PathList, $(INTERIM_CORBA_JAR) \
|
||||||
BTRMIC_ARGS := "-Xbootclasspath/p:$(BTRMIC_CP)" -cp "$(BTRMIC_CP)"
|
$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes $(INTERIM_LANGTOOLS_JAR))
|
||||||
|
BTRMIC_ARGS := -Xbootclasspath/p:$(BTRMIC_CP) -cp $(BTRMIC_CP)
|
||||||
RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
|
RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
|
||||||
|
|
||||||
CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
|
CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
|
||||||
|
@ -27,15 +27,12 @@ package build.tools.cldrconverter;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
class Bundle {
|
class Bundle {
|
||||||
static enum Type {
|
static enum Type {
|
||||||
@ -117,6 +114,7 @@ class Bundle {
|
|||||||
private final String cldrPath;
|
private final String cldrPath;
|
||||||
private final EnumSet<Type> bundleTypes;
|
private final EnumSet<Type> bundleTypes;
|
||||||
private final String currencies;
|
private final String currencies;
|
||||||
|
private Map<String, Object> targetMap;
|
||||||
|
|
||||||
static Bundle getBundle(String id) {
|
static Bundle getBundle(String id) {
|
||||||
return bundles.get(id);
|
return bundles.get(id);
|
||||||
@ -176,6 +174,10 @@ class Bundle {
|
|||||||
* visible for the bundle's locale
|
* visible for the bundle's locale
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getTargetMap() throws Exception {
|
Map<String, Object> getTargetMap() throws Exception {
|
||||||
|
if (targetMap != null) {
|
||||||
|
return targetMap;
|
||||||
|
}
|
||||||
|
|
||||||
String[] cldrBundles = getCLDRPath().split(",");
|
String[] cldrBundles = getCLDRPath().split(",");
|
||||||
|
|
||||||
// myMap contains resources for id.
|
// myMap contains resources for id.
|
||||||
@ -398,6 +400,7 @@ class Bundle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetMap = myMap;
|
||||||
return myMap;
|
return myMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +635,7 @@ class Bundle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
|
static List<Object[]> jreTimeZoneNames = Arrays.asList(TimeZoneNames.getContents());
|
||||||
private void fillInJREs(String key, Map<String, String> map) {
|
private void fillInJREs(String key, Map<String, String> map) {
|
||||||
String tzid = null;
|
String tzid = null;
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package build.tools.cldrconverter;
|
package build.tools.cldrconverter;
|
||||||
|
|
||||||
|
import static build.tools.cldrconverter.Bundle.jreTimeZoneNames;
|
||||||
import build.tools.cldrconverter.BundleGenerator.BundleType;
|
import build.tools.cldrconverter.BundleGenerator.BundleType;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.DirectoryStream;
|
import java.nio.file.DirectoryStream;
|
||||||
@ -564,6 +565,44 @@ public class CLDRConverter {
|
|||||||
|
|
||||||
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
|
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
|
||||||
Map<String, Object> names = new HashMap<>();
|
Map<String, Object> names = new HashMap<>();
|
||||||
|
|
||||||
|
// Copy over missing time zone ids from JRE for English locale
|
||||||
|
if (id.equals("en")) {
|
||||||
|
Map<String[], String> jreMetaMap = new HashMap<>();
|
||||||
|
jreTimeZoneNames.stream().forEach(e -> {
|
||||||
|
String tzid = (String)e[0];
|
||||||
|
String[] data = (String[])e[1];
|
||||||
|
|
||||||
|
if (map.get(TIMEZONE_ID_PREFIX + tzid) == null &&
|
||||||
|
handlerMetaZones.get(tzid) == null) {
|
||||||
|
// First, check the CLDR meta key
|
||||||
|
Optional<Map.Entry<String, String>> cldrMeta =
|
||||||
|
handlerMetaZones.getData().entrySet().stream()
|
||||||
|
.filter(me ->
|
||||||
|
Arrays.deepEquals(data,
|
||||||
|
(String[])map.get(METAZONE_ID_PREFIX + me.getValue())))
|
||||||
|
.findAny();
|
||||||
|
if (cldrMeta.isPresent()) {
|
||||||
|
names.put(tzid, cldrMeta.get().getValue());
|
||||||
|
} else {
|
||||||
|
// check the JRE meta key, add if there is not.
|
||||||
|
Optional<Map.Entry<String[], String>> jreMeta =
|
||||||
|
jreMetaMap.entrySet().stream()
|
||||||
|
.filter(jm -> Arrays.deepEquals(data, jm.getKey()))
|
||||||
|
.findAny();
|
||||||
|
if (jreMeta.isPresent()) {
|
||||||
|
names.put(tzid, jreMeta.get().getValue());
|
||||||
|
} else {
|
||||||
|
String metaName = "JRE_" + tzid.replaceAll("[/-]", "_");
|
||||||
|
names.put(METAZONE_ID_PREFIX + metaName, data);
|
||||||
|
names.put(tzid, metaName);
|
||||||
|
jreMetaMap.put(data, metaName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for (String tzid : handlerMetaZones.keySet()) {
|
for (String tzid : handlerMetaZones.keySet()) {
|
||||||
String tzKey = TIMEZONE_ID_PREFIX + tzid;
|
String tzKey = TIMEZONE_ID_PREFIX + tzid;
|
||||||
Object data = map.get(tzKey);
|
Object data = map.get(tzKey);
|
||||||
|
@ -266,22 +266,47 @@ class ResourceBundleGenerator implements BundleGenerator {
|
|||||||
out.println((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
|
out.println((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
|
||||||
"package sun.util.resources.cldr.provider;\n\n")
|
"package sun.util.resources.cldr.provider;\n\n")
|
||||||
+ "import java.util.HashMap;\n"
|
+ "import java.util.HashMap;\n"
|
||||||
|
+ "import java.util.Locale;\n"
|
||||||
+ "import java.util.Map;\n"
|
+ "import java.util.Map;\n"
|
||||||
+ "import java.util.ListResourceBundle;\n"
|
|
||||||
+ "import sun.util.locale.provider.LocaleProviderAdapter;\n"
|
+ "import sun.util.locale.provider.LocaleProviderAdapter;\n"
|
||||||
+ "import sun.util.locale.provider.LocaleDataMetaInfo;\n");
|
+ "import sun.util.locale.provider.LocaleDataMetaInfo;\n");
|
||||||
out.printf("public class %s extends ListResourceBundle implements LocaleDataMetaInfo {\n", className);
|
out.printf("public class %s implements LocaleDataMetaInfo {\n", className);
|
||||||
out.println(" @Override\n" +
|
out.println(" private static final Map<String, String> resourceNameToLocales = new HashMap<>();\n" +
|
||||||
" protected final Object[][] getContents() {\n" +
|
(CLDRConverter.isBaseModule ?
|
||||||
" final Object[][] data = new Object[][] {");
|
" private static final Map<Locale, String[]> parentLocalesMap = new HashMap<>();\n\n" : "\n") +
|
||||||
|
" static {\n");
|
||||||
|
|
||||||
for (String key : metaInfo.keySet()) {
|
for (String key : metaInfo.keySet()) {
|
||||||
out.printf(" { \"%s\",\n", key);
|
if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
|
||||||
out.printf(" \"%s\" },\n",
|
String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
||||||
|
if ("root".equals(parentTag)) {
|
||||||
|
out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
|
||||||
|
} else {
|
||||||
|
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
|
||||||
|
parentTag);
|
||||||
|
}
|
||||||
|
String[] childlen = toLocaleList(metaInfo.get(key), true).split(" ");
|
||||||
|
out.printf(" new String[] {\n" +
|
||||||
|
" ");
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < childlen.length; i++) {
|
||||||
|
String child = childlen[i];
|
||||||
|
out.printf("\"%s\", ", child);
|
||||||
|
count += child.length() + 4;
|
||||||
|
if (i != childlen.length - 1 && count > 64) {
|
||||||
|
out.printf("\n ");
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.printf("\n });\n");
|
||||||
|
} else {
|
||||||
|
out.printf(" resourceNameToLocales.put(\"%s\",\n", key);
|
||||||
|
out.printf(" \"%s\");\n",
|
||||||
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
|
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
|
||||||
metaInfo.get(key),
|
metaInfo.get(key), false));
|
||||||
key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)));
|
}
|
||||||
}
|
}
|
||||||
out.println(" };\n return data;\n }\n\n");
|
out.println(" }\n\n");
|
||||||
|
|
||||||
out.println(" @Override\n" +
|
out.println(" @Override\n" +
|
||||||
" public LocaleProviderAdapter.Type getType() {\n" +
|
" public LocaleProviderAdapter.Type getType() {\n" +
|
||||||
@ -290,19 +315,13 @@ class ResourceBundleGenerator implements BundleGenerator {
|
|||||||
|
|
||||||
out.println(" @Override\n" +
|
out.println(" @Override\n" +
|
||||||
" public String availableLanguageTags(String category) {\n" +
|
" public String availableLanguageTags(String category) {\n" +
|
||||||
" return getString(category);\n" +
|
" return resourceNameToLocales.getOrDefault(category, \"\");\n" +
|
||||||
" };\n\n");
|
" }\n\n");
|
||||||
|
|
||||||
if (CLDRConverter.isBaseModule) {
|
if (CLDRConverter.isBaseModule) {
|
||||||
out.printf(" public Map<String, String> parentLocales() {\n" +
|
out.printf(" public Map<Locale, String[]> parentLocales() {\n" +
|
||||||
" Map<String, String> ret = new HashMap<>();\n" +
|
" return parentLocalesMap;\n" +
|
||||||
" keySet().stream()\n" +
|
" }\n}");
|
||||||
" .filter(key -> key.startsWith(\"%s\"))\n" +
|
|
||||||
" .forEach(key -> ret.put(key.substring(%d), getString(key)));\n" +
|
|
||||||
" return ret.isEmpty() ? null : ret;\n" +
|
|
||||||
" };\n}",
|
|
||||||
CLDRConverter.PARENT_LOCALE_PREFIX,
|
|
||||||
CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
|
||||||
} else {
|
} else {
|
||||||
out.println("}");
|
out.println("}");
|
||||||
}
|
}
|
||||||
|
@ -1,285 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012, 2013, 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Name: add_gnu_debuglink.c
|
|
||||||
*
|
|
||||||
* Description: Add a ".gnu_debuglink" section that refers to the specified
|
|
||||||
* debug_info_path to the specified ELF object.
|
|
||||||
*
|
|
||||||
* This program is adapted from the example program shown on the
|
|
||||||
* elf(3elf) man page and from code from the Solaris compiler
|
|
||||||
* driver.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* needed to define SHF_EXCLUDE
|
|
||||||
*/
|
|
||||||
#define ELF_TARGET_ALL
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <libelf.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
static void failure(void);
|
|
||||||
static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
|
|
||||||
size_t len);
|
|
||||||
|
|
||||||
void
|
|
||||||
main(int argc, char ** argv) {
|
|
||||||
/* new ELF section name */
|
|
||||||
static char SEC_NAME[] = ".gnu_debuglink";
|
|
||||||
|
|
||||||
unsigned char buffer[8 * 1024]; /* I/O buffer */
|
|
||||||
int buffer_len; /* buffer length */
|
|
||||||
char * debug_info_path; /* debug info path */
|
|
||||||
void * ehdr; /* ELF header */
|
|
||||||
Elf * elf; /* ELF descriptor */
|
|
||||||
char * elf_ident; /* ELF identity string */
|
|
||||||
char * elf_obj; /* elf_obj file */
|
|
||||||
int fd; /* descriptor for files */
|
|
||||||
unsigned int file_crc = 0; /* CRC for debug info file */
|
|
||||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
|
||||||
Elf_Data * link_dat; /* ELF data for new debug info link */
|
|
||||||
Elf_Data * name_dat; /* ELF data for new section name */
|
|
||||||
Elf_Scn * new_scn; /* new ELF section descriptor */
|
|
||||||
void * new_shdr; /* new ELF section header */
|
|
||||||
Elf_Scn * scn; /* ELF section descriptor */
|
|
||||||
void * shdr; /* ELF section header */
|
|
||||||
|
|
||||||
if (argc != 3) {
|
|
||||||
(void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
debug_info_path = argv[1]; /* save for later */
|
|
||||||
if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
|
|
||||||
(void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("Computing CRC for '%s'\n", debug_info_path);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
/* compute CRC for the debug info file */
|
|
||||||
for (;;) {
|
|
||||||
int len = read(fd, buffer, sizeof buffer);
|
|
||||||
if (len <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
|
|
||||||
}
|
|
||||||
(void) close(fd);
|
|
||||||
|
|
||||||
/* open the elf_obj */
|
|
||||||
elf_obj = argv[2];
|
|
||||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
|
||||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
|
||||||
|
|
||||||
/* obtain the ELF descriptors from the input file */
|
|
||||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* determine if ELFCLASS64 or not? */
|
|
||||||
elf_ident = elf_getident(elf, NULL);
|
|
||||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
|
||||||
|
|
||||||
/* get the ELF header */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
ehdr = elf64_getehdr(elf);
|
|
||||||
} else {
|
|
||||||
ehdr = elf32_getehdr(elf);
|
|
||||||
}
|
|
||||||
if (ehdr == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the ELF section descriptor */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
|
||||||
} else {
|
|
||||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
|
||||||
}
|
|
||||||
if (scn == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the section header */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
shdr = elf64_getshdr(scn);
|
|
||||||
} else {
|
|
||||||
shdr = elf32_getshdr(scn);
|
|
||||||
}
|
|
||||||
if (shdr == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("Adding ELF data for new section name\n");
|
|
||||||
(void) fflush(stdout);
|
|
||||||
name_dat = elf_newdata(scn);
|
|
||||||
name_dat->d_buf = (void *) SEC_NAME;
|
|
||||||
if (is_elfclass64) {
|
|
||||||
name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
|
|
||||||
} else {
|
|
||||||
name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
|
|
||||||
}
|
|
||||||
name_dat->d_align = 1;
|
|
||||||
name_dat->d_size = strlen(SEC_NAME) + 1;
|
|
||||||
|
|
||||||
new_scn = elf_newscn(elf);
|
|
||||||
|
|
||||||
if (is_elfclass64) {
|
|
||||||
new_shdr = elf64_getshdr(new_scn);
|
|
||||||
((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
|
||||||
((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
|
||||||
((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
|
|
||||||
((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
|
|
||||||
((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
|
||||||
} else {
|
|
||||||
new_shdr = elf32_getshdr(new_scn);
|
|
||||||
((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
|
||||||
((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
|
||||||
((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
|
|
||||||
((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
|
|
||||||
((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("Adding ELF data for debug_info_path value\n");
|
|
||||||
(void) fflush(stdout);
|
|
||||||
(void) memset(buffer, 0, sizeof buffer);
|
|
||||||
buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
|
|
||||||
(void) strncpy((char *) buffer, debug_info_path, buffer_len);
|
|
||||||
if (buffer_len % 4 != 0) {
|
|
||||||
/* not on a 4 byte boundary so pad to the next one */
|
|
||||||
buffer_len += (4 - buffer_len % 4);
|
|
||||||
}
|
|
||||||
/* save the CRC */
|
|
||||||
(void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
|
|
||||||
buffer_len += sizeof file_crc;
|
|
||||||
|
|
||||||
link_dat = elf_newdata(new_scn);
|
|
||||||
link_dat->d_type = ELF_T_BYTE;
|
|
||||||
link_dat->d_size = buffer_len;
|
|
||||||
link_dat->d_buf = buffer;
|
|
||||||
link_dat->d_align = 1;
|
|
||||||
|
|
||||||
(void) printf("Saving updates to '%s'\n", elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
|
||||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
|
||||||
(void) elf_end(elf); /* done with ELF obj */
|
|
||||||
(void) close(fd);
|
|
||||||
|
|
||||||
(void) printf("Done updating '%s'\n", elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
exit(0);
|
|
||||||
} /* end main */
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
failure() {
|
|
||||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
|
||||||
exit(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The CRC used in gnu_debuglink, retrieved from
|
|
||||||
* http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static unsigned int
|
|
||||||
gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
|
|
||||||
static const unsigned int crc32_table[256] = {
|
|
||||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
|
||||||
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
|
||||||
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
|
||||||
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
|
||||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
|
||||||
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
|
||||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
|
||||||
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
|
||||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
|
||||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
|
||||||
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
|
||||||
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
|
||||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
|
||||||
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
|
||||||
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
|
||||||
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
|
||||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
|
||||||
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
|
||||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
|
||||||
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
|
||||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
|
||||||
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
|
||||||
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
|
||||||
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
|
||||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
|
||||||
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
|
||||||
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
|
||||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
|
||||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
|
||||||
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
|
||||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
|
||||||
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
|
||||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
|
||||||
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
|
||||||
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
|
||||||
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
|
||||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
|
||||||
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
|
||||||
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
|
||||||
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
|
||||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
|
||||||
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
|
||||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
|
||||||
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
|
||||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
|
||||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
|
||||||
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
|
||||||
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
|
||||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
|
||||||
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
|
||||||
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
|
||||||
0x2d02ef8d
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned char *end;
|
|
||||||
|
|
||||||
crc = ~crc & 0xffffffff;
|
|
||||||
for (end = buf + len; buf < end; ++buf) {
|
|
||||||
crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
|
|
||||||
}
|
|
||||||
return ~crc & 0xffffffff;
|
|
||||||
}
|
|
@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012, 2013, 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Name: fix_empty_sec_hdr_flags.c
|
|
||||||
*
|
|
||||||
* Description: Remove the SHF_ALLOC flag from "empty" section headers.
|
|
||||||
* An "empty" section header has sh_addr == 0 and sh_size == 0.
|
|
||||||
*
|
|
||||||
* This program is adapted from the example program shown on the
|
|
||||||
* elf(3elf) man page and from code from the Solaris compiler
|
|
||||||
* driver.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <libelf.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
static void failure(void);
|
|
||||||
|
|
||||||
void
|
|
||||||
main(int argc, char ** argv) {
|
|
||||||
void * ehdr; /* ELF header */
|
|
||||||
unsigned int i; /* section counter */
|
|
||||||
int fd; /* descriptor for file */
|
|
||||||
Elf * elf; /* ELF descriptor */
|
|
||||||
char * elf_ident; /* ELF identity string */
|
|
||||||
char * elf_obj; /* elf_obj file */
|
|
||||||
int fix_count; /* number of flags fixed */
|
|
||||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
|
||||||
Elf_Scn * scn; /* ELF section descriptor */
|
|
||||||
void * shdr; /* ELF section header */
|
|
||||||
Elf_Data * shstrtab; /* ELF section header string table */
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
(void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the elf_obj */
|
|
||||||
elf_obj = argv[1];
|
|
||||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
|
||||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
|
||||||
|
|
||||||
/* obtain the ELF descriptors from the input file */
|
|
||||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* determine if ELFCLASS64 or not? */
|
|
||||||
elf_ident = elf_getident(elf, NULL);
|
|
||||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
|
||||||
|
|
||||||
/* get the ELF header */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
ehdr = elf64_getehdr(elf);
|
|
||||||
} else {
|
|
||||||
ehdr = elf32_getehdr(elf);
|
|
||||||
}
|
|
||||||
if (ehdr == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the ELF section descriptor */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
|
||||||
} else {
|
|
||||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
|
||||||
}
|
|
||||||
if (scn == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the section header string table */
|
|
||||||
shstrtab = elf_getdata(scn, NULL);
|
|
||||||
if (shstrtab == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
fix_count = 0;
|
|
||||||
|
|
||||||
/* traverse the sections of the input file */
|
|
||||||
for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
|
|
||||||
int has_flag_set; /* is SHF_ALLOC flag set? */
|
|
||||||
int is_empty; /* is section empty? */
|
|
||||||
char * name; /* short hand pointer */
|
|
||||||
|
|
||||||
/* get the section header */
|
|
||||||
if (is_elfclass64) {
|
|
||||||
shdr = elf64_getshdr(scn);
|
|
||||||
} else {
|
|
||||||
shdr = elf32_getshdr(scn);
|
|
||||||
}
|
|
||||||
if (shdr == NULL) {
|
|
||||||
failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_elfclass64) {
|
|
||||||
name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
|
|
||||||
} else {
|
|
||||||
name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_elfclass64) {
|
|
||||||
has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
|
||||||
is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
|
|
||||||
((Elf64_Shdr *) shdr)->sh_size == 0;
|
|
||||||
} else {
|
|
||||||
has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
|
||||||
is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
|
|
||||||
((Elf32_Shdr *) shdr)->sh_size == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_empty && has_flag_set) {
|
|
||||||
(void) printf("section[%u] '%s' is empty, "
|
|
||||||
"but SHF_ALLOC flag is set.\n", i, name);
|
|
||||||
(void) printf("Clearing the SHF_ALLOC flag.\n");
|
|
||||||
|
|
||||||
if (is_elfclass64) {
|
|
||||||
((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
|
||||||
} else {
|
|
||||||
((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
|
||||||
}
|
|
||||||
fix_count++;
|
|
||||||
}
|
|
||||||
} /* end for each ELF section */
|
|
||||||
|
|
||||||
if (fix_count > 0) {
|
|
||||||
(void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
|
||||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
|
||||||
} else {
|
|
||||||
(void) printf("No SHF_ALLOC flags needed to be cleared.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) elf_end(elf); /* done with ELF obj */
|
|
||||||
(void) close(fd);
|
|
||||||
|
|
||||||
(void) printf("Done %s '%s'\n",
|
|
||||||
(fix_count > 0) ? "updating" : "with", elf_obj);
|
|
||||||
(void) fflush(stdout);
|
|
||||||
exit(0);
|
|
||||||
} /* end main */
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
failure() {
|
|
||||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
|
||||||
exit(6);
|
|
||||||
}
|
|
@ -141,15 +141,19 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
|
|||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to open /proc/<pid>/cmdline
|
* Stat /proc/<pid> to get the user id
|
||||||
*/
|
*/
|
||||||
snprintf(fn, sizeof fn, "/proc/%d/cmdline", pid);
|
snprintf(fn, sizeof fn, "/proc/%d", pid);
|
||||||
if ((fd = open(fn, O_RDONLY)) < 0) {
|
if (stat(fn, &stat_buf) == 0) {
|
||||||
return;
|
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat(fd, &stat_buf) == 0) {
|
/*
|
||||||
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
* Try to open /proc/<pid>/cmdline
|
||||||
|
*/
|
||||||
|
strncat(fn, "/cmdline", sizeof fn - strnlen(fn, sizeof fn) - 1);
|
||||||
|
if ((fd = open(fn, O_RDONLY)) < 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
do { // Block to break out of on errors
|
do { // Block to break out of on errors
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -68,7 +68,6 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -364,6 +363,5 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
|||||||
return connectDisabled;
|
return connectDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
native int dataAvailable();
|
abstract int dataAvailable();
|
||||||
private static native void init();
|
|
||||||
}
|
}
|
||||||
|
@ -233,8 +233,7 @@ public class DistributionPointFetcher {
|
|||||||
}
|
}
|
||||||
CertStore ucs = null;
|
CertStore ucs = null;
|
||||||
try {
|
try {
|
||||||
ucs = URICertStore.getInstance
|
ucs = URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||||
(new URICertStore.URICertStoreParameters(uri));
|
|
||||||
} catch (InvalidAlgorithmParameterException |
|
} catch (InvalidAlgorithmParameterException |
|
||||||
NoSuchAlgorithmException e) {
|
NoSuchAlgorithmException e) {
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
|
@ -26,15 +26,13 @@
|
|||||||
package sun.security.provider.certpath;
|
package sun.security.provider.certpath;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.util.Objects;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import sun.security.x509.AttributeNameEnumeration;
|
|
||||||
import sun.security.x509.CertAttrSet;
|
|
||||||
import sun.security.x509.Extension;
|
import sun.security.x509.Extension;
|
||||||
import sun.security.x509.PKIXExtensions;
|
import sun.security.x509.PKIXExtensions;
|
||||||
import sun.security.util.*;
|
import sun.security.util.Debug;
|
||||||
|
import sun.security.util.DerValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent the OCSP Nonce Extension.
|
* Represent the OCSP Nonce Extension.
|
||||||
@ -43,252 +41,139 @@ import sun.security.util.*;
|
|||||||
* and help to prevent replay attacks (see RFC 6960, section 4.4.1).
|
* and help to prevent replay attacks (see RFC 6960, section 4.4.1).
|
||||||
*
|
*
|
||||||
* @see Extension
|
* @see Extension
|
||||||
* @see CertAttrSet
|
|
||||||
*/
|
*/
|
||||||
public class OCSPNonceExtension extends Extension
|
public final class OCSPNonceExtension extends Extension {
|
||||||
implements CertAttrSet<String> {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute name.
|
* Attribute name.
|
||||||
*/
|
*/
|
||||||
public static final String NAME = "OCSPNonce";
|
private static final String EXTENSION_NAME = "OCSPNonce";
|
||||||
public static final String NONCE = "nonce";
|
|
||||||
|
|
||||||
private byte[] nonceData = null;
|
private byte[] nonceData = null;
|
||||||
private String extensionName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encode this extension value to DER and assign it to the
|
|
||||||
* {@code extensionName} data member.
|
|
||||||
*
|
|
||||||
* @throws IOException if any errors occur during DER encoding
|
|
||||||
*/
|
|
||||||
private void encodeInternal() throws IOException {
|
|
||||||
if (nonceData == null) {
|
|
||||||
this.extensionValue = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DerOutputStream os = new DerOutputStream();
|
|
||||||
os.putOctetString(this.nonceData);
|
|
||||||
this.extensionValue = os.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@code OCSPNonceExtension} by providing the nonce length.
|
* Create a {@code OCSPNonceExtension} by providing the nonce length.
|
||||||
* The criticality is set to false. The random bytes will be generated
|
* The criticality is set to false, and the OID for the extension will
|
||||||
* using the SUN provider.
|
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||||
*
|
*
|
||||||
* @param length the number of random bytes composing the nonce
|
* @param length the number of random bytes composing the nonce
|
||||||
*
|
*
|
||||||
* @throws IOException if any errors happen during encoding of the
|
* @throws IOException if any errors happen during encoding of the
|
||||||
* extension.
|
* extension.
|
||||||
|
* @throws IllegalArgumentException if length is not a positive integer.
|
||||||
*/
|
*/
|
||||||
public OCSPNonceExtension(int length) throws IOException {
|
public OCSPNonceExtension(int length) throws IOException {
|
||||||
this(PKIXExtensions.OCSPNonce_Id, false, length, NAME);
|
this(false, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the extension (also called by the subclass).
|
* Create a {@code OCSPNonceExtension} by providing the nonce length and
|
||||||
|
* criticality setting. The OID for the extension will
|
||||||
|
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||||
*
|
*
|
||||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||||
* extension
|
* is set for this extension
|
||||||
* @param isCritical a boolean flag indicating if the criticality bit
|
* @param length the number of random bytes composing the nonce
|
||||||
* is to be set for this extension
|
|
||||||
* @param length the length of the nonce in bytes
|
|
||||||
* @param extensionName the name of the extension
|
|
||||||
*
|
*
|
||||||
* @throws IOException if any errors happen during encoding of the
|
* @throws IOException if any errors happen during encoding of the
|
||||||
* extension.
|
* extension.
|
||||||
|
* @throws IllegalArgumentException if length is not a positive integer.
|
||||||
*/
|
*/
|
||||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
public OCSPNonceExtension(boolean isCritical, int length)
|
||||||
boolean isCritical, int length, String extensionName)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SecureRandom rng = new SecureRandom();
|
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||||
this.nonceData = new byte[length];
|
|
||||||
rng.nextBytes(nonceData);
|
|
||||||
this.extensionId = extensionId;
|
|
||||||
this.critical = isCritical;
|
this.critical = isCritical;
|
||||||
this.extensionName = extensionName;
|
|
||||||
encodeInternal();
|
if (length > 0) {
|
||||||
|
SecureRandom rng = new SecureRandom();
|
||||||
|
this.nonceData = new byte[length];
|
||||||
|
rng.nextBytes(nonceData);
|
||||||
|
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||||
|
nonceData).toByteArray();
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Length must be a positive integer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the extension using the provided criticality bit setting and
|
* Create a {@code OCSPNonceExtension} by providing a nonce value.
|
||||||
* DER encoding.
|
* The criticality is set to false, and the OID for the extension will
|
||||||
|
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||||
*
|
*
|
||||||
* @param critical true if the extension is to be treated as critical.
|
* @param incomingNonce The nonce data to be set for the extension. This
|
||||||
* @param value an array of DER encoded bytes of the extnValue for the
|
* must be a non-null array of at least one byte long.
|
||||||
* extension. It must not include the encapsulating OCTET STRING
|
|
||||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
|
||||||
* should be a simple OCTET STRING containing random bytes
|
|
||||||
* (see RFC 6960, section 4.4.1).
|
|
||||||
*
|
*
|
||||||
* @throws ClassCastException if value is not an array of bytes
|
|
||||||
* @throws IOException if any errors happen during encoding of the
|
* @throws IOException if any errors happen during encoding of the
|
||||||
* extension
|
* extension.
|
||||||
|
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||||
|
* positive integer.
|
||||||
|
* @throws NullPointerException if the incomingNonce is null.
|
||||||
*/
|
*/
|
||||||
public OCSPNonceExtension(Boolean critical, Object value)
|
public OCSPNonceExtension(byte[] incomingNonce) throws IOException {
|
||||||
throws IOException {
|
this(false, incomingNonce);
|
||||||
this(PKIXExtensions.OCSPNonce_Id, critical, value, NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the extension (also called by the subclass).
|
* Create a {@code OCSPNonceExtension} by providing a nonce value and
|
||||||
|
* criticality setting. The OID for the extension will
|
||||||
|
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||||
*
|
*
|
||||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||||
* extension
|
* is set for this extension
|
||||||
* @param critical a boolean flag indicating if the criticality bit
|
* @param incomingNonce The nonce data to be set for the extension. This
|
||||||
* is to be set for this extension
|
* must be a non-null array of at least one byte long.
|
||||||
* @param value an array of DER encoded bytes of the extnValue for the
|
|
||||||
* extension. It must not include the encapsulating OCTET STRING
|
|
||||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
|
||||||
* should be a simple OCTET STRING containing random bytes
|
|
||||||
* (see RFC 6960, section 4.4.1).
|
|
||||||
* @param extensionName the name of the extension
|
|
||||||
*
|
*
|
||||||
* @throws ClassCastException if value is not an array of bytes
|
|
||||||
* @throws IOException if any errors happen during encoding of the
|
* @throws IOException if any errors happen during encoding of the
|
||||||
* extension
|
* extension.
|
||||||
|
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||||
|
* positive integer.
|
||||||
|
* @throws NullPointerException if the incomingNonce is null.
|
||||||
*/
|
*/
|
||||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
public OCSPNonceExtension(boolean isCritical, byte[] incomingNonce)
|
||||||
Boolean critical, Object value, String extensionName)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this.extensionId = extensionId;
|
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||||
this.critical = critical;
|
this.critical = isCritical;
|
||||||
this.extensionValue = (byte[]) value;
|
|
||||||
DerValue val = new DerValue(this.extensionValue);
|
|
||||||
this.nonceData = val.getOctetString();
|
|
||||||
this.extensionName = extensionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
Objects.requireNonNull(incomingNonce, "Nonce data must be non-null");
|
||||||
* Set the attribute value.
|
if (incomingNonce.length > 0) {
|
||||||
*
|
this.nonceData = incomingNonce.clone();
|
||||||
* @param name the name of the attribute.
|
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||||
* @param obj an array of nonce bytes for the extension. It must not
|
nonceData).toByteArray();
|
||||||
* contain any DER tags or length.
|
|
||||||
*
|
|
||||||
* @throws IOException if an unsupported name is provided or the supplied
|
|
||||||
* {@code obj} is not a byte array
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void set(String name, Object obj) throws IOException {
|
|
||||||
if (name.equalsIgnoreCase(NONCE)) {
|
|
||||||
if (!(obj instanceof byte[])) {
|
|
||||||
throw new IOException("Attribute must be of type byte[].");
|
|
||||||
}
|
|
||||||
nonceData = (byte[])obj;
|
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Attribute name not recognized by"
|
throw new IllegalArgumentException(
|
||||||
+ " CertAttrSet:" + extensionName + ".");
|
"Nonce data must be at least 1 byte in length");
|
||||||
}
|
|
||||||
encodeInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the attribute value.
|
|
||||||
*
|
|
||||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
|
||||||
* is currently supported.
|
|
||||||
*
|
|
||||||
* @return an array of bytes that are the nonce data. It will not contain
|
|
||||||
* any DER tags or length, only the random nonce bytes.
|
|
||||||
*
|
|
||||||
* @throws IOException if an unsupported name is provided.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Object get(String name) throws IOException {
|
|
||||||
if (name.equalsIgnoreCase(NONCE)) {
|
|
||||||
return nonceData;
|
|
||||||
} else {
|
|
||||||
throw new IOException("Attribute name not recognized by"
|
|
||||||
+ " CertAttrSet:" + extensionName + ".");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the attribute value.
|
* Return the nonce bytes themselves, without any DER encoding.
|
||||||
*
|
*
|
||||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
* @return A copy of the underlying nonce bytes
|
||||||
* is currently supported.
|
|
||||||
*
|
|
||||||
* @throws IOException if an unsupported name is provided or an error
|
|
||||||
* occurs during re-encoding of the extension.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
public byte[] getNonceValue() {
|
||||||
public void delete(String name) throws IOException {
|
return nonceData.clone();
|
||||||
if (name.equalsIgnoreCase(NONCE)) {
|
|
||||||
nonceData = null;
|
|
||||||
} else {
|
|
||||||
throw new IOException("Attribute name not recognized by"
|
|
||||||
+ " CertAttrSet:" + extensionName + ".");
|
|
||||||
}
|
|
||||||
encodeInternal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a printable representation of the {@code OCSPNonceExtension}.
|
* Returns a printable representation of the {@code OCSPNonceExtension}.
|
||||||
|
*
|
||||||
|
* @return a string representation of the extension.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String s = super.toString() + extensionName + ": " +
|
StringBuilder sb = new StringBuilder();
|
||||||
((nonceData == null) ? "" : Debug.toString(nonceData))
|
sb.append(super.toString()).append(EXTENSION_NAME).append(": ");
|
||||||
+ "\n";
|
sb.append((nonceData == null) ? "" : Debug.toString(nonceData));
|
||||||
return (s);
|
sb.append("\n");
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the extension to an {@code OutputStream}
|
* Return the name of the extension as a {@code String}
|
||||||
*
|
*
|
||||||
* @param out the {@code OutputStream} to write the extension to.
|
* @return the name of the extension
|
||||||
*
|
|
||||||
* @throws IOException on encoding errors.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void encode(OutputStream out) throws IOException {
|
|
||||||
encode(out, PKIXExtensions.OCSPNonce_Id, this.critical);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the extension to the DerOutputStream.
|
|
||||||
*
|
|
||||||
* @param out the {@code OutputStream} to write the extension to.
|
|
||||||
* @param extensionId the {@code ObjectIdentifier} used for this extension
|
|
||||||
* @param isCritical a flag indicating if the criticality bit is set for
|
|
||||||
* this extension.
|
|
||||||
*
|
|
||||||
* @throws IOException on encoding errors.
|
|
||||||
*/
|
|
||||||
protected void encode(OutputStream out, ObjectIdentifier extensionId,
|
|
||||||
boolean isCritical) throws IOException {
|
|
||||||
|
|
||||||
DerOutputStream tmp = new DerOutputStream();
|
|
||||||
|
|
||||||
if (this.extensionValue == null) {
|
|
||||||
this.extensionId = extensionId;
|
|
||||||
this.critical = isCritical;
|
|
||||||
encodeInternal();
|
|
||||||
}
|
|
||||||
super.encode(tmp);
|
|
||||||
out.write(tmp.toByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an enumeration of names of attributes existing within this
|
|
||||||
* attribute.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Enumeration<String> getElements() {
|
|
||||||
AttributeNameEnumeration elements = new AttributeNameEnumeration();
|
|
||||||
elements.addElement(NONCE);
|
|
||||||
return (elements.elements());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name of this attribute.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (extensionName);
|
return EXTENSION_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,7 @@ import java.security.cert.CRLException;
|
|||||||
import java.security.cert.CRLSelector;
|
import java.security.cert.CRLSelector;
|
||||||
import java.security.cert.URICertStoreParameters;
|
import java.security.cert.URICertStoreParameters;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.security.cert.X509CertSelector;
|
|
||||||
import java.security.cert.X509CRL;
|
import java.security.cert.X509CRL;
|
||||||
import java.security.cert.X509CRLSelector;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -160,12 +158,11 @@ class URICertStore extends CertStoreSpi {
|
|||||||
throw new InvalidAlgorithmParameterException
|
throw new InvalidAlgorithmParameterException
|
||||||
("params must be instanceof URICertStoreParameters");
|
("params must be instanceof URICertStoreParameters");
|
||||||
}
|
}
|
||||||
this.uri = ((URICertStoreParameters) params).uri;
|
this.uri = ((URICertStoreParameters) params).getURI();
|
||||||
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
|
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
|
||||||
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
|
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
|
||||||
ldap = true;
|
ldap = true;
|
||||||
URICertStoreParameters lparams = new URICertStoreParameters(uri);
|
ldapCertStore = CertStore.getInstance("LDAP", params);
|
||||||
ldapCertStore = CertStore.getInstance("LDAP", lparams);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
factory = CertificateFactory.getInstance("X.509");
|
factory = CertificateFactory.getInstance("X.509");
|
||||||
@ -183,7 +180,7 @@ class URICertStore extends CertStoreSpi {
|
|||||||
static synchronized CertStore getInstance(URICertStoreParameters params)
|
static synchronized CertStore getInstance(URICertStoreParameters params)
|
||||||
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
debug.println("CertStore URI:" + params.uri);
|
debug.println("CertStore URI:" + params.getURI());
|
||||||
}
|
}
|
||||||
CertStore ucs = certStoreCache.get(params);
|
CertStore ucs = certStoreCache.get(params);
|
||||||
if (ucs == null) {
|
if (ucs == null) {
|
||||||
@ -212,8 +209,7 @@ class URICertStore extends CertStoreSpi {
|
|||||||
}
|
}
|
||||||
URI uri = ((URIName) gn).getURI();
|
URI uri = ((URIName) gn).getURI();
|
||||||
try {
|
try {
|
||||||
return URICertStore.getInstance
|
return URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||||
(new URICertStore.URICertStoreParameters(uri));
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
debug.println("exception creating CertStore: " + ex);
|
debug.println("exception creating CertStore: " + ex);
|
||||||
@ -420,40 +416,6 @@ class URICertStore extends CertStoreSpi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* CertStoreParameters for the URICertStore.
|
|
||||||
*/
|
|
||||||
static class URICertStoreParameters implements CertStoreParameters {
|
|
||||||
private final URI uri;
|
|
||||||
private volatile int hashCode = 0;
|
|
||||||
URICertStoreParameters(URI uri) {
|
|
||||||
this.uri = uri;
|
|
||||||
}
|
|
||||||
@Override public boolean equals(Object obj) {
|
|
||||||
if (!(obj instanceof URICertStoreParameters)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
URICertStoreParameters params = (URICertStoreParameters) obj;
|
|
||||||
return uri.equals(params.uri);
|
|
||||||
}
|
|
||||||
@Override public int hashCode() {
|
|
||||||
if (hashCode == 0) {
|
|
||||||
int result = 17;
|
|
||||||
result = 37*result + uri.hashCode();
|
|
||||||
hashCode = result;
|
|
||||||
}
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
@Override public Object clone() {
|
|
||||||
try {
|
|
||||||
return super.clone();
|
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
/* Cannot happen */
|
|
||||||
throw new InternalError(e.toString(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class allows the URICertStore to be accessed as a CertStore.
|
* This class allows the URICertStore to be accessed as a CertStore.
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,7 @@ import java.util.Objects;
|
|||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import sun.util.locale.provider.JRELocaleProviderAdapter;
|
import sun.util.locale.provider.JRELocaleProviderAdapter;
|
||||||
import sun.util.locale.provider.LocaleProviderAdapter;
|
import sun.util.locale.provider.LocaleProviderAdapter;
|
||||||
import sun.util.locale.provider.LocaleDataMetaInfo;
|
import sun.util.locale.provider.LocaleDataMetaInfo;
|
||||||
@ -148,11 +149,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
|||||||
private List<Locale> applyParentLocales(String baseName, List<Locale> candidates) {
|
private List<Locale> applyParentLocales(String baseName, List<Locale> candidates) {
|
||||||
if (Objects.isNull(parentLocalesMap)) {
|
if (Objects.isNull(parentLocalesMap)) {
|
||||||
Map<Locale, Locale> map = new HashMap<>();
|
Map<Locale, Locale> map = new HashMap<>();
|
||||||
Map<String, String> parentLocales = baseMetaInfo.parentLocales();
|
baseMetaInfo.parentLocales().forEach((parent, children) -> {
|
||||||
parentLocales.keySet().forEach(parent -> {
|
Stream.of(children).forEach(child -> {
|
||||||
Arrays.asList(parentLocales.get(parent).split(" ")).stream().forEach(child -> {
|
map.put(Locale.forLanguageTag(child), parent);
|
||||||
map.put(Locale.forLanguageTag(child),
|
|
||||||
"root".equals(parent) ? Locale.ROOT : Locale.forLanguageTag(parent));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
parentLocalesMap = Collections.unmodifiableMap(map);
|
parentLocalesMap = Collections.unmodifiableMap(map);
|
||||||
|
@ -57,6 +57,7 @@ Java_java_net_InetAddress_init(JNIEnv *env, jclass cls) {
|
|||||||
c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder");
|
c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder");
|
||||||
CHECK_NULL(c);
|
CHECK_NULL(c);
|
||||||
iac_class = (*env)->NewGlobalRef(env, c);
|
iac_class = (*env)->NewGlobalRef(env, c);
|
||||||
|
CHECK_NULL(iac_class);
|
||||||
ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
|
ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
|
||||||
CHECK_NULL(ia_holderID);
|
CHECK_NULL(ia_holderID);
|
||||||
ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
|
ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -130,6 +130,8 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
|||||||
|
|
||||||
protected native void disconnect0(int family);
|
protected native void disconnect0(int family);
|
||||||
|
|
||||||
|
native int dataAvailable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform class load-time initializations.
|
* Perform class load-time initializations.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,3 +31,4 @@
|
|||||||
# and may not be available in a future release.
|
# and may not be available in a future release.
|
||||||
#
|
#
|
||||||
-server KNOWN
|
-server KNOWN
|
||||||
|
-client IGNORE
|
||||||
|
@ -35,14 +35,20 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef __solaris__
|
#if defined(__solaris__)
|
||||||
#include <libscf.h>
|
#include <libscf.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
|
#include "TimeZone_md.h"
|
||||||
|
|
||||||
#define SKIP_SPACE(p) while (*p == ' ' || *p == '\t') p++;
|
#define SKIP_SPACE(p) while (*p == ' ' || *p == '\t') p++;
|
||||||
|
|
||||||
|
#if defined(_ALLBSD_SOURCE)
|
||||||
|
#define dirent64 dirent
|
||||||
|
#define readdir64_r readdir_r
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
|
#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
|
||||||
#define fileopen fopen
|
#define fileopen fopen
|
||||||
#define filegets fgets
|
#define filegets fgets
|
||||||
@ -50,19 +56,20 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||||
|
|
||||||
|
|
||||||
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
|
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
|
||||||
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
|
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
|
||||||
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
|
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
|
||||||
#else
|
#else
|
||||||
#ifdef _AIX
|
|
||||||
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
|
||||||
#endif
|
|
||||||
static const char *SYS_INIT_FILE = "/etc/default/init";
|
static const char *SYS_INIT_FILE = "/etc/default/init";
|
||||||
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
|
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
|
||||||
static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
|
static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
|
||||||
#endif /*__linux__*/
|
#endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
|
||||||
|
|
||||||
|
#if defined(_AIX)
|
||||||
|
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a pointer to the zone ID portion of the given zoneinfo file
|
* Returns a pointer to the zone ID portion of the given zoneinfo file
|
||||||
@ -108,8 +115,8 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
|||||||
{
|
{
|
||||||
DIR *dirp = NULL;
|
DIR *dirp = NULL;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
struct dirent *dp = NULL;
|
struct dirent64 *dp = NULL;
|
||||||
struct dirent *entry = NULL;
|
struct dirent64 *entry = NULL;
|
||||||
char *pathname = NULL;
|
char *pathname = NULL;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
char *dbuf = NULL;
|
char *dbuf = NULL;
|
||||||
@ -120,19 +127,13 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = (struct dirent *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
entry = (struct dirent64 *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
(void) closedir(dirp);
|
(void) closedir(dirp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_AIX) || defined(__linux__) || defined(MACOSX) || (defined(__solaris__) \
|
while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
||||||
&& (defined(_POSIX_PTHREAD_SEMANTICS) || defined(_LP64)))
|
|
||||||
while (readdir_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
|
||||||
#else
|
|
||||||
while ((dp = readdir_r(dirp, entry)) != NULL) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip '.' and '..' (and possibly other .* files)
|
* Skip '.' and '..' (and possibly other .* files)
|
||||||
*/
|
*/
|
||||||
@ -145,7 +146,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
|||||||
*/
|
*/
|
||||||
if ((strcmp(dp->d_name, "ROC") == 0)
|
if ((strcmp(dp->d_name, "ROC") == 0)
|
||||||
|| (strcmp(dp->d_name, "posixrules") == 0)
|
|| (strcmp(dp->d_name, "posixrules") == 0)
|
||||||
#ifdef __solaris__
|
#if defined(__solaris__)
|
||||||
/*
|
/*
|
||||||
* Skip the "src" and "tab" directories on Solaris.
|
* Skip the "src" and "tab" directories on Solaris.
|
||||||
*/
|
*/
|
||||||
@ -230,7 +231,7 @@ getPlatformTimeZoneID()
|
|||||||
char *buf;
|
char *buf;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__)
|
||||||
/*
|
/*
|
||||||
* Try reading the /etc/timezone file for Debian distros. There's
|
* Try reading the /etc/timezone file for Debian distros. There's
|
||||||
* no spec of the file format available. This parsing assumes that
|
* no spec of the file format available. This parsing assumes that
|
||||||
@ -254,7 +255,7 @@ getPlatformTimeZoneID()
|
|||||||
return tz;
|
return tz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* __linux__ */
|
#endif /* defined(__linux__) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Next, try /etc/localtime to find the zone ID.
|
* Next, try /etc/localtime to find the zone ID.
|
||||||
@ -318,8 +319,9 @@ getPlatformTimeZoneID()
|
|||||||
free((void *) buf);
|
free((void *) buf);
|
||||||
return tz;
|
return tz;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#ifdef __solaris__
|
#elif defined(__solaris__)
|
||||||
|
|
||||||
#if !defined(__sparcv9) && !defined(amd64)
|
#if !defined(__sparcv9) && !defined(amd64)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -444,8 +446,7 @@ filegets(char *s, int n, FILE *stream)
|
|||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
#endif /* not __sparcv9 */
|
#endif /* !defined(__sparcv9) && !defined(amd64) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Performs Solaris dependent mapping. Returns a zone ID if
|
* Performs Solaris dependent mapping. Returns a zone ID if
|
||||||
@ -546,7 +547,7 @@ cleanupScf(scf_handle_t *h,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retruns a zone ID of Solaris when the TZ value is "localtime".
|
* Returns a zone ID of Solaris when the TZ value is "localtime".
|
||||||
* First, it tries scf. If scf fails, it looks for the same file as
|
* First, it tries scf. If scf fails, it looks for the same file as
|
||||||
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
|
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
|
||||||
*/
|
*/
|
||||||
@ -615,10 +616,11 @@ getSolarisDefaultZoneID() {
|
|||||||
free((void *) buf);
|
free((void *) buf);
|
||||||
return tz;
|
return tz;
|
||||||
}
|
}
|
||||||
#endif /*__solaris__*/
|
|
||||||
#endif /*__linux__*/
|
|
||||||
|
|
||||||
#ifdef _AIX
|
#endif /* defined(__solaris__) */
|
||||||
|
|
||||||
|
#elif defined(_AIX)
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
getPlatformTimeZoneID()
|
getPlatformTimeZoneID()
|
||||||
{
|
{
|
||||||
@ -644,178 +646,33 @@ getPlatformTimeZoneID()
|
|||||||
|
|
||||||
return tz;
|
return tz;
|
||||||
}
|
}
|
||||||
static char *mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
|
||||||
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
|
||||||
* trys some libc implementation dependent mappings. If it still
|
|
||||||
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
|
||||||
* form.
|
|
||||||
*/
|
|
||||||
/*ARGSUSED1*/
|
|
||||||
char *
|
|
||||||
findJavaTZ_md(const char *java_home_dir)
|
|
||||||
{
|
|
||||||
char *tz;
|
|
||||||
char *javatz = NULL;
|
|
||||||
char *freetz = NULL;
|
|
||||||
|
|
||||||
tz = getenv("TZ");
|
|
||||||
|
|
||||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
|
||||||
if (tz == NULL) {
|
|
||||||
#else
|
|
||||||
#if defined (__solaris__) || defined(_AIX)
|
|
||||||
if (tz == NULL || *tz == '\0') {
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
tz = getPlatformTimeZoneID();
|
|
||||||
freetz = tz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove any preceding ':'
|
|
||||||
*/
|
|
||||||
if (tz != NULL && *tz == ':') {
|
|
||||||
tz++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __solaris__
|
|
||||||
if (tz != NULL && strcmp(tz, "localtime") == 0) {
|
|
||||||
tz = getSolarisDefaultZoneID();
|
|
||||||
if (freetz != NULL) {
|
|
||||||
free((void *) freetz);
|
|
||||||
}
|
|
||||||
freetz = tz;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tz != NULL) {
|
|
||||||
#ifdef __linux__
|
|
||||||
/*
|
|
||||||
* Ignore "posix/" prefix.
|
|
||||||
*/
|
|
||||||
if (strncmp(tz, "posix/", 6) == 0) {
|
|
||||||
tz += 6;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
javatz = strdup(tz);
|
|
||||||
if (freetz != NULL) {
|
|
||||||
free((void *) freetz);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _AIX
|
|
||||||
freetz = mapPlatformToJavaTimezone(java_home_dir, javatz);
|
|
||||||
if (javatz != NULL) {
|
|
||||||
free((void *) javatz);
|
|
||||||
}
|
|
||||||
javatz = freetz;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return javatz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef MACOSX
|
|
||||||
|
|
||||||
char *
|
|
||||||
getGMTOffsetID()
|
|
||||||
{
|
|
||||||
time_t offset;
|
|
||||||
char sign, buf[32];
|
|
||||||
struct tm *local_tm;
|
|
||||||
time_t clock;
|
|
||||||
time_t currenttime;
|
|
||||||
|
|
||||||
clock = time(NULL);
|
|
||||||
tzset();
|
|
||||||
local_tm = localtime(&clock);
|
|
||||||
if (local_tm->tm_gmtoff >= 0) {
|
|
||||||
offset = (time_t) local_tm->tm_gmtoff;
|
|
||||||
sign = '+';
|
|
||||||
} else {
|
|
||||||
offset = (time_t) -local_tm->tm_gmtoff;
|
|
||||||
sign = '-';
|
|
||||||
}
|
|
||||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
|
||||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
|
||||||
return strdup(buf);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
char *
|
|
||||||
getGMTOffsetID()
|
|
||||||
{
|
|
||||||
time_t offset;
|
|
||||||
char sign, buf[32];
|
|
||||||
#ifdef __solaris__
|
|
||||||
struct tm localtm;
|
|
||||||
time_t currenttime;
|
|
||||||
|
|
||||||
currenttime = time(NULL);
|
|
||||||
if (localtime_r(¤ttime, &localtm) == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = localtm.tm_isdst ? altzone : timezone;
|
|
||||||
#else
|
|
||||||
offset = timezone;
|
|
||||||
#endif /*__linux__*/
|
|
||||||
|
|
||||||
if (offset == 0) {
|
|
||||||
return strdup("GMT");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note that the time offset direction is opposite. */
|
|
||||||
if (offset > 0) {
|
|
||||||
sign = '-';
|
|
||||||
} else {
|
|
||||||
offset = -offset;
|
|
||||||
sign = '+';
|
|
||||||
}
|
|
||||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
|
||||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
|
||||||
return strdup(buf);
|
|
||||||
}
|
|
||||||
#endif /* MACOSX */
|
|
||||||
|
|
||||||
#ifdef _AIX
|
|
||||||
static char *
|
static char *
|
||||||
mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||||
FILE *tzmapf;
|
FILE *tzmapf;
|
||||||
char mapfilename[PATH_MAX+1];
|
char mapfilename[PATH_MAX + 1];
|
||||||
char line[256];
|
char line[256];
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
char temp[100], *temp_tz;
|
char *tz_buf = NULL;
|
||||||
|
char *temp_tz = NULL;
|
||||||
char *javatz = NULL;
|
char *javatz = NULL;
|
||||||
char *str_tmp = NULL;
|
size_t tz_len = 0;
|
||||||
size_t temp_tz_len = 0;
|
|
||||||
|
|
||||||
/* On AIX, the TZ environment variable may end with a comma
|
/* On AIX, the TZ environment variable may end with a comma
|
||||||
* followed by modifier fields. These are ignored here.
|
* followed by modifier fields. These are ignored here. */
|
||||||
*/
|
temp_tz = strchr(tz, ',');
|
||||||
strncpy(temp, tz, 100);
|
tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
|
||||||
temp_tz = strtok_r(temp, ",", &str_tmp);
|
tz_buf = (char *)malloc(tz_len + 1);
|
||||||
|
memcpy(tz_buf, tz, tz_len);
|
||||||
|
tz_buf[tz_len] = 0;
|
||||||
|
|
||||||
if(temp_tz == NULL)
|
/* Open tzmappings file, with buffer overrun check */
|
||||||
goto tzerr;
|
if ((strlen(java_home_dir) + 15) > PATH_MAX) {
|
||||||
|
jio_fprintf(stderr, "Path %s/lib/tzmappings exceeds maximum path length\n", java_home_dir);
|
||||||
temp_tz_len = strlen(temp_tz);
|
|
||||||
|
|
||||||
if (strlen(java_home_dir) >= (PATH_MAX - 15)) {
|
|
||||||
jio_fprintf(stderr, "java.home longer than maximum path length \n");
|
|
||||||
goto tzerr;
|
goto tzerr;
|
||||||
}
|
}
|
||||||
|
strcpy(mapfilename, java_home_dir);
|
||||||
strncpy(mapfilename, java_home_dir, PATH_MAX);
|
|
||||||
strcat(mapfilename, "/lib/tzmappings");
|
strcat(mapfilename, "/lib/tzmappings");
|
||||||
|
|
||||||
if ((tzmapf = fopen(mapfilename, "r")) == NULL) {
|
if ((tzmapf = fopen(mapfilename, "r")) == NULL) {
|
||||||
jio_fprintf(stderr, "can't open %s\n", mapfilename);
|
jio_fprintf(stderr, "can't open %s\n", mapfilename);
|
||||||
goto tzerr;
|
goto tzerr;
|
||||||
@ -848,7 +705,7 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
if ((result = strncmp(temp_tz, sol, temp_tz_len)) == 0) {
|
if ((result = strncmp(tz_buf, sol, tz_len)) == 0) {
|
||||||
/*
|
/*
|
||||||
* If this is the current platform zone ID,
|
* If this is the current platform zone ID,
|
||||||
* take the Java time zone ID (2nd field).
|
* take the Java time zone ID (2nd field).
|
||||||
@ -874,11 +731,150 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
|||||||
(void) fclose(tzmapf);
|
(void) fclose(tzmapf);
|
||||||
|
|
||||||
tzerr:
|
tzerr:
|
||||||
|
if (tz_buf != NULL ) {
|
||||||
|
free((void *) tz_buf);
|
||||||
|
}
|
||||||
|
|
||||||
if (javatz == NULL) {
|
if (javatz == NULL) {
|
||||||
return getGMTOffsetID();
|
return getGMTOffsetID();
|
||||||
}
|
}
|
||||||
|
|
||||||
return javatz;
|
return javatz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(_AIX) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
||||||
|
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
||||||
|
* trys some libc implementation dependent mappings. If it still
|
||||||
|
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
||||||
|
* form.
|
||||||
|
*/
|
||||||
|
/*ARGSUSED1*/
|
||||||
|
char *
|
||||||
|
findJavaTZ_md(const char *java_home_dir)
|
||||||
|
{
|
||||||
|
char *tz;
|
||||||
|
char *javatz = NULL;
|
||||||
|
char *freetz = NULL;
|
||||||
|
|
||||||
|
tz = getenv("TZ");
|
||||||
|
|
||||||
|
if (tz == NULL || *tz == '\0') {
|
||||||
|
tz = getPlatformTimeZoneID();
|
||||||
|
freetz = tz;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tz != NULL) {
|
||||||
|
/* Ignore preceding ':' */
|
||||||
|
if (*tz == ':') {
|
||||||
|
tz++;
|
||||||
|
}
|
||||||
|
#if defined(__linux__)
|
||||||
|
/* Ignore "posix/" prefix on Linux. */
|
||||||
|
if (strncmp(tz, "posix/", 6) == 0) {
|
||||||
|
tz += 6;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_AIX)
|
||||||
|
/* On AIX do the platform to Java mapping. */
|
||||||
|
javatz = mapPlatformToJavaTimezone(java_home_dir, tz);
|
||||||
|
if (freetz != NULL) {
|
||||||
|
free((void *) freetz);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#if defined(__solaris__)
|
||||||
|
/* Solaris might use localtime, so handle it here. */
|
||||||
|
if (strcmp(tz, "localtime") == 0) {
|
||||||
|
javatz = getSolarisDefaultZoneID();
|
||||||
|
if (freetz != NULL) {
|
||||||
|
free((void *) freetz);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
if (freetz == NULL) {
|
||||||
|
/* strdup if we are still working on getenv result. */
|
||||||
|
javatz = strdup(tz);
|
||||||
|
} else if (freetz != tz) {
|
||||||
|
/* strdup and free the old buffer, if we moved the pointer. */
|
||||||
|
javatz = strdup(tz);
|
||||||
|
free((void *) freetz);
|
||||||
|
} else {
|
||||||
|
/* we are good if we already work on a freshly allocated buffer. */
|
||||||
|
javatz = tz;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return javatz;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(MACOSX)
|
||||||
|
|
||||||
|
char *
|
||||||
|
getGMTOffsetID()
|
||||||
|
{
|
||||||
|
time_t offset;
|
||||||
|
char sign, buf[32];
|
||||||
|
struct tm *local_tm;
|
||||||
|
time_t clock;
|
||||||
|
time_t currenttime;
|
||||||
|
|
||||||
|
clock = time(NULL);
|
||||||
|
tzset();
|
||||||
|
local_tm = localtime(&clock);
|
||||||
|
if (local_tm->tm_gmtoff >= 0) {
|
||||||
|
offset = (time_t) local_tm->tm_gmtoff;
|
||||||
|
sign = '+';
|
||||||
|
} else {
|
||||||
|
offset = (time_t) -local_tm->tm_gmtoff;
|
||||||
|
sign = '-';
|
||||||
|
}
|
||||||
|
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||||
|
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||||
|
return strdup(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
char *
|
||||||
|
getGMTOffsetID()
|
||||||
|
{
|
||||||
|
time_t offset;
|
||||||
|
char sign, buf[32];
|
||||||
|
#if defined(__solaris__)
|
||||||
|
struct tm localtm;
|
||||||
|
time_t currenttime;
|
||||||
|
|
||||||
|
currenttime = time(NULL);
|
||||||
|
if (localtime_r(¤ttime, &localtm) == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = localtm.tm_isdst ? altzone : timezone;
|
||||||
|
#else
|
||||||
|
offset = timezone;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (offset == 0) {
|
||||||
|
return strdup("GMT");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note that the time offset direction is opposite. */
|
||||||
|
if (offset > 0) {
|
||||||
|
sign = '-';
|
||||||
|
} else {
|
||||||
|
offset = -offset;
|
||||||
|
sign = '+';
|
||||||
|
}
|
||||||
|
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||||
|
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||||
|
return strdup(buf);
|
||||||
|
}
|
||||||
|
#endif /* MACOSX */
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#ifdef __solaris__
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stropts.h>
|
|
||||||
|
|
||||||
#ifndef BSD_COMP
|
|
||||||
#define BSD_COMP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
#include "jvm.h"
|
|
||||||
#include "jni_util.h"
|
|
||||||
#include "net_util.h"
|
|
||||||
|
|
||||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
|
||||||
|
|
||||||
static jfieldID IO_fd_fdID;
|
|
||||||
|
|
||||||
static jfieldID apdsi_fdID;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
|
||||||
* Method: init
|
|
||||||
* Signature: ()V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
|
||||||
|
|
||||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
|
||||||
"Ljava/io/FileDescriptor;");
|
|
||||||
CHECK_NULL(apdsi_fdID);
|
|
||||||
|
|
||||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
|
||||||
* Method: dataAvailable
|
|
||||||
* Signature: ()I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
|
||||||
(JNIEnv *env, jobject this) {
|
|
||||||
int fd, retval;
|
|
||||||
|
|
||||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
|
||||||
"Socket closed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
|
||||||
|
|
||||||
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -32,6 +32,12 @@
|
|||||||
|
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stropts.h>
|
||||||
|
|
||||||
|
#ifndef BSD_COMP
|
||||||
|
#define BSD_COMP
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -52,6 +58,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#ifndef IPTOS_TOS_MASK
|
#ifndef IPTOS_TOS_MASK
|
||||||
#define IPTOS_TOS_MASK 0x1e
|
#define IPTOS_TOS_MASK 0x1e
|
||||||
#endif
|
#endif
|
||||||
@ -2240,3 +2248,28 @@ Java_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
|||||||
{
|
{
|
||||||
mcast_join_leave(env, this, iaObj, niObj, JNI_FALSE);
|
mcast_join_leave(env, this, iaObj, niObj, JNI_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: java_net_PlainDatagramSocketImpl
|
||||||
|
* Method: dataAvailable
|
||||||
|
* Signature: ()I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_java_net_PlainDatagramSocketImpl_dataAvailable(JNIEnv *env, jobject this)
|
||||||
|
{
|
||||||
|
int fd, retval;
|
||||||
|
|
||||||
|
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||||
|
|
||||||
|
if (IS_NULL(fdObj)) {
|
||||||
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
|
"Socket closed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
|
|
||||||
|
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
@ -118,6 +118,8 @@ Java_sun_net_sdp_SdpSupport_convert0(JNIEnv *env, jclass cls, int fd)
|
|||||||
RESTARTABLE(dup2(s, fd), res);
|
RESTARTABLE(dup2(s, fd), res);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
JNU_ThrowIOExceptionWithLastError(env, "dup2");
|
JNU_ThrowIOExceptionWithLastError(env, "dup2");
|
||||||
RESTARTABLE(close(s), res);
|
res = close(s);
|
||||||
|
if (res < 0 && !(*env)->ExceptionOccurred(env))
|
||||||
|
JNU_ThrowIOExceptionWithLastError(env, "close");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -45,7 +45,7 @@ import java.security.PrivilegedAction;
|
|||||||
|
|
||||||
class DefaultDatagramSocketImplFactory
|
class DefaultDatagramSocketImplFactory
|
||||||
{
|
{
|
||||||
static Class<?> prefixImplClass = null;
|
private final static Class<?> prefixImplClass;
|
||||||
|
|
||||||
/* the windows version. */
|
/* the windows version. */
|
||||||
private static float version;
|
private static float version;
|
||||||
@ -54,16 +54,19 @@ class DefaultDatagramSocketImplFactory
|
|||||||
private static boolean preferIPv4Stack = false;
|
private static boolean preferIPv4Stack = false;
|
||||||
|
|
||||||
/* If the version supports a dual stack TCP implementation */
|
/* If the version supports a dual stack TCP implementation */
|
||||||
private static boolean useDualStackImpl = false;
|
private final static boolean useDualStackImpl;
|
||||||
|
|
||||||
/* sun.net.useExclusiveBind */
|
/* sun.net.useExclusiveBind */
|
||||||
private static String exclBindProp;
|
private static String exclBindProp;
|
||||||
|
|
||||||
/* True if exclusive binding is on for Windows */
|
/* True if exclusive binding is on for Windows */
|
||||||
private static boolean exclusiveBind = true;
|
private final static boolean exclusiveBind;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
Class<?> prefixImplClassLocal = null;
|
||||||
|
boolean useDualStackImplLocal = false;
|
||||||
|
boolean exclusiveBindLocal = true;
|
||||||
|
|
||||||
// Determine Windows Version.
|
// Determine Windows Version.
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Object>() {
|
new PrivilegedAction<Object>() {
|
||||||
@ -78,7 +81,7 @@ class DefaultDatagramSocketImplFactory
|
|||||||
"java.net.preferIPv4Stack"));
|
"java.net.preferIPv4Stack"));
|
||||||
exclBindProp = System.getProperty(
|
exclBindProp = System.getProperty(
|
||||||
"sun.net.useExclusiveBind");
|
"sun.net.useExclusiveBind");
|
||||||
} catch (NumberFormatException e ) {
|
} catch (NumberFormatException e) {
|
||||||
assert false : e;
|
assert false : e;
|
||||||
}
|
}
|
||||||
return null; // nothing to return
|
return null; // nothing to return
|
||||||
@ -87,14 +90,14 @@ class DefaultDatagramSocketImplFactory
|
|||||||
|
|
||||||
// (version >= 6.0) implies Vista or greater.
|
// (version >= 6.0) implies Vista or greater.
|
||||||
if (version >= 6.0 && !preferIPv4Stack) {
|
if (version >= 6.0 && !preferIPv4Stack) {
|
||||||
useDualStackImpl = true;
|
useDualStackImplLocal = true;
|
||||||
}
|
}
|
||||||
if (exclBindProp != null) {
|
if (exclBindProp != null) {
|
||||||
// sun.net.useExclusiveBind is true
|
// sun.net.useExclusiveBind is true
|
||||||
exclusiveBind = exclBindProp.length() == 0 ? true
|
exclusiveBindLocal = exclBindProp.length() == 0 ? true
|
||||||
: Boolean.parseBoolean(exclBindProp);
|
: Boolean.parseBoolean(exclBindProp);
|
||||||
} else if (version < 6.0) {
|
} else if (version < 6.0) {
|
||||||
exclusiveBind = false;
|
exclusiveBindLocal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl.prefix
|
// impl.prefix
|
||||||
@ -103,12 +106,16 @@ class DefaultDatagramSocketImplFactory
|
|||||||
prefix = AccessController.doPrivileged(
|
prefix = AccessController.doPrivileged(
|
||||||
new sun.security.action.GetPropertyAction("impl.prefix", null));
|
new sun.security.action.GetPropertyAction("impl.prefix", null));
|
||||||
if (prefix != null)
|
if (prefix != null)
|
||||||
prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Can't find class: java.net." +
|
System.err.println("Can't find class: java.net." +
|
||||||
prefix +
|
prefix +
|
||||||
"DatagramSocketImpl: check impl.prefix property");
|
"DatagramSocketImpl: check impl.prefix property");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefixImplClass = prefixImplClassLocal;
|
||||||
|
useDualStackImpl = useDualStackImplLocal;
|
||||||
|
exclusiveBind = exclusiveBindLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,12 +133,10 @@ class DefaultDatagramSocketImplFactory
|
|||||||
throw new SocketException("can't instantiate DatagramSocketImpl");
|
throw new SocketException("can't instantiate DatagramSocketImpl");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isMulticast)
|
|
||||||
exclusiveBind = false;
|
|
||||||
if (useDualStackImpl && !isMulticast)
|
if (useDualStackImpl && !isMulticast)
|
||||||
return new DualStackPlainDatagramSocketImpl(exclusiveBind);
|
return new DualStackPlainDatagramSocketImpl(exclusiveBind);
|
||||||
else
|
else
|
||||||
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind);
|
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind && !isMulticast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -292,4 +292,6 @@ class DualStackPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
|||||||
int optionValue) throws SocketException;
|
int optionValue) throws SocketException;
|
||||||
|
|
||||||
private static native int socketGetIntOption(int fd, int cmd) throws SocketException;
|
private static native int socketGetIntOption(int fd, int cmd) throws SocketException;
|
||||||
|
|
||||||
|
native int dataAvailable();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -207,6 +207,8 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
|||||||
|
|
||||||
protected native void disconnect0(int family);
|
protected native void disconnect0(int family);
|
||||||
|
|
||||||
|
native int dataAvailable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform class load-time initializations.
|
* Perform class load-time initializations.
|
||||||
*/
|
*/
|
||||||
|
@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <winsock2.h>
|
|
||||||
|
|
||||||
#include "jvm.h"
|
|
||||||
#include "jni_util.h"
|
|
||||||
#include "net_util.h"
|
|
||||||
|
|
||||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
|
||||||
|
|
||||||
static jfieldID IO_fd_fdID = NULL;
|
|
||||||
static jfieldID apdsi_fdID = NULL;
|
|
||||||
|
|
||||||
static jfieldID apdsi_fd1ID = NULL;
|
|
||||||
static jclass two_stacks_clazz = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
|
||||||
* Method: init
|
|
||||||
* Signature: ()V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
|
||||||
|
|
||||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
|
||||||
"Ljava/io/FileDescriptor;");
|
|
||||||
CHECK_NULL(apdsi_fdID);
|
|
||||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
|
||||||
CHECK_NULL(IO_fd_fdID);
|
|
||||||
|
|
||||||
two_stacks_clazz = (*env)->FindClass(env, "java/net/TwoStacksPlainDatagramSocketImpl");
|
|
||||||
CHECK_NULL(two_stacks_clazz);
|
|
||||||
|
|
||||||
/* Handle both TwoStacks and DualStack here */
|
|
||||||
|
|
||||||
if (JNU_Equals(env, cls, two_stacks_clazz)) {
|
|
||||||
/* fd1 present only in TwoStack.. */
|
|
||||||
apdsi_fd1ID = (*env)->GetFieldID(env, cls, "fd1",
|
|
||||||
"Ljava/io/FileDescriptor;");
|
|
||||||
CHECK_NULL(apdsi_fd1ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNU_CHECK_EXCEPTION(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
|
||||||
* Method: dataAvailable
|
|
||||||
* Signature: ()I
|
|
||||||
*/
|
|
||||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
|
||||||
(JNIEnv *env, jobject this) {
|
|
||||||
SOCKET fd;
|
|
||||||
SOCKET fd1;
|
|
||||||
int rv = -1, rv1 = -1;
|
|
||||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
|
||||||
|
|
||||||
if (!IS_NULL(fdObj)) {
|
|
||||||
int retval = 0;
|
|
||||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
|
||||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
|
||||||
if (retval > 0) {
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IS_NULL(apdsi_fd1ID)) {
|
|
||||||
/* TwoStacks */
|
|
||||||
jobject fd1Obj = (*env)->GetObjectField(env, this, apdsi_fd1ID);
|
|
||||||
if (!IS_NULL(fd1Obj)) {
|
|
||||||
int retval = 0;
|
|
||||||
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
|
||||||
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
|
||||||
if (retval > 0) {
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rv < 0 && rv1 < 0) {
|
|
||||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
|
||||||
"Socket closed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -70,6 +70,9 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
|||||||
return got_icmp;
|
return got_icmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jfieldID IO_fd_fdID = NULL;
|
||||||
|
static jfieldID pdsi_fdID = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: java_net_DualStackPlainDatagramSocketImpl
|
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||||
* Method: initIDs
|
* Method: initIDs
|
||||||
@ -78,6 +81,13 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
|||||||
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_initIDs
|
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_initIDs
|
||||||
(JNIEnv *env, jclass clazz)
|
(JNIEnv *env, jclass clazz)
|
||||||
{
|
{
|
||||||
|
pdsi_fdID = (*env)->GetFieldID(env, clazz, "fd",
|
||||||
|
"Ljava/io/FileDescriptor;");
|
||||||
|
CHECK_NULL(pdsi_fdID);
|
||||||
|
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||||
|
CHECK_NULL(IO_fd_fdID);
|
||||||
|
JNU_CHECK_EXCEPTION(env);
|
||||||
|
|
||||||
initInetAddressIDs(env);
|
initInetAddressIDs(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,3 +513,32 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketGetI
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||||
|
* Method: dataAvailable
|
||||||
|
* Signature: ()I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_dataAvailable
|
||||||
|
(JNIEnv *env, jobject this) {
|
||||||
|
SOCKET fd;
|
||||||
|
int rv = -1;
|
||||||
|
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||||
|
|
||||||
|
if (!IS_NULL(fdObj)) {
|
||||||
|
int retval = 0;
|
||||||
|
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
|
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||||
|
if (retval > 0) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rv < 0) {
|
||||||
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
|
"Socket closed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -45,9 +45,10 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_initIDs
|
|||||||
jclass cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
|
jclass cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
|
||||||
CHECK_NULL(cls);
|
CHECK_NULL(cls);
|
||||||
isa_class = (*env)->NewGlobalRef(env, cls);
|
isa_class = (*env)->NewGlobalRef(env, cls);
|
||||||
|
CHECK_NULL(isa_class);
|
||||||
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
|
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
|
||||||
"(Ljava/net/InetAddress;I)V");
|
"(Ljava/net/InetAddress;I)V");
|
||||||
|
CHECK_NULL(isa_ctorID);
|
||||||
initInetAddressIDs(env);
|
initInetAddressIDs(env);
|
||||||
|
|
||||||
// implement read timeout with select.
|
// implement read timeout with select.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2563,3 +2563,44 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
|||||||
{
|
{
|
||||||
mcast_join_leave (env, this, iaObj, niObj, JNI_FALSE);
|
mcast_join_leave (env, this, iaObj, niObj, JNI_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: java_net_TwoStacksPlainDatagramSocketImpl
|
||||||
|
* Method: dataAvailable
|
||||||
|
* Signature: ()I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_java_net_TwoStacksPlainDatagramSocketImpl_dataAvailable
|
||||||
|
(JNIEnv *env, jobject this) {
|
||||||
|
SOCKET fd;
|
||||||
|
SOCKET fd1;
|
||||||
|
int rv = -1, rv1 = -1;
|
||||||
|
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||||
|
jobject fd1Obj;
|
||||||
|
|
||||||
|
if (!IS_NULL(fdObj)) {
|
||||||
|
int retval = 0;
|
||||||
|
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
|
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||||
|
if (retval > 0) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||||
|
if (!IS_NULL(fd1Obj)) {
|
||||||
|
int retval = 0;
|
||||||
|
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||||
|
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
||||||
|
if (retval > 0) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rv < 0 && rv1 < 0) {
|
||||||
|
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||||
|
"Socket closed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -224,7 +224,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
|||||||
* Set the value to be associated with the given name, replacing
|
* Set the value to be associated with the given name, replacing
|
||||||
* any previous association.
|
* any previous association.
|
||||||
*
|
*
|
||||||
* @throw IllegalArgumentException if parameter or value is illegal
|
* @throws IllegalArgumentException if parameter or value is illegal
|
||||||
*/
|
*/
|
||||||
public void setParameter(String name, String value) {
|
public void setParameter(String name, String value) {
|
||||||
parameters.set(name, value);
|
parameters.set(name, value);
|
||||||
@ -233,7 +233,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
|||||||
/**
|
/**
|
||||||
* Remove any value associated with the given name.
|
* Remove any value associated with the given name.
|
||||||
*
|
*
|
||||||
* @throw IllegalArgumentException if parameter may not be deleted
|
* @throws IllegalArgumentException if parameter may not be deleted
|
||||||
*/
|
*/
|
||||||
public void removeParameter(String name) {
|
public void removeParameter(String name) {
|
||||||
parameters.remove(name);
|
parameters.remove(name);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -58,6 +58,7 @@ class AquaComboBoxButton extends JButton {
|
|||||||
this.list = list;
|
this.list = list;
|
||||||
|
|
||||||
setModel(new DefaultButtonModel() {
|
setModel(new DefaultButtonModel() {
|
||||||
|
@Override
|
||||||
public void setArmed(final boolean armed) {
|
public void setArmed(final boolean armed) {
|
||||||
super.setArmed(isPressed() ? true : armed);
|
super.setArmed(isPressed() ? true : armed);
|
||||||
}
|
}
|
||||||
@ -66,12 +67,13 @@ class AquaComboBoxButton extends JButton {
|
|||||||
setEnabled(comboBox.isEnabled());
|
setEnabled(comboBox.isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return comboBox == null ? true : comboBox.isEnabled();
|
return comboBox == null ? true : comboBox.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@Override
|
||||||
public boolean isFocusTraversable() {
|
public boolean isFocusable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +94,7 @@ class AquaComboBoxButton extends JButton {
|
|||||||
return State.ACTIVE;
|
return State.ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
// Don't Paint the button as usual
|
// Don't Paint the button as usual
|
||||||
// super.paintComponent( g );
|
// super.paintComponent( g );
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -303,7 +303,7 @@ public class AquaInternalFrameDockIconUI extends DesktopIconUI implements MouseL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@Deprecated
|
||||||
public void hide() {
|
public void hide() {
|
||||||
final Container parent = getParent();
|
final Container parent = getParent();
|
||||||
final Rectangle r = this.getBounds();
|
final Rectangle r = this.getBounds();
|
||||||
|
@ -991,9 +991,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
|||||||
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]{"ESCAPE", "cancel"}),};
|
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]{"ESCAPE", "cancel"}),};
|
||||||
|
|
||||||
table.putDefaults(defaults);
|
table.putDefaults(defaults);
|
||||||
|
SwingUtilities2.putAATextInfo(true, table);
|
||||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
|
||||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initSystemColorDefaults(final UIDefaults table) {
|
protected void initSystemColorDefaults(final UIDefaults table) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -125,9 +125,8 @@ public abstract class OSXSurfaceData extends BufImgSurfaceData {
|
|||||||
return fConfig;
|
return fConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
protected void setBounds(int x, int y, int w, int h) {
|
protected void setBounds(int x, int y, int w, int h) {
|
||||||
fBounds.reshape(x, y, w, y + h);
|
fBounds.setBounds(x, y, w, y + h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// START compositing support API
|
// START compositing support API
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -77,7 +77,7 @@ public class CGLLayer extends CFRetainedResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object getDestination() {
|
public Object getDestination() {
|
||||||
return peer;
|
return peer.getTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SurfaceData replaceSurfaceData() {
|
public SurfaceData replaceSurfaceData() {
|
||||||
|
@ -576,6 +576,14 @@ public class LWWindowPeer
|
|||||||
: getDefaultMaximizedBounds());
|
: getDefaultMaximizedBounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rectangle getMaximizedBounds() {
|
||||||
|
synchronized (getStateLock()) {
|
||||||
|
return (maximizedBounds == null)
|
||||||
|
? getDefaultMaximizedBounds()
|
||||||
|
: maximizedBounds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setPlatformMaximizedBounds(Rectangle bounds) {
|
private void setPlatformMaximizedBounds(Rectangle bounds) {
|
||||||
platformWindow.setMaximizedBounds(
|
platformWindow.setMaximizedBounds(
|
||||||
bounds.x, bounds.y,
|
bounds.x, bounds.y,
|
||||||
|
@ -498,14 +498,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
|||||||
// to be sure that there are no setBounds requests in the queue.
|
// to be sure that there are no setBounds requests in the queue.
|
||||||
LWCToolkit.flushNativeSelectors();
|
LWCToolkit.flushNativeSelectors();
|
||||||
this.normalBounds = peer.getBounds();
|
this.normalBounds = peer.getBounds();
|
||||||
|
Rectangle maximizedBounds = peer.getMaximizedBounds();
|
||||||
GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
|
setBounds(maximizedBounds.x, maximizedBounds.y,
|
||||||
Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
|
maximizedBounds.width, maximizedBounds.height);
|
||||||
Rectangle toBounds = config.getBounds();
|
|
||||||
setBounds(toBounds.x + i.left,
|
|
||||||
toBounds.y + i.top,
|
|
||||||
toBounds.width - i.left - i.right,
|
|
||||||
toBounds.height - i.top - i.bottom);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package com.sun.java.swing.plaf.gtk;
|
package com.sun.java.swing.plaf.gtk;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
|
||||||
import java.beans.*;
|
import java.beans.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.*;
|
import java.lang.ref.*;
|
||||||
@ -41,6 +40,8 @@ import javax.swing.text.DefaultEditorKit;
|
|||||||
|
|
||||||
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
|
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
|
||||||
import com.sun.java.swing.plaf.gtk.GTKConstants.StateType;
|
import com.sun.java.swing.plaf.gtk.GTKConstants.StateType;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.UNIXToolkit;
|
import sun.awt.UNIXToolkit;
|
||||||
import sun.awt.OSInfo;
|
import sun.awt.OSInfo;
|
||||||
@ -61,7 +62,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
|||||||
* We should assume ON - or some variation of ON as no GTK desktop
|
* We should assume ON - or some variation of ON as no GTK desktop
|
||||||
* ships with it OFF.
|
* ships with it OFF.
|
||||||
*/
|
*/
|
||||||
static Object aaTextInfo;
|
static Map<Object, Object> aaTextInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Solaris, or Linux with Sun JDS in a CJK Locale.
|
* Solaris, or Linux with Sun JDS in a CJK Locale.
|
||||||
@ -1337,7 +1338,9 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
|||||||
if (fallbackFont != null) {
|
if (fallbackFont != null) {
|
||||||
table.put("TitledBorder.font", fallbackFont);
|
table.put("TitledBorder.font", fallbackFont);
|
||||||
}
|
}
|
||||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
if (aaTextInfo != null) {
|
||||||
|
table.putAll(aaTextInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initSystemColorDefaults(UIDefaults table) {
|
protected void initSystemColorDefaults(UIDefaults table) {
|
||||||
@ -1477,7 +1480,8 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
|||||||
* XRender.
|
* XRender.
|
||||||
*/
|
*/
|
||||||
gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
|
gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
|
||||||
aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
|
aaTextInfo = new HashMap<>(2);
|
||||||
|
SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ReferenceQueue<GTKLookAndFeel> queue = new ReferenceQueue<GTKLookAndFeel>();
|
static ReferenceQueue<GTKLookAndFeel> queue = new ReferenceQueue<GTKLookAndFeel>();
|
||||||
|
@ -39,6 +39,8 @@ import sun.swing.SwingUtilities2;
|
|||||||
import sun.swing.plaf.synth.SynthIcon;
|
import sun.swing.plaf.synth.SynthIcon;
|
||||||
|
|
||||||
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType;
|
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType;
|
||||||
|
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||||
|
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -115,10 +117,12 @@ class GTKStyle extends SynthStyle implements GTKConstants {
|
|||||||
@Override
|
@Override
|
||||||
public void installDefaults(SynthContext context) {
|
public void installDefaults(SynthContext context) {
|
||||||
super.installDefaults(context);
|
super.installDefaults(context);
|
||||||
if (!context.getRegion().isSubregion()) {
|
Map<Object, Object> aaTextInfo = GTKLookAndFeel.aaTextInfo;
|
||||||
context.getComponent().putClientProperty(
|
if (aaTextInfo != null && !context.getRegion().isSubregion()) {
|
||||||
SwingUtilities2.AA_TEXT_PROPERTY_KEY,
|
context.getComponent().putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||||
GTKLookAndFeel.aaTextInfo);
|
aaTextInfo.get(KEY_TEXT_ANTIALIASING));
|
||||||
|
context.getComponent().putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||||
|
aaTextInfo.get(KEY_TEXT_LCD_CONTRAST));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,8 +556,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
|||||||
* for both client property and UIDefaults.
|
* for both client property and UIDefaults.
|
||||||
* Also need to set up listeners for changes in these settings.
|
* Also need to set up listeners for changes in these settings.
|
||||||
*/
|
*/
|
||||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
SwingUtilities2.putAATextInfo(true, table);
|
||||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
this.aaSettings =
|
this.aaSettings =
|
||||||
new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
||||||
}
|
}
|
||||||
@ -835,12 +834,12 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
|||||||
"InternalFrame.closeIcon",
|
"InternalFrame.closeIcon",
|
||||||
WindowsIconFactory.createFrameCloseIcon(),
|
WindowsIconFactory.createFrameCloseIcon(),
|
||||||
"InternalFrame.icon",
|
"InternalFrame.icon",
|
||||||
(LazyValue) t -> new Object[]{
|
(LazyValue) t -> new WindowsInternalFrameTitlePane.ScalableIconUIResource(new Object[]{
|
||||||
// The constructor takes one arg: an array of UIDefaults.LazyValue
|
// The constructor takes one arg: an array of UIDefaults.LazyValue
|
||||||
// representing the icons
|
// representing the icons
|
||||||
SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
|
SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
|
||||||
SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
|
SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
|
||||||
},
|
}),
|
||||||
// Internal Frame Auditory Cue Mappings
|
// Internal Frame Auditory Cue Mappings
|
||||||
"InternalFrame.closeSound", "win.sound.close",
|
"InternalFrame.closeSound", "win.sound.close",
|
||||||
"InternalFrame.maximizeSound", "win.sound.maximize",
|
"InternalFrame.maximizeSound", "win.sound.maximize",
|
||||||
@ -2402,9 +2401,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateUI() {
|
protected void updateUI() {
|
||||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
|
||||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
SwingUtilities2.putAATextInfo(true, defaults);
|
||||||
super.updateUI();
|
super.updateUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ abstract class MultipleGradientPaintContext implements PaintContext {
|
|||||||
*
|
*
|
||||||
* @param position the unmanipulated position, which will be mapped
|
* @param position the unmanipulated position, which will be mapped
|
||||||
* into the range 0 to 1
|
* into the range 0 to 1
|
||||||
* @returns integer color to display
|
* @return integer color to display
|
||||||
*/
|
*/
|
||||||
protected final int indexIntoGradientsArrays(float position) {
|
protected final int indexIntoGradientsArrays(float position) {
|
||||||
// first, manipulate position value depending on the cycle method
|
// first, manipulate position value depending on the cycle method
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -33,13 +33,10 @@ import java.awt.image.DirectColorModel;
|
|||||||
import java.awt.image.Raster;
|
import java.awt.image.Raster;
|
||||||
import java.awt.image.WritableRaster;
|
import java.awt.image.WritableRaster;
|
||||||
import java.awt.peer.RobotPeer;
|
import java.awt.peer.RobotPeer;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.security.AccessController;
|
|
||||||
|
|
||||||
import sun.awt.AWTPermissions;
|
import sun.awt.AWTPermissions;
|
||||||
import sun.awt.ComponentFactory;
|
import sun.awt.ComponentFactory;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
import sun.awt.OSInfo;
|
|
||||||
import sun.awt.image.SunWritableRaster;
|
import sun.awt.image.SunWritableRaster;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -558,28 +555,8 @@ public class Robot {
|
|||||||
*/
|
*/
|
||||||
public synchronized void waitForIdle() {
|
public synchronized void waitForIdle() {
|
||||||
checkNotDispatchThread();
|
checkNotDispatchThread();
|
||||||
|
SunToolkit.flushPendingEvents();
|
||||||
try {
|
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
||||||
SunToolkit.flushPendingEvents();
|
|
||||||
// 7185258: realSync() call blocks all DnD tests on OS X
|
|
||||||
if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
|
|
||||||
// post a dummy event to the queue so we know when
|
|
||||||
// all the events before it have been processed
|
|
||||||
EventQueue.invokeAndWait( new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
// dummy implementation
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
|
||||||
}
|
|
||||||
} catch(InterruptedException ite) {
|
|
||||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
|
||||||
ite.printStackTrace();
|
|
||||||
} catch(InvocationTargetException ine) {
|
|
||||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
|
||||||
ine.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotDispatchThread() {
|
private void checkNotDispatchThread() {
|
||||||
@ -593,6 +570,7 @@ public class Robot {
|
|||||||
*
|
*
|
||||||
* @return the string representation.
|
* @return the string representation.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized String toString() {
|
public synchronized String toString() {
|
||||||
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
|
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
|
||||||
return getClass().getName() + "[ " + params + " ]";
|
return getClass().getName() + "[ " + params + " ]";
|
||||||
|
@ -448,7 +448,7 @@ public abstract class Toolkit {
|
|||||||
*
|
*
|
||||||
* @param s the error message
|
* @param s the error message
|
||||||
* @param e the original exception
|
* @param e the original exception
|
||||||
* @throw the new AWTError including the cause (the original exception)
|
* @throws the new AWTError including the cause (the original exception)
|
||||||
*/
|
*/
|
||||||
private static void newAWTError(Throwable e, String s) {
|
private static void newAWTError(Throwable e, String s) {
|
||||||
AWTError newAWTError = new AWTError(s);
|
AWTError newAWTError = new AWTError(s);
|
||||||
|
@ -133,13 +133,42 @@ public class JColorChooser extends JComponent implements Accessible {
|
|||||||
* returns true.
|
* returns true.
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static Color showDialog(Component component,
|
public static Color showDialog(Component component,
|
||||||
String title, Color initialColor) throws HeadlessException {
|
String title, Color initialColor) throws HeadlessException {
|
||||||
|
return showDialog(component, title, initialColor, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a modal color-chooser dialog and blocks until the
|
||||||
|
* dialog is hidden. If the user presses the "OK" button, then
|
||||||
|
* this method hides/disposes the dialog and returns the selected color.
|
||||||
|
* If the user presses the "Cancel" button or closes the dialog without
|
||||||
|
* pressing "OK", then this method hides/disposes the dialog and returns
|
||||||
|
* <code>null</code>.
|
||||||
|
*
|
||||||
|
* @param component the parent <code>Component</code> for the dialog
|
||||||
|
* @param title the String containing the dialog's title
|
||||||
|
* @param initialColor the initial Color set when the color-chooser is shown
|
||||||
|
* @param colorTransparencySelectionEnabled true if the transparency of
|
||||||
|
* a color can be selected
|
||||||
|
* @return the selected color or <code>null</code> if the user opted out
|
||||||
|
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||||
|
* returns true.
|
||||||
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static Color showDialog(Component component, String title,
|
||||||
|
Color initialColor, boolean colorTransparencySelectionEnabled)
|
||||||
|
throws HeadlessException {
|
||||||
|
|
||||||
final JColorChooser pane = new JColorChooser(initialColor != null?
|
final JColorChooser pane = new JColorChooser(initialColor != null?
|
||||||
initialColor : Color.white);
|
initialColor : Color.white);
|
||||||
|
|
||||||
|
for (AbstractColorChooserPanel ccPanel : pane.getChooserPanels()) {
|
||||||
|
ccPanel.setColorTransparencySelectionEnabled(
|
||||||
|
colorTransparencySelectionEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
ColorTracker ok = new ColorTracker(pane);
|
ColorTracker ok = new ColorTracker(pane);
|
||||||
JDialog dialog = createDialog(component, title, true, pane, ok, null);
|
JDialog dialog = createDialog(component, title, true, pane, ok, null);
|
||||||
|
|
||||||
@ -150,7 +179,6 @@ public class JColorChooser extends JComponent implements Accessible {
|
|||||||
return ok.getColor();
|
return ok.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns a new dialog containing the specified
|
* Creates and returns a new dialog containing the specified
|
||||||
* <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset"
|
* <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset"
|
||||||
|
@ -377,7 +377,8 @@ public abstract class JComponent extends Container implements Serializable,
|
|||||||
/**
|
/**
|
||||||
* AA text hints.
|
* AA text hints.
|
||||||
*/
|
*/
|
||||||
transient private Object aaTextInfo;
|
transient private Object aaHint;
|
||||||
|
transient private Object lcdRenderingHint;
|
||||||
|
|
||||||
static Graphics safelyGetGraphics(Component c) {
|
static Graphics safelyGetGraphics(Component c) {
|
||||||
return safelyGetGraphics(c, SwingUtilities.getRoot(c));
|
return safelyGetGraphics(c, SwingUtilities.getRoot(c));
|
||||||
@ -616,6 +617,15 @@ public abstract class JComponent extends Container implements Serializable,
|
|||||||
*/
|
*/
|
||||||
public void updateUI() {}
|
public void updateUI() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the look and feel delegate that renders this component.
|
||||||
|
*
|
||||||
|
* @return the {@code ComponentUI} object that renders this component
|
||||||
|
* @since 1.9
|
||||||
|
*/
|
||||||
|
public ComponentUI getUI() {
|
||||||
|
return ui;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the look and feel delegate for this component.
|
* Sets the look and feel delegate for this component.
|
||||||
@ -655,8 +665,10 @@ public abstract class JComponent extends Container implements Serializable,
|
|||||||
uninstallUIAndProperties();
|
uninstallUIAndProperties();
|
||||||
|
|
||||||
// aaText shouldn't persist between look and feels, reset it.
|
// aaText shouldn't persist between look and feels, reset it.
|
||||||
aaTextInfo =
|
aaHint = UIManager.getDefaults().get(
|
||||||
UIManager.getDefaults().get(SwingUtilities2.AA_TEXT_PROPERTY_KEY);
|
RenderingHints.KEY_TEXT_ANTIALIASING);
|
||||||
|
lcdRenderingHint = UIManager.getDefaults().get(
|
||||||
|
RenderingHints.KEY_TEXT_LCD_CONTRAST);
|
||||||
ComponentUI oldUI = ui;
|
ComponentUI oldUI = ui;
|
||||||
ui = newUI;
|
ui = newUI;
|
||||||
if (ui != null) {
|
if (ui != null) {
|
||||||
@ -4048,8 +4060,10 @@ public abstract class JComponent extends Container implements Serializable,
|
|||||||
* @see #putClientProperty
|
* @see #putClientProperty
|
||||||
*/
|
*/
|
||||||
public final Object getClientProperty(Object key) {
|
public final Object getClientProperty(Object key) {
|
||||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||||
return aaTextInfo;
|
return aaHint;
|
||||||
|
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||||
|
return lcdRenderingHint;
|
||||||
} else if (key == SwingUtilities2.COMPONENT_UI_PROPERTY_KEY) {
|
} else if (key == SwingUtilities2.COMPONENT_UI_PROPERTY_KEY) {
|
||||||
return ui;
|
return ui;
|
||||||
}
|
}
|
||||||
@ -4091,8 +4105,11 @@ public abstract class JComponent extends Container implements Serializable,
|
|||||||
* @see #addPropertyChangeListener
|
* @see #addPropertyChangeListener
|
||||||
*/
|
*/
|
||||||
public final void putClientProperty(Object key, Object value) {
|
public final void putClientProperty(Object key, Object value) {
|
||||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||||
aaTextInfo = value;
|
aaHint = value;
|
||||||
|
return;
|
||||||
|
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||||
|
lcdRenderingHint = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (value == null && clientProperties == null) {
|
if (value == null && clientProperties == null) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2304,8 +2304,10 @@ public class JTabbedPane extends JComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle getBounds() {
|
public Rectangle getBounds() {
|
||||||
return parent.getUI().getTabBounds(parent,
|
int i = parent.indexOfTab(title);
|
||||||
parent.indexOfTab(title));
|
// Check for no title. Even though that's a bug in the app we should
|
||||||
|
// inhibit an ArrayIndexOutOfBoundsException from getTabBounds.
|
||||||
|
return (i == -1) ? null : parent.getUI().getTabBounds(parent, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBounds(Rectangle r) {
|
public void setBounds(Rectangle r) {
|
||||||
|
@ -50,6 +50,14 @@ import javax.swing.*;
|
|||||||
@SuppressWarnings("serial") // Same-version serialization only
|
@SuppressWarnings("serial") // Same-version serialization only
|
||||||
public abstract class AbstractColorChooserPanel extends JPanel {
|
public abstract class AbstractColorChooserPanel extends JPanel {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifies that the transparency of the color (alpha value) can be
|
||||||
|
* selected
|
||||||
|
*/
|
||||||
|
public static final String TRANSPARENCY_ENABLED_PROPERTY
|
||||||
|
= "TransparencyEnabled";
|
||||||
|
|
||||||
private final PropertyChangeListener enabledListener = new PropertyChangeListener() {
|
private final PropertyChangeListener enabledListener = new PropertyChangeListener() {
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
Object value = event.getNewValue();
|
Object value = event.getNewValue();
|
||||||
@ -201,6 +209,40 @@ public abstract class AbstractColorChooserPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether color chooser panel allows to select the transparency
|
||||||
|
* (alpha value) of a color.
|
||||||
|
* This method fires a property-changed event, using the string value of
|
||||||
|
* {@code TRANSPARENCY_ENABLED_PROPERTY} as the name
|
||||||
|
* of the property.
|
||||||
|
*
|
||||||
|
* <p>The value is a hint and may not be applicable to all types of chooser
|
||||||
|
* panel.
|
||||||
|
*
|
||||||
|
* <p>The default value is {@code true}.
|
||||||
|
*
|
||||||
|
* @param b true if the transparency of a color can be selected
|
||||||
|
*
|
||||||
|
* @beaninfo
|
||||||
|
* bound: true
|
||||||
|
* description: Sets the transparency of a color selection on or off.
|
||||||
|
*
|
||||||
|
* @see #isColorTransparencySelectionEnabled()
|
||||||
|
*/
|
||||||
|
public void setColorTransparencySelectionEnabled(boolean b){
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether color chooser panel allows to select the transparency
|
||||||
|
* (alpha value) of a color.
|
||||||
|
*
|
||||||
|
* @return true if the transparency of a color can be selected
|
||||||
|
* @see #setColorTransparencySelectionEnabled(boolean)
|
||||||
|
*/
|
||||||
|
public boolean isColorTransparencySelectionEnabled(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the panel.
|
* Draws the panel.
|
||||||
* @param g the <code>Graphics</code> object
|
* @param g the <code>Graphics</code> object
|
||||||
|
@ -176,6 +176,21 @@ final class ColorChooserPanel extends AbstractColorChooserPanel implements Prope
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColorTransparencySelectionEnabled(boolean b){
|
||||||
|
boolean oldValue = isColorTransparencySelectionEnabled();
|
||||||
|
if (b != oldValue) {
|
||||||
|
panel.setColorTransparencySelectionEnabled(b);
|
||||||
|
firePropertyChange(TRANSPARENCY_ENABLED_PROPERTY,
|
||||||
|
oldValue, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isColorTransparencySelectionEnabled(){
|
||||||
|
return panel.isColorTransparencySelectionEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
ColorSelectionModel model = getColorSelectionModel();
|
ColorSelectionModel model = getColorSelectionModel();
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
|
@ -145,7 +145,7 @@ final class ColorPanel extends JPanel implements ActionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void colorChanged() {
|
void colorChanged() {
|
||||||
this.color = new Color(getColor(0), true);
|
this.color = new Color(getColor(0), isColorTransparencySelectionEnabled());
|
||||||
Object parent = getParent();
|
Object parent = getParent();
|
||||||
if (parent instanceof ColorChooserPanel) {
|
if (parent instanceof ColorChooserPanel) {
|
||||||
ColorChooserPanel chooser = (ColorChooserPanel) parent;
|
ColorChooserPanel chooser = (ColorChooserPanel) parent;
|
||||||
@ -208,6 +208,17 @@ final class ColorPanel extends JPanel implements ActionListener {
|
|||||||
return this.model.getColor(this.values);
|
return this.model.getColor(this.values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setColorTransparencySelectionEnabled(boolean b) {
|
||||||
|
if (spinners[model.getCount() - 1].isVisible() != b) {
|
||||||
|
spinners[model.getCount() - 1].setVisible(b);
|
||||||
|
colorChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isColorTransparencySelectionEnabled() {
|
||||||
|
return spinners[model.getCount() - 1].isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
private void setValue(int index) {
|
private void setValue(int index) {
|
||||||
this.values[index] = this.spinners[index].getValue();
|
this.values[index] = this.spinners[index].getValue();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,10 @@ final class SlidingSpinner implements ChangeListener {
|
|||||||
this.spinner.setVisible(visible);
|
this.spinner.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isVisible() {
|
||||||
|
return this.slider.isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
public void stateChanged(ChangeEvent event) {
|
public void stateChanged(ChangeEvent event) {
|
||||||
if (!this.internal) {
|
if (!this.internal) {
|
||||||
if (this.spinner == event.getSource()) {
|
if (this.spinner == event.getSource()) {
|
||||||
|
@ -90,7 +90,7 @@ public class LayerUI<V extends Component>
|
|||||||
* and set the layer event mask to {@code 0}
|
* and set the layer event mask to {@code 0}
|
||||||
* in {@link #uninstallUI(javax.swing.JComponent)} after that.
|
* in {@link #uninstallUI(javax.swing.JComponent)} after that.
|
||||||
* By default this method calls the appropriate
|
* By default this method calls the appropriate
|
||||||
* {@code process<event type>Event}
|
* {@code process<event} {@code type>Event}
|
||||||
* method for the given class of event.
|
* method for the given class of event.
|
||||||
* <p>
|
* <p>
|
||||||
* <b>Note:</b> Events are processed only for displayable {@code JLayer}s.
|
* <b>Note:</b> Events are processed only for displayable {@code JLayer}s.
|
||||||
|
@ -35,11 +35,11 @@ import javax.swing.event.InternalFrameEvent;
|
|||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
|
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||||
|
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||||
|
|
||||||
import sun.swing.DefaultLookup;
|
import sun.swing.DefaultLookup;
|
||||||
|
|
||||||
import static sun.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class that manages a basic title bar
|
* The class that manages a basic title bar
|
||||||
* <p>
|
* <p>
|
||||||
@ -217,8 +217,10 @@ public class BasicInternalFrameTitlePane extends JComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateProperties() {
|
private void updateProperties() {
|
||||||
final Object aaTextInfo = frame.getClientProperty(AA_TEXT_PROPERTY_KEY);
|
putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||||
putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
frame.getClientProperty(KEY_TEXT_ANTIALIASING));
|
||||||
|
putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||||
|
frame.getClientProperty(KEY_TEXT_LCD_CONTRAST));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1514,8 +1514,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
|||||||
flushUnreferenced(); // Remove old listeners
|
flushUnreferenced(); // Remove old listeners
|
||||||
|
|
||||||
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
||||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(lafCond);
|
SwingUtilities2.putAATextInfo(lafCond, table);
|
||||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
new AATextListener(this);
|
new AATextListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2204,9 +2203,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
|||||||
}
|
}
|
||||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||||
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
||||||
Object aaTextInfo =
|
SwingUtilities2.putAATextInfo(lafCond, defaults);
|
||||||
SwingUtilities2.AATextInfo.getAATextInfo(lafCond);
|
|
||||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,8 +688,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
|||||||
|
|
||||||
// enabled antialiasing depending on desktop settings
|
// enabled antialiasing depending on desktop settings
|
||||||
flushUnreferenced();
|
flushUnreferenced();
|
||||||
Object aaTextInfo = getAATextInfo();
|
SwingUtilities2.putAATextInfo(useLAFConditions(), table);
|
||||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
new AATextListener(this);
|
new AATextListener(this);
|
||||||
|
|
||||||
if (defaultsMap != null) {
|
if (defaultsMap != null) {
|
||||||
@ -794,7 +793,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
|||||||
*
|
*
|
||||||
* @return the text antialiasing information associated to the desktop
|
* @return the text antialiasing information associated to the desktop
|
||||||
*/
|
*/
|
||||||
private static Object getAATextInfo() {
|
private static boolean useLAFConditions() {
|
||||||
String language = Locale.getDefault().getLanguage();
|
String language = Locale.getDefault().getLanguage();
|
||||||
String desktop =
|
String desktop =
|
||||||
AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
|
AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
|
||||||
@ -805,10 +804,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
|||||||
boolean isGnome = "gnome".equals(desktop);
|
boolean isGnome = "gnome".equals(desktop);
|
||||||
boolean isLocal = SwingUtilities2.isLocalDisplay();
|
boolean isLocal = SwingUtilities2.isLocalDisplay();
|
||||||
|
|
||||||
boolean setAA = isLocal && (!isGnome || !isCjkLocale);
|
return isLocal && (!isGnome || !isCjkLocale);
|
||||||
|
|
||||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(setAA);
|
|
||||||
return aaTextInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReferenceQueue<LookAndFeel> queue = new ReferenceQueue<LookAndFeel>();
|
private static ReferenceQueue<LookAndFeel> queue = new ReferenceQueue<LookAndFeel>();
|
||||||
@ -844,8 +840,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object aaTextInfo = getAATextInfo();
|
SwingUtilities2.putAATextInfo(useLAFConditions(), defaults);
|
||||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
|
||||||
|
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
@ -298,8 +298,8 @@ public void close()
|
|||||||
* Handles a parameterless RTF keyword. This is called by the superclass
|
* Handles a parameterless RTF keyword. This is called by the superclass
|
||||||
* (RTFParser) when a keyword is found in the input stream.
|
* (RTFParser) when a keyword is found in the input stream.
|
||||||
*
|
*
|
||||||
* @returns <code>true</code> if the keyword is recognized and handled;
|
* @return true if the keyword is recognized and handled;
|
||||||
* <code>false</code> otherwise
|
* false otherwise
|
||||||
* @see RTFParser#handleKeyword
|
* @see RTFParser#handleKeyword
|
||||||
*/
|
*/
|
||||||
public boolean handleKeyword(String keyword)
|
public boolean handleKeyword(String keyword)
|
||||||
@ -444,8 +444,8 @@ public boolean handleKeyword(String keyword)
|
|||||||
* This is called by the superclass
|
* This is called by the superclass
|
||||||
* (RTFParser) when a keyword is found in the input stream.
|
* (RTFParser) when a keyword is found in the input stream.
|
||||||
*
|
*
|
||||||
* @returns <code>true</code> if the keyword is recognized and handled;
|
* @return true if the keyword is recognized and handled;
|
||||||
* <code>false</code> otherwise
|
* false otherwise
|
||||||
* @see RTFParser#handleKeyword
|
* @see RTFParser#handleKeyword
|
||||||
*/
|
*/
|
||||||
public boolean handleKeyword(String keyword, int parameter)
|
public boolean handleKeyword(String keyword, int parameter)
|
||||||
@ -553,7 +553,7 @@ defineCharacterSet(String name, char[] table)
|
|||||||
* array of characters, mapping unsigned byte values to their Unicode
|
* array of characters, mapping unsigned byte values to their Unicode
|
||||||
* equivalents. The character set is loaded if necessary.
|
* equivalents. The character set is loaded if necessary.
|
||||||
*
|
*
|
||||||
* @returns the character set
|
* @return the character set
|
||||||
*/
|
*/
|
||||||
public static Object
|
public static Object
|
||||||
getCharacterSet(final String name)
|
getCharacterSet(final String name)
|
||||||
@ -577,7 +577,7 @@ getCharacterSet(final String name)
|
|||||||
* must contain 256 decimal integers, separated by whitespace, with
|
* must contain 256 decimal integers, separated by whitespace, with
|
||||||
* no punctuation. B- and C- style comments are allowed.
|
* no punctuation. B- and C- style comments are allowed.
|
||||||
*
|
*
|
||||||
* @returns the newly read character set
|
* @return the newly read character set
|
||||||
*/
|
*/
|
||||||
static char[] readCharset(InputStream strm)
|
static char[] readCharset(InputStream strm)
|
||||||
throws IOException
|
throws IOException
|
||||||
@ -1349,7 +1349,7 @@ abstract class AttributeTrackingDestination implements Destination
|
|||||||
* Calculates the current text (character) attributes in a form suitable
|
* Calculates the current text (character) attributes in a form suitable
|
||||||
* for SwingText from the current parser state.
|
* for SwingText from the current parser state.
|
||||||
*
|
*
|
||||||
* @returns a new MutableAttributeSet containing the text attributes.
|
* @return a new MutableAttributeSet containing the text attributes.
|
||||||
*/
|
*/
|
||||||
MutableAttributeSet currentTextAttributes()
|
MutableAttributeSet currentTextAttributes()
|
||||||
{
|
{
|
||||||
@ -1410,7 +1410,7 @@ abstract class AttributeTrackingDestination implements Destination
|
|||||||
* Calculates the current paragraph attributes (with keys
|
* Calculates the current paragraph attributes (with keys
|
||||||
* as given in StyleConstants) from the current parser state.
|
* as given in StyleConstants) from the current parser state.
|
||||||
*
|
*
|
||||||
* @returns a newly created MutableAttributeSet.
|
* @return a newly created MutableAttributeSet.
|
||||||
* @see StyleConstants
|
* @see StyleConstants
|
||||||
*/
|
*/
|
||||||
MutableAttributeSet currentParagraphAttributes()
|
MutableAttributeSet currentParagraphAttributes()
|
||||||
@ -1449,7 +1449,7 @@ abstract class AttributeTrackingDestination implements Destination
|
|||||||
* Calculates the current section attributes
|
* Calculates the current section attributes
|
||||||
* from the current parser state.
|
* from the current parser state.
|
||||||
*
|
*
|
||||||
* @returns a newly created MutableAttributeSet.
|
* @return a newly created MutableAttributeSet.
|
||||||
*/
|
*/
|
||||||
public AttributeSet currentSectionAttributes()
|
public AttributeSet currentSectionAttributes()
|
||||||
{
|
{
|
||||||
|
@ -124,18 +124,7 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
* @param appContext AppContext to associate with the event queue
|
* @param appContext AppContext to associate with the event queue
|
||||||
*/
|
*/
|
||||||
private static void initEQ(AppContext appContext) {
|
private static void initEQ(AppContext appContext) {
|
||||||
EventQueue eventQueue;
|
EventQueue eventQueue = new EventQueue();
|
||||||
|
|
||||||
String eqName = System.getProperty("AWT.EventQueueClass",
|
|
||||||
"java.awt.EventQueue");
|
|
||||||
|
|
||||||
try {
|
|
||||||
eventQueue = (EventQueue)Class.forName(eqName).newInstance();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.err.println("Failed loading " + eqName + ": " + e);
|
|
||||||
eventQueue = new EventQueue();
|
|
||||||
}
|
|
||||||
appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
|
appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
|
||||||
|
|
||||||
PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
|
PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
|
||||||
|
@ -50,7 +50,7 @@ class DefaultShellFolder extends ShellFolder {
|
|||||||
* this default implementation can always be represented with a
|
* this default implementation can always be represented with a
|
||||||
* <code>java.io.File</code> object instead.
|
* <code>java.io.File</code> object instead.
|
||||||
*
|
*
|
||||||
* @returns a <code>java.io.File</code> replacement object.
|
* @return a java.io.File replacement object.
|
||||||
*/
|
*/
|
||||||
protected Object writeReplace() throws java.io.ObjectStreamException {
|
protected Object writeReplace() throws java.io.ObjectStreamException {
|
||||||
return new File(getPath());
|
return new File(getPath());
|
||||||
|
@ -67,8 +67,8 @@ public abstract class ShellFolder extends File {
|
|||||||
* <code>java.io.File</code> instead. If not, then the object is most likely
|
* <code>java.io.File</code> instead. If not, then the object is most likely
|
||||||
* depending on some internal (native) state and cannot be serialized.
|
* depending on some internal (native) state and cannot be serialized.
|
||||||
*
|
*
|
||||||
* @returns a <code>java.io.File</code> replacement object, or <code>null</code>
|
* @return a java.io.File replacement object, or null
|
||||||
* if no suitable replacement can be found.
|
* if no suitable replacement can be found.
|
||||||
*/
|
*/
|
||||||
protected abstract Object writeReplace() throws java.io.ObjectStreamException;
|
protected abstract Object writeReplace() throws java.io.ObjectStreamException;
|
||||||
|
|
||||||
|
@ -419,8 +419,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
|||||||
/**
|
/**
|
||||||
* Presents the user a dialog for changing properties of the
|
* Presents the user a dialog for changing properties of the
|
||||||
* print job interactively.
|
* print job interactively.
|
||||||
* @returns false if the user cancels the dialog and
|
* @return false if the user cancels the dialog and
|
||||||
* true otherwise.
|
* true otherwise.
|
||||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||||
* returns true.
|
* returns true.
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
|
@ -964,8 +964,8 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
/**
|
/**
|
||||||
* Presents the user a dialog for changing properties of the
|
* Presents the user a dialog for changing properties of the
|
||||||
* print job interactively.
|
* print job interactively.
|
||||||
* @returns false if the user cancels the dialog and
|
* @return false if the user cancels the dialog and
|
||||||
* true otherwise.
|
* true otherwise.
|
||||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||||
* returns true.
|
* returns true.
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
|
@ -102,14 +102,6 @@ public class SwingUtilities2 {
|
|||||||
public static final FontRenderContext DEFAULT_FRC =
|
public static final FontRenderContext DEFAULT_FRC =
|
||||||
new FontRenderContext(null, false, false);
|
new FontRenderContext(null, false, false);
|
||||||
|
|
||||||
/**
|
|
||||||
* A JComponent client property is used to determine text aa settings.
|
|
||||||
* To avoid having this property persist between look and feels changes
|
|
||||||
* the value of the property is set to null in JComponent.setUI
|
|
||||||
*/
|
|
||||||
public static final Object AA_TEXT_PROPERTY_KEY =
|
|
||||||
new StringBuffer("AATextInfoPropertyKey");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute key for the content elements. If it is set on an element, the
|
* Attribute key for the content elements. If it is set on an element, the
|
||||||
* element is considered to be a line break.
|
* element is considered to be a line break.
|
||||||
@ -123,58 +115,23 @@ public class SwingUtilities2 {
|
|||||||
private static final StringBuilder SKIP_CLICK_COUNT =
|
private static final StringBuilder SKIP_CLICK_COUNT =
|
||||||
new StringBuilder("skipClickCount");
|
new StringBuilder("skipClickCount");
|
||||||
|
|
||||||
/* Presently this class assumes default fractional metrics.
|
@SuppressWarnings("unchecked")
|
||||||
* This may need to change to emulate future platform L&Fs.
|
public static void putAATextInfo(boolean lafCondition,
|
||||||
*/
|
Map<Object, Object> map) {
|
||||||
public static class AATextInfo {
|
SunToolkit.setAAFontSettingsCondition(lafCondition);
|
||||||
|
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||||
|
Object desktopHints = tk.getDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
||||||
|
|
||||||
private static AATextInfo getAATextInfoFromMap(Map<java.awt.RenderingHints.Key, Object> hints) {
|
if (desktopHints instanceof Map) {
|
||||||
|
Map<Object, Object> hints = (Map<Object, Object>) desktopHints;
|
||||||
Object aaHint = hints.get(KEY_TEXT_ANTIALIASING);
|
Object aaHint = hints.get(KEY_TEXT_ANTIALIASING);
|
||||||
Object contHint = hints.get(KEY_TEXT_LCD_CONTRAST);
|
if (aaHint == null
|
||||||
|
|| aaHint == VALUE_TEXT_ANTIALIAS_OFF
|
||||||
if (aaHint == null ||
|
|| aaHint == VALUE_TEXT_ANTIALIAS_DEFAULT) {
|
||||||
aaHint == VALUE_TEXT_ANTIALIAS_OFF ||
|
return;
|
||||||
aaHint == VALUE_TEXT_ANTIALIAS_DEFAULT) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return new AATextInfo(aaHint, (Integer)contHint);
|
|
||||||
}
|
}
|
||||||
}
|
map.put(KEY_TEXT_ANTIALIASING, aaHint);
|
||||||
|
map.put(KEY_TEXT_LCD_CONTRAST, hints.get(KEY_TEXT_LCD_CONTRAST));
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static AATextInfo getAATextInfo(boolean lafCondition) {
|
|
||||||
SunToolkit.setAAFontSettingsCondition(lafCondition);
|
|
||||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
|
||||||
Object map = tk.getDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
|
||||||
if (map instanceof Map) {
|
|
||||||
return getAATextInfoFromMap((Map<java.awt.RenderingHints.Key, Object>)map);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object aaHint;
|
|
||||||
Integer lcdContrastHint;
|
|
||||||
FontRenderContext frc;
|
|
||||||
|
|
||||||
/* These are rarely constructed objects, and only when a complete
|
|
||||||
* UI is being updated, so the cost of the tests here is minimal
|
|
||||||
* and saves tests elsewhere.
|
|
||||||
* We test that the values are ones we support/expect.
|
|
||||||
*/
|
|
||||||
public AATextInfo(Object aaHint, Integer lcdContrastHint) {
|
|
||||||
if (aaHint == null) {
|
|
||||||
throw new InternalError("null not allowed here");
|
|
||||||
}
|
|
||||||
if (aaHint == VALUE_TEXT_ANTIALIAS_OFF ||
|
|
||||||
aaHint == VALUE_TEXT_ANTIALIAS_DEFAULT) {
|
|
||||||
throw new InternalError("AA must be on");
|
|
||||||
}
|
|
||||||
this.aaHint = aaHint;
|
|
||||||
this.lcdContrastHint = lcdContrastHint;
|
|
||||||
this.frc = new FontRenderContext(null, aaHint,
|
|
||||||
VALUE_FRACTIONALMETRICS_DEFAULT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,22 +197,6 @@ public class SwingUtilities2 {
|
|||||||
// need to gracefully handle null.
|
// need to gracefully handle null.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not text should be drawn antialiased.
|
|
||||||
*
|
|
||||||
* @param c JComponent to test.
|
|
||||||
* @return Whether or not text should be drawn antialiased for the
|
|
||||||
* specified component.
|
|
||||||
*/
|
|
||||||
public static AATextInfo drawTextAntialiased(JComponent c) {
|
|
||||||
if (c != null) {
|
|
||||||
/* a non-null property implies some form of AA requested */
|
|
||||||
return (AATextInfo)c.getClientProperty(AA_TEXT_PROPERTY_KEY);
|
|
||||||
}
|
|
||||||
// No component, assume aa is off
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the left side bearing of the first character of string. The
|
* Returns the left side bearing of the first character of string. The
|
||||||
* left side bearing is calculated from the passed in
|
* left side bearing is calculated from the passed in
|
||||||
@ -530,7 +471,6 @@ public class SwingUtilities2 {
|
|||||||
|
|
||||||
// If we get here we're not printing
|
// If we get here we're not printing
|
||||||
if (g instanceof Graphics2D) {
|
if (g instanceof Graphics2D) {
|
||||||
AATextInfo info = drawTextAntialiased(c);
|
|
||||||
Graphics2D g2 = (Graphics2D)g;
|
Graphics2D g2 = (Graphics2D)g;
|
||||||
|
|
||||||
boolean needsTextLayout = ((c != null) &&
|
boolean needsTextLayout = ((c != null) &&
|
||||||
@ -543,21 +483,27 @@ public class SwingUtilities2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info != null) {
|
Object aaHint = (c == null)
|
||||||
|
? null
|
||||||
|
: c.getClientProperty(KEY_TEXT_ANTIALIASING);
|
||||||
|
if (aaHint != null) {
|
||||||
Object oldContrast = null;
|
Object oldContrast = null;
|
||||||
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
|
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
|
||||||
if (info.aaHint != oldAAValue) {
|
if (aaHint != oldAAValue) {
|
||||||
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, info.aaHint);
|
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, aaHint);
|
||||||
} else {
|
} else {
|
||||||
oldAAValue = null;
|
oldAAValue = null;
|
||||||
}
|
}
|
||||||
if (info.lcdContrastHint != null) {
|
|
||||||
|
Object lcdContrastHint = c.getClientProperty(
|
||||||
|
KEY_TEXT_LCD_CONTRAST);
|
||||||
|
if (lcdContrastHint != null) {
|
||||||
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
|
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
|
||||||
if (info.lcdContrastHint.equals(oldContrast)) {
|
if (lcdContrastHint.equals(oldContrast)) {
|
||||||
oldContrast = null;
|
oldContrast = null;
|
||||||
} else {
|
} else {
|
||||||
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
|
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
|
||||||
info.lcdContrastHint);
|
lcdContrastHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,24 +767,28 @@ public class SwingUtilities2 {
|
|||||||
}
|
}
|
||||||
// Assume we're not printing if we get here, or that we are invoked
|
// Assume we're not printing if we get here, or that we are invoked
|
||||||
// via Swing text printing which is laid out for the printer.
|
// via Swing text printing which is laid out for the printer.
|
||||||
AATextInfo info = drawTextAntialiased(c);
|
Object aaHint = (c == null)
|
||||||
if (info != null && (g instanceof Graphics2D)) {
|
? null
|
||||||
|
: c.getClientProperty(KEY_TEXT_ANTIALIASING);
|
||||||
|
if (aaHint != null && (g instanceof Graphics2D)) {
|
||||||
Graphics2D g2 = (Graphics2D)g;
|
Graphics2D g2 = (Graphics2D)g;
|
||||||
|
|
||||||
Object oldContrast = null;
|
Object oldContrast = null;
|
||||||
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
|
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
|
||||||
if (info.aaHint != null && info.aaHint != oldAAValue) {
|
if (aaHint != null && aaHint != oldAAValue) {
|
||||||
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, info.aaHint);
|
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, aaHint);
|
||||||
} else {
|
} else {
|
||||||
oldAAValue = null;
|
oldAAValue = null;
|
||||||
}
|
}
|
||||||
if (info.lcdContrastHint != null) {
|
|
||||||
|
Object lcdContrastHint = c.getClientProperty(KEY_TEXT_LCD_CONTRAST);
|
||||||
|
if (lcdContrastHint != null) {
|
||||||
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
|
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
|
||||||
if (info.lcdContrastHint.equals(oldContrast)) {
|
if (lcdContrastHint.equals(oldContrast)) {
|
||||||
oldContrast = null;
|
oldContrast = null;
|
||||||
} else {
|
} else {
|
||||||
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
|
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
|
||||||
info.lcdContrastHint);
|
lcdContrastHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1117,15 +1067,35 @@ public class SwingUtilities2 {
|
|||||||
*/
|
*/
|
||||||
private static FontRenderContext getFRCProperty(JComponent c) {
|
private static FontRenderContext getFRCProperty(JComponent c) {
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
AATextInfo info =
|
Object aaHint = c.getClientProperty(KEY_TEXT_ANTIALIASING);
|
||||||
(AATextInfo)c.getClientProperty(AA_TEXT_PROPERTY_KEY);
|
if (aaHint != null) {
|
||||||
if (info != null) {
|
return getFRCFromCache(aaHint);
|
||||||
return info.frc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Object APP_CONTEXT_FRC_CACHE_KEY = new Object();
|
||||||
|
|
||||||
|
private static FontRenderContext getFRCFromCache(Object aaHint) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<Object, FontRenderContext> cache = (Map<Object, FontRenderContext>)
|
||||||
|
AppContext.getAppContext().get(APP_CONTEXT_FRC_CACHE_KEY);
|
||||||
|
|
||||||
|
if (cache == null) {
|
||||||
|
cache = new HashMap<>();
|
||||||
|
AppContext.getAppContext().put(APP_CONTEXT_FRC_CACHE_KEY, cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
FontRenderContext frc = cache.get(aaHint);
|
||||||
|
if (frc == null) {
|
||||||
|
frc = new FontRenderContext(null, aaHint,
|
||||||
|
VALUE_FRACTIONALMETRICS_DEFAULT);
|
||||||
|
cache.put(aaHint, frc);
|
||||||
|
}
|
||||||
|
return frc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* returns true if the Graphics is print Graphics
|
* returns true if the Graphics is print Graphics
|
||||||
* false otherwise
|
* false otherwise
|
||||||
|
@ -96,7 +96,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
|
|||||||
/**
|
/**
|
||||||
* Processes the specified client message event.
|
* Processes the specified client message event.
|
||||||
*
|
*
|
||||||
* @returns true if the event was successfully processed.
|
* @return true if the event was successfully processed.
|
||||||
*/
|
*/
|
||||||
public boolean processClientMessage(XClientMessageEvent xclient) {
|
public boolean processClientMessage(XClientMessageEvent xclient) {
|
||||||
if (xclient.get_message_type() !=
|
if (xclient.get_message_type() !=
|
||||||
|
@ -68,7 +68,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
|
|||||||
/**
|
/**
|
||||||
* Performs protocol-specific drag initialization.
|
* Performs protocol-specific drag initialization.
|
||||||
*
|
*
|
||||||
* @returns true if the initialized successfully.
|
* @return true if the initialized successfully.
|
||||||
*/
|
*/
|
||||||
protected void initializeDragImpl(int actions, Transferable contents,
|
protected void initializeDragImpl(int actions, Transferable contents,
|
||||||
Map<Long, DataFlavor> formatMap, long[] formats)
|
Map<Long, DataFlavor> formatMap, long[] formats)
|
||||||
|
@ -379,7 +379,7 @@ public final class XDragSourceContextPeer
|
|||||||
/**
|
/**
|
||||||
* Updates the source action according to the specified state.
|
* Updates the source action according to the specified state.
|
||||||
*
|
*
|
||||||
* @returns true if the source
|
* @return true if the source
|
||||||
*/
|
*/
|
||||||
private boolean updateSourceAction(int state) {
|
private boolean updateSourceAction(int state) {
|
||||||
int action = SunDragSourceContextPeer.convertModifiersToDropAction(XWindow.getModifiers(state, 0, 0),
|
int action = SunDragSourceContextPeer.convertModifiersToDropAction(XWindow.getModifiers(state, 0, 0),
|
||||||
@ -570,7 +570,7 @@ public final class XDragSourceContextPeer
|
|||||||
/**
|
/**
|
||||||
* The caller must own awtLock.
|
* The caller must own awtLock.
|
||||||
*
|
*
|
||||||
* @returns true if the even was processed and shouldn't be passed along.
|
* @return true if the event was processed and shouldn't be passed along.
|
||||||
*/
|
*/
|
||||||
private boolean doProcessEvent(XEvent ev) {
|
private boolean doProcessEvent(XEvent ev) {
|
||||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||||
|
@ -140,7 +140,7 @@ abstract class XDragSourceProtocol {
|
|||||||
/**
|
/**
|
||||||
* Processes the specified client message event.
|
* Processes the specified client message event.
|
||||||
*
|
*
|
||||||
* @returns true if the event was successfully processed.
|
* @return true if the event was successfully processed.
|
||||||
*/
|
*/
|
||||||
public abstract boolean processClientMessage(XClientMessageEvent xclient)
|
public abstract boolean processClientMessage(XClientMessageEvent xclient)
|
||||||
throws XException;
|
throws XException;
|
||||||
|
@ -293,7 +293,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query and then return the current composition state.
|
* Query and then return the current composition state.
|
||||||
* @returns the composition state if isCompositionEnabled call
|
* @return the composition state if isCompositionEnabled call
|
||||||
* is successful. Otherwise, it returns false.
|
* is successful. Otherwise, it returns false.
|
||||||
*/
|
*/
|
||||||
private boolean getCompositionState() {
|
private boolean getCompositionState() {
|
||||||
|
@ -97,14 +97,14 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
|
|||||||
* Returns the number of pixels per logical inch along the screen width.
|
* Returns the number of pixels per logical inch along the screen width.
|
||||||
* In a system with multiple display monitors, this value is the same for
|
* In a system with multiple display monitors, this value is the same for
|
||||||
* all monitors.
|
* all monitors.
|
||||||
* @returns number of pixels per logical inch in X direction
|
* @return number of pixels per logical inch in X direction
|
||||||
*/
|
*/
|
||||||
public native int getXResolution();
|
public native int getXResolution();
|
||||||
/**
|
/**
|
||||||
* Returns the number of pixels per logical inch along the screen height.
|
* Returns the number of pixels per logical inch along the screen height.
|
||||||
* In a system with multiple display monitors, this value is the same for
|
* In a system with multiple display monitors, this value is the same for
|
||||||
* all monitors.
|
* all monitors.
|
||||||
* @returns number of pixels per logical inch in Y direction
|
* @return number of pixels per logical inch in Y direction
|
||||||
*/
|
*/
|
||||||
public native int getYResolution();
|
public native int getYResolution();
|
||||||
|
|
||||||
|
@ -556,8 +556,8 @@ public final class WPrinterJob extends RasterPrinterJob
|
|||||||
/**
|
/**
|
||||||
* Presents the user a dialog for changing properties of the
|
* Presents the user a dialog for changing properties of the
|
||||||
* print job interactively.
|
* print job interactively.
|
||||||
* @returns false if the user cancels the dialog and
|
* @return false if the user cancels the dialog and
|
||||||
* true otherwise.
|
* true otherwise.
|
||||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||||
* returns true.
|
* returns true.
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
|
@ -201,8 +201,8 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
|
|||||||
* - it's one of the classes likely to have custom rendering worth
|
* - it's one of the classes likely to have custom rendering worth
|
||||||
* accelerating
|
* accelerating
|
||||||
*
|
*
|
||||||
* @returns true if we can use a d3d surface for this peer's onscreen
|
* @return true if we can use a d3d surface for this peer's onscreen
|
||||||
* rendering
|
* rendering
|
||||||
*/
|
*/
|
||||||
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
|
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
|
||||||
final Win32GraphicsConfig gc,
|
final Win32GraphicsConfig gc,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -76,7 +76,6 @@ class HotspotCompilation
|
|||||||
private LongCounter lastInvalidatedType;
|
private LongCounter lastInvalidatedType;
|
||||||
|
|
||||||
private class CompilerThreadInfo {
|
private class CompilerThreadInfo {
|
||||||
int index;
|
|
||||||
String name;
|
String name;
|
||||||
StringCounter method;
|
StringCounter method;
|
||||||
LongCounter type;
|
LongCounter type;
|
||||||
@ -90,14 +89,6 @@ class HotspotCompilation
|
|||||||
this.compiles = (LongCounter) lookup(basename + "compiles");
|
this.compiles = (LongCounter) lookup(basename + "compiles");
|
||||||
this.time = (LongCounter) lookup(basename + "time");
|
this.time = (LongCounter) lookup(basename + "time");
|
||||||
}
|
}
|
||||||
CompilerThreadInfo(String bname) {
|
|
||||||
String basename = bname + ".";
|
|
||||||
this.name = bname;
|
|
||||||
this.method = (StringCounter) lookup(basename + "method");
|
|
||||||
this.type = (LongCounter) lookup(basename + "type");
|
|
||||||
this.compiles = (LongCounter) lookup(basename + "compiles");
|
|
||||||
this.time = (LongCounter) lookup(basename + "time");
|
|
||||||
}
|
|
||||||
|
|
||||||
CompilerThreadStat getCompilerThreadStat() {
|
CompilerThreadStat getCompilerThreadStat() {
|
||||||
MethodInfo minfo = new MethodInfo(method.stringValue(),
|
MethodInfo minfo = new MethodInfo(method.stringValue(),
|
||||||
@ -109,7 +100,7 @@ class HotspotCompilation
|
|||||||
minfo);
|
minfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private CompilerThreadInfo[] threads;
|
private List<CompilerThreadInfo> threads;
|
||||||
private int numActiveThreads; // number of active compiler threads
|
private int numActiveThreads; // number of active compiler threads
|
||||||
|
|
||||||
private Map<String, Counter> counters;
|
private Map<String, Counter> counters;
|
||||||
@ -158,18 +149,12 @@ class HotspotCompilation
|
|||||||
numActiveThreads = (int) compilerThreads.longValue();
|
numActiveThreads = (int) compilerThreads.longValue();
|
||||||
|
|
||||||
// Allocate CompilerThreadInfo for compilerThread and adaptorThread
|
// Allocate CompilerThreadInfo for compilerThread and adaptorThread
|
||||||
threads = new CompilerThreadInfo[numActiveThreads+1];
|
threads = new ArrayList<CompilerThreadInfo>();
|
||||||
|
|
||||||
// AdaptorThread has index 0
|
for (int i = 0; i < numActiveThreads; i++) {
|
||||||
if (counters.containsKey(SUN_CI + "adapterThread.compiles")) {
|
if (counters.containsKey(SUN_CI + "compilerThread." + i + ".method")) {
|
||||||
threads[0] = new CompilerThreadInfo("adapterThread", 0);
|
threads.add(new CompilerThreadInfo("compilerThread", i));
|
||||||
numActiveThreads++;
|
}
|
||||||
} else {
|
|
||||||
threads[0] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < threads.length; i++) {
|
|
||||||
threads[i] = new CompilerThreadInfo("compilerThread", i-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,15 +182,10 @@ class HotspotCompilation
|
|||||||
return nmethodSize.longValue();
|
return nmethodSize.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.List<CompilerThreadStat> getCompilerThreadStats() {
|
public List<CompilerThreadStat> getCompilerThreadStats() {
|
||||||
List<CompilerThreadStat> list = new ArrayList<>(threads.length);
|
List<CompilerThreadStat> list = new ArrayList<>(threads.size());
|
||||||
int i = 0;
|
for (CompilerThreadInfo info : threads) {
|
||||||
if (threads[0] == null) {
|
list.add(info.getCompilerThreadStat());
|
||||||
// no adaptor thread
|
|
||||||
i = 1;
|
|
||||||
}
|
|
||||||
for (; i < threads.length; i++) {
|
|
||||||
list.add(threads[i].getCompilerThreadStat());
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,12 @@
|
|||||||
|
|
||||||
package sun.security.provider.certpath.ldap;
|
package sun.security.provider.certpath.ldap;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.cert.Certificate;
|
|
||||||
import java.security.cert.*;
|
import java.security.cert.*;
|
||||||
import javax.security.auth.x500.X500Principal;
|
import java.util.*;
|
||||||
|
|
||||||
import sun.security.util.Cache;
|
import sun.security.util.Cache;
|
||||||
import sun.security.util.Debug;
|
import sun.security.util.Debug;
|
||||||
import sun.security.x509.X500Name;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <code>CertStore</code> that retrieves <code>Certificates</code> and
|
* A <code>CertStore</code> that retrieves <code>Certificates</code> and
|
||||||
@ -93,8 +87,6 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
|
|
||||||
private static final Debug debug = Debug.getInstance("certpath");
|
private static final Debug debug = Debug.getInstance("certpath");
|
||||||
|
|
||||||
private final static boolean DEBUG = false;
|
|
||||||
|
|
||||||
private String ldapDN;
|
private String ldapDN;
|
||||||
|
|
||||||
private LDAPCertStoreImpl impl;
|
private LDAPCertStoreImpl impl;
|
||||||
@ -108,7 +100,7 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
String dn = null;
|
String dn = null;
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
throw new InvalidAlgorithmParameterException(
|
throw new InvalidAlgorithmParameterException(
|
||||||
"parameters required for LDAP Certore");
|
"Parameters required for LDAP certstore");
|
||||||
}
|
}
|
||||||
if (params instanceof LDAPCertStoreParameters) {
|
if (params instanceof LDAPCertStoreParameters) {
|
||||||
LDAPCertStoreParameters p = (LDAPCertStoreParameters) params;
|
LDAPCertStoreParameters p = (LDAPCertStoreParameters) params;
|
||||||
@ -119,7 +111,9 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
URI u = p.getURI();
|
URI u = p.getURI();
|
||||||
if (!u.getScheme().equalsIgnoreCase("ldap")) {
|
if (!u.getScheme().equalsIgnoreCase("ldap")) {
|
||||||
throw new InvalidAlgorithmParameterException(
|
throw new InvalidAlgorithmParameterException(
|
||||||
"Only LDAP URIs are supported for LDAP Certore");
|
"Unsupported scheme '" + u.getScheme()
|
||||||
|
+ "', only LDAP URIs are supported "
|
||||||
|
+ "for LDAP certstore");
|
||||||
}
|
}
|
||||||
// Use the same default values as in LDAPCertStoreParameters
|
// Use the same default values as in LDAPCertStoreParameters
|
||||||
// if unspecified in URI
|
// if unspecified in URI
|
||||||
@ -137,8 +131,9 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidAlgorithmParameterException(
|
throw new InvalidAlgorithmParameterException(
|
||||||
"parameters must be either LDAPCertStoreParameters or " +
|
"Parameters must be either LDAPCertStoreParameters or "
|
||||||
"URICertStoreParameters");
|
+ "URICertStoreParameters, but instance of "
|
||||||
|
+ params.getClass().getName() + " passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
Key k = new Key(serverName, port);
|
Key k = new Key(serverName, port);
|
||||||
@ -236,6 +231,7 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
* match the specified selector
|
* match the specified selector
|
||||||
* @throws CertStoreException if an exception occurs
|
* @throws CertStoreException if an exception occurs
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized Collection<X509Certificate> engineGetCertificates
|
public synchronized Collection<X509Certificate> engineGetCertificates
|
||||||
(CertSelector selector) throws CertStoreException {
|
(CertSelector selector) throws CertStoreException {
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
@ -245,7 +241,9 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
if (selector == null) {
|
if (selector == null) {
|
||||||
selector = new X509CertSelector();
|
selector = new X509CertSelector();
|
||||||
} else if (!(selector instanceof X509CertSelector)) {
|
} else if (!(selector instanceof X509CertSelector)) {
|
||||||
throw new CertStoreException("need X509CertSelector to find certs");
|
throw new CertStoreException("Need X509CertSelector to find certs, "
|
||||||
|
+ "but instance of " + selector.getClass().getName()
|
||||||
|
+ " passed");
|
||||||
}
|
}
|
||||||
return impl.getCertificates((X509CertSelector) selector, ldapDN);
|
return impl.getCertificates((X509CertSelector) selector, ldapDN);
|
||||||
}
|
}
|
||||||
@ -271,6 +269,7 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
* match the specified selector
|
* match the specified selector
|
||||||
* @throws CertStoreException if an exception occurs
|
* @throws CertStoreException if an exception occurs
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
|
public synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
|
||||||
throws CertStoreException {
|
throws CertStoreException {
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
@ -281,7 +280,9 @@ public final class LDAPCertStore extends CertStoreSpi {
|
|||||||
if (selector == null) {
|
if (selector == null) {
|
||||||
selector = new X509CRLSelector();
|
selector = new X509CRLSelector();
|
||||||
} else if (!(selector instanceof X509CRLSelector)) {
|
} else if (!(selector instanceof X509CRLSelector)) {
|
||||||
throw new CertStoreException("need X509CRLSelector to find CRLs");
|
throw new CertStoreException("Need X509CRLSelector to find CRLs, "
|
||||||
|
+ "but instance of " + selector.getClass().getName()
|
||||||
|
+ " passed");
|
||||||
}
|
}
|
||||||
return impl.getCRLs((X509CRLSelector) selector, ldapDN);
|
return impl.getCRLs((X509CRLSelector) selector, ldapDN);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,19 +31,9 @@ import java.util.concurrent.ConcurrentSkipListSet;
|
|||||||
import java.lang.ref.*;
|
import java.lang.ref.*;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.*;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.interfaces.*;
|
||||||
import java.security.Key;
|
import java.security.spec.*;
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.security.PrivateKey;
|
|
||||||
import java.security.KeyFactorySpi;
|
|
||||||
import java.security.interfaces.RSAPrivateCrtKey;
|
|
||||||
import java.security.interfaces.RSAPublicKey;
|
|
||||||
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.security.spec.KeySpec;
|
|
||||||
import java.security.spec.RSAPrivateCrtKeySpec;
|
|
||||||
import java.security.spec.RSAPublicKeySpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class for native keys needed for using ucrypto APIs.
|
* Wrapper class for native keys needed for using ucrypto APIs.
|
||||||
@ -87,6 +77,41 @@ abstract class NativeKey implements Key {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final class RSAPrivate extends NativeKey implements RSAPrivateKey {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1622705588904302831L;
|
||||||
|
|
||||||
|
private final RSAPrivateKeySpec keySpec;
|
||||||
|
private final long keyId;
|
||||||
|
|
||||||
|
RSAPrivate(KeySpec keySpec) throws InvalidKeySpecException {
|
||||||
|
super(2);
|
||||||
|
long pKey = 0L;
|
||||||
|
if (keySpec instanceof RSAPrivateKeySpec) {
|
||||||
|
RSAPrivateKeySpec ks = (RSAPrivateKeySpec) keySpec;
|
||||||
|
BigInteger mod = ks.getModulus();
|
||||||
|
BigInteger privateExp = ks.getPrivateExponent();
|
||||||
|
pKey = nativeInit(NativeKey.getMagnitude(mod),
|
||||||
|
NativeKey.getMagnitude(privateExp));
|
||||||
|
} else {
|
||||||
|
throw new InvalidKeySpecException("Only supports RSAPrivateKeySpec");
|
||||||
|
}
|
||||||
|
if (pKey == 0L) {
|
||||||
|
throw new UcryptoException("Error constructing RSA PrivateKey");
|
||||||
|
}
|
||||||
|
// track native resource clean up
|
||||||
|
new KeyRef(this, pKey);
|
||||||
|
this.keySpec = (RSAPrivateKeySpec) keySpec;
|
||||||
|
this.keyId = pKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
long value() { return keyId; }
|
||||||
|
public BigInteger getModulus() { return keySpec.getModulus(); };
|
||||||
|
public BigInteger getPrivateExponent() { return keySpec.getPrivateExponent(); };
|
||||||
|
|
||||||
|
private native static long nativeInit(byte[] mod, byte[] privExp);
|
||||||
|
}
|
||||||
|
|
||||||
static final class RSAPrivateCrt extends NativeKey implements RSAPrivateCrtKey {
|
static final class RSAPrivateCrt extends NativeKey implements RSAPrivateCrtKey {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6812507588904302831L;
|
private static final long serialVersionUID = 6812507588904302831L;
|
||||||
@ -119,7 +144,7 @@ abstract class NativeKey implements Key {
|
|||||||
throw new InvalidKeySpecException("Only supports RSAPrivateCrtKeySpec");
|
throw new InvalidKeySpecException("Only supports RSAPrivateCrtKeySpec");
|
||||||
}
|
}
|
||||||
if (pKey == 0L) {
|
if (pKey == 0L) {
|
||||||
throw new UcryptoException("Error constructing RSA PrivateKey");
|
throw new UcryptoException("Error constructing RSA PrivateCrtKey");
|
||||||
}
|
}
|
||||||
// track native resource clean up
|
// track native resource clean up
|
||||||
new KeyRef(this, pKey);
|
new KeyRef(this, pKey);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -37,9 +37,11 @@ import java.security.Key;
|
|||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.spec.RSAPrivateCrtKeySpec;
|
import java.security.spec.RSAPrivateCrtKeySpec;
|
||||||
|
import java.security.spec.RSAPrivateKeySpec;
|
||||||
import java.security.spec.RSAPublicKeySpec;
|
import java.security.spec.RSAPublicKeySpec;
|
||||||
import java.security.interfaces.RSAKey;
|
import java.security.interfaces.RSAKey;
|
||||||
import java.security.interfaces.RSAPrivateCrtKey;
|
import java.security.interfaces.RSAPrivateCrtKey;
|
||||||
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
import java.security.interfaces.RSAPublicKey;
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
@ -205,8 +207,8 @@ public class NativeRSACipher extends CipherSpi {
|
|||||||
// Make sure the proper opmode uses the proper key
|
// Make sure the proper opmode uses the proper key
|
||||||
if (doEncrypt && (!(newKey instanceof RSAPublicKey))) {
|
if (doEncrypt && (!(newKey instanceof RSAPublicKey))) {
|
||||||
throw new InvalidKeyException("RSAPublicKey required for encryption");
|
throw new InvalidKeyException("RSAPublicKey required for encryption");
|
||||||
} else if (!doEncrypt && (!(newKey instanceof RSAPrivateCrtKey))) {
|
} else if (!doEncrypt && (!(newKey instanceof RSAPrivateKey))) {
|
||||||
throw new InvalidKeyException("RSAPrivateCrtKey required for decryption");
|
throw new InvalidKeyException("RSAPrivateKey required for decryption");
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeKey nativeKey = null;
|
NativeKey nativeKey = null;
|
||||||
@ -223,17 +225,26 @@ public class NativeRSACipher extends CipherSpi {
|
|||||||
throw new InvalidKeyException(ikse);
|
throw new InvalidKeyException(ikse);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RSAPrivateCrtKey privateKey = (RSAPrivateCrtKey) newKey;
|
|
||||||
try {
|
try {
|
||||||
nativeKey = (NativeKey) keyFactory.engineGeneratePrivate
|
if (newKey instanceof RSAPrivateCrtKey) {
|
||||||
(new RSAPrivateCrtKeySpec(privateKey.getModulus(),
|
RSAPrivateCrtKey privateKey = (RSAPrivateCrtKey) newKey;
|
||||||
privateKey.getPublicExponent(),
|
nativeKey = (NativeKey) keyFactory.engineGeneratePrivate
|
||||||
privateKey.getPrivateExponent(),
|
(new RSAPrivateCrtKeySpec(privateKey.getModulus(),
|
||||||
privateKey.getPrimeP(),
|
privateKey.getPublicExponent(),
|
||||||
privateKey.getPrimeQ(),
|
privateKey.getPrivateExponent(),
|
||||||
privateKey.getPrimeExponentP(),
|
privateKey.getPrimeP(),
|
||||||
privateKey.getPrimeExponentQ(),
|
privateKey.getPrimeQ(),
|
||||||
privateKey.getCrtCoefficient()));
|
privateKey.getPrimeExponentP(),
|
||||||
|
privateKey.getPrimeExponentQ(),
|
||||||
|
privateKey.getCrtCoefficient()));
|
||||||
|
} else if (newKey instanceof RSAPrivateKey) {
|
||||||
|
RSAPrivateKey privateKey = (RSAPrivateKey) newKey;
|
||||||
|
nativeKey = (NativeKey) keyFactory.engineGeneratePrivate
|
||||||
|
(new RSAPrivateKeySpec(privateKey.getModulus(),
|
||||||
|
privateKey.getPrivateExponent()));
|
||||||
|
} else {
|
||||||
|
throw new InvalidKeyException("Unsupported type of RSAPrivateKey");
|
||||||
|
}
|
||||||
} catch (InvalidKeySpecException ikse) {
|
} catch (InvalidKeySpecException ikse) {
|
||||||
throw new InvalidKeyException(ikse);
|
throw new InvalidKeyException(ikse);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -38,16 +38,11 @@ import java.security.PublicKey;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.KeyFactorySpi;
|
import java.security.KeyFactorySpi;
|
||||||
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.*;
|
||||||
import java.security.spec.KeySpec;
|
|
||||||
import java.security.spec.RSAPrivateCrtKeySpec;
|
|
||||||
import java.security.spec.RSAPublicKeySpec;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ucrypto-private KeyFactory class for generating native keys
|
* Ucrypto-private KeyFactory class for generating native keys
|
||||||
* needed for using ucrypto APIs. Given that it's not used
|
* needed for using ucrypto APIs.
|
||||||
* externally, it only needs to support RSAPrivateCrtKeySpec
|
|
||||||
* and RSAPublicKeySpec objects.
|
|
||||||
*
|
*
|
||||||
* @since 1.9
|
* @since 1.9
|
||||||
*/
|
*/
|
||||||
@ -56,7 +51,13 @@ public final class NativeRSAKeyFactory extends KeyFactorySpi {
|
|||||||
@Override
|
@Override
|
||||||
protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
|
protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
return new NativeKey.RSAPrivateCrt(keySpec);
|
if (keySpec instanceof RSAPrivateCrtKeySpec) {
|
||||||
|
return new NativeKey.RSAPrivateCrt(keySpec);
|
||||||
|
} else if (keySpec instanceof RSAPrivateKeySpec) {
|
||||||
|
return new NativeKey.RSAPrivate(keySpec);
|
||||||
|
} else {
|
||||||
|
throw new InvalidKeySpecException("Unsupported key spec");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,9 +43,8 @@ import java.security.PublicKey;
|
|||||||
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.interfaces.*;
|
import java.security.interfaces.*;
|
||||||
import java.security.spec.RSAPrivateCrtKeySpec;
|
import java.security.spec.*;
|
||||||
import java.security.spec.RSAPublicKeySpec;
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import sun.nio.ch.DirectBuffer;
|
import sun.nio.ch.DirectBuffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
@ -192,25 +191,31 @@ class NativeRSASignature extends SignatureSpi {
|
|||||||
int newSigLength = sigLength;
|
int newSigLength = sigLength;
|
||||||
// Need to check RSA key length whenever a new private key is set
|
// Need to check RSA key length whenever a new private key is set
|
||||||
if (privateKey != key) {
|
if (privateKey != key) {
|
||||||
if (privateKey instanceof RSAPrivateCrtKey) {
|
if (!(privateKey instanceof RSAPrivateKey)) {
|
||||||
RSAPrivateCrtKey rsaPrivKey = (RSAPrivateCrtKey) privateKey;
|
throw new InvalidKeyException("RSAPrivateKey required");
|
||||||
BigInteger mod = rsaPrivKey.getModulus();
|
}
|
||||||
newSigLength = checkRSAKeyLength(mod);
|
RSAPrivateKey rsaPrivKey = (RSAPrivateKey) privateKey;
|
||||||
try {
|
BigInteger mod = rsaPrivKey.getModulus();
|
||||||
|
newSigLength = checkRSAKeyLength(mod);
|
||||||
|
BigInteger pe = rsaPrivKey.getPrivateExponent();
|
||||||
|
try {
|
||||||
|
if (rsaPrivKey instanceof RSAPrivateCrtKey) {
|
||||||
|
RSAPrivateCrtKey rsaPrivCrtKey = (RSAPrivateCrtKey) rsaPrivKey;
|
||||||
newKey = (NativeKey) keyFactory.engineGeneratePrivate
|
newKey = (NativeKey) keyFactory.engineGeneratePrivate
|
||||||
(new RSAPrivateCrtKeySpec(mod,
|
(new RSAPrivateCrtKeySpec(mod,
|
||||||
rsaPrivKey.getPublicExponent(),
|
rsaPrivCrtKey.getPublicExponent(),
|
||||||
rsaPrivKey.getPrivateExponent(),
|
pe,
|
||||||
rsaPrivKey.getPrimeP(),
|
rsaPrivCrtKey.getPrimeP(),
|
||||||
rsaPrivKey.getPrimeQ(),
|
rsaPrivCrtKey.getPrimeQ(),
|
||||||
rsaPrivKey.getPrimeExponentP(),
|
rsaPrivCrtKey.getPrimeExponentP(),
|
||||||
rsaPrivKey.getPrimeExponentQ(),
|
rsaPrivCrtKey.getPrimeExponentQ(),
|
||||||
rsaPrivKey.getCrtCoefficient()));
|
rsaPrivCrtKey.getCrtCoefficient()));
|
||||||
} catch (InvalidKeySpecException ikse) {
|
} else {
|
||||||
throw new InvalidKeyException(ikse);
|
newKey = (NativeKey) keyFactory.engineGeneratePrivate
|
||||||
|
(new RSAPrivateKeySpec(mod, pe));
|
||||||
}
|
}
|
||||||
} else {
|
} catch (InvalidKeySpecException ikse) {
|
||||||
throw new InvalidKeyException("RSAPrivateCrtKey required");
|
throw new InvalidKeyException(ikse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init(true, newKey, newSigLength);
|
init(true, newKey, newSigLength);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -430,12 +430,18 @@ jint JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate
|
|||||||
* Signature: (JZ[BI)I
|
* Signature: (JZ[BI)I
|
||||||
*/
|
*/
|
||||||
jint JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal
|
jint JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal
|
||||||
(jlong pContext, jboolean encrypt, int outLen, jbyte* bufOut, jint outOfs) {
|
(jlong pContext, jboolean encrypt, int outLen, jbyte* out, jint outOfs) {
|
||||||
crypto_ctx_t *context;
|
crypto_ctx_t *context;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
unsigned char* bufOut = (unsigned char*) out;
|
||||||
|
|
||||||
context = (crypto_ctx_t *) pContext;
|
context = (crypto_ctx_t *) pContext;
|
||||||
rv = CipherFinal(context, encrypt, (unsigned char*)bufOut, outOfs, &outLen);
|
// Avoid null output buffer to workaround Solaris bug21481818 (fixed in S12)
|
||||||
|
if (bufOut == NULL) {
|
||||||
|
bufOut = (unsigned char*)(&outLen);
|
||||||
|
outLen = 0;
|
||||||
|
}
|
||||||
|
rv = CipherFinal(context, encrypt, bufOut, outOfs, &outLen);
|
||||||
free(context);
|
free(context);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
return -rv; // use negative value to indicate error!
|
return -rv; // use negative value to indicate error!
|
||||||
@ -648,7 +654,8 @@ JNIEXPORT jint JNICALL Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal
|
|||||||
|
|
||||||
// out is null when nativeFinal() is called solely for resource clean up
|
// out is null when nativeFinal() is called solely for resource clean up
|
||||||
if (out == NULL) {
|
if (out == NULL) {
|
||||||
bufOut = NULL;
|
// Avoid null output buffer to workaround Solaris bug21481818 (fixed in S12)
|
||||||
|
bufOut = (unsigned char *)(&outLen);
|
||||||
outLen = 0;
|
outLen = 0;
|
||||||
} else {
|
} else {
|
||||||
outLen = (*env)->GetArrayLength(env, out) - outOfs;
|
outLen = (*env)->GetArrayLength(env, out) - outOfs;
|
||||||
@ -661,10 +668,12 @@ JNIEXPORT jint JNICALL Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal
|
|||||||
rv = CipherFinal(context, encrypt, bufOut, 0, &outLen);
|
rv = CipherFinal(context, encrypt, bufOut, 0, &outLen);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
free(context);
|
free(context);
|
||||||
free(bufOut);
|
if (outLen != 0) {
|
||||||
|
free(bufOut);
|
||||||
|
}
|
||||||
return -rv;
|
return -rv;
|
||||||
} else {
|
} else {
|
||||||
if (bufOut != NULL) {
|
if (bufOut != NULL && outLen != 0) {
|
||||||
(*env)->SetByteArrayRegion(env, out, outOfs, outLen, (jbyte *)bufOut);
|
(*env)->SetByteArrayRegion(env, out, outOfs, outLen, (jbyte *)bufOut);
|
||||||
free(bufOut);
|
free(bufOut);
|
||||||
}
|
}
|
||||||
@ -696,6 +705,86 @@ JNIEXPORT void JNICALL Java_com_oracle_security_ucrypto_NativeKey_nativeFree
|
|||||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree(id, numOfComponents);
|
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree(id, numOfComponents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_oracle_security_ucrypto_NativeKey_RSAPrivate
|
||||||
|
* Method: nativeInit
|
||||||
|
* Signature: ([B[B)J
|
||||||
|
*/
|
||||||
|
jlong JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit
|
||||||
|
(int modLen, jbyte* jMod, int privLen, jbyte* jPriv) {
|
||||||
|
|
||||||
|
unsigned char *mod, *priv;
|
||||||
|
crypto_object_attribute_t* pKey = NULL;
|
||||||
|
|
||||||
|
pKey = calloc(2, sizeof(crypto_object_attribute_t));
|
||||||
|
if (pKey == NULL) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
mod = priv = NULL;
|
||||||
|
mod = malloc(modLen);
|
||||||
|
priv = malloc(privLen);
|
||||||
|
if (mod == NULL || priv == NULL) {
|
||||||
|
free(pKey);
|
||||||
|
free(mod);
|
||||||
|
free(priv);
|
||||||
|
return 0L;
|
||||||
|
} else {
|
||||||
|
memcpy(mod, jMod, modLen);
|
||||||
|
memcpy(priv, jPriv, privLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: numOfComponents should be 2
|
||||||
|
pKey[0].oa_type = SUN_CKA_MODULUS;
|
||||||
|
pKey[0].oa_value = (char*) mod;
|
||||||
|
pKey[0].oa_value_len = (size_t) modLen;
|
||||||
|
pKey[1].oa_type = SUN_CKA_PRIVATE_EXPONENT;
|
||||||
|
pKey[1].oa_value = (char*) priv;
|
||||||
|
pKey[1].oa_value_len = (size_t) privLen;
|
||||||
|
|
||||||
|
return (jlong) pKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit
|
||||||
|
(JNIEnv *env, jclass jCls, jbyteArray jMod, jbyteArray jPriv) {
|
||||||
|
|
||||||
|
int modLen, privLen;
|
||||||
|
jbyte *bufMod, *bufPriv;
|
||||||
|
crypto_object_attribute_t* pKey = NULL;
|
||||||
|
|
||||||
|
bufMod = bufPriv = NULL;
|
||||||
|
|
||||||
|
modLen = (*env)->GetArrayLength(env, jMod);
|
||||||
|
bufMod = getBytes(env, jMod, 0, modLen);
|
||||||
|
if ((*env)->ExceptionCheck(env)) goto cleanup;
|
||||||
|
|
||||||
|
privLen = (*env)->GetArrayLength(env, jPriv);
|
||||||
|
bufPriv = getBytes(env, jPriv, 0, privLen);
|
||||||
|
if ((*env)->ExceptionCheck(env)) goto cleanup;
|
||||||
|
|
||||||
|
// proceed if no error; otherwise free allocated memory
|
||||||
|
pKey = calloc(2, sizeof(crypto_object_attribute_t));
|
||||||
|
if (pKey == NULL) {
|
||||||
|
throwOutOfMemoryError(env, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: numOfComponents should be 2
|
||||||
|
pKey[0].oa_type = SUN_CKA_MODULUS;
|
||||||
|
pKey[0].oa_value = (char*) bufMod;
|
||||||
|
pKey[0].oa_value_len = (size_t) modLen;
|
||||||
|
pKey[1].oa_type = SUN_CKA_PRIVATE_EXPONENT;
|
||||||
|
pKey[1].oa_value = (char*) bufPriv;
|
||||||
|
pKey[1].oa_value_len = (size_t) privLen;
|
||||||
|
return (jlong) pKey;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
free(bufMod);
|
||||||
|
free(bufPriv);
|
||||||
|
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_oracle_security_ucrypto_NativeKey_RSAPrivateCrt
|
* Class: com_oracle_security_ucrypto_NativeKey_RSAPrivateCrt
|
||||||
* Method: nativeInit
|
* Method: nativeInit
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -106,7 +106,11 @@ public class Jps {
|
|||||||
errorString = " -- jvm args information unavailable";
|
errorString = " -- jvm args information unavailable";
|
||||||
String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
|
String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
|
||||||
if (jvmArgs != null && jvmArgs.length() > 0) {
|
if (jvmArgs != null && jvmArgs.length() > 0) {
|
||||||
output.append(' ').append(jvmArgs);
|
output.append(' ')
|
||||||
|
.append(
|
||||||
|
// multi-line args are permitted
|
||||||
|
jvmArgs.replace("\n", "\\n").replace("\r", "\\r")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arguments.showVmFlags()) {
|
if (arguments.showVmFlags()) {
|
||||||
|
@ -133,9 +133,6 @@ java/beans/Introspector/8132566/OverrideUserDefPropertyInfoTest.java generic-all
|
|||||||
# 8029891
|
# 8029891
|
||||||
java/lang/ClassLoader/deadlock/GetResource.java generic-all
|
java/lang/ClassLoader/deadlock/GetResource.java generic-all
|
||||||
|
|
||||||
# 8133552
|
|
||||||
java/lang/ProcessHandle/InfoTest.java generic-all
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# jdk_instrument
|
# jdk_instrument
|
||||||
@ -363,10 +360,6 @@ com/sun/jdi/GetLocalVariables4Test.sh windows-all
|
|||||||
# 8062512
|
# 8062512
|
||||||
java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
|
java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
|
||||||
|
|
||||||
# 8029453
|
|
||||||
java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java linux-all
|
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# jdk_instrument
|
# jdk_instrument
|
||||||
@ -387,11 +380,6 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all
|
|||||||
# 6456333
|
# 6456333
|
||||||
sun/tools/jps/TestJpsJarRelative.java generic-all
|
sun/tools/jps/TestJpsJarRelative.java generic-all
|
||||||
|
|
||||||
# 8134420
|
|
||||||
sun/tools/jps/TestJpsClass.java generic-all
|
|
||||||
sun/tools/jps/TestJpsJar.java generic-all
|
|
||||||
sun/tools/jps/TestJpsSanity.java generic-all
|
|
||||||
|
|
||||||
# 6734748
|
# 6734748
|
||||||
sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
|
sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8007267
|
* @bug 8007267
|
||||||
* @summary [macosx] com.apple.eawt.Application.setDefaultMenuBar is not working
|
* @summary [macosx] com.apple.eawt.Application.setDefaultMenuBar is not working
|
||||||
|
* @requires (os.family == "mac")
|
||||||
* @author leonid.romanov@oracle.com
|
* @author leonid.romanov@oracle.com
|
||||||
* @modules java.desktop/sun.awt
|
* @modules java.desktop/sun.awt
|
||||||
* java.desktop/com.apple.eawt
|
* java.desktop/com.apple.eawt
|
||||||
@ -34,7 +35,6 @@
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import sun.awt.*;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class DefaultMenuBarTest {
|
|||||||
|
|
||||||
static volatile int listenerCallCounter = 0;
|
static volatile int listenerCallCounter = 0;
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
|
if (!System.getProperty("os.name").contains("OS X")) {
|
||||||
System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
|
System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,7 +55,6 @@ public class DefaultMenuBarTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
|
||||||
Robot robot = new Robot();
|
Robot robot = new Robot();
|
||||||
robot.setAutoDelay(100);
|
robot.setAutoDelay(100);
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ public class DefaultMenuBarTest {
|
|||||||
robot.keyRelease(ks.getKeyCode());
|
robot.keyRelease(ks.getKeyCode());
|
||||||
robot.keyRelease(KeyEvent.VK_META);
|
robot.keyRelease(KeyEvent.VK_META);
|
||||||
|
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (listenerCallCounter != 1) {
|
if (listenerCallCounter != 1) {
|
||||||
throw new Exception("Test failed: ActionListener either wasn't called or was called more than once");
|
throw new Exception("Test failed: ActionListener either wasn't called or was called more than once");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8029849
|
* @bug 8029849 8132082
|
||||||
* @summary Make sure signing via encrypt and verifying via decrypt are not
|
* @summary Make sure signing via encrypt and verifying via decrypt are not
|
||||||
* supported by OracleUcrypto provider.
|
* supported by OracleUcrypto provider.
|
||||||
* @author Anthony Scarpino
|
* @author Anthony Scarpino
|
||||||
@ -31,12 +31,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.security.KeyPairGenerator;
|
import java.security.*;
|
||||||
import java.security.KeyPair;
|
import java.security.interfaces.*;
|
||||||
|
import java.security.spec.RSAPrivateKeySpec;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.Provider;
|
|
||||||
|
|
||||||
public class CipherSignNotSupported extends UcryptoTest {
|
public class CipherSignNotSupported extends UcryptoTest {
|
||||||
|
|
||||||
@ -69,27 +67,43 @@ public class CipherSignNotSupported extends UcryptoTest {
|
|||||||
c.init(Cipher.ENCRYPT_MODE, kp.getPublic());
|
c.init(Cipher.ENCRYPT_MODE, kp.getPublic());
|
||||||
ct = c.doFinal(pt);
|
ct = c.doFinal(pt);
|
||||||
// Decryption
|
// Decryption
|
||||||
c.init(Cipher.DECRYPT_MODE, kp.getPrivate());
|
PrivateKey[] privKeys = new PrivateKey[2];
|
||||||
c.doFinal(ct);
|
privKeys[0] = kp.getPrivate();
|
||||||
// Sign
|
if (privKeys[0] instanceof RSAPrivateCrtKey) {
|
||||||
try {
|
RSAPrivateCrtKey k = (RSAPrivateCrtKey) privKeys[0];
|
||||||
c.init(Cipher.ENCRYPT_MODE, kp.getPrivate());
|
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||||
ct = c.doFinal(pt);
|
privKeys[1] = kf.generatePrivate
|
||||||
throw new RuntimeException("Encrypt operation should have failed.");
|
(new RSAPrivateKeySpec(k.getModulus(), k.getPrivateExponent()));
|
||||||
} catch (InvalidKeyException e) {
|
} else {
|
||||||
if (e.getMessage().compareTo("RSAPublicKey required for " +
|
privKeys = new PrivateKey[] {privKeys[0]};
|
||||||
"encryption") != 0) {
|
}
|
||||||
System.out.println("Wrong exception thrown.");
|
|
||||||
throw e;
|
for (PrivateKey pk : privKeys) {
|
||||||
|
System.out.println("Testing " + pk);
|
||||||
|
c.init(Cipher.DECRYPT_MODE, pk);
|
||||||
|
c.doFinal(ct);
|
||||||
|
|
||||||
|
// Sign
|
||||||
|
try {
|
||||||
|
c.init(Cipher.ENCRYPT_MODE, pk);
|
||||||
|
ct = c.doFinal(pt);
|
||||||
|
throw new RuntimeException("Encrypt operation should have failed.");
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
if (e.getMessage().compareTo("RSAPublicKey required for " +
|
||||||
|
"encryption") != 0) {
|
||||||
|
System.out.println("Wrong exception thrown.");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify
|
// Verify
|
||||||
try {
|
try {
|
||||||
c.init(Cipher.DECRYPT_MODE, kp.getPublic());
|
c.init(Cipher.DECRYPT_MODE, kp.getPublic());
|
||||||
c.doFinal(ct);
|
c.doFinal(ct);
|
||||||
throw new RuntimeException("Decrypt operation should have failed.");
|
throw new RuntimeException("Decrypt operation should have failed.");
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
if (e.getMessage().compareTo("RSAPrivateCrtKey required for " +
|
if (e.getMessage().compareTo("RSAPrivateKey required for " +
|
||||||
"decryption") != 0) {
|
"decryption") != 0) {
|
||||||
System.out.println("Wrong exception thrown.");
|
System.out.println("Wrong exception thrown.");
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* 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.awt.AWTException;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Canvas;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 4356202
|
||||||
|
* @summary Tests that getLocationOnScreen returns valid value(WindowMaker
|
||||||
|
* only).
|
||||||
|
* @author dom@sparc.spb.su:
|
||||||
|
*/
|
||||||
|
public class GetScreenLocTest {
|
||||||
|
//Declare things used in the test, like buttons and labels here
|
||||||
|
static Robot robot = null;
|
||||||
|
private static class MyCanvas extends Canvas {
|
||||||
|
public Dimension getPreferredSize() {
|
||||||
|
return new Dimension(100, 100);
|
||||||
|
}
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
super.paint(g);
|
||||||
|
g.setColor(Color.blue);
|
||||||
|
Rectangle r = getBounds();
|
||||||
|
g.fillRect(0, 0, r.width, r.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static int state = 0; // there are three states - (-1,-1),(0,0),(1,1)
|
||||||
|
|
||||||
|
static void bigPause() {
|
||||||
|
Toolkit.getDefaultToolkit().sync();
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void doPress(Point p) {
|
||||||
|
robot.mouseMove(p.x, p.y);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) throws AWTException {
|
||||||
|
robot = new Robot();
|
||||||
|
Frame bigOne = new Frame();
|
||||||
|
bigOne.setSize(200, 200);
|
||||||
|
bigOne.setLocationRelativeTo(null);
|
||||||
|
bigOne.setVisible(true);
|
||||||
|
Frame f = new Frame();
|
||||||
|
f.setLayout(new BorderLayout());
|
||||||
|
f.setSize(120, 150);
|
||||||
|
f.setLocationRelativeTo(null);
|
||||||
|
Canvas c = new MyCanvas();
|
||||||
|
f.add(c, BorderLayout.CENTER);
|
||||||
|
c.addMouseListener(new MouseAdapter() {
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
switch(state) {
|
||||||
|
case 0: // the first event should be (0,0)
|
||||||
|
if (e.getX() != 0 || e.getY() != 0) {
|
||||||
|
System.out.println("state 0: wrong location" + e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
state++;
|
||||||
|
break;
|
||||||
|
case 1: // the second event should be (1,1)
|
||||||
|
if (e.getX() != 1 || e.getY() != 1) {
|
||||||
|
System.out.println("state 1: wrong location " + e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
state++;
|
||||||
|
break;
|
||||||
|
case 2: // this should never happen
|
||||||
|
System.out.println("state 2: wrong location " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
f.pack();
|
||||||
|
f.setVisible(true);
|
||||||
|
bigPause();
|
||||||
|
|
||||||
|
Point p = c.getLocationOnScreen();
|
||||||
|
doPress(p);
|
||||||
|
p.x += 1;
|
||||||
|
p.y += 1;
|
||||||
|
doPress(p);
|
||||||
|
p.x -= 2;
|
||||||
|
p.y -= 2;
|
||||||
|
doPress(p);
|
||||||
|
bigPause();
|
||||||
|
|
||||||
|
f.dispose();
|
||||||
|
bigOne.dispose();
|
||||||
|
|
||||||
|
// ...and at the end the state should be 2
|
||||||
|
if (state != 2) {
|
||||||
|
throw new RuntimeException("wrong state: " + state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* 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 4980592
|
||||||
|
@summary switching user in XP causes an NPE in
|
||||||
|
sun.awt.windows.WWindowPeer.displayChanged
|
||||||
|
@requires (os.family == "windows")
|
||||||
|
@modules java.desktop/java.awt.peer
|
||||||
|
@modules java.desktop/sun.awt.windows
|
||||||
|
@modules java.desktop/sun.awt
|
||||||
|
@author son@sparc.spb.su: area=embedded
|
||||||
|
@run main DisplayChangedTest
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* DisplayChangedTest.java
|
||||||
|
*
|
||||||
|
* summary: switching user in XP causes an NPE in
|
||||||
|
* sun.awt.windows.WWindowPeer.displayChanged
|
||||||
|
*/
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Dialog;
|
||||||
|
import java.awt.TextArea;
|
||||||
|
import java.awt.peer.ComponentPeer;
|
||||||
|
import java.awt.peer.FramePeer;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
|
public class DisplayChangedTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test fails if it throws any exception.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void init() throws Exception {
|
||||||
|
|
||||||
|
if (!System.getProperty("os.name").startsWith("Windows")) {
|
||||||
|
System.out.println("This is Windows only test.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame frame = new Frame("AWT Frame");
|
||||||
|
frame.pack();
|
||||||
|
|
||||||
|
FramePeer frame_peer = AWTAccessor.getComponentAccessor()
|
||||||
|
.getPeer(frame);
|
||||||
|
Class comp_peer_class = Class.forName("sun.awt.windows.WComponentPeer");
|
||||||
|
Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
|
||||||
|
hwnd_field.setAccessible(true);
|
||||||
|
long hwnd = hwnd_field.getLong(frame_peer);
|
||||||
|
|
||||||
|
Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
|
||||||
|
Constructor constructor = clazz
|
||||||
|
.getConstructor(new Class[]{long.class});
|
||||||
|
Frame embedded_frame = (Frame) constructor
|
||||||
|
.newInstance(new Object[]{new Long(hwnd)});
|
||||||
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(
|
||||||
|
embedded_frame);
|
||||||
|
Class peerClass = peer.getClass();
|
||||||
|
Method displayChangedM = peerClass.getMethod("displayChanged",
|
||||||
|
new Class[0]);
|
||||||
|
displayChangedM.invoke(peer, null);
|
||||||
|
embedded_frame.dispose();
|
||||||
|
frame.dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
new DisplayChangedTest().init();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* 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 6345002
|
||||||
|
@summary grab problems with EmbeddedFrame
|
||||||
|
@requires (os.family == "windows")
|
||||||
|
@modules java.desktop/java.awt.peer
|
||||||
|
@modules java.desktop/sun.awt
|
||||||
|
@modules java.desktop/sun.awt.windows
|
||||||
|
@author Oleg.Semenov@sun.com area=EmbeddedFrame
|
||||||
|
@run main EmbeddedFrameGrabTest
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* EmbeddedFrameGrabTest.java
|
||||||
|
*
|
||||||
|
* summary: grab problems with EmbeddedFrame
|
||||||
|
*/
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.peer.FramePeer;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import java.awt.Panel;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.TextArea;
|
||||||
|
import java.awt.Dialog;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
|
public class EmbeddedFrameGrabTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test fails if it throws any exception.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void init() throws Exception {
|
||||||
|
|
||||||
|
if (!System.getProperty("os.name").startsWith("Windows")) {
|
||||||
|
System.out.println("This is Windows only test.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Frame frame = new Frame("AWT Frame");
|
||||||
|
frame.pack();
|
||||||
|
frame.setSize(200, 200);
|
||||||
|
FramePeer frame_peer = AWTAccessor.getComponentAccessor()
|
||||||
|
.getPeer(frame);
|
||||||
|
Class comp_peer_class
|
||||||
|
= Class.forName("sun.awt.windows.WComponentPeer");
|
||||||
|
Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
|
||||||
|
hwnd_field.setAccessible(true);
|
||||||
|
long hwnd = hwnd_field.getLong(frame_peer);
|
||||||
|
|
||||||
|
Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
|
||||||
|
Constructor constructor
|
||||||
|
= clazz.getConstructor(new Class[]{long.class});
|
||||||
|
final Frame embedded_frame
|
||||||
|
= (Frame) constructor.newInstance(new Object[]{
|
||||||
|
new Long(hwnd)});;
|
||||||
|
final JComboBox<String> combo = new JComboBox<>(new String[]{
|
||||||
|
"Item 1", "Item 2"
|
||||||
|
});
|
||||||
|
combo.setSelectedIndex(1);
|
||||||
|
final Panel p = new Panel();
|
||||||
|
p.setLayout(new BorderLayout());
|
||||||
|
embedded_frame.add(p, BorderLayout.CENTER);
|
||||||
|
embedded_frame.validate();
|
||||||
|
p.add(combo);
|
||||||
|
p.validate();
|
||||||
|
frame.setVisible(true);
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.delay(2000);
|
||||||
|
Rectangle clos = new Rectangle(
|
||||||
|
combo.getLocationOnScreen(), combo.getSize());
|
||||||
|
robot.mouseMove(clos.x + clos.width / 2, clos.y + clos.height / 2);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||||
|
robot.delay(1000);
|
||||||
|
if (!combo.isPopupVisible()) {
|
||||||
|
throw new RuntimeException("Combobox popup is not visible!");
|
||||||
|
}
|
||||||
|
robot.mouseMove(clos.x + clos.width / 2, clos.y + clos.height + 3);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||||
|
robot.delay(1000);
|
||||||
|
if (combo.getSelectedIndex() != 0) {
|
||||||
|
throw new RuntimeException("Combobox selection has not changed!");
|
||||||
|
}
|
||||||
|
embedded_frame.remove(p);
|
||||||
|
embedded_frame.dispose();
|
||||||
|
frame.dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
new EmbeddedFrameGrabTest().init();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,6 +24,7 @@
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
|
* @bug 8065739 8131339
|
||||||
* @summary When Frame.setExtendedState(Frame.MAXIMIZED_BOTH)
|
* @summary When Frame.setExtendedState(Frame.MAXIMIZED_BOTH)
|
||||||
* is called for a Frame after been called setMaximizedBounds() with
|
* is called for a Frame after been called setMaximizedBounds() with
|
||||||
* certain value, Frame bounds must equal to this value.
|
* certain value, Frame bounds must equal to this value.
|
||||||
@ -55,12 +56,14 @@ public class SetMaximizedBounds {
|
|||||||
|
|
||||||
for (GraphicsDevice gd : ge.getScreenDevices()) {
|
for (GraphicsDevice gd : ge.getScreenDevices()) {
|
||||||
for (GraphicsConfiguration gc : gd.getConfigurations()) {
|
for (GraphicsConfiguration gc : gd.getConfigurations()) {
|
||||||
testMaximizedBounds(gc);
|
testMaximizedBounds(gc, false);
|
||||||
|
testMaximizedBounds(gc, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testMaximizedBounds(GraphicsConfiguration gc) throws Exception {
|
static void testMaximizedBounds(GraphicsConfiguration gc, boolean undecorated)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
Frame frame = null;
|
Frame frame = null;
|
||||||
try {
|
try {
|
||||||
@ -71,6 +74,7 @@ public class SetMaximizedBounds {
|
|||||||
robot.setAutoDelay(50);
|
robot.setAutoDelay(50);
|
||||||
|
|
||||||
frame = new Frame();
|
frame = new Frame();
|
||||||
|
frame.setUndecorated(undecorated);
|
||||||
Rectangle maximizedBounds = new Rectangle(
|
Rectangle maximizedBounds = new Rectangle(
|
||||||
maxArea.x + maxArea.width / 6,
|
maxArea.x + maxArea.width / 6,
|
||||||
maxArea.y + maxArea.height / 6,
|
maxArea.y + maxArea.height / 6,
|
||||||
|
@ -37,6 +37,8 @@ import java.lang.reflect.Proxy;
|
|||||||
* @bug 8013468
|
* @bug 8013468
|
||||||
* @summary Cursor does not update properly when in fullscreen mode on Mac
|
* @summary Cursor does not update properly when in fullscreen mode on Mac
|
||||||
* The core reason of the issue was the lack of a mouse entered event in fullscreen
|
* The core reason of the issue was the lack of a mouse entered event in fullscreen
|
||||||
|
* @requires (os.family == "mac")
|
||||||
|
* @modules java.desktop/com.apple.eawt
|
||||||
* @library ../../regtesthelpers
|
* @library ../../regtesthelpers
|
||||||
* @build Util
|
* @build Util
|
||||||
* @modules java.desktop/com.apple.eawt
|
* @modules java.desktop/com.apple.eawt
|
||||||
|
@ -36,6 +36,7 @@ import javax.swing.*;
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8024185
|
* @bug 8024185
|
||||||
* @summary Native Mac OS X full screen does not work after showing the splash
|
* @summary Native Mac OS X full screen does not work after showing the splash
|
||||||
|
* @requires (os.family == "mac")
|
||||||
* @library ../
|
* @library ../
|
||||||
* @library ../../../../lib/testlibrary
|
* @library ../../../../lib/testlibrary
|
||||||
* @modules java.desktop/sun.awt
|
* @modules java.desktop/sun.awt
|
||||||
|
@ -39,7 +39,7 @@ public class TestBeanProperty {
|
|||||||
Class<?>[] types =
|
Class<?>[] types =
|
||||||
{B.class, BL.class, BLF.class, E.class, H.class, P.class,
|
{B.class, BL.class, BLF.class, E.class, H.class, P.class,
|
||||||
VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
|
VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
|
||||||
EVX.class};
|
EVX.class, R.class};
|
||||||
for (Class<?> type : types) {
|
for (Class<?> type : types) {
|
||||||
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
|
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
|
||||||
if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
|
if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
|
||||||
@ -66,6 +66,10 @@ public class TestBeanProperty {
|
|||||||
BeanUtils.reportPropertyDescriptor(pd);
|
BeanUtils.reportPropertyDescriptor(pd);
|
||||||
throw new Error("required");
|
throw new Error("required");
|
||||||
}
|
}
|
||||||
|
if ((D.class == type) == !"getter".equals(pd.getShortDescription())) {
|
||||||
|
BeanUtils.reportPropertyDescriptor(pd);
|
||||||
|
throw new Error("shortDescription");
|
||||||
|
}
|
||||||
if ((VU.class == type) == !Boolean.TRUE.equals(pd.getValue("visualUpdate"))) {
|
if ((VU.class == type) == !Boolean.TRUE.equals(pd.getValue("visualUpdate"))) {
|
||||||
BeanUtils.reportPropertyDescriptor(pd);
|
BeanUtils.reportPropertyDescriptor(pd);
|
||||||
throw new Error("visualUpdate");
|
throw new Error("visualUpdate");
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user