diff --git a/.hgtags b/.hgtags index 31681df35e7..ebb28740088 100644 --- a/.hgtags +++ b/.hgtags @@ -250,3 +250,7 @@ b32e2219736e42baaf45daf0ad67ed34f6033799 jdk9-b02 dd311791ad6895a3989020dd6c6c46db87972ab8 jdk9-b05 85dbdc227c5e11429b4fc4a8ba763f50107edd6e jdk9-b06 c826d05f1fb0773f6a28caa763307dd30d90d36e jdk9-b07 +b47e021195757f8f45582124ea7cad48ccf5f872 jdk9-b08 +efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09 +8c0bdeecd7c0f9ce3f3762a51991f755cb3a972c jdk9-b10 +0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index b35a11c862e..1d48958d7bb 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -250,3 +250,7 @@ cb4c3440bc2748101923e2488506e61009ab1bf5 jdk9-b04 8c63f0b6ada282f27e3a80125e53c3be603f9af7 jdk9-b05 d0b525cd31b87abeb6d5b7e3516953eeb13b323c jdk9-b06 0ea015c298b201c07fa33990f2445b6d0ef3566d jdk9-b07 +db045d8faa0924b7378102d24a1a0d850c1e3834 jdk9-b08 +4a21dc7d57d1069a01f68e7182c074cb37349dfb jdk9-b09 +fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10 +ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11 diff --git a/README-builds.html b/README-builds.html index 14796a27e87..438c9907a9d 100644 --- a/README-builds.html +++ b/README-builds.html @@ -145,7 +145,7 @@ root repository:
- hg clone http://hg.openjdk.java.net/jdk8/jdk8
+ hg clone http://hg.openjdk.java.net/jdk9/jdk9
YourOpenJDK
cd YourOpenJDK
@@ -373,18 +373,17 @@
particular update level.
- Building JDK 8 requires use of a version
- of JDK 7 that is at Update 7 or newer. JDK 8
- developers should not use JDK 8 as the boot
- JDK, to ensure that JDK 8 dependencies are
+ Building JDK 9 requires JDK 8. JDK 9
+ developers should not use JDK 9 as the boot
+ JDK, to ensure that JDK 9 dependencies are
not introduced into the parts of the system
- that are built with JDK 7.
+ that are built with JDK 8.
- The JDK 7 binaries can be downloaded from Oracle's
+ The JDK 8 binaries can be downloaded from Oracle's
JDK 7 download site.
- For build performance reasons
+ target="_blank">JDK 8 download site.
+ For build performance reasons it
is very important that this bootstrap JDK be made available
on the local disk of the machine doing the build.
You should add its bin
directory
@@ -1454,9 +1453,7 @@
One of the top goals of the new build system is to improve the
build performance and decrease the time needed to build. This will
soon also apply to the java compilation when the Smart Javac wrapper
- is making its way into jdk8. It can be tried in the build-infra
- repository already. You are likely to find that the new build system
- is faster than the old one even without this feature.
+ is fully supported.
At the end of a successful execution of configure
,
you will get a performance summary,
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index edd6cec4ffb..ae679a9d469 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -82,10 +82,10 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`]
+ [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
- AC_MSG_NOTICE([(Your Boot JDK must be version 7, 8 or 9)])
+ AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
diff --git a/common/autoconf/build-performance.m4 b/common/autoconf/build-performance.m4
index 22a62748a13..7d4b8abb8da 100644
--- a/common/autoconf/build-performance.m4
+++ b/common/autoconf/build-performance.m4
@@ -89,7 +89,7 @@ AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
if test "x$FOUND_MEM" = xyes; then
AC_MSG_RESULT([$MEMORY_SIZE MB])
else
- AC_MSG_RESULT([could not detect memory size, defaulting to 1024 MB])
+ AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
AC_MSG_WARN([This might seriously impact build performance!])
fi
])
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index a3f0803b0fe..fc13f71b8aa 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -473,7 +473,8 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
;;
ppc )
- # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
+ # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
+ CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
;;
* )
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index fdf1c6dc829..c7a27482caf 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -4243,7 +4243,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1396624161
+DATE_WHEN_GENERATED=1398861894
###############################################################################
#
@@ -19896,12 +19896,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20228,12 +20228,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20422,12 +20422,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20609,12 +20609,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20795,12 +20795,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -20981,12 +20981,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21158,12 +21158,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21476,12 +21476,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -21804,12 +21804,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22019,12 +22019,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22199,12 +22199,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22407,12 +22407,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22587,12 +22587,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22795,12 +22795,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -22975,12 +22975,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23183,12 +23183,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23363,12 +23363,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23558,12 +23558,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23736,12 +23736,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -23932,12 +23932,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24110,12 +24110,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24305,12 +24305,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24483,12 +24483,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24679,12 +24679,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -24857,12 +24857,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -25034,12 +25034,12 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`
+ FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 7, 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 7, 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -41662,7 +41662,8 @@ fi
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
;;
ppc )
- # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
+ # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
+ CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
;;
* )
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
@@ -43504,9 +43505,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -44092,9 +44094,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -44394,9 +44397,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -44687,9 +44691,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -44980,9 +44985,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -45274,9 +45280,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -45569,9 +45576,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -45860,9 +45868,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -46151,9 +46160,10 @@ $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME
$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
@@ -48566,8 +48576,8 @@ $as_echo_n "checking for memory size... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEMORY_SIZE MB" >&5
$as_echo "$MEMORY_SIZE MB" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not detect memory size, defaulting to 1024 MB" >&5
-$as_echo "could not detect memory size, defaulting to 1024 MB" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not detect memory size, defaulting to $MEMORY_SIZE MB" >&5
+$as_echo "could not detect memory size, defaulting to $MEMORY_SIZE MB" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This might seriously impact build performance!" >&5
$as_echo "$as_me: WARNING: This might seriously impact build performance!" >&2;}
fi
diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
index 1546529ce80..88bdfe30de3 100644
--- a/common/autoconf/libraries.m4
+++ b/common/autoconf/libraries.m4
@@ -286,9 +286,10 @@ AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
FOUND_FREETYPE=no
fi
- elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
- # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
- POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
fi
fi
fi
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index c793d0e5c63..47861fcf2b8 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -261,6 +261,7 @@ BOOT_JDK_SOURCETARGET:=@BOOT_JDK_SOURCETARGET@
# Information about the build system
NUM_CORES:=@NUM_CORES@
+MEMORY_SIZE:=@MEMORY_SIZE@
# Enable sjavac support = use a javac server,
# multi core javac compilation and dependency tracking.
ENABLE_SJAVAC:=@ENABLE_SJAVAC@
diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh
index 3ada41ee0cd..13f44425585 100644
--- a/common/bin/hgforest.sh
+++ b/common/bin/hgforest.sh
@@ -72,12 +72,21 @@ usage() {
exit 1
}
-
if [ "x" = "x$command" ] ; then
echo "ERROR: No command to hg supplied!"
usage
fi
+# Check if we can use fifos for monitoring sub-process completion.
+on_windows=`uname -s | egrep -ic -e 'cygwin|msys'`
+if [ ${on_windows} = "1" ]; then
+ # cygwin has (2014-04-18) broken (single writer only) FIFOs
+ # msys has (2014-04-18) no FIFOs.
+ have_fifos="false"
+else
+ have_fifos="true"
+fi
+
# Clean out the temporary directory that stores the pid files.
tmp=/tmp/forest.$$
rm -f -r ${tmp}
@@ -210,7 +219,19 @@ if [ "${command}" = "serve" ] ; then
) &
else
# Run the supplied command on all repos in parallel.
+
+ # n is the number of subprocess started or which might still be running.
n=0
+ if [ $have_fifos = "true" ]; then
+ # if we have fifos use them to detect command completion.
+ mkfifo ${tmp}/fifo
+ exec 3<>${tmp}/fifo
+ if [ "${sflag}" = "true" ] ; then
+ # force sequential
+ at_a_time=1
+ fi
+ fi
+
for i in ${repos} ${repos_extra} ; do
n=`expr ${n} '+' 1`
repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'`
@@ -221,10 +242,11 @@ else
pull_base="${pull_extra}"
fi
done
+ pull_base="`echo ${pull_base} | sed -e 's@[/]*$@@'`"
(
(
if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then
- pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
+ pull_newrepo="${pull_base}/${i}"
path="`dirname ${i}`"
if [ "${path}" != "." ] ; then
times=0
@@ -237,7 +259,7 @@ else
sleep 5
done
fi
- echo "hg clone ${pull_newrepo} ${i}" > ${status_output}
+ echo "hg${global_opts} clone ${pull_newrepo} ${i}" > ${status_output}
(PYTHONUNBUFFERED=true hg${global_opts} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
else
echo "cd ${i} && hg${global_opts} ${command} ${command_args}" > ${status_output}
@@ -246,21 +268,41 @@ else
echo $! > ${tmp}/${repopidfile}.pid
) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output}
+ if [ $have_fifos = "true" ]; then
+ echo "${reponame}" >&3
+ fi
) &
- if [ `expr ${n} '%' ${at_a_time}` -eq 0 -a "${sflag}" = "false" ] ; then
- sleep 2
- echo "Waiting 5 secs before spawning next background command." > ${status_output}
- sleep 3
- fi
-
- if [ "${sflag}" = "true" ] ; then
+ if [ $have_fifos = "true" ]; then
+ # check on count of running subprocesses and possibly wait for completion
+ if [ ${at_a_time} -lt ${n} ] ; then
+ # read will block until there are completed subprocesses
+ while read repo_done; do
+ n=`expr ${n} '-' 1`
+ if [ ${n} -lt ${at_a_time} ] ; then
+ # we should start more subprocesses
+ break;
+ fi
+ done <&3
+ fi
+ else
+ if [ "${sflag}" = "false" ] ; then
+ # Compare completions to starts
+ completed="`(ls -1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
+ while [ ${at_a_time} -lt `expr ${n} '-' ${completed}` ] ; do
+ # sleep a short time to give time for something to complete
+ sleep 1
+ completed="`(ls -1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
+ done
+ else
+ # complete this task before starting another.
wait
+ fi
fi
done
fi
-# Wait for all hg commands to complete
+# Wait for all subprocesses to complete
wait
# Terminate with exit 0 only if all subprocesses were successful
@@ -270,7 +312,7 @@ if [ -d ${tmp} ]; then
exit_code=`cat ${rc} | tr -d ' \n\r'`
if [ "${exit_code}" != "0" ] ; then
repo="`echo ${rc} | sed -e s@^${tmp}@@ -e 's@/*\([^/]*\)\.pid\.rc$@\1@' -e 's@_@/@g'`"
- echo "WARNING: ${repo} exited abnormally." > ${status_output}
+ echo "WARNING: ${repo} exited abnormally ($exit_code)" > ${status_output}
ec=1
fi
done
diff --git a/common/src/fixpath.c b/common/src/fixpath.c
index b30f58d6b51..9e8d352121a 100644
--- a/common/src/fixpath.c
+++ b/common/src/fixpath.c
@@ -109,7 +109,7 @@ char *replace_cygdrive_cygwin(char const *in)
void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
{
- while ( (addlen+*u+1) > *bl) {
+ while ((addlen+*u+1) > *bl) {
*bl *= 2;
*b = (char*) realloc(*b, *bl);
}
@@ -118,7 +118,7 @@ void append(char **b, size_t *bl, size_t *u, char *add, size_t addlen)
}
/*
- * Creates a new string from in where the first occurance of sub is
+ * Creates a new string from in where the first occurrence of sub is
* replaced by rep.
*/
char *replace_substring(char *in, char *sub, char *rep)
@@ -246,7 +246,7 @@ char *fix_at_file(char const *in)
}
buffer = (char*) malloc(buflen);
- while((blocklen = fread(block,1,sizeof(block),atin)) > 0) {
+ while ((blocklen = fread(block, 1, sizeof(block), atin)) > 0) {
append(&buffer, &buflen, &used, block, blocklen);
}
buffer[used] = 0;
@@ -280,16 +280,21 @@ char * quote_arg(char const * in_arg) {
char *current = quoted;
int pass;
- if(strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) {
+ if (strlen(in_arg) == 0) {
+ // empty string? explicitly quote it.
+ return _strdup("\"\"");
+ }
+
+ if (strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) {
return _strdup(in_arg);
}
// process the arg twice. Once to calculate the size and then to copy it.
- for(pass=1; pass<=2; pass++) {
+ for (pass=1; pass<=2; pass++) {
char const *arg = in_arg;
// initial "
- if(pass == 2) {
+ if (pass == 2) {
*current = '\"';
}
current++;
@@ -328,7 +333,7 @@ char * quote_arg(char const * in_arg) {
*current = *arg;
}
current++;
- } while( *arg++ != '\0');
+ } while (*arg++ != '\0');
// allocate the buffer
if (pass == 1) {
@@ -362,7 +367,7 @@ int main(int argc, char const ** argv)
if (getenv("DEBUG_FIXPATH") != NULL) {
char const * cmdline = GetCommandLine();
- fprintf(stderr, "fixpath input line >%s<\n", strstr( cmdline , argv[1]));
+ fprintf(stderr, "fixpath input line >%s<\n", strstr(cmdline, argv[1]));
}
if (argv[1][1] == 'c' && argv[1][2] == '\0') {
@@ -399,7 +404,7 @@ int main(int argc, char const ** argv)
}
rc = SetEnvironmentVariable(var, val);
- if(!rc) {
+ if (!rc) {
// Could not set var for some reason. Try to report why.
const int msg_len = 80 + var_len + strlen(val);
char * msg = (char *) alloca(msg_len);
@@ -422,7 +427,7 @@ int main(int argc, char const ** argv)
// handle command and it's args.
while (i < argc) {
char const *replaced = replace_cygdrive(argv[i]);
- if(replaced[0] == '@') {
+ if (replaced[0] == '@') {
// Found at-file! Fix it!
replaced = fix_at_file(replaced);
}
@@ -433,7 +438,7 @@ int main(int argc, char const ** argv)
// determine the length of the line
line = NULL;
// args
- for(i = cmd; i < argc; i++) {
+ for (i = cmd; i < argc; i++) {
line += (ptrdiff_t) strlen(argv[i]);
}
// spaces and null
@@ -443,7 +448,7 @@ int main(int argc, char const ** argv)
// copy in args.
current = line;
- for(i = cmd; i < argc; i++) {
+ for (i = cmd; i < argc; i++) {
ptrdiff_t len = strlen(argv[i]);
if (i != cmd) {
*current++ = ' ';
@@ -457,16 +462,16 @@ int main(int argc, char const ** argv)
fprintf(stderr, "fixpath converted line >%s<\n", line);
}
- if(cmd == argc) {
+ if (cmd == argc) {
if (getenv("DEBUG_FIXPATH") != NULL) {
fprintf(stderr, "fixpath no command provided!\n");
}
exit(0);
}
- ZeroMemory(&si,sizeof(si));
+ ZeroMemory(&si, sizeof(si));
si.cb=sizeof(si);
- ZeroMemory(&pi,sizeof(pi));
+ ZeroMemory(&pi, sizeof(pi));
fflush(stderr);
fflush(stdout);
@@ -481,14 +486,14 @@ int main(int argc, char const ** argv)
NULL,
&si,
&pi);
- if(!rc) {
+ if (!rc) {
// Could not start process for some reason. Try to report why:
report_error("Could not start process!");
exit(126);
}
- WaitForSingleObject(pi.hProcess,INFINITE);
- GetExitCodeProcess(pi.hProcess,&exitCode);
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ GetExitCodeProcess(pi.hProcess, &exitCode);
if (getenv("DEBUG_FIXPATH") != NULL) {
for (i=0; i noTypesList[] = {};
/** true if represents enum type */
private boolean isEnum;
private static final Bridge bridge =
- (Bridge)AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Bridge run() {
return Bridge.get() ;
}
}
@@ -98,7 +99,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* is returned if the specified class does not implement
* java.io.Serializable or java.io.Externalizable.
*/
- static final ObjectStreamClass lookup(Class cl)
+ static final ObjectStreamClass lookup(Class> cl)
{
ObjectStreamClass desc = lookupInternal(cl);
if (desc.isSerializable() || desc.isExternalizable())
@@ -110,7 +111,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* Find the class descriptor for the specified class.
* Package access only so it can be called from ObjectIn/OutStream.
*/
- static ObjectStreamClass lookupInternal(Class cl)
+ static ObjectStreamClass lookupInternal(Class> cl)
{
/* Synchronize on the hashtable so no two threads will do
* this at the same time.
@@ -121,14 +122,14 @@ public class ObjectStreamClass implements java.io.Serializable {
desc = findDescriptorFor(cl);
if (desc == null) {
/* Check if it's serializable */
- boolean serializable = classSerializable.isAssignableFrom(cl);
+ boolean serializable = Serializable.class.isAssignableFrom(cl);
/* If the class is only Serializable,
* lookup the descriptor for the superclass.
*/
ObjectStreamClass superdesc = null;
if (serializable) {
- Class superclass = cl.getSuperclass();
+ Class> superclass = cl.getSuperclass();
if (superclass != null)
superdesc = lookup(superclass);
}
@@ -141,7 +142,7 @@ public class ObjectStreamClass implements java.io.Serializable {
if (serializable) {
externalizable =
((superdesc != null) && superdesc.isExternalizable()) ||
- classExternalizable.isAssignableFrom(cl);
+ Externalizable.class.isAssignableFrom(cl);
if (externalizable) {
serializable = false;
}
@@ -185,7 +186,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* that have evolved from a common root class and agree to be serialized
* and deserialized using a common format.
*/
- public static final long getSerialVersionUID( java.lang.Class clazz) {
+ public static final long getSerialVersionUID( java.lang.Class> clazz) {
ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
if( theosc != null )
{
@@ -219,7 +220,7 @@ public class ObjectStreamClass implements java.io.Serializable {
/**
* Return the actual (computed) serialVersionUID for this class.
*/
- public static final long getActualSerialVersionUID( java.lang.Class clazz )
+ public static final long getActualSerialVersionUID( java.lang.Class> clazz )
{
ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
if( theosc != null )
@@ -249,7 +250,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* Return the class in the local VM that this version is mapped to.
* Null is returned if there is no corresponding local class.
*/
- public final Class forClass() {
+ public final Class> forClass() {
return ofClass;
}
@@ -349,7 +350,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* Create a new ObjectStreamClass from a loaded class.
* Don't call this directly, call lookup instead.
*/
- private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc,
+ private ObjectStreamClass(java.lang.Class> cl, ObjectStreamClass superdesc,
boolean serial, boolean extern)
{
ofClass = cl; /* created from this class */
@@ -433,7 +434,7 @@ public class ObjectStreamClass implements java.io.Serializable {
if (initialized)
return;
- final Class cl = ofClass;
+ final Class> cl = ofClass;
if (!serializable ||
externalizable ||
@@ -561,9 +562,9 @@ public class ObjectStreamClass implements java.io.Serializable {
* will call it as necessary.
*/
writeObjectMethod = getPrivateMethod( cl, "writeObject",
- new Class[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ;
+ new Class>[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ;
readObjectMethod = getPrivateMethod( cl, "readObject",
- new Class[] { java.io.ObjectInputStream.class }, Void.TYPE ) ;
+ new Class>[] { java.io.ObjectInputStream.class }, Void.TYPE ) ;
}
return null;
}
@@ -589,9 +590,9 @@ public class ObjectStreamClass implements java.io.Serializable {
* class, or null if none found. Access checks are disabled on the
* returned method (if any).
*/
- private static Method getPrivateMethod(Class cl, String name,
- Class[] argTypes,
- Class returnType)
+ private static Method getPrivateMethod(Class> cl, String name,
+ Class>[] argTypes,
+ Class> returnType)
{
try {
Method meth = cl.getDeclaredMethod(name, argTypes);
@@ -653,7 +654,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* Fill in the reflected Fields that will be used
* for reading.
*/
- final void setClass(Class cl) throws InvalidClassException {
+ final void setClass(Class> cl) throws InvalidClassException {
if (cl == null) {
localClassDesc = null;
@@ -920,9 +921,9 @@ public class ObjectStreamClass implements java.io.Serializable {
* Access checks are disabled on the returned constructor (if any), since
* the defining class may still be non-public.
*/
- private static Constructor getExternalizableConstructor(Class cl) {
+ private static Constructor getExternalizableConstructor(Class> cl) {
try {
- Constructor cons = cl.getDeclaredConstructor(new Class[0]);
+ Constructor cons = cl.getDeclaredConstructor(new Class>[0]);
cons.setAccessible(true);
return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
cons : null;
@@ -936,15 +937,15 @@ public class ObjectStreamClass implements java.io.Serializable {
* superclass, or null if none found. Access checks are disabled on the
* returned constructor (if any).
*/
- private static Constructor getSerializableConstructor(Class cl) {
- Class initCl = cl;
+ private static Constructor getSerializableConstructor(Class> cl) {
+ Class> initCl = cl;
while (Serializable.class.isAssignableFrom(initCl)) {
if ((initCl = initCl.getSuperclass()) == null) {
return null;
}
}
try {
- Constructor cons = initCl.getDeclaredConstructor(new Class[0]);
+ Constructor cons = initCl.getDeclaredConstructor(new Class>[0]);
int mods = cons.getModifiers();
if ((mods & Modifier.PRIVATE) != 0 ||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
@@ -1049,7 +1050,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* items to the hash accumulating in the digest stream.
* Fold the hash into a long. Use the SHA secure hash function.
*/
- private static long _computeSerialVersionUID(Class cl) {
+ private static long _computeSerialVersionUID(Class> cl) {
if (DEBUG_SVUID)
msg( "Computing SerialVersionUID for " + cl ) ;
ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
@@ -1103,7 +1104,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* them from its computation.
*/
- Class interfaces[] = cl.getInterfaces();
+ Class> interfaces[] = cl.getInterfaces();
Arrays.sort(interfaces, compareClassByName);
for (int i = 0; i < interfaces.length; i++) {
@@ -1233,7 +1234,7 @@ public class ObjectStreamClass implements java.io.Serializable {
return h;
}
- private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class cl) {
+ private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class> cl) {
ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
long h = 0;
@@ -1253,7 +1254,7 @@ public class ObjectStreamClass implements java.io.Serializable {
DataOutputStream data = new DataOutputStream(mdo);
// Get SUID of parent
- Class parent = cl.getSuperclass();
+ Class> parent = cl.getSuperclass();
if ((parent != null))
// SerialBug 1; acc. to spec the one for
// java.lang.object
@@ -1309,10 +1310,10 @@ public class ObjectStreamClass implements java.io.Serializable {
/**
* Compute the JVM signature for the class.
*/
- static String getSignature(Class clazz) {
+ static String getSignature(Class> clazz) {
String type = null;
if (clazz.isArray()) {
- Class cl = clazz;
+ Class> cl = clazz;
int dimensions = 0;
while (cl.isArray()) {
dimensions++;
@@ -1358,7 +1359,7 @@ public class ObjectStreamClass implements java.io.Serializable {
sb.append("(");
- Class[] params = meth.getParameterTypes(); // avoid clone
+ Class>[] params = meth.getParameterTypes(); // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(getSignature(params[j]));
}
@@ -1375,7 +1376,7 @@ public class ObjectStreamClass implements java.io.Serializable {
sb.append("(");
- Class[] params = cons.getParameterTypes(); // avoid clone
+ Class>[] params = cons.getParameterTypes(); // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(getSignature(params[j]));
}
@@ -1395,7 +1396,7 @@ public class ObjectStreamClass implements java.io.Serializable {
* The entries are extended from java.lang.ref.SoftReference so the
* gc will be able to free them if needed.
*/
- private static ObjectStreamClass findDescriptorFor(Class cl) {
+ private static ObjectStreamClass findDescriptorFor(Class> cl) {
int hash = cl.hashCode();
int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
@@ -1442,7 +1443,7 @@ public class ObjectStreamClass implements java.io.Serializable {
descriptorFor[index] = e;
}
- private static Field[] getDeclaredFields(final Class clz) {
+ private static Field[] getDeclaredFields(final Class> clz) {
return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return clz.getDeclaredFields();
@@ -1476,7 +1477,7 @@ public class ObjectStreamClass implements java.io.Serializable {
/*
* Class that is a descriptor for in this virtual machine.
*/
- private Class ofClass;
+ private Class> ofClass;
/*
* True if descriptor for a proxy class.
@@ -1548,30 +1549,17 @@ public class ObjectStreamClass implements java.io.Serializable {
* Returns true if the given class defines a static initializer method,
* false otherwise.
*/
- private static boolean hasStaticInitializer(Class cl) {
+ private static boolean hasStaticInitializer(Class> cl) {
if (hasStaticInitializerMethod == null) {
- Class classWithThisMethod = null;
+ Class> classWithThisMethod = null;
try {
- try {
- // When using rip-int with Merlin or when this is a Merlin
- // workspace, the method we want is in sun.misc.ClassReflector
- // and absent from java.io.ObjectStreamClass.
- //
- // When compiling rip-int with JDK 1.3.x, we have to get it
- // from java.io.ObjectStreamClass.
- classWithThisMethod = Class.forName("sun.misc.ClassReflector");
- } catch (ClassNotFoundException cnfe) {
- // Do nothing. This is either not a Merlin workspace,
- // or rip-int is being compiled with something other than
- // Merlin, probably JDK 1.3. Fall back on java.io.ObjectStreaClass.
- }
if (classWithThisMethod == null)
classWithThisMethod = java.io.ObjectStreamClass.class;
hasStaticInitializerMethod =
classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
- new Class[] { Class.class });
+ new Class>[] { Class.class });
} catch (NoSuchMethodException ex) {
}
@@ -1596,22 +1584,6 @@ public class ObjectStreamClass implements java.io.Serializable {
}
- /* The Class Object for java.io.Serializable */
- private static Class classSerializable = null;
- private static Class classExternalizable = null;
-
- /*
- * Resolve java.io.Serializable at load time.
- */
- static {
- try {
- classSerializable = Class.forName("java.io.Serializable");
- classExternalizable = Class.forName("java.io.Externalizable");
- } catch (Throwable e) {
- System.err.println("Could not load java.io.Serializable or java.io.Externalizable.");
- }
- }
-
/** use serialVersionUID from JDK 1.1. for interoperability */
private static final long serialVersionUID = -6120832682080437368L;
@@ -1649,8 +1621,8 @@ public class ObjectStreamClass implements java.io.Serializable {
private static class CompareClassByName implements Comparator {
public int compare(Object o1, Object o2) {
- Class c1 = (Class)o1;
- Class c2 = (Class)o2;
+ Class> c1 = (Class)o1;
+ Class> c2 = (Class)o2;
return (c1.getName()).compareTo(c2.getName());
}
}
@@ -1764,12 +1736,12 @@ public class ObjectStreamClass implements java.io.Serializable {
*
* Copied from the Merlin java.io.ObjectStreamClass.
*/
- private static Method getInheritableMethod(Class cl, String name,
- Class[] argTypes,
- Class returnType)
+ private static Method getInheritableMethod(Class> cl, String name,
+ Class>[] argTypes,
+ Class> returnType)
{
Method meth = null;
- Class defCl = cl;
+ Class> defCl = cl;
while (defCl != null) {
try {
meth = defCl.getDeclaredMethod(name, argTypes);
@@ -1801,7 +1773,7 @@ public class ObjectStreamClass implements java.io.Serializable {
*
* Copied from the Merlin java.io.ObjectStreamClass.
*/
- private static boolean packageEquals(Class cl1, Class cl2) {
+ private static boolean packageEquals(Class> cl1, Class> cl2) {
Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage();
return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2))));
}
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java
index 6fb95dbccad..8a4fdc0ee34 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -94,7 +94,7 @@ public final class ObjectStreamClassUtil_1_3 {
});
}
- public static long computeStructuralUID(boolean hasWriteObject, Class cl) {
+ public static long computeStructuralUID(boolean hasWriteObject, Class> cl) {
ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
long h = 0;
@@ -119,7 +119,7 @@ public final class ObjectStreamClassUtil_1_3 {
// Object method in there
// Get SUID of parent
- Class parent = cl.getSuperclass();
+ Class> parent = cl.getSuperclass();
if ((parent != null) && (parent != java.lang.Object.class)) {
boolean hasWriteObjectFlag = false;
Class [] args = {java.io.ObjectOutputStream.class};
@@ -503,19 +503,6 @@ public final class ObjectStreamClassUtil_1_3 {
Class classWithThisMethod = null;
try {
- try {
- // When using rip-int with Merlin or when this is a Merlin
- // workspace, the method we want is in sun.misc.ClassReflector
- // and absent from java.io.ObjectStreamClass.
- //
- // When compiling rip-int with JDK 1.3.x, we have to get it
- // from java.io.ObjectStreamClass.
- classWithThisMethod = Class.forName("sun.misc.ClassReflector");
- } catch (ClassNotFoundException cnfe) {
- // Do nothing. This is either not a Merlin workspace,
- // or rip-int is being compiled with something other than
- // Merlin, probably JDK 1.3. Fall back on java.io.ObjectStreaClass.
- }
if (classWithThisMethod == null)
classWithThisMethod = java.io.ObjectStreamClass.class;
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
index 891a4887123..3e06edc2550 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -53,6 +53,7 @@ import java.io.DataOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.InvalidClassException;
import java.io.Serializable;
+import java.io.Externalizable;
import java.util.Arrays;
import java.util.Comparator;
@@ -88,7 +89,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
public static final long kDefaultUID = -1;
private static Object noArgsList[] = {};
- private static Class noTypesList[] = {};
+ private static Class> noTypesList[] = {};
private static Hashtable translatedFields;
@@ -96,7 +97,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* is returned if the specified class does not implement
* java.io.Serializable or java.io.Externalizable.
*/
- static final ObjectStreamClass_1_3_1 lookup(Class cl)
+ static final ObjectStreamClass_1_3_1 lookup(Class> cl)
{
ObjectStreamClass_1_3_1 desc = lookupInternal(cl);
if (desc.isSerializable() || desc.isExternalizable())
@@ -108,7 +109,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* Find the class descriptor for the specified class.
* Package access only so it can be called from ObjectIn/OutStream.
*/
- static ObjectStreamClass_1_3_1 lookupInternal(Class cl)
+ static ObjectStreamClass_1_3_1 lookupInternal(Class> cl)
{
/* Synchronize on the hashtable so no two threads will do
* this at the same time.
@@ -122,13 +123,13 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
}
/* Check if it's serializable */
- boolean serializable = classSerializable.isAssignableFrom(cl);
+ boolean serializable = Serializable.class.isAssignableFrom(cl);
/* If the class is only Serializable,
* lookup the descriptor for the superclass.
*/
ObjectStreamClass_1_3_1 superdesc = null;
if (serializable) {
- Class superclass = cl.getSuperclass();
+ Class> superclass = cl.getSuperclass();
if (superclass != null)
superdesc = lookup(superclass);
}
@@ -141,7 +142,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
if (serializable) {
externalizable =
((superdesc != null) && superdesc.isExternalizable()) ||
- classExternalizable.isAssignableFrom(cl);
+ Externalizable.class.isAssignableFrom(cl);
if (externalizable) {
serializable = false;
}
@@ -170,7 +171,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* that have evolved from a common root class and agree to be serialized
* and deserialized using a common format.
*/
- public static final long getSerialVersionUID( java.lang.Class clazz) {
+ public static final long getSerialVersionUID( java.lang.Class> clazz) {
ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
if( theosc != null )
{
@@ -204,7 +205,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
/**
* Return the actual (computed) serialVersionUID for this class.
*/
- public static final long getActualSerialVersionUID( java.lang.Class clazz )
+ public static final long getActualSerialVersionUID( java.lang.Class> clazz )
{
ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
if( theosc != null )
@@ -234,7 +235,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* Return the class in the local VM that this version is mapped to.
* Null is returned if there is no corresponding local class.
*/
- public final Class forClass() {
+ public final Class> forClass() {
return ofClass;
}
@@ -333,7 +334,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* Create a new ObjectStreamClass_1_3_1 from a loaded class.
* Don't call this directly, call lookup instead.
*/
- private ObjectStreamClass_1_3_1(java.lang.Class cl, ObjectStreamClass_1_3_1 superdesc,
+ private ObjectStreamClass_1_3_1(java.lang.Class> cl, ObjectStreamClass_1_3_1 superdesc,
boolean serial, boolean extern)
{
ofClass = cl; /* created from this class */
@@ -376,7 +377,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
private void init() {
synchronized (lock) {
- final Class cl = ofClass;
+ final Class> cl = ofClass;
if (fields != null) // already initialized
return;
@@ -558,7 +559,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* will call it as necessary.
*/
try {
- Class[] args = {java.io.ObjectOutputStream.class};
+ Class>[] args = {java.io.ObjectOutputStream.class};
writeObjectMethod = cl.getDeclaredMethod("writeObject", args);
hasWriteObjectMethod = true;
int mods = writeObjectMethod.getModifiers();
@@ -578,7 +579,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* ObjectInputStream so it can all the method directly.
*/
try {
- Class[] args = {java.io.ObjectInputStream.class};
+ Class>[] args = {java.io.ObjectInputStream.class};
readObjectMethod = cl.getDeclaredMethod("readObject", args);
int mods = readObjectMethod.getModifiers();
@@ -629,11 +630,11 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
if (translation != null)
return translation;
else {
- Class osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class;
+ Class> osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class;
translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length);
Object arg[] = new Object[2];
- Class types[] = {String.class, Class.class};
+ Class> types[] = {String.class, Class.class};
Constructor constructor = osfClass.getDeclaredConstructor(types);
for (int i = fields.length -1; i >= 0; i--){
arg[0] = fields[i].getName();
@@ -804,7 +805,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
}
}
- private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class cl) {
+ private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class> cl) {
ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
long h = 0;
@@ -824,7 +825,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
DataOutputStream data = new DataOutputStream(mdo);
// Get SUID of parent
- Class parent = cl.getSuperclass();
+ Class> parent = cl.getSuperclass();
if ((parent != null))
// SerialBug 1; acc. to spec the one for
// java.lang.object
@@ -910,10 +911,10 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
/**
* Compute the JVM signature for the class.
*/
- static String getSignature(Class clazz) {
+ static String getSignature(Class> clazz) {
String type = null;
if (clazz.isArray()) {
- Class cl = clazz;
+ Class> cl = clazz;
int dimensions = 0;
while (cl.isArray()) {
dimensions++;
@@ -959,7 +960,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
sb.append("(");
- Class[] params = meth.getParameterTypes(); // avoid clone
+ Class>[] params = meth.getParameterTypes(); // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(getSignature(params[j]));
}
@@ -976,7 +977,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
sb.append("(");
- Class[] params = cons.getParameterTypes(); // avoid clone
+ Class>[] params = cons.getParameterTypes(); // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(getSignature(params[j]));
}
@@ -996,7 +997,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
* The entries are extended from java.lang.ref.SoftReference so the
* gc will be able to free them if needed.
*/
- private static ObjectStreamClass_1_3_1 findDescriptorFor(Class cl) {
+ private static ObjectStreamClass_1_3_1 findDescriptorFor(Class> cl) {
int hash = cl.hashCode();
int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
@@ -1077,7 +1078,7 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
/*
* Class that is a descriptor for in this virtual machine.
*/
- private Class ofClass;
+ private Class> ofClass;
/*
* True if descriptor for a proxy class.
@@ -1130,22 +1131,6 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
/* Get the private static final field for serial version UID */
// private static native long getSerialVersionUIDField(Class cl);
- /* The Class Object for java.io.Serializable */
- private static Class classSerializable = null;
- private static Class classExternalizable = null;
-
- /*
- * Resolve java.io.Serializable at load time.
- */
- static {
- try {
- classSerializable = Class.forName("java.io.Serializable");
- classExternalizable = Class.forName("java.io.Externalizable");
- } catch (Throwable e) {
- System.err.println("Could not load java.io.Serializable or java.io.Externalizable.");
- }
- }
-
/** use serialVersionUID from JDK 1.1. for interoperability */
private static final long serialVersionUID = -6120832682080437368L;
@@ -1183,8 +1168,8 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
private static class CompareClassByName implements Comparator {
public int compare(Object o1, Object o2) {
- Class c1 = (Class)o1;
- Class c2 = (Class)o2;
+ Class> c1 = (Class)o1;
+ Class> c2 = (Class)o2;
return (c1.getName()).compareTo(c2.getName());
}
}
diff --git a/corba/src/share/classes/org/omg/CORBA/ORB.java b/corba/src/share/classes/org/omg/CORBA/ORB.java
index 58649f00630..2250ba066a2 100644
--- a/corba/src/share/classes/org/omg/CORBA/ORB.java
+++ b/corba/src/share/classes/org/omg/CORBA/ORB.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -36,6 +36,8 @@ import java.io.FileInputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import sun.reflect.misc.ReflectUtil;
+
/**
* A class providing APIs for the CORBA Object Request Broker
* features. The ORB
class also provides
@@ -161,6 +163,20 @@ import java.security.PrivilegedAction;
*
* An application or applet can be initialized in one or more ORBs.
* ORB initialization is a bootstrap call into the CORBA world.
+ *
+ *
+ * @implNote
+ * As described above it is possible to specify, at runtime, an alternative ORBSingleton class and
+ * an alternative ORB implementation class, via the system properties {@code org.omg.CORBA.ORBSingletonClass}
+ * and {@code org.omg.CORBA.ORBClass} respectively.
+ * The class loading strategy is organized, such that, in the case of the ORBSingleton
+ * the system class loader is used to load the alternative singleton ORB.
+ * Thus, it is necessary that an application's CLASSPATH
+ * includes the classes for this alternative ORBSingleton, when specified.
+ *
+ * In the case of specifying an alternative ORB implementation class, the loading
+ * strategy will use the thread context class loader, as appropriate.
+ *
* @since JDK1.2
*/
abstract public class ORB {
@@ -289,20 +305,38 @@ abstract public class ORB {
(className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) {
singleton = new com.sun.corba.se.impl.orb.ORBSingleton();
} else {
- singleton = create_impl(className);
+ singleton = create_impl_with_systemclassloader(className);
}
}
return singleton;
}
- private static ORB create_impl(String className) {
+ private static ORB create_impl_with_systemclassloader(String className) {
+ try {
+ ReflectUtil.checkPackageAccess(className);
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ Class orbBaseClass = org.omg.CORBA.ORB.class;
+ Class> singletonOrbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass);
+ return (ORB)singletonOrbClass.newInstance();
+ } catch (Throwable ex) {
+ SystemException systemException = new INITIALIZE(
+ "can't instantiate default ORB implementation " + className);
+ systemException.initCause(ex);
+ throw systemException;
+ }
+ }
+
+ private static ORB create_impl(String className) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
try {
- return (ORB) Class.forName(className, true, cl).newInstance();
+ ReflectUtil.checkPackageAccess(className);
+ Class orbBaseClass = org.omg.CORBA.ORB.class;
+ Class> orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass);
+ return (ORB)orbClass.newInstance();
} catch (Throwable ex) {
SystemException systemException = new INITIALIZE(
"can't instantiate default ORB implementation " + className);
@@ -346,7 +380,6 @@ abstract public class ORB {
} else {
orb = create_impl(className);
}
-
orb.set_parameters(args, props);
return orb;
}
@@ -377,7 +410,6 @@ abstract public class ORB {
} else {
orb = create_impl(className);
}
-
orb.set_parameters(app, props);
return orb;
}
@@ -573,7 +605,7 @@ abstract public class ORB {
try {
// First try to load the OperationDef class
String opDefClassName = "org.omg.CORBA.OperationDef";
- Class opDefClass = null;
+ Class> opDefClass = null;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if ( cl == null )
@@ -583,7 +615,7 @@ abstract public class ORB {
// OK, we loaded OperationDef. Now try to get the
// create_operation_list(OperationDef oper) method.
- Class[] argc = { opDefClass };
+ Class>[] argc = { opDefClass };
java.lang.reflect.Method meth =
this.getClass().getMethod("create_operation_list", argc);
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 856ce390fa1..d940606f786 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -410,3 +410,7 @@ b2fee789d23f3cdabb3db4e51af43038e5692d3a jdk9-b03
bdc5311e1db7598589b77015119b821bf8c828bd jdk9-b05
52377a30a3f87b62d6135706997b8c7a47366e37 jdk9-b06
52f7edf2589d9f9d35db3008bc5377f279de9c18 jdk9-b07
+4dedef5e51ed3a36677a8ba82949fc517ad64162 jdk9-b08
+05e8f5242c26ba45d4fa947e4f4f54c058c9b522 jdk9-b09
+ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
+783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
diff --git a/hotspot/make/aix/makefiles/buildtree.make b/hotspot/make/aix/makefiles/buildtree.make
index 882533024ea..eb8fc24e637 100644
--- a/hotspot/make/aix/makefiles/buildtree.make
+++ b/hotspot/make/aix/makefiles/buildtree.make
@@ -37,7 +37,7 @@
# GAMMADIR - top of workspace
# OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered
-# HOTSPOT_RELEASE_VERSION - .-b (11.0-b07)
+# HOTSPOT_RELEASE_VERSION - ..[-][-][-b]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - .. (1.7.0)
#
diff --git a/hotspot/make/aix/makefiles/mapfile-vers-debug b/hotspot/make/aix/makefiles/mapfile-vers-debug
index b18fb74fd9a..0a9d3e981c9 100644
--- a/hotspot/make/aix/makefiles/mapfile-vers-debug
+++ b/hotspot/make/aix/makefiles/mapfile-vers-debug
@@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers;
JVM_GetClassName;
JVM_GetClassNameUTF;
- JVM_GetClassSignature;
+ JVM_GetClassSignature;
JVM_GetClassSigners;
JVM_GetClassTypeAnnotations;
JVM_GetComponentType;
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/aix/makefiles/mapfile-vers-product b/hotspot/make/aix/makefiles/mapfile-vers-product
index 04531fa15aa..f748a10c8e2 100644
--- a/hotspot/make/aix/makefiles/mapfile-vers-product
+++ b/hotspot/make/aix/makefiles/mapfile-vers-product
@@ -161,6 +161,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/aix/makefiles/vm.make b/hotspot/make/aix/makefiles/vm.make
index ab994a3c2ae..4cdb6d92e5a 100644
--- a/hotspot/make/aix/makefiles/vm.make
+++ b/hotspot/make/aix/makefiles/vm.make
@@ -73,17 +73,14 @@ else
endif
endif
-# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
-# in $(GAMMADIR)/make/defs.make
-ifeq ($(HOTSPOT_BUILD_VERSION),)
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
-else
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
-endif
-
# The following variables are defined in the generated flags.make file.
-BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
-JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
+JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
+ -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
+ -DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
+ -DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
+VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
+ -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
+ $(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \
${SYSDEFS} \
${INCLUDES} \
- ${BUILD_VERSION} \
${BUILD_TARGET} \
${BUILD_USER} \
${HS_LIB_ARCH} \
@@ -101,7 +97,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date.
-CXXFLAGS/vm_version.o += ${JRE_VERSION}
+CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
diff --git a/hotspot/make/bsd/makefiles/buildtree.make b/hotspot/make/bsd/makefiles/buildtree.make
index 88b141e94c5..1ed146c729b 100644
--- a/hotspot/make/bsd/makefiles/buildtree.make
+++ b/hotspot/make/bsd/makefiles/buildtree.make
@@ -36,7 +36,7 @@
# GAMMADIR - top of workspace
# OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered
-# HOTSPOT_RELEASE_VERSION - .-b (11.0-b07)
+# HOTSPOT_RELEASE_VERSION - ..[-][-][-b]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - .. (1.7.0)
#
diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug
index d446cc81d84..db8c276811a 100644
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug
@@ -161,6 +161,7 @@
_JVM_GetStackTraceElement
_JVM_GetSystemPackage
_JVM_GetSystemPackages
+ _JVM_GetTemporaryDirectory
_JVM_GetThreadStateNames
_JVM_GetThreadStateValues
_JVM_GetVersionInfo
diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product
index d446cc81d84..db8c276811a 100644
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product
@@ -161,6 +161,7 @@
_JVM_GetStackTraceElement
_JVM_GetSystemPackage
_JVM_GetSystemPackages
+ _JVM_GetTemporaryDirectory
_JVM_GetThreadStateNames
_JVM_GetThreadStateValues
_JVM_GetVersionInfo
diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-debug b/hotspot/make/bsd/makefiles/mapfile-vers-debug
index 4936ba711f9..df433ad55ea 100644
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug
@@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers;
JVM_GetClassName;
JVM_GetClassNameUTF;
- JVM_GetClassSignature;
+ JVM_GetClassSignature;
JVM_GetClassSigners;
JVM_GetClassTypeAnnotations;
JVM_GetComponentType;
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-product b/hotspot/make/bsd/makefiles/mapfile-vers-product
index 4641af0af20..df433ad55ea 100644
--- a/hotspot/make/bsd/makefiles/mapfile-vers-product
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-product
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make
index 3726ab6be77..40a9d6594af 100644
--- a/hotspot/make/bsd/makefiles/vm.make
+++ b/hotspot/make/bsd/makefiles/vm.make
@@ -72,17 +72,14 @@ else
endif
endif
-# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
-# in $(GAMMADIR)/make/defs.make
-ifeq ($(HOTSPOT_BUILD_VERSION),)
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
-else
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
-endif
-
# The following variables are defined in the generated flags.make file.
-BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
-JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
+JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
+ -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
+ -DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
+ -DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
+VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
+ -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
+ $(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@@ -91,7 +88,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \
${SYSDEFS} \
${INCLUDES} \
- ${BUILD_VERSION} \
${BUILD_TARGET} \
${BUILD_USER} \
${HS_LIB_ARCH} \
@@ -100,7 +96,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date.
-CXXFLAGS/vm_version.o += ${JRE_VERSION}
+CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
diff --git a/hotspot/make/defs.make b/hotspot/make/defs.make
index 51f0c40d358..65942d2b53f 100644
--- a/hotspot/make/defs.make
+++ b/hotspot/make/defs.make
@@ -114,7 +114,7 @@ ifeq ($(JVM_VARIANTS),)
endif
# hotspot version definitions
-include $(GAMMADIR)/make/hotspot_version
+include $(GAMMADIR)/make/jdk_version
# Java versions needed
ifeq ($(PREVIOUS_JDK_VERSION),)
@@ -129,6 +129,9 @@ endif
ifeq ($(JDK_MICRO_VERSION),)
JDK_MICRO_VERSION=$(JDK_MICRO_VER)
endif
+ifeq ($(JDK_BUILD_NUMBER),)
+ JDK_BUILD_NUMBER=0
+endif
ifeq ($(JDK_MKTG_VERSION),)
JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
endif
@@ -146,7 +149,7 @@ ifndef JRE_RELEASE_VERSION
endif
ifndef HOTSPOT_RELEASE_VERSION
- HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
+ HOTSPOT_RELEASE_VERSION=$(FULL_VERSION)
endif
ifdef HOTSPOT_BUILD_VERSION
@@ -325,7 +328,6 @@ MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
-MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
# Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile
diff --git a/hotspot/make/hotspot_version b/hotspot/make/jdk_version
similarity index 81%
rename from hotspot/make/hotspot_version
rename to hotspot/make/jdk_version
index 94de662e7b4..e7092f73874 100644
--- a/hotspot/make/hotspot_version
+++ b/hotspot/make/jdk_version
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -19,27 +19,18 @@
# 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.
-#
-
#
-#
-
-#
-# Master Hotspot version file. These values may be overridden by a control
+# Master JDK version file. These values may be overridden by a control
# workspace build. This file format must remain compatible with both
# GNU Makefile and Microsoft nmake formats.
#
# Don't put quotes (fail windows build).
-HOTSPOT_VM_COPYRIGHT=Copyright 2013
-
-HS_MAJOR_VER=25
-HS_MINOR_VER=0
-HS_BUILD_NUMBER=62
+HOTSPOT_VM_COPYRIGHT=Copyright 2014
JDK_MAJOR_VER=1
-JDK_MINOR_VER=8
+JDK_MINOR_VER=9
JDK_MICRO_VER=0
# Previous (bootdir) JDK version
-JDK_PREVIOUS_VERSION=1.7.0
+JDK_PREVIOUS_VERSION=1.8.0
diff --git a/hotspot/make/linux/makefiles/buildtree.make b/hotspot/make/linux/makefiles/buildtree.make
index 87cee830800..d9c053e50cd 100644
--- a/hotspot/make/linux/makefiles/buildtree.make
+++ b/hotspot/make/linux/makefiles/buildtree.make
@@ -36,7 +36,7 @@
# GAMMADIR - top of workspace
# OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered
-# HOTSPOT_RELEASE_VERSION - .-b (11.0-b07)
+# HOTSPOT_RELEASE_VERSION - ..[-][-][-b]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - .. (1.7.0)
#
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug
index 4936ba711f9..df433ad55ea 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug
@@ -122,7 +122,7 @@ SUNWprivate_1.1 {
JVM_GetClassModifiers;
JVM_GetClassName;
JVM_GetClassNameUTF;
- JVM_GetClassSignature;
+ JVM_GetClassSignature;
JVM_GetClassSigners;
JVM_GetClassTypeAnnotations;
JVM_GetComponentType;
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product
index 4641af0af20..df433ad55ea 100644
--- a/hotspot/make/linux/makefiles/mapfile-vers-product
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make
index 442c9afb1bf..bcf87c043ec 100644
--- a/hotspot/make/linux/makefiles/vm.make
+++ b/hotspot/make/linux/makefiles/vm.make
@@ -73,17 +73,14 @@ else
endif
endif
-# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
-# in $(GAMMADIR)/make/defs.make
-ifeq ($(HOTSPOT_BUILD_VERSION),)
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
-else
- BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
-endif
-
# The following variables are defined in the generated flags.make file.
-BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
-JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
+JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
+ -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
+ -DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
+ -DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
+VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
+ -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
+ $(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \
${SYSDEFS} \
${INCLUDES} \
- ${BUILD_VERSION} \
${BUILD_TARGET} \
${BUILD_USER} \
${HS_LIB_ARCH} \
@@ -101,7 +97,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date.
-CXXFLAGS/vm_version.o += ${JRE_VERSION}
+CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make
index 731e6ca5137..2627dbf040a 100644
--- a/hotspot/make/solaris/makefiles/buildtree.make
+++ b/hotspot/make/solaris/makefiles/buildtree.make
@@ -36,7 +36,7 @@
# GAMMADIR - top of workspace
# OS_FAMILY - operating system
# VARIANT - core, compiler1, compiler2, or tiered
-# HOTSPOT_RELEASE_VERSION - .-b (11.0-b07)
+# HOTSPOT_RELEASE_VERSION - ..[-][-][-b]
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION - .. (1.7.0)
#
diff --git a/hotspot/make/solaris/makefiles/mapfile-vers b/hotspot/make/solaris/makefiles/mapfile-vers
index 01b31b6fffb..d2a3d5c6e2a 100644
--- a/hotspot/make/solaris/makefiles/mapfile-vers
+++ b/hotspot/make/solaris/makefiles/mapfile-vers
@@ -163,6 +163,7 @@ SUNWprivate_1.1 {
JVM_GetStackTraceElement;
JVM_GetSystemPackage;
JVM_GetSystemPackages;
+ JVM_GetTemporaryDirectory;
JVM_GetThreadStateNames;
JVM_GetThreadStateValues;
JVM_GetVersionInfo;
diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make
index 6c27eaa1d06..3e32a57cd92 100644
--- a/hotspot/make/solaris/makefiles/vm.make
+++ b/hotspot/make/solaris/makefiles/vm.make
@@ -69,8 +69,13 @@ else
endif
# The following variables are defined in the generated flags.make file.
-BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
-JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
+JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
+ -DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
+ -DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
+ -DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
+VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
+ -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
+ $(JDK_VER_DEFS)
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
@@ -79,7 +84,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
CXXFLAGS = \
${SYSDEFS} \
${INCLUDES} \
- ${BUILD_VERSION} \
${BUILD_TARGET} \
${BUILD_USER} \
${HS_LIB_ARCH} \
@@ -88,7 +92,7 @@ CXXFLAGS = \
# This is VERY important! The version define must only be supplied to vm_version.o
# If not, ccache will not re-use the cache at all, since the version string might contain
# a time and date.
-CXXFLAGS/vm_version.o += ${JRE_VERSION}
+CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
diff --git a/hotspot/make/windows/build.make b/hotspot/make/windows/build.make
index 7c66b206c3e..62943b5abfe 100644
--- a/hotspot/make/windows/build.make
+++ b/hotspot/make/windows/build.make
@@ -117,7 +117,7 @@ VARIANT_TEXT=Tiered
# These can be overridden via the nmake.exe command line.
# They are overridden by RE during the control builds.
#
-!include "$(WorkSpace)/make/hotspot_version"
+!include "$(WorkSpace)/make/jdk_version"
# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
# or make/hotspot_distro.
@@ -163,7 +163,7 @@ HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(ARCH_TEXT) $(VARIANT_TEXT) VM
# 1.6.0-b01 will be 6.0.0.1
# 1.6.0_01a-b02 will be 6.0.11.2
#
-# JDK_* variables are defined in make/hotspot_version or on command line
+# JDK_* variables are defined in make/jdk_version or on command line
#
JDK_VER=$(JDK_MINOR_VER),$(JDK_MICRO_VER),$(JDK_UPDATE_VER),$(JDK_BUILD_NUMBER)
JDK_DOTVER=$(JDK_MINOR_VER).$(JDK_MICRO_VER).$(JDK_UPDATE_VER).$(JDK_BUILD_NUMBER)
@@ -179,13 +179,12 @@ JDK_MKTG_VERSION=$(JDK_MINOR_VER).$(JDK_MICRO_VER)
# Hotspot Express VM FileVersion:
# 10.0-b will have DLL version 10.0.0.yz (need 4 numbers).
#
-# HS_* variables are defined in make/hotspot_version
#
-HS_VER=$(HS_MAJOR_VER),$(HS_MINOR_VER),0,$(HS_BUILD_NUMBER)
-HS_DOTVER=$(HS_MAJOR_VER).$(HS_MINOR_VER).0.$(HS_BUILD_NUMBER)
+HS_VER=$(JDK_VER)
+HS_DOTVER=$(JDK_DOTVER)
!if "$(HOTSPOT_RELEASE_VERSION)" == ""
-HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
+HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
!endif
!if "$(HOTSPOT_BUILD_VERSION)" == ""
diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make
index fe4b6c72fbf..9b22e37a301 100644
--- a/hotspot/make/windows/makefiles/defs.make
+++ b/hotspot/make/windows/makefiles/defs.make
@@ -179,9 +179,9 @@ LIBRARY_SUFFIX=dll
# next parameters are defined in $(GAMMADIR)/make/defs.make.
MAKE_ARGS += JDK_MKTG_VERSION=$(JDK_MKTG_VERSION)
-MAKE_ARGS += JDK_MAJOR_VER=$(JDK_MAJOR_VERSION)
-MAKE_ARGS += JDK_MINOR_VER=$(JDK_MINOR_VERSION)
-MAKE_ARGS += JDK_MICRO_VER=$(JDK_MICRO_VERSION)
+MAKE_ARGS += JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION)
+MAKE_ARGS += JDK_MINOR_VERSION=$(JDK_MINOR_VERSION)
+MAKE_ARGS += JDK_MICRO_VERSION=$(JDK_MICRO_VERSION)
ifdef COOKED_JDK_UPDATE_VERSION
MAKE_ARGS += JDK_UPDATE_VER=$(COOKED_JDK_UPDATE_VERSION)
diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make
index 229be6870a7..e4caa13dea2 100644
--- a/hotspot/make/windows/makefiles/vm.make
+++ b/hotspot/make/windows/makefiles/vm.make
@@ -56,6 +56,10 @@ HOTSPOT_LIB_ARCH=$(BUILDARCH)
# The following variables are defined in the generated local.make file.
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\""
+CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\""
+CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\""
+CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MICRO_VERSION=\"$(JDK_MICRO_VERSION)\""
+CXX_FLAGS=$(CXX_FLAGS) /D "JDK_BUILD_NUMBER=\"$(JDK_BUILD_NUMBER)\""
CXX_FLAGS=$(CXX_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\""
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile
index 0bc4fb182ec..4a527ef68c3 100644
--- a/hotspot/make/windows/projectfiles/common/Makefile
+++ b/hotspot/make/windows/projectfiles/common/Makefile
@@ -78,24 +78,23 @@ HS_INTERNAL_NAME=jvm
default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) $(TraceGeneratedFiles)
-!include $(HOTSPOTWORKSPACE)/make/hotspot_version
+!include $(HOTSPOTWORKSPACE)/make/jdk_version
!if "$(USER_RELEASE_SUFFIX)" != ""
HOTSPOT_BUILD_VERSION = internal-$(USER_RELEASE_SUFFIX)
!else
HOTSPOT_BUILD_VERSION = internal
!endif
-!if "$(HOTSPOT_RELEASE_VERSION)" != ""
-HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
-!else
-HOTSPOT_RELEASE_VERSION="\\\"$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)-$(HOTSPOT_BUILD_VERSION)\\\""
-!endif
!if "$(JRE_RELEASE_VERSION)" != ""
JRE_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
!else
JRE_RELEASE_VERSION="\\\"$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)\\\""
!endif
-
+!if "$(HOTSPOT_RELEASE_VERSION)" != ""
+HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
+!else
+HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
+!endif
# Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
# and if it is not see if we have the src/closed directory
!if "$(HOTSPOT_VM_DISTRO)" != ""
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index f6066c51510..2ad6e5fd40b 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -127,8 +127,12 @@
// global variables
julong os::Bsd::_physical_memory = 0;
-
+#ifdef __APPLE__
+mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0};
+volatile uint64_t os::Bsd::_max_abstime = 0;
+#else
int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL;
+#endif
pthread_t os::Bsd::_main_thread;
int os::Bsd::_page_size = -1;
@@ -986,13 +990,15 @@ jlong os::javaTimeMillis() {
return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
}
+#ifndef __APPLE__
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (1)
#endif
+#endif
#ifdef __APPLE__
void os::Bsd::clock_init() {
- // XXXDARWIN: Investigate replacement monotonic clock
+ mach_timebase_info(&_timebase_info);
}
#else
void os::Bsd::clock_init() {
@@ -1007,10 +1013,39 @@ void os::Bsd::clock_init() {
#endif
+
+#ifdef __APPLE__
+
+jlong os::javaTimeNanos() {
+ const uint64_t tm = mach_absolute_time();
+ const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom;
+ const uint64_t prev = Bsd::_max_abstime;
+ if (now <= prev) {
+ return prev; // same or retrograde time;
+ }
+ const uint64_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&Bsd::_max_abstime, prev);
+ assert(obsv >= prev, "invariant"); // Monotonicity
+ // If the CAS succeeded then we're done and return "now".
+ // If the CAS failed and the observed value "obsv" is >= now then
+ // we should return "obsv". If the CAS failed and now > obsv > prv then
+ // some other thread raced this thread and installed a new value, in which case
+ // we could either (a) retry the entire operation, (b) retry trying to install now
+ // or (c) just return obsv. We use (c). No loop is required although in some cases
+ // we might discard a higher "now" value in deference to a slightly lower but freshly
+ // installed obsv value. That's entirely benign -- it admits no new orderings compared
+ // to (a) or (b) -- and greatly reduces coherence traffic.
+ // We might also condition (c) on the magnitude of the delta between obsv and now.
+ // Avoiding excessive CAS operations to hot RW locations is critical.
+ // See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
+ return (prev == obsv) ? now : obsv;
+}
+
+#else // __APPLE__
+
jlong os::javaTimeNanos() {
if (os::supports_monotonic_clock()) {
struct timespec tp;
- int status = Bsd::clock_gettime(CLOCK_MONOTONIC, &tp);
+ int status = Bsd::_clock_gettime(CLOCK_MONOTONIC, &tp);
assert(status == 0, "gettime error");
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
return result;
@@ -1023,6 +1058,8 @@ jlong os::javaTimeNanos() {
}
}
+#endif // __APPLE__
+
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
if (os::supports_monotonic_clock()) {
info_ptr->max_value = ALL_64_BITS;
diff --git a/hotspot/src/os/bsd/vm/os_bsd.hpp b/hotspot/src/os/bsd/vm/os_bsd.hpp
index 6a07ddd1611..25a16562dee 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.hpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.hpp
@@ -58,7 +58,13 @@ class Bsd {
// For signal flags diagnostics
static int sigflags[MAXSIGNUM];
+#ifdef __APPLE__
+ // mach_absolute_time
+ static mach_timebase_info_data_t _timebase_info;
+ static volatile uint64_t _max_abstime;
+#else
static int (*_clock_gettime)(clockid_t, struct timespec *);
+#endif
static GrowableArray* _cpu_to_node;
@@ -134,10 +140,6 @@ class Bsd {
// Real-time clock functions
static void clock_init(void);
- static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
- return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
- }
-
// Stack repair handling
// none present
diff --git a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
index 61ae5b984e8..8e574855933 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
@@ -287,7 +287,11 @@ inline int os::set_sock_opt(int fd, int level, int optname,
}
inline bool os::supports_monotonic_clock() {
+#ifdef __APPLE__
+ return true;
+#else
return Bsd::_clock_gettime != NULL;
+#endif
}
#endif // OS_BSD_VM_OS_BSD_INLINE_HPP
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 0aab29dd2ab..b0d4ef01294 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -347,11 +347,7 @@ julong os::physical_memory() {
static hrtime_t first_hrtime = 0;
static const hrtime_t hrtime_hz = 1000*1000*1000;
-const int LOCK_BUSY = 1;
-const int LOCK_FREE = 0;
-const int LOCK_INVALID = -1;
static volatile hrtime_t max_hrtime = 0;
-static volatile int max_hrtime_lock = LOCK_FREE; // Update counter with LSB as lock-in-progress
void os::Solaris::initialize_system_info() {
@@ -1364,58 +1360,31 @@ void* os::thread_local_storage_at(int index) {
}
-// gethrtime can move backwards if read from one cpu and then a different cpu
-// getTimeNanos is guaranteed to not move backward on Solaris
-// local spinloop created as faster for a CAS on an int than
-// a CAS on a 64bit jlong. Also Atomic::cmpxchg for jlong is not
-// supported on sparc v8 or pre supports_cx8 intel boxes.
-// oldgetTimeNanos for systems which do not support CAS on 64bit jlong
-// i.e. sparc v8 and pre supports_cx8 (i486) intel boxes
-inline hrtime_t oldgetTimeNanos() {
- int gotlock = LOCK_INVALID;
- hrtime_t newtime = gethrtime();
-
- for (;;) {
-// grab lock for max_hrtime
- int curlock = max_hrtime_lock;
- if (curlock & LOCK_BUSY) continue;
- if (gotlock = Atomic::cmpxchg(LOCK_BUSY, &max_hrtime_lock, LOCK_FREE) != LOCK_FREE) continue;
- if (newtime > max_hrtime) {
- max_hrtime = newtime;
- } else {
- newtime = max_hrtime;
- }
- // release lock
- max_hrtime_lock = LOCK_FREE;
- return newtime;
- }
-}
-// gethrtime can move backwards if read from one cpu and then a different cpu
-// getTimeNanos is guaranteed to not move backward on Solaris
+// gethrtime() should be monotonic according to the documentation,
+// but some virtualized platforms are known to break this guarantee.
+// getTimeNanos() must be guaranteed not to move backwards, so we
+// are forced to add a check here.
inline hrtime_t getTimeNanos() {
- if (VM_Version::supports_cx8()) {
- const hrtime_t now = gethrtime();
- // Use atomic long load since 32-bit x86 uses 2 registers to keep long.
- const hrtime_t prev = Atomic::load((volatile jlong*)&max_hrtime);
- if (now <= prev) return prev; // same or retrograde time;
- const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
- assert(obsv >= prev, "invariant"); // Monotonicity
- // If the CAS succeeded then we're done and return "now".
- // If the CAS failed and the observed value "obs" is >= now then
- // we should return "obs". If the CAS failed and now > obs > prv then
- // some other thread raced this thread and installed a new value, in which case
- // we could either (a) retry the entire operation, (b) retry trying to install now
- // or (c) just return obs. We use (c). No loop is required although in some cases
- // we might discard a higher "now" value in deference to a slightly lower but freshly
- // installed obs value. That's entirely benign -- it admits no new orderings compared
- // to (a) or (b) -- and greatly reduces coherence traffic.
- // We might also condition (c) on the magnitude of the delta between obs and now.
- // Avoiding excessive CAS operations to hot RW locations is critical.
- // See http://blogs.sun.com/dave/entry/cas_and_cache_trivia_invalidate
- return (prev == obsv) ? now : obsv ;
- } else {
- return oldgetTimeNanos();
+ const hrtime_t now = gethrtime();
+ const hrtime_t prev = max_hrtime;
+ if (now <= prev) {
+ return prev; // same or retrograde time;
}
+ const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
+ assert(obsv >= prev, "invariant"); // Monotonicity
+ // If the CAS succeeded then we're done and return "now".
+ // If the CAS failed and the observed value "obsv" is >= now then
+ // we should return "obsv". If the CAS failed and now > obsv > prv then
+ // some other thread raced this thread and installed a new value, in which case
+ // we could either (a) retry the entire operation, (b) retry trying to install now
+ // or (c) just return obsv. We use (c). No loop is required although in some cases
+ // we might discard a higher "now" value in deference to a slightly lower but freshly
+ // installed obsv value. That's entirely benign -- it admits no new orderings compared
+ // to (a) or (b) -- and greatly reduces coherence traffic.
+ // We might also condition (c) on the magnitude of the delta between obsv and now.
+ // Avoiding excessive CAS operations to hot RW locations is critical.
+ // See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
+ return (prev == obsv) ? now : obsv;
}
// Time since start-up in seconds to a fine granularity.
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index ead180e38ee..668b2c8f910 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -130,6 +130,13 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
case DLL_PROCESS_DETACH:
if(ForceTimeHighResolution)
timeEndPeriod(1L);
+
+ // Workaround for issue when a custom launcher doesn't call
+ // DestroyJavaVM and NMT is trying to track memory when free is
+ // called from a static destructor
+ if (MemTracker::is_on()) {
+ MemTracker::shutdown(MemTracker::NMT_normal);
+ }
break;
default:
break;
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 6322e66693a..a9d213948eb 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -421,6 +421,15 @@ char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
return UNICODE::as_utf8(position, len);
}
+char* java_lang_String::as_utf8_string(oop java_string, int start, int len, char* buf, int buflen) {
+ typeArrayOop value = java_lang_String::value(java_string);
+ int offset = java_lang_String::offset(java_string);
+ int length = java_lang_String::length(java_string);
+ assert(start + len <= length, "just checking");
+ jchar* position = value->char_at_addr(offset + start);
+ return UNICODE::as_utf8(position, len, buf, buflen);
+}
+
bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
assert(java_string->klass() == SystemDictionary::String_klass(),
"must be java_string");
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index e566ec7915f..b4da42c423d 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -162,6 +162,7 @@ class java_lang_String : AllStatic {
static char* as_utf8_string(oop java_string);
static char* as_utf8_string(oop java_string, char* buf, int buflen);
static char* as_utf8_string(oop java_string, int start, int len);
+ static char* as_utf8_string(oop java_string, int start, int len, char* buf, int buflen);
static char* as_platform_dependent_str(Handle java_string, TRAPS);
static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
// produce an ascii string with all other values quoted using \u####
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index f7494e12fde..de13a943c10 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -1282,6 +1282,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(before)");
}
+ g1h->check_bitmaps("Remark Start");
G1CollectorPolicy* g1p = g1h->g1_policy();
g1p->record_concurrent_mark_remark_start();
@@ -1330,6 +1331,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
Universe::verify(VerifyOption_G1UseNextMarking,
" VerifyDuringGC:(after)");
}
+ g1h->check_bitmaps("Remark End");
assert(!restart_for_overflow(), "sanity");
// Completely reset the marking state since marking completed
set_non_marking_state();
@@ -1979,6 +1981,7 @@ void ConcurrentMark::cleanup() {
Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(before)");
}
+ g1h->check_bitmaps("Cleanup Start");
G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
g1p->record_concurrent_mark_cleanup_start();
@@ -2133,6 +2136,7 @@ void ConcurrentMark::cleanup() {
Universe::verify(VerifyOption_G1UsePrevMarking,
" VerifyDuringGC:(after)");
}
+ g1h->check_bitmaps("Cleanup End");
g1h->verify_region_sets_optional();
g1h->trace_heap_after_concurrent_cycle();
@@ -3224,6 +3228,11 @@ void ConcurrentMark::print_stats() {
void ConcurrentMark::abort() {
// Clear all marks to force marking thread to do nothing
_nextMarkBitMap->clearAll();
+
+ // Note we cannot clear the previous marking bitmap here
+ // since VerifyDuringGC verifies the objects marked during
+ // a full GC against the previous bitmap.
+
// Clear the liveness counting data
clear_all_count_data();
// Empty mark stack
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 7d57183a20a..79a19976658 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -768,6 +768,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
// match new_top.
assert(hr == NULL ||
(hr->end() == new_end && hr->top() == new_top), "sanity");
+ check_bitmaps("Humongous Region Allocation", first_hr);
assert(first_hr->used() == word_size * HeapWordSize, "invariant");
_summary_bytes_used += first_hr->used();
@@ -1326,6 +1327,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
verify_before_gc();
+ check_bitmaps("Full GC Start");
pre_full_gc_dump(gc_timer);
COMPILER2_PRESENT(DerivedPointerTable::clear());
@@ -1499,6 +1501,18 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
verify_after_gc();
+ // Clear the previous marking bitmap, if needed for bitmap verification.
+ // Note we cannot do this when we clear the next marking bitmap in
+ // ConcurrentMark::abort() above since VerifyDuringGC verifies the
+ // objects marked during a full GC against the previous bitmap.
+ // But we need to clear it before calling check_bitmaps below since
+ // the full GC has compacted objects and updated TAMS but not updated
+ // the prev bitmap.
+ if (G1VerifyBitmaps) {
+ ((CMBitMap*) concurrent_mark()->prevMarkBitMap())->clearAll();
+ }
+ check_bitmaps("Full GC End");
+
// Start a new incremental collection set for the next pause
assert(g1_policy()->collection_set() == NULL, "must be");
g1_policy()->start_incremental_cset_building();
@@ -3978,6 +3992,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
increment_gc_time_stamp();
verify_before_gc();
+ check_bitmaps("GC Start");
COMPILER2_PRESENT(DerivedPointerTable::clear());
@@ -4223,6 +4238,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
increment_gc_time_stamp();
verify_after_gc();
+ check_bitmaps("GC End");
assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
ref_processor_stw()->verify_no_references_recorded();
@@ -5945,6 +5961,11 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
assert(!hr->is_empty(), "the region should not be empty");
assert(free_list != NULL, "pre-condition");
+ if (G1VerifyBitmaps) {
+ MemRegion mr(hr->bottom(), hr->end());
+ concurrent_mark()->clearRangePrevBitmap(mr);
+ }
+
// Clear the card counts for this region.
// Note: we only need to do this if the region is not young
// (since we don't refine cards in young regions).
@@ -6079,7 +6100,87 @@ void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) {
void G1CollectedHeap::verify_dirty_young_regions() {
verify_dirty_young_list(_young_list->first_region());
}
-#endif
+
+bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
+ HeapWord* tams, HeapWord* end) {
+ guarantee(tams <= end,
+ err_msg("tams: "PTR_FORMAT" end: "PTR_FORMAT, tams, end));
+ HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
+ if (result < end) {
+ gclog_or_tty->cr();
+ gclog_or_tty->print_cr("## wrong marked address on %s bitmap: "PTR_FORMAT,
+ bitmap_name, result);
+ gclog_or_tty->print_cr("## %s tams: "PTR_FORMAT" end: "PTR_FORMAT,
+ bitmap_name, tams, end);
+ return false;
+ }
+ return true;
+}
+
+bool G1CollectedHeap::verify_bitmaps(const char* caller, HeapRegion* hr) {
+ CMBitMapRO* prev_bitmap = concurrent_mark()->prevMarkBitMap();
+ CMBitMapRO* next_bitmap = (CMBitMapRO*) concurrent_mark()->nextMarkBitMap();
+
+ HeapWord* bottom = hr->bottom();
+ HeapWord* ptams = hr->prev_top_at_mark_start();
+ HeapWord* ntams = hr->next_top_at_mark_start();
+ HeapWord* end = hr->end();
+
+ bool res_p = verify_no_bits_over_tams("prev", prev_bitmap, ptams, end);
+
+ bool res_n = true;
+ // We reset mark_in_progress() before we reset _cmThread->in_progress() and in this window
+ // we do the clearing of the next bitmap concurrently. Thus, we can not verify the bitmap
+ // if we happen to be in that state.
+ if (mark_in_progress() || !_cmThread->in_progress()) {
+ res_n = verify_no_bits_over_tams("next", next_bitmap, ntams, end);
+ }
+ if (!res_p || !res_n) {
+ gclog_or_tty->print_cr("#### Bitmap verification failed for "HR_FORMAT,
+ HR_FORMAT_PARAMS(hr));
+ gclog_or_tty->print_cr("#### Caller: %s", caller);
+ return false;
+ }
+ return true;
+}
+
+void G1CollectedHeap::check_bitmaps(const char* caller, HeapRegion* hr) {
+ if (!G1VerifyBitmaps) return;
+
+ guarantee(verify_bitmaps(caller, hr), "bitmap verification");
+}
+
+class G1VerifyBitmapClosure : public HeapRegionClosure {
+private:
+ const char* _caller;
+ G1CollectedHeap* _g1h;
+ bool _failures;
+
+public:
+ G1VerifyBitmapClosure(const char* caller, G1CollectedHeap* g1h) :
+ _caller(caller), _g1h(g1h), _failures(false) { }
+
+ bool failures() { return _failures; }
+
+ virtual bool doHeapRegion(HeapRegion* hr) {
+ if (hr->continuesHumongous()) return false;
+
+ bool result = _g1h->verify_bitmaps(_caller, hr);
+ if (!result) {
+ _failures = true;
+ }
+ return false;
+ }
+};
+
+void G1CollectedHeap::check_bitmaps(const char* caller) {
+ if (!G1VerifyBitmaps) return;
+
+ G1VerifyBitmapClosure cl(caller, this);
+ heap_region_iterate(&cl);
+ guarantee(!cl.failures(), "bitmap verification");
+}
+#endif // PRODUCT
void G1CollectedHeap::cleanUpCardTable() {
G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
@@ -6464,6 +6565,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
if (new_alloc_region != NULL) {
set_region_short_lived_locked(new_alloc_region);
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Eden, young_list_full);
+ check_bitmaps("Mutator Region Allocation", new_alloc_region);
return new_alloc_region;
}
}
@@ -6530,8 +6632,10 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
if (survivor) {
new_alloc_region->set_survivor();
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
+ check_bitmaps("Survivor Region Allocation", new_alloc_region);
} else {
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
+ check_bitmaps("Old Region Allocation", new_alloc_region);
}
bool during_im = g1_policy()->during_initial_mark_pause();
new_alloc_region->note_start_of_copying(during_im);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 743fc291975..833024a1f8a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1186,6 +1186,30 @@ public:
void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
void verify_dirty_young_regions() PRODUCT_RETURN;
+#ifndef PRODUCT
+ // Make sure that the given bitmap has no marked objects in the
+ // range [from,limit). If it does, print an error message and return
+ // false. Otherwise, just return true. bitmap_name should be "prev"
+ // or "next".
+ bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
+ HeapWord* from, HeapWord* limit);
+
+ // Verify that the prev / next bitmap range [tams,end) for the given
+ // region has no marks. Return true if all is well, false if errors
+ // are detected.
+ bool verify_bitmaps(const char* caller, HeapRegion* hr);
+#endif // PRODUCT
+
+ // If G1VerifyBitmaps is set, verify that the marking bitmaps for
+ // the given region do not have any spurious marks. If errors are
+ // detected, print appropriate error messages and crash.
+ void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
+
+ // If G1VerifyBitmaps is set, verify that the marking bitmaps do not
+ // have any spurious marks. If errors are detected, print
+ // appropriate error messages and crash.
+ void check_bitmaps(const char* caller) PRODUCT_RETURN;
+
// verify_region_sets() performs verification over the region
// lists. It will be compiled in the product code to be used when
// necessary (i.e., during heap verification).
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp
index eb64b87126b..cb6fd08d77e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp
@@ -191,6 +191,7 @@ public:
hr->note_self_forwarding_removal_start(during_initial_mark,
during_conc_mark);
+ _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
// In the common case (i.e. when there is no evacuation
// failure) we make sure that the following is done when
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
index 8c8a30bae38..f50eaa1001e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
@@ -325,11 +325,14 @@
"evacuation pauses") \
\
diagnostic(bool, G1VerifyRSetsDuringFullGC, false, \
- "If true, perform verification of each heap region's " \
- "remembered set when verifying the heap during a full GC.") \
+ "If true, perform verification of each heap region's " \
+ "remembered set when verifying the heap during a full GC.") \
\
diagnostic(bool, G1VerifyHeapRegionCodeRoots, false, \
- "Verify the code root lists attached to each heap region.")
+ "Verify the code root lists attached to each heap region.") \
+ \
+ develop(bool, G1VerifyBitmaps, false, \
+ "Verifies the consistency of the marking bitmaps")
G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG)
diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp
index 65a658bca21..d0f6284b822 100644
--- a/hotspot/src/share/vm/oops/klass.cpp
+++ b/hotspot/src/share/vm/oops/klass.cpp
@@ -488,6 +488,7 @@ void Klass::remove_unshareable_info() {
}
void Klass::restore_unshareable_info(TRAPS) {
+ TRACE_INIT_ID(this);
// If an exception happened during CDS restore, some of these fields may already be
// set. We leave the class on the CLD list, even if incomplete so that we don't
// modify the CLD list outside a safepoint.
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index ad481679103..9e32dbc821a 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -3150,11 +3150,9 @@ JNI_ENTRY(void, jni_GetStringUTFRegion(JNIEnv *env, jstring string, jsize start,
} else {
//%note jni_7
if (len > 0) {
- ResourceMark rm(THREAD);
- char *utf_region = java_lang_String::as_utf8_string(s, start, len);
- int utf_len = (int)strlen(utf_region);
- memcpy(buf, utf_region, utf_len);
- buf[utf_len] = 0;
+ // Assume the buffer is large enough as the JNI spec. does not require user error checking
+ java_lang_String::as_utf8_string(s, start, len, buf, INT_MAX);
+ // as_utf8_string null-terminates the result string
} else {
// JDK null-terminates the buffer even in len is zero
if (buf != NULL) {
@@ -3880,6 +3878,7 @@ void TestNewSize_test();
void TestOldSize_test();
void TestKlass_test();
void TestBitMap_test();
+void TestAsUtf8();
#if INCLUDE_ALL_GCS
void TestOldFreeSpaceCalculation_test();
void TestG1BiasedArray_test();
@@ -3907,6 +3906,7 @@ void execute_internal_vm_tests() {
run_unit_test(TestOldSize_test());
run_unit_test(TestKlass_test());
run_unit_test(TestBitMap_test());
+ run_unit_test(TestAsUtf8());
#if INCLUDE_VM_STRUCTS
run_unit_test(VMStructs::test());
#endif
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 9104fb552e4..e6c059c0d30 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -386,6 +386,23 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties))
JVM_END
+/*
+ * Return the temporary directory that the VM uses for the attach
+ * and perf data files.
+ *
+ * It is important that this directory is well-known and the
+ * same for all VM instances. It cannot be affected by configuration
+ * variables such as java.io.tmpdir.
+ */
+JVM_ENTRY(jstring, JVM_GetTemporaryDirectory(JNIEnv *env))
+ JVMWrapper("JVM_GetTemporaryDirectory");
+ HandleMark hm(THREAD);
+ const char* temp_dir = os::get_temp_directory();
+ Handle h = java_lang_String::create_from_platform_dependent_str(temp_dir, CHECK_NULL);
+ return (jstring) JNIHandles::make_local(env, h());
+JVM_END
+
+
// java.lang.Runtime /////////////////////////////////////////////////////////////////////////
extern volatile jint vm_created;
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index bfd63d4c4bc..016bed8875e 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -1485,6 +1485,9 @@ JVM_GetManagement(jint version);
JNIEXPORT jobject JNICALL
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
+JNIEXPORT jstring JNICALL
+JVM_GetTemporaryDirectory(JNIEnv *env);
+
/* Generics reflection support.
*
* Returns information about the given class's EnclosingMethod
@@ -1553,12 +1556,10 @@ JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
* ==========================================================================
*/
typedef struct {
- /* HotSpot Express VM version string:
- * .-bxx[-][-]
- */
- unsigned int jvm_version; /* Consists of major.minor.0.build */
- unsigned int update_version : 8; /* 0 in HotSpot Express VM */
- unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */
+ /* VM version string: follows the JDK release version naming convention */
+ unsigned int jvm_version; /* ..[-][-][-b] */
+ unsigned int update_version : 8;
+ unsigned int special_update_version : 8;
unsigned int reserved1 : 16;
unsigned int reserved2;
@@ -1577,11 +1578,7 @@ typedef struct {
#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-// Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
-/* Build number is available in all HotSpot Express VM builds.
- * It is defined in make/hotspot_version file.
- */
#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
JNIEXPORT void JNICALL
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index 8946b0f5973..c0c81a1f2ad 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -48,6 +48,9 @@
#ifdef TARGET_OS_FAMILY_bsd
# include "jvm_bsd.h"
# include
+# ifdef __APPLE__
+# include
+# endif
#endif
class AgentLibrary;
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 9742ca1f5dd..67bf7b1033d 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -1218,6 +1218,7 @@ typedef TwoOopHashtable SymbolTwoOopHashtable;
static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \
static_field(Abstract_VM_Version, _vm_major_version, int) \
static_field(Abstract_VM_Version, _vm_minor_version, int) \
+ static_field(Abstract_VM_Version, _vm_micro_version, int) \
static_field(Abstract_VM_Version, _vm_build_number, int) \
static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
\
diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp
index 6888c091951..d2d7efcafa2 100644
--- a/hotspot/src/share/vm/runtime/vm_version.cpp
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp
@@ -55,6 +55,20 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
#ifndef HOTSPOT_RELEASE_VERSION
#error HOTSPOT_RELEASE_VERSION must be defined
#endif
+
+#ifndef JDK_MAJOR_VERSION
+ #error JDK_MAJOR_VERSION must be defined
+#endif
+#ifndef JDK_MINOR_VERSION
+ #error JDK_MINOR_VERSION must be defined
+#endif
+#ifndef JDK_MICRO_VERSION
+ #error JDK_MICRO_VERSION must be defined
+#endif
+#ifndef JDK_BUILD_NUMBER
+ #error JDK_BUILD_NUMBER must be defined
+#endif
+
#ifndef JRE_RELEASE_VERSION
#error JRE_RELEASE_VERSION must be defined
#endif
@@ -68,39 +82,44 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
#define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
#endif
-// HOTSPOT_RELEASE_VERSION must follow the release version naming convention
-// .-b[-][-]
+// HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
+// ..[-][-][-b]
int Abstract_VM_Version::_vm_major_version = 0;
int Abstract_VM_Version::_vm_minor_version = 0;
+int Abstract_VM_Version::_vm_micro_version = 0;
int Abstract_VM_Version::_vm_build_number = 0;
bool Abstract_VM_Version::_initialized = false;
int Abstract_VM_Version::_parallel_worker_threads = 0;
bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
+#ifdef ASSERT
+static void assert_digits(const char * s, const char * message) {
+ for (int i = 0; s[i] != '\0'; i++) {
+ assert(isdigit(s[i]), message);
+ }
+}
+#endif
+
+static void set_version_field(int * version_field, const char * version_str,
+ const char * const assert_msg) {
+ if (version_str != NULL && *version_str != '\0') {
+ DEBUG_ONLY(assert_digits(version_str, assert_msg));
+ *version_field = atoi(version_str);
+ }
+}
+
void Abstract_VM_Version::initialize() {
if (_initialized) {
return;
}
- char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
- // Expecting the next vm_version format:
- // .-b[-]
- char* vm_major_ver = vm_version;
- assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
- char* vm_minor_ver = strchr(vm_major_ver, '.');
- assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
- vm_minor_ver[0] = '\0'; // terminate vm_major_ver
- vm_minor_ver += 1;
- char* vm_build_num = strchr(vm_minor_ver, '-');
- assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
- vm_build_num[0] = '\0'; // terminate vm_minor_ver
- vm_build_num += 2;
+ set_version_field(&_vm_major_version, JDK_MAJOR_VERSION, "bad major version");
+ set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
+ set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
+ int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
+ set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset,
+ "bad build number");
- _vm_major_version = atoi(vm_major_ver);
- _vm_minor_version = atoi(vm_minor_ver);
- _vm_build_number = atoi(vm_build_num);
-
- os::free(vm_version);
_initialized = true;
}
@@ -276,6 +295,7 @@ const char *Abstract_VM_Version::vm_build_user() {
unsigned int Abstract_VM_Version::jvm_version() {
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
+ ((Abstract_VM_Version::vm_micro_version() & 0xFF) << 8) |
(Abstract_VM_Version::vm_build_number() & 0xFF);
}
diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp
index d48b4542282..27a5717d383 100644
--- a/hotspot/src/share/vm/runtime/vm_version.hpp
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp
@@ -44,6 +44,7 @@ class Abstract_VM_Version: AllStatic {
static unsigned int _logical_processors_per_package;
static int _vm_major_version;
static int _vm_minor_version;
+ static int _vm_micro_version;
static int _vm_build_number;
static bool _initialized;
static int _parallel_worker_threads;
@@ -68,6 +69,7 @@ class Abstract_VM_Version: AllStatic {
static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; }
static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; }
+ static int vm_micro_version() { assert(_initialized, "not initialized"); return _vm_micro_version; }
static int vm_build_number() { assert(_initialized, "not initialized"); return _vm_build_number; }
// Gets the jvm_version_info.jvm_version defined in jvm.h
diff --git a/hotspot/src/share/vm/services/memTracker.cpp b/hotspot/src/share/vm/services/memTracker.cpp
index a2961ee990a..50208a5cbba 100644
--- a/hotspot/src/share/vm/services/memTracker.cpp
+++ b/hotspot/src/share/vm/services/memTracker.cpp
@@ -785,7 +785,7 @@ void MemTracker::Tracker::record(address old_addr, address new_addr, size_t size
MEMFLAGS flags, address pc) {
assert(old_addr != NULL && new_addr != NULL, "Sanity check");
assert(_op == Realloc || _op == NoOp, "Wrong call");
- if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) {
+ if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
assert(_seq > 0, "Need pre-reserve sequence number");
if (_need_thread_critical_lock) {
ThreadCritical tc;
@@ -811,7 +811,7 @@ void MemTracker::Tracker::record(address addr, size_t size, MEMFLAGS flags, addr
// OOM already?
if (addr == NULL) return;
- if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) {
+ if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
bool pre_reserved_seq = (_seq != 0);
address pc = CALLER_CALLER_PC;
MEMFLAGS orig_flags = flags;
diff --git a/hotspot/src/share/vm/utilities/utf8.cpp b/hotspot/src/share/vm/utilities/utf8.cpp
index 8c013c9b30b..a0fbd95988e 100644
--- a/hotspot/src/share/vm/utilities/utf8.cpp
+++ b/hotspot/src/share/vm/utilities/utf8.cpp
@@ -329,23 +329,19 @@ int UNICODE::utf8_length(jchar* base, int length) {
char* UNICODE::as_utf8(jchar* base, int length) {
int utf8_len = utf8_length(base, length);
- u_char* result = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1);
- u_char* p = result;
- for (int index = 0; index < length; index++) {
- p = utf8_write(p, base[index]);
- }
- *p = '\0';
- assert(p == &result[utf8_len], "length prediction must be correct");
- return (char*) result;
+ u_char* buf = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1);
+ char* result = as_utf8(base, length, (char*) buf, utf8_len + 1);
+ assert((int) strlen(result) == utf8_len, "length prediction must be correct");
+ return result;
}
char* UNICODE::as_utf8(jchar* base, int length, char* buf, int buflen) {
u_char* p = (u_char*)buf;
- u_char* end = (u_char*)buf + buflen;
for (int index = 0; index < length; index++) {
jchar c = base[index];
- if (p + utf8_size(c) >= end) break; // string is truncated
- p = utf8_write(p, base[index]);
+ buflen -= utf8_size(c);
+ if (buflen <= 0) break; // string is truncated
+ p = utf8_write(p, c);
}
*p = '\0';
return buf;
@@ -389,3 +385,29 @@ void UNICODE::as_quoted_ascii(const jchar* base, int length, char* buf, int bufl
}
*p = '\0';
}
+
+#ifndef PRODUCT
+void TestAsUtf8() {
+ char res[60];
+ jchar str[20];
+
+ for (int i = 0; i < 20; i++) {
+ str[i] = 0x0800; // char that is 2B in UTF-16 but 3B in UTF-8
+ }
+ str[19] = (jchar)'\0';
+
+ // The resulting string in UTF-8 is 3*19 bytes long, but should be truncated
+ UNICODE::as_utf8(str, 19, res, 10);
+ assert(strlen(res) == 9, "string should be truncated here");
+
+ UNICODE::as_utf8(str, 19, res, 18);
+ assert(strlen(res) == 15, "string should be truncated here");
+
+ UNICODE::as_utf8(str, 19, res, 20);
+ assert(strlen(res) == 18, "string should be truncated here");
+
+ // Test with an "unbounded" buffer
+ UNICODE::as_utf8(str, 19, res, INT_MAX);
+ assert(strlen(res) == 3*19, "string should end here");
+}
+#endif
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index e7dc2ecc96a..9d41f5d4a05 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -250,3 +250,7 @@ fb92ed0399424193f444489ad49a16748816dc12 jdk9-b03
b92a20e303d24c74078888cd7084b14d7626d48f jdk9-b05
46e4951b2a267e98341613a3b796f2c7554eb831 jdk9-b06
389f4094fd603c17e215997b0b40171179629007 jdk9-b07
+3b360a77658e6b3ac150dd7cdbff1a7abe855afc jdk9-b08
+f93a792fe37279d4d37aea86a99f3abbdc6fe79b jdk9-b09
+4ce98701efe3b28f6ce3ab23385445731e968af7 jdk9-b10
+6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
diff --git a/jaxp/make/BuildJaxp.gmk b/jaxp/make/BuildJaxp.gmk
index 57c184bc4ee..4efd49f4921 100644
--- a/jaxp/make/BuildJaxp.gmk
+++ b/jaxp/make/BuildJaxp.gmk
@@ -35,15 +35,15 @@ DISABLE_JAXP_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-ser
# The generate new bytecode uses the new compiler for to generate bytecode
# for the new jdk that is being built. The code compiled by this setup
# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
+$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -XDignore.symbol.file=true $(DISABLE_JAXP_WARNINGS) -g, \
+ FLAGS := -XDignore.symbol.file=true $(DISABLE_JAXP_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
$(eval $(call SetupJavaCompilation,BUILD_JAXP, \
- SETUP := GENERATE_NEWBYTECODE_DEBUG, \
+ SETUP := GENERATE_NEWBYTECODE, \
SRC := $(JAXP_TOPDIR)/src, \
CLEAN := .properties, \
BIN := $(JAXP_OUTPUTDIR)/classes, \
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
index 0c2d2b1c9ba..e581f9a5b40 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
@@ -57,7 +57,7 @@ public final class SecuritySupport {
return securitySupport;
}
- static ClassLoader getContextClassLoader() {
+ public static ClassLoader getContextClassLoader() {
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java
index 5415c98e6a4..e33612e4a0d 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -19,7 +20,7 @@
*/
package com.sun.org.apache.xerces.internal.xpointer;
-import java.util.Hashtable;
+import java.util.HashMap;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
@@ -38,9 +39,8 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
* @xerces.internal
*
* @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $
- *
*/
-class ElementSchemePointer implements XPointerPart {
+final class ElementSchemePointer implements XPointerPart {
// Fields
@@ -346,15 +346,17 @@ class ElementSchemePointer implements XPointerPart {
// Donot check for empty elements if the empty element is
// a child of a found parent element
- //if (!fIsElementFound) {
- if (checkMatch()) {
- fIsElementFound = true;
+ if (checkMatch()) {
+ if (!fIsElementFound) {
fWasOnlyEmptyElementFound = true;
} else {
- fIsElementFound = false;
+ fWasOnlyEmptyElementFound = false;
}
- //}
-
+ fIsElementFound = true;
+ } else {
+ fIsElementFound = false;
+ fWasOnlyEmptyElementFound = false;
+ }
}
}
@@ -526,7 +528,7 @@ class ElementSchemePointer implements XPointerPart {
private SymbolTable fSymbolTable;
- private Hashtable fTokenNames = new Hashtable();
+ private HashMap fTokenNames = new HashMap<>();
/**
* Constructor
@@ -548,16 +550,7 @@ class ElementSchemePointer implements XPointerPart {
* @return String The token string
*/
private String getTokenString(int token) {
- return (String) fTokenNames.get(new Integer(token));
- }
-
- /**
- * Returns the token String
- * @param token The index of the token
- * @return String The token string
- */
- private Integer getToken(int token) {
- return (Integer) fTokenNames.get(new Integer(token));
+ return fTokenNames.get(new Integer(token));
}
/**
@@ -566,12 +559,11 @@ class ElementSchemePointer implements XPointerPart {
* @param token The token string
*/
private void addToken(String tokenStr) {
- Integer tokenInt = (Integer) fTokenNames.get(tokenStr);
- if (tokenInt == null) {
- tokenInt = new Integer(fTokenNames.size());
+ if (!fTokenNames.containsValue(tokenStr)) {
+ Integer tokenInt = new Integer(fTokenNames.size());
fTokenNames.put(tokenInt, tokenStr);
+ addToken(tokenInt.intValue());
}
- addToken(tokenInt.intValue());
}
/**
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ShortHandPointer.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ShortHandPointer.java
index 1317deb7415..c068917e2d0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ShortHandPointer.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ShortHandPointer.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,6 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.sun.org.apache.xerces.internal.xpointer;
import com.sun.org.apache.xerces.internal.impl.Constants;
@@ -37,9 +39,8 @@ import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
* in document order that has a matching NCName as an identifier.
*
*
- *
*/
-class ShortHandPointer implements XPointerPart {
+final class ShortHandPointer implements XPointerPart {
// The name of the ShortHand pointer
private String fShortHandPointer;
@@ -261,7 +262,7 @@ class ShortHandPointer implements XPointerPart {
* @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#isChildFragmentResolved()
*/
public boolean isChildFragmentResolved() {
- return fIsFragmentResolved & ( fMatchingChildCount > 0);
+ return fIsFragmentResolved && ( fMatchingChildCount > 0);
}
/**
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerErrorHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerErrorHandler.java
index e1a971f98b7..7d02f30e0fa 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerErrorHandler.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerErrorHandler.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,6 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.sun.org.apache.xerces.internal.xpointer;
import java.io.PrintWriter;
@@ -31,7 +33,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
* implementation and reported as resource errors.
*
*/
-class XPointerErrorHandler implements XMLErrorHandler {
+final class XPointerErrorHandler implements XMLErrorHandler {
//
// Data
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java
index 30b75630b54..5d4c905a3b8 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,10 +18,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.sun.org.apache.xerces.internal.xpointer;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.HashMap;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
@@ -32,6 +34,7 @@ import com.sun.org.apache.xerces.internal.xinclude.XIncludeNamespaceSupport;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
+import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
import com.sun.org.apache.xerces.internal.xni.XMLString;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
@@ -64,8 +67,8 @@ public final class XPointerHandler extends XIncludeHandler implements
XPointerProcessor {
// Fields
- // A Vector of XPointerParts
- protected Vector fXPointerParts = null;
+ // An ArrayList of XPointerParts
+ protected ArrayList fXPointerParts = null;
// The current XPointerPart
protected XPointerPart fXPointerPart = null;
@@ -102,7 +105,7 @@ public final class XPointerHandler extends XIncludeHandler implements
public XPointerHandler() {
super();
- fXPointerParts = new Vector();
+ fXPointerParts = new ArrayList<>();
fSymbolTable = new SymbolTable();
}
@@ -110,13 +113,17 @@ public final class XPointerHandler extends XIncludeHandler implements
XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) {
super();
- fXPointerParts = new Vector();
+ fXPointerParts = new ArrayList<>();
fSymbolTable = symbolTable;
fErrorHandler = errorHandler;
fXPointerErrorReporter = errorReporter;
//fErrorReporter = errorReporter; // The XInclude ErrorReporter
}
+ public void setDocumentHandler(XMLDocumentHandler handler) {
+ fDocumentHandler = handler;
+ }
+
// ************************************************************************
// Implementation of the XPointerProcessor interface.
// ************************************************************************
@@ -300,7 +307,7 @@ public final class XPointerHandler extends XIncludeHandler implements
// in the XPointer expression until a matching element is found.
for (int i = 0; i < fXPointerParts.size(); i++) {
- fXPointerPart = (XPointerPart) fXPointerParts.get(i);
+ fXPointerPart = fXPointerParts.get(i);
if (fXPointerPart.resolveXPointer(element, attributes, augs,
event)) {
@@ -430,11 +437,11 @@ public final class XPointerHandler extends XIncludeHandler implements
}
/**
- * Returns a Vector of XPointerPart objects
+ * Returns an ArrayList of XPointerPart objects
*
- * @return A Vector of XPointerPart objects.
+ * @return An ArrayList of XPointerPart objects.
*/
- public Vector getPointerParts() {
+ public ArrayList getPointerParts() {
return fXPointerParts;
}
@@ -480,7 +487,7 @@ public final class XPointerHandler extends XIncludeHandler implements
private SymbolTable fSymbolTable;
- private Hashtable fTokenNames = new Hashtable();
+ private HashMap fTokenNames = new HashMap<>();
/**
* Constructor
@@ -508,7 +515,7 @@ public final class XPointerHandler extends XIncludeHandler implements
* @return String The token string
*/
private String getTokenString(int token) {
- return (String) fTokenNames.get(new Integer(token));
+ return fTokenNames.get(new Integer(token));
}
/**
@@ -517,12 +524,11 @@ public final class XPointerHandler extends XIncludeHandler implements
* @param token The token string
*/
private void addToken(String tokenStr) {
- Integer tokenInt = (Integer) fTokenNames.get(tokenStr);
- if (tokenInt == null) {
- tokenInt = new Integer(fTokenNames.size());
+ if (!fTokenNames.containsValue(tokenStr)) {
+ Integer tokenInt = new Integer(fTokenNames.size());
fTokenNames.put(tokenInt, tokenStr);
+ addToken(tokenInt.intValue());
}
- addToken(tokenInt.intValue());
}
/**
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
index 639bdef7784..36ee4811039 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,6 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.sun.org.apache.xerces.internal.xpointer;
import java.util.Locale;
@@ -34,7 +36,7 @@ import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
*
* @version $Id: XPointerMessageFormatter.java,v 1.5 2010-11-01 04:40:26 joehw Exp $
*/
-class XPointerMessageFormatter implements MessageFormatter {
+final class XPointerMessageFormatter implements MessageFormatter {
public static final String XPOINTER_DOMAIN = "http://www.w3.org/TR/XPTR";
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerPart.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerPart.java
index 667facef7fd..d5ee0617efe 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerPart.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerPart.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,6 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.sun.org.apache.xerces.internal.xpointer;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
@@ -49,7 +51,7 @@ public interface XPointerPart {
* Provides scheme specific parsing of a XPointer expression i.e.
* the PointerPart or ShortHandPointer.
*
- * @param xpointer A String representing the PointerPart or ShortHandPointer.
+ * @param part A String representing the PointerPart or ShortHandPointer.
* @throws XNIException Thrown if the PointerPart string does not conform to
* the syntax defined by its scheme.
*
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerProcessor.java b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerProcessor.java
index c6e746e365a..8457fd5fd0e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerProcessor.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerProcessor.java
@@ -3,11 +3,12 @@
* DO NOT REMOVE OR ALTER!
*/
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -34,7 +35,6 @@ import com.sun.org.apache.xerces.internal.xni.XNIException;
*
* @xerces.internal
*
- *
*/
public interface XPointerProcessor {
@@ -56,7 +56,6 @@ public interface XPointerProcessor {
* @throws XNIException Thrown if the xpointer string does not conform to
* the XPointer Framework syntax or the syntax of the pointer part does
* not conform to its definition for its scheme.
- *
*/
public void parseXPointer(String xpointer) throws XNIException;
@@ -74,7 +73,6 @@ public interface XPointerProcessor {
* 2 - An empty element call
* @return true if the element was resolved by the xpointer
* @throws XNIException Thrown to signal an error
- *
*/
public boolean resolveXPointer(QName element, XMLAttributes attributes,
Augmentations augs, int event) throws XNIException;
@@ -86,7 +84,6 @@ public interface XPointerProcessor {
* @return True if the xpointer expression matches a node/fragment in the resource
* else returns false.
* @throws XNIException Thrown to signal an error
- *
*/
public boolean isFragmentResolved() throws XNIException;
@@ -97,7 +94,6 @@ public interface XPointerProcessor {
* @return True if the xpointer expression matches a fragment in the resource
* else returns false.
* @throws XNIException Thrown to signal an error
- *
*/
public boolean isXPointerResolved() throws XNIException;
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java
index ab138efa477..04e77d6bc62 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java
@@ -22,6 +22,11 @@
*/
package com.sun.org.apache.xml.internal.serializer;
+import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
+import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
+import com.sun.org.apache.xml.internal.serializer.utils.Utils;
+import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -29,19 +34,11 @@ import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
import javax.xml.transform.TransformerException;
-import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
-import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
-import com.sun.org.apache.xml.internal.serializer.utils.Utils;
-import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-
/**
* This class provides services that tell if a character should have
* special treatement, such as entity reference substitution or normalization
@@ -176,13 +173,19 @@ final class CharInfo
// file
// 3) try treating the resource a URI
- if (internal) {
- try {
+ try {
+ if (internal) {
// Load entity property files by using PropertyResourceBundle,
// cause of security issure for applets
entities = PropertyResourceBundle.getBundle(entitiesResource);
- } catch (Exception e) {}
- }
+ } else {
+ ClassLoader cl = SecuritySupport.getContextClassLoader();
+ if (cl != null) {
+ entities = PropertyResourceBundle.getBundle(entitiesResource,
+ Locale.getDefault(), cl);
+ }
+ }
+ } catch (Exception e) {}
if (entities != null) {
Enumeration keys = entities.getKeys();
@@ -198,6 +201,7 @@ final class CharInfo
set(S_CARRIAGERETURN);
} else {
InputStream is = null;
+ String err = null;
// Load user specified resource file by using URL loading, it
// requires a valid URI as parameter
@@ -205,18 +209,22 @@ final class CharInfo
if (internal) {
is = CharInfo.class.getResourceAsStream(entitiesResource);
} else {
- ClassLoader cl = ObjectFactory.findClassLoader();
- if (cl == null) {
- is = ClassLoader.getSystemResourceAsStream(entitiesResource);
- } else {
- is = cl.getResourceAsStream(entitiesResource);
+ ClassLoader cl = SecuritySupport.getContextClassLoader();
+ if (cl != null) {
+ try {
+ is = cl.getResourceAsStream(entitiesResource);
+ } catch (Exception e) {
+ err = e.getMessage();
+ }
}
if (is == null) {
try {
URL url = new URL(entitiesResource);
is = url.openStream();
- } catch (Exception e) {}
+ } catch (Exception e) {
+ err = e.getMessage();
+ }
}
}
@@ -224,7 +232,7 @@ final class CharInfo
throw new RuntimeException(
Utils.messages.createMessage(
MsgKey.ER_RESOURCE_COULD_NOT_FIND,
- new Object[] {entitiesResource, entitiesResource}));
+ new Object[] {entitiesResource, err}));
}
// Fix Bugzilla#4000: force reading in UTF-8
@@ -456,64 +464,56 @@ final class CharInfo
return isCleanTextASCII[value];
}
-// In the future one might want to use the array directly and avoid
-// the method call, but I think the JIT alreay inlines this well enough
-// so don't do it (for now) - bjm
-// public final boolean[] getASCIIClean()
-// {
-// return isCleanTextASCII;
-// }
-
-
- private static CharInfo getCharInfoBasedOnPrivilege(
- final String entitiesFileName, final String method,
- final boolean internal){
- return (CharInfo) AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
- return new CharInfo(entitiesFileName,
- method, internal);}
- });
- }
/**
- * Factory that reads in a resource file that describes the mapping of
- * characters to entity references.
+ * Read an internal resource file that describes the mapping of
+ * characters to entity references; Construct a CharInfo object.
*
- * Resource files must be encoded in UTF-8 and have a format like:
- *
- * # First char # is a comment
- * Entity numericValue
- * quot 34
- * amp 38
- *
- * (Note: Why don't we just switch to .properties files? Oct-01 -sc)
- *
- * @param entitiesResource Name of entities resource file that should
- * be loaded, which describes that mapping of characters to entity references.
- * @param method the output method type, which should be one of "xml", "html", "text"...
+ * @param entitiesFileName Name of entities resource file that should
+ * be loaded, which describes the mapping of characters to entity references.
+ * @param method the output method type, which should be one of "xml", "html", and "text".
+ * @return an instance of CharInfo
*
* @xsl.usage internal
*/
- static CharInfo getCharInfo(String entitiesFileName, String method)
+ static CharInfo getCharInfoInternal(String entitiesFileName, String method)
{
CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName);
if (charInfo != null) {
return charInfo;
}
- // try to load it internally - cache
- try {
- charInfo = getCharInfoBasedOnPrivilege(entitiesFileName,
- method, true);
- m_getCharInfoCache.put(entitiesFileName, charInfo);
- return charInfo;
- } catch (Exception e) {}
+ charInfo = new CharInfo(entitiesFileName, method, true);
+ m_getCharInfoCache.put(entitiesFileName, charInfo);
+ return charInfo;
+ }
- // try to load it externally - do not cache
+ /**
+ * Constructs a CharInfo object using the following process to try reading
+ * the entitiesFileName parameter:
+ *
+ * 1) attempt to load it as a ResourceBundle
+ * 2) try using the class loader to find the specified file
+ * 3) try opening it as an URI
+ *
+ * In case of 2 and 3, the resource file must be encoded in UTF-8 and have the
+ * following format:
+ *
+ * # First char # is a comment
+ * Entity numericValue
+ * quot 34
+ * amp 38
+ *
+ *
+ * @param entitiesFileName Name of entities resource file that should
+ * be loaded, which describes the mapping of characters to entity references.
+ * @param method the output method type, which should be one of "xml", "html", and "text".
+ * @return an instance of CharInfo
+ */
+ static CharInfo getCharInfo(String entitiesFileName, String method)
+ {
try {
- return getCharInfoBasedOnPrivilege(entitiesFileName,
- method, false);
+ return new CharInfo(entitiesFileName, method, false);
} catch (Exception e) {}
String absoluteEntitiesFileName;
@@ -530,8 +530,7 @@ final class CharInfo
}
}
- return getCharInfoBasedOnPrivilege(entitiesFileName,
- method, false);
+ return new CharInfo(absoluteEntitiesFileName, method, false);
}
/** Table of user-specified char infos. */
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
index aa48eaed8b4..a68ec6dfa04 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java
@@ -60,7 +60,7 @@ public final class ToHTMLStream extends ToStream
*/
private static final CharInfo m_htmlcharInfo =
// new CharInfo(CharInfo.HTML_ENTITIES_RESOURCE);
- CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML);
+ CharInfo.getCharInfoInternal(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML);
/** A digital search trie for fast, case insensitive lookup of ElemDesc objects. */
static final Trie m_elementFlags = new Trie();
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
index e64cc3face8..00463bce33f 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java
@@ -58,7 +58,7 @@ public final class ToXMLStream extends ToStream
*/
private static CharInfo m_xmlcharInfo =
// new CharInfo(CharInfo.XML_ENTITIES_RESOURCE);
- CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, Method.XML);
+ CharInfo.getCharInfoInternal(CharInfo.XML_ENTITIES_RESOURCE, Method.XML);
/**
* Default constructor.
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index a7525e9cd6a..bcb5f8d0804 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -253,3 +253,7 @@ da44a8bdf1f3fdd518e7d785d60cc1b15983b176 jdk9-b04
eae966c8133fec0a8bf9e16d1274a4ede3c0fb52 jdk9-b05
cf0a6e41670f990414cd337000ad5f3bd1908073 jdk9-b06
856a9132f506cafe2f251c1a16a0b14e4d16048d jdk9-b07
+2d9f4166e0be68aa43c5f4fd0f8d34768e11f652 jdk9-b08
+c9e8bb8c1144a966ca7b481142c6b5e55d14a29c jdk9-b09
+9af43f4d215f6f19b1767f6ac66da931b8ee9535 jdk9-b10
+1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
diff --git a/jaxws/make/BuildJaxws.gmk b/jaxws/make/BuildJaxws.gmk
index 1c159965dd3..5994543f39f 100644
--- a/jaxws/make/BuildJaxws.gmk
+++ b/jaxws/make/BuildJaxws.gmk
@@ -35,21 +35,21 @@ DISABLE_JAXWS_WARNINGS := -Xlint:all,-varargs,-rawtypes,-deprecation,-unchecked,
# The generate new bytecode uses the new compiler for to generate bytecode
# for the new jdk that is being built. The code compiled by this setup
# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
+$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -XDignore.symbol.file=true $(DISABLE_JAXWS_WARNINGS) -g, \
+ FLAGS := -XDignore.symbol.file=true $(DISABLE_JAXWS_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
$(eval $(call SetupJavaCompilation,BUILD_JAF, \
- SETUP := GENERATE_NEWBYTECODE_DEBUG, \
+ SETUP := GENERATE_NEWBYTECODE, \
SRC := $(JAXWS_TOPDIR)/src/share/jaf_classes, \
CLEAN := .properties, \
BIN := $(JAXWS_OUTPUTDIR)/jaf_classes))
$(eval $(call SetupJavaCompilation,BUILD_JAXWS, \
- SETUP := GENERATE_NEWBYTECODE_DEBUG, \
+ SETUP := GENERATE_NEWBYTECODE, \
SRC := $(JAXWS_TOPDIR)/src/share/jaxws_classes, \
BIN := $(JAXWS_OUTPUTDIR)/jaxws_classes, \
COPY := .xsd, \
diff --git a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
index 55f180b9554..93393377a06 100644
--- a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
+++ b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
@@ -25,6 +25,9 @@
package javax.activation;
+import java.util.Map;
+import java.util.WeakHashMap;
+
/**
* The CommandMap class provides an interface to a registry of
@@ -38,6 +41,8 @@ package javax.activation;
*/
public abstract class CommandMap {
private static CommandMap defaultCommandMap = null;
+ private static Map map =
+ new WeakHashMap();
/**
* Get the default CommandMap.
@@ -56,11 +61,18 @@ public abstract class CommandMap {
*
* @return the CommandMap
*/
- public static CommandMap getDefaultCommandMap() {
- if (defaultCommandMap == null)
- defaultCommandMap = new MailcapCommandMap();
+ public static synchronized CommandMap getDefaultCommandMap() {
+ if (defaultCommandMap != null)
+ return defaultCommandMap;
- return defaultCommandMap;
+ // fetch per-thread-context-class-loader default
+ ClassLoader tccl = SecuritySupport.getContextClassLoader();
+ CommandMap def = map.get(tccl);
+ if (def == null) {
+ def = new MailcapCommandMap();
+ map.put(tccl, def);
+ }
+ return def;
}
/**
@@ -71,7 +83,7 @@ public abstract class CommandMap {
* @exception SecurityException if the caller doesn't have permission
* to change the default
*/
- public static void setDefaultCommandMap(CommandMap commandMap) {
+ public static synchronized void setDefaultCommandMap(CommandMap commandMap) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
@@ -79,13 +91,16 @@ public abstract class CommandMap {
security.checkSetFactory();
} catch (SecurityException ex) {
// otherwise, we also allow it if this code and the
- // factory come from the same class loader (e.g.,
+ // factory come from the same (non-system) class loader (e.g.,
// the JAF classes were loaded with the applet classes).
- if (CommandMap.class.getClassLoader() !=
+ if (CommandMap.class.getClassLoader() == null ||
+ CommandMap.class.getClassLoader() !=
commandMap.getClass().getClassLoader())
throw ex;
}
}
+ // remove any per-thread-context-class-loader CommandMap
+ map.remove(SecuritySupport.getContextClassLoader());
defaultCommandMap = commandMap;
}
diff --git a/jaxws/src/share/jaf_classes/javax/activation/DataHandler.java b/jaxws/src/share/jaf_classes/javax/activation/DataHandler.java
index 977fb7c3c10..6fef9302a83 100644
--- a/jaxws/src/share/jaf_classes/javax/activation/DataHandler.java
+++ b/jaxws/src/share/jaf_classes/javax/activation/DataHandler.java
@@ -368,7 +368,12 @@ public class DataHandler implements Transferable {
// if it's not set, set it...
if (transferFlavors == emptyFlavors)
transferFlavors = getDataContentHandler().getTransferDataFlavors();
- return transferFlavors;
+
+ if (transferFlavors == emptyFlavors)
+ return transferFlavors;
+ else
+ return transferFlavors.clone();
+
}
/**
diff --git a/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java b/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
index a1922d8d070..a7c41185273 100644
--- a/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
+++ b/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
@@ -26,6 +26,8 @@
package javax.activation;
import java.io.File;
+import java.util.Map;
+import java.util.WeakHashMap;
/**
* The FileTypeMap is an abstract class that provides a data typing
@@ -48,6 +50,8 @@ import java.io.File;
public abstract class FileTypeMap {
private static FileTypeMap defaultMap = null;
+ private static Map map =
+ new WeakHashMap();
/**
* The default constructor.
@@ -78,11 +82,11 @@ public abstract class FileTypeMap {
* Sets the default FileTypeMap for the system. This instance
* will be returned to callers of getDefaultFileTypeMap.
*
- * @param map The FileTypeMap.
+ * @param fileTypeMap The FileTypeMap.
* @exception SecurityException if the caller doesn't have permission
* to change the default
*/
- public static void setDefaultFileTypeMap(FileTypeMap map) {
+ public static synchronized void setDefaultFileTypeMap(FileTypeMap fileTypeMap) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
@@ -90,14 +94,17 @@ public abstract class FileTypeMap {
security.checkSetFactory();
} catch (SecurityException ex) {
// otherwise, we also allow it if this code and the
- // factory come from the same class loader (e.g.,
+ // factory come from the same (non-system) class loader (e.g.,
// the JAF classes were loaded with the applet classes).
- if (FileTypeMap.class.getClassLoader() !=
- map.getClass().getClassLoader())
+ if (FileTypeMap.class.getClassLoader() == null ||
+ FileTypeMap.class.getClassLoader() !=
+ fileTypeMap.getClass().getClassLoader())
throw ex;
}
}
- defaultMap = map;
+ // remove any per-thread-context-class-loader FileTypeMap
+ map.remove(SecuritySupport.getContextClassLoader());
+ defaultMap = fileTypeMap;
}
/**
@@ -109,10 +116,17 @@ public abstract class FileTypeMap {
* @return The default FileTypeMap
* @see javax.activation.FileTypeMap#setDefaultFileTypeMap
*/
- public static FileTypeMap getDefaultFileTypeMap() {
- // XXX - probably should be synchronized
- if (defaultMap == null)
- defaultMap = new MimetypesFileTypeMap();
- return defaultMap;
+ public static synchronized FileTypeMap getDefaultFileTypeMap() {
+ if (defaultMap != null)
+ return defaultMap;
+
+ // fetch per-thread-context-class-loader default
+ ClassLoader tccl = SecuritySupport.getContextClassLoader();
+ FileTypeMap def = map.get(tccl);
+ if (def == null) {
+ def = new MimetypesFileTypeMap();
+ map.put(tccl, def);
+ }
+ return def;
}
}
diff --git a/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java b/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java
index b24774be77d..91df5fe9afb 100644
--- a/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java
+++ b/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java
@@ -120,11 +120,7 @@ import com.sun.activation.registries.LogSupport;
public class MailcapCommandMap extends CommandMap {
/*
* We manage a collection of databases, searched in order.
- * The default database is shared between all instances
- * of this class.
- * XXX - Can we safely share more databases between instances?
*/
- private static MailcapFile defDB = null;
private MailcapFile[] DB;
private static final int PROG = 0; // programmatically added entries
@@ -164,14 +160,10 @@ public class MailcapCommandMap extends CommandMap {
loadAllResources(dbv, "META-INF/mailcap");
LogSupport.log("MailcapCommandMap: load DEF");
- synchronized (MailcapCommandMap.class) {
- // see if another instance has created this yet.
- if (defDB == null)
- defDB = loadResource("/META-INF/mailcap.default");
- }
+ mf = loadResource("/META-INF/mailcap.default");
- if (defDB != null)
- dbv.add(defDB);
+ if (mf != null)
+ dbv.add(mf);
DB = new MailcapFile[dbv.size()];
DB = (MailcapFile[])dbv.toArray(DB);
diff --git a/jaxws/src/share/jaf_classes/javax/activation/MimetypesFileTypeMap.java b/jaxws/src/share/jaf_classes/javax/activation/MimetypesFileTypeMap.java
index 36a19fcae35..fca50572047 100644
--- a/jaxws/src/share/jaf_classes/javax/activation/MimetypesFileTypeMap.java
+++ b/jaxws/src/share/jaf_classes/javax/activation/MimetypesFileTypeMap.java
@@ -69,11 +69,7 @@ import com.sun.activation.registries.LogSupport;
public class MimetypesFileTypeMap extends FileTypeMap {
/*
* We manage a collection of databases, searched in order.
- * The default database is shared between all instances
- * of this class.
- * XXX - Can we safely share more databases between instances?
*/
- private static MimeTypeFile defDB = null;
private MimeTypeFile[] DB;
private static final int PROG = 0; // programmatically added entries
@@ -114,14 +110,10 @@ public class MimetypesFileTypeMap extends FileTypeMap {
loadAllResources(dbv, "META-INF/mime.types");
LogSupport.log("MimetypesFileTypeMap: load DEF");
- synchronized (MimetypesFileTypeMap.class) {
- // see if another instance has created this yet.
- if (defDB == null)
- defDB = loadResource("/META-INF/mimetypes.default");
- }
+ mf = loadResource("/META-INF/mimetypes.default");
- if (defDB != null)
- dbv.addElement(defDB);
+ if (mf != null)
+ dbv.addElement(mf);
DB = new MimeTypeFile[dbv.size()];
dbv.copyInto(DB);
diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..c8c847907cd
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.internal.ws.wsdl.parser;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
index 449f4dcb6a5..c153cce7f68 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -60,12 +60,10 @@ import java.util.Set;
*/
public class Internalizer {
- private static final XPathFactory xpf = XmlUtil.newXPathFactory(true);
- private final XPath xpath = xpf.newXPath();
+ private final XPath xpath = xpf.get().newXPath();
private final DOMForest forest;
private final ErrorReceiver errorReceiver;
-
public Internalizer(DOMForest forest, WsimportOptions options, ErrorReceiver errorReceiver) {
this.forest = forest;
this.errorReceiver = errorReceiver;
@@ -77,6 +75,12 @@ public class Internalizer {
}
}
+ private static final ContextClassloaderLocal xpf = new ContextClassloaderLocal() {
+ @Override
+ protected XPathFactory initialValue() throws Exception {
+ return XPathFactory.newInstance();
+ }
+ };
/**
* Validates attributes of a <JAXWS:bindings> element.
*/
diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
index 52546947ad7..0f12222220c 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -54,8 +54,14 @@ import java.util.Map;
public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler {
// xml security enabled always, xpath used for parsing "part" attribute
- private static final XPathFactory xpf = XmlUtil.newXPathFactory(true);
- private final XPath xpath = xpf.newXPath();
+ private static final ContextClassloaderLocal xpf = new ContextClassloaderLocal() {
+ @Override
+ protected XPathFactory initialValue() throws Exception {
+ return XPathFactory.newInstance();
+ }
+ };
+
+ private final XPath xpath = xpf.get().newXPath();
public JAXWSBindingExtensionHandler(Map extensionHandlerMap) {
super(extensionHandlerMap);
diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/Internalizer.java b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/Internalizer.java
index 3fa46d39a00..c360248a139 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/Internalizer.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/Internalizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -76,8 +76,6 @@ class Internalizer {
private static final String WSDL_NS = "http://schemas.xmlsoap.org/wsdl/";
- private static XPathFactory xpf = null;
-
private final XPath xpath;
/**
@@ -99,12 +97,7 @@ class Internalizer {
this.errorHandler = forest.getErrorHandler();
this.forest = forest;
this.enableSCD = enableSCD;
- synchronized (this) {
- if (xpf == null) {
- xpf = XmlFactory.createXPathFactory(disableSecureProcessing);
- }
- }
- xpath = xpf.newXPath();
+ xpath = XmlFactory.createXPathFactory(disableSecureProcessing).newXPath();
}
/**
@@ -170,7 +163,6 @@ class Internalizer {
if( a.getLocalName().equals("multiple") ) //
continue;
-
// TODO: flag error for this undefined attribute
}
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java
index 92e4337b012..7f58b05f24f 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,9 +27,14 @@ package com.sun.xml.internal.bind;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Calendar;
+import java.util.Collections;
import java.util.GregorianCalendar;
+import java.util.Map;
import java.util.TimeZone;
+import java.util.WeakHashMap;
import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.DatatypeConverterInterface;
@@ -356,7 +361,7 @@ public final class DatatypeConverterImpl implements DatatypeConverterInterface {
public static GregorianCalendar _parseDateTime(CharSequence s) {
String val = WhiteSpaceProcessor.trim(s).toString();
- return datatypeFactory.newXMLGregorianCalendar(val).toGregorianCalendar();
+ return getDatatypeFactory().newXMLGregorianCalendar(val).toGregorianCalendar();
}
public static String _printDateTime(Calendar val) {
@@ -722,14 +727,30 @@ public final class DatatypeConverterImpl implements DatatypeConverterInterface {
}
return false;
}
- private static final DatatypeFactory datatypeFactory;
- static {
- try {
- datatypeFactory = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e) {
- throw new Error(e);
+ private static final Map DF_CACHE = Collections.synchronizedMap(new WeakHashMap());
+
+ public static DatatypeFactory getDatatypeFactory() {
+ ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ DatatypeFactory df = DF_CACHE.get(tccl);
+ if (df == null) {
+ synchronized (DatatypeConverterImpl.class) {
+ df = DF_CACHE.get(tccl);
+ if (df == null) { // to prevent multiple initialization
+ try {
+ df = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new Error(Messages.FAILED_TO_INITIALE_DATATYPE_FACTORY.format(),e);
+ }
+ DF_CACHE.put(tccl, df);
+ }
+ }
}
+ return df;
}
private static final class CalendarFormatter {
@@ -1045,7 +1066,7 @@ public final class DatatypeConverterImpl implements DatatypeConverterInterface {
@Deprecated
public Calendar parseTime(String lexicalXSDTime) {
- return datatypeFactory.newXMLGregorianCalendar(lexicalXSDTime).toGregorianCalendar();
+ return getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDTime).toGregorianCalendar();
}
@Deprecated
@@ -1055,7 +1076,7 @@ public final class DatatypeConverterImpl implements DatatypeConverterInterface {
@Deprecated
public Calendar parseDate(String lexicalXSDDate) {
- return datatypeFactory.newXMLGregorianCalendar(lexicalXSDDate).toGregorianCalendar();
+ return getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDDate).toGregorianCalendar();
}
@Deprecated
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.java
similarity index 51%
rename from jdk/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java
rename to jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.java
index 9b958f56600..f424fb71903 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,38 +23,26 @@
* questions.
*/
-package javax.swing.text.html.parser;
+package com.sun.xml.internal.bind;
-import java.io.InputStream;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
/**
- * Simple class to load resources using the 1.2
- * security model. Since the html support is loaded
- * lazily, it's resources are potentially fetched with
- * applet code in the call stack. By providing this
- * functionality in a class that is only built on 1.2,
- * reflection can be used from the code that is also
- * built on 1.1 to call this functionality (and avoid
- * the evils of preprocessing). This functionality
- * is called from ParserDelegator.getResourceAsStream.
- *
- * @author Timothy Prinzing
+ * Message resources
*/
-class ResourceLoader implements java.security.PrivilegedAction {
+enum Messages {
+ FAILED_TO_INITIALE_DATATYPE_FACTORY, // 0 args
+ ;
- ResourceLoader(String name) {
- this.name = name;
+ private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName());
+
+ @Override
+ public String toString() {
+ return format();
}
- public Object run() {
- Object o = ParserDelegator.class.getResourceAsStream(name);
- return o;
+ public String format( Object... args ) {
+ return MessageFormat.format( rb.getString(name()), args );
}
-
- public static InputStream getResourceAsStream(String name) {
- java.security.PrivilegedAction a = new ResourceLoader(name);
- return (InputStream) java.security.AccessController.doPrivileged(a);
- }
-
- private String name;
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.properties
new file mode 100644
index 00000000000..1da585a50de
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages.properties
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = \
+ Failed to initialize JAXP 1.3 DatatypeFactory class.
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.java
index 16190f0b77c..d429eb65310 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -60,7 +60,6 @@ enum Messages {
PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY, // 2 args
INVALID_XML_ENUM_VALUE, // 2 arg
- FAILED_TO_INITIALE_DATATYPE_FACTORY, // 0 args
NO_IMAGE_WRITER, // 1 arg
ILLEGAL_MIME_TYPE, // 2 args
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java
index e7ff4433460..9447c51048e 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java
@@ -63,9 +63,7 @@ import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import javax.xml.bind.ValidationEvent;
import javax.xml.bind.helpers.ValidationEventImpl;
-import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeConstants;
-import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
@@ -574,7 +572,8 @@ public abstract class RuntimeBuiltinLeafInfoImpl extends BuiltinLeafInfoImpl<
public XMLGregorianCalendar parse(CharSequence lexical) throws SAXException {
try {
- return datatypeFactory.newXMLGregorianCalendar(lexical.toString().trim()); // (.trim() - issue 396)
+ return DatatypeConverterImpl.getDatatypeFactory()
+ .newXMLGregorianCalendar(lexical.toString().trim()); // (.trim() - issue 396)
} catch (Exception e) {
UnmarshallingContext.getInstance().handleError(e);
return null;
@@ -844,7 +843,7 @@ public abstract class RuntimeBuiltinLeafInfoImpl extends BuiltinLeafInfoImpl<
public Duration parse(CharSequence lexical) {
TODO.checkSpec("JSR222 Issue #42");
- return datatypeFactory.newDuration(lexical.toString());
+ return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString());
}
});
primaryList.add(
@@ -885,21 +884,6 @@ public abstract class RuntimeBuiltinLeafInfoImpl extends BuiltinLeafInfoImpl<
}
}
-
- /**
- * Cached instance of {@link DatatypeFactory} to create
- * {@link XMLGregorianCalendar} and {@link Duration}.
- */
- private static final DatatypeFactory datatypeFactory = init();
-
- private static DatatypeFactory init() {
- try {
- return DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e) {
- throw new Error(Messages.FAILED_TO_INITIALE_DATATYPE_FACTORY.format(),e);
- }
- }
-
private static void checkXmlGregorianCalendarFieldRef(QName type,
XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{
StringBuilder buf = new StringBuilder();
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java
index 8454c632780..f7b1db6bee1 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java
@@ -128,14 +128,6 @@ public final class JAXBContextImpl extends JAXBRIContext {
*/
private final Map bridges = new LinkedHashMap();
- /**
- * Shared instance of {@link TransformerFactory}.
- * Lock before use, because a {@link TransformerFactory} is not thread-safe
- * whereas {@link JAXBContextImpl} is.
- * Lazily created.
- */
- private volatile static SAXTransformerFactory tf;
-
/**
* Shared instance of {@link DocumentBuilder}.
* Lock before use. Lazily created.
@@ -705,13 +697,7 @@ public final class JAXBContextImpl extends JAXBRIContext {
*/
static Transformer createTransformer(boolean disableSecureProcessing) {
try {
- if (tf==null) {
- synchronized(JAXBContextImpl.class) {
- if (tf==null) {
- tf = (SAXTransformerFactory)XmlFactory.createTransformerFactory(disableSecureProcessing);
- }
- }
- }
+ SAXTransformerFactory tf = (SAXTransformerFactory)XmlFactory.createTransformerFactory(disableSecureProcessing);
return tf.newTransformer();
} catch (TransformerConfigurationException e) {
throw new Error(e); // impossible
@@ -723,13 +709,7 @@ public final class JAXBContextImpl extends JAXBRIContext {
*/
public static TransformerHandler createTransformerHandler(boolean disableSecureProcessing) {
try {
- if (tf==null) {
- synchronized(JAXBContextImpl.class) {
- if (tf==null) {
- tf = (SAXTransformerFactory)XmlFactory.createTransformerFactory(disableSecureProcessing);
- }
- }
- }
+ SAXTransformerFactory tf = (SAXTransformerFactory)XmlFactory.createTransformerFactory(disableSecureProcessing);
return tf.newTransformerHandler();
} catch (TransformerConfigurationException e) {
throw new Error(e); // impossible
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java
index 3239b418a36..d6b76551dfc 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -58,6 +58,7 @@ enum Messages {
FAILED_TO_GENERATE_SCHEMA, // 0 args
ERROR_PROCESSING_SCHEMA, // 0 args
ILLEGAL_CONTENT, // 2 args
+ FAILED_TO_INITIALE_DATATYPE_FACTORY, // 2 args
;
private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName());
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java
index 631a86be1cf..c4721fd5ea8 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -153,7 +153,6 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
}
}
-
/**
* Reference to FI's XMLStreamWriter class, if FI can be loaded.
*/
@@ -162,9 +161,8 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
private static Class initFIStAXWriterClass() {
try {
- ClassLoader loader = getClassLoader();
- Class llfisw = Class.forName("com.sun.xml.internal.org.jvnet.fastinfoset.stax.LowLevelFastInfosetStreamWriter", true, loader);
- Class sds = loader.loadClass("com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer");
+ Class> llfisw = Class.forName("com.sun.xml.internal.org.jvnet.fastinfoset.stax.LowLevelFastInfosetStreamWriter");
+ Class> sds = Class.forName("com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer");
// Check if StAXDocumentSerializer implements LowLevelFastInfosetStreamWriter
if (llfisw.isAssignableFrom(sds))
return sds;
@@ -179,8 +177,7 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
try {
if (FI_STAX_WRITER_CLASS == null)
return null;
- ClassLoader loader = getClassLoader();
- Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.FastInfosetStreamWriterOutput", true, loader);
+ Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.FastInfosetStreamWriterOutput");
return c.getConstructor(FI_STAX_WRITER_CLASS, JAXBContextImpl.class);
} catch (Throwable e) {
return null;
@@ -195,8 +192,7 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
private static Class initStAXExWriterClass() {
try {
- ClassLoader loader = getClassLoader();
- return Class.forName("com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx",true,loader);
+ return Class.forName("com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx");
} catch (Throwable e) {
return null;
}
@@ -204,20 +200,11 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
private static Constructor extends XmlOutput> initStAXExOutputClass() {
try {
- ClassLoader loader = getClassLoader();
- Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.StAXExStreamWriterOutput",true, loader);
+ Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.StAXExStreamWriterOutput");
return c.getConstructor(STAXEX_WRITER_CLASS);
} catch (Throwable e) {
return null;
}
}
- private static ClassLoader getClassLoader() {
- ClassLoader cl = SecureLoader.getClassClassLoader(UnmarshallerImpl.class);
- if (cl == null) {
- cl = SecureLoader.getContextClassLoader();
- }
- return cl;
- }
-
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.properties
index ef094c72f01..8bff1f850bd 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.properties
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -38,3 +38,6 @@ NO_SETTER = \
NO_GETTER = \
The property has a setter "{0}" but no getter. \
For marshaller, please define getters.
+
+INVALID_XML_ENUM_VALUE = \
+ "{0}" is not a valid value for {1}.
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
index 1993cd648a4..3b6af4820a9 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -336,9 +336,8 @@ class StAXStreamConnector extends StAXConnector {
private static Class initFIStAXReaderClass() {
try {
- ClassLoader cl = getClassLoader();
- Class fisr = cl.loadClass("com.sun.xml.internal.org.jvnet.fastinfoset.stax.FastInfosetStreamReader");
- Class sdp = cl.loadClass("com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser");
+ Class> fisr = Class.forName("com.sun.xml.internal.org.jvnet.fastinfoset.stax.FastInfosetStreamReader");
+ Class> sdp = Class.forName("com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser");
// Check if StAXDocumentParser implements FastInfosetStreamReader
if (fisr.isAssignableFrom(sdp))
return sdp;
@@ -354,7 +353,7 @@ class StAXStreamConnector extends StAXConnector {
if (FI_STAX_READER_CLASS == null)
return null;
- Class c = getClassLoader().loadClass(
+ Class c = Class.forName(
"com.sun.xml.internal.bind.v2.runtime.unmarshaller.FastInfosetConnector");
return c.getConstructor(FI_STAX_READER_CLASS,XmlVisitor.class);
} catch (Throwable e) {
@@ -370,7 +369,7 @@ class StAXStreamConnector extends StAXConnector {
private static Class initStAXExReader() {
try {
- return getClassLoader().loadClass("com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx");
+ return Class.forName("com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx");
} catch (Throwable e) {
return null;
}
@@ -378,19 +377,11 @@ class StAXStreamConnector extends StAXConnector {
private static Constructor extends StAXConnector> initStAXExConnector() {
try {
- Class c = getClassLoader().loadClass("com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXExConnector");
+ Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXExConnector");
return c.getConstructor(STAX_EX_READER_CLASS,XmlVisitor.class);
} catch (Throwable e) {
return null;
}
}
- private static ClassLoader getClassLoader() {
- ClassLoader cl = SecureLoader.getClassClassLoader(UnmarshallerImpl.class);
- if (cl == null) {
- cl = SecureLoader.getContextClassLoader();
- }
- return cl;
- }
-
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java
index 76f6802b50d..bc35f38f8da 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java
@@ -62,61 +62,6 @@ public class AttachmentPartImpl extends AttachmentPart {
Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
"com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
- static {
- try {
- CommandMap map = CommandMap.getDefaultCommandMap();
- if (map instanceof MailcapCommandMap) {
- MailcapCommandMap mailMap = (MailcapCommandMap) map;
- String hndlrStr = ";;x-java-content-handler=";
- mailMap.addMailcap(
- "text/xml"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
- mailMap.addMailcap(
- "application/xml"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
- mailMap.addMailcap(
- "application/fastinfoset"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler");
- /* Image DataContentHandler handles all image types
- mailMap.addMailcap(
- "image/jpeg"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.JpegDataContentHandler");
- mailMap.addMailcap(
- "image/gif"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.GifDataContentHandler"); */
- /*mailMap.addMailcap(
- "multipart/*"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");*/
- mailMap.addMailcap(
- "image/*"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.ImageDataContentHandler");
- mailMap.addMailcap(
- "text/plain"
- + hndlrStr
- + "com.sun.xml.internal.messaging.saaj.soap.StringDataContentHandler");
- } else {
- throw new SOAPExceptionImpl("Default CommandMap is not a MailcapCommandMap");
- }
- } catch (Throwable t) {
- log.log(
- Level.SEVERE,
- "SAAJ0508.soap.cannot.register.handlers",
- t);
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- } else {
- throw new RuntimeException(t.getLocalizedMessage());
- }
- }
- };
-
private final MimeHeaders headers;
private MimeBodyPart rawContent = null;
private DataHandler dataHandler = null;
@@ -126,6 +71,12 @@ public class AttachmentPartImpl extends AttachmentPart {
public AttachmentPartImpl() {
headers = new MimeHeaders();
+
+ // initialization from here should cover most of cases;
+ // if not, it would be necessary to call
+ // AttachmentPartImpl.initializeJavaActivationHandlers()
+ // explicitly by programmer
+ initializeJavaActivationHandlers();
}
public AttachmentPartImpl(MIMEPart part) {
@@ -619,4 +570,43 @@ public class AttachmentPartImpl extends AttachmentPart {
return headers;
}
+ public static void initializeJavaActivationHandlers() {
+ // DataHandler.writeTo() may search for DCH. So adding some default ones.
+ try {
+ CommandMap map = CommandMap.getDefaultCommandMap();
+ if (map instanceof MailcapCommandMap) {
+ MailcapCommandMap mailMap = (MailcapCommandMap) map;
+
+ // registering our DCH since javamail's DCH doesn't handle
+ if (!cmdMapInitialized(mailMap)) {
+ mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
+ mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
+ mailMap.addMailcap("application/fastinfoset;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler");
+ mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
+ mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.ImageDataContentHandler");
+ mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.StringDataContentHandler");
+ }
+ }
+ } catch (Throwable t) {
+ // ignore the exception.
+ }
+ }
+
+ private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
+
+ // checking fastinfoset handler, since this one is specific to SAAJ
+ CommandInfo[] commands = mailMap.getAllCommands("application/fastinfoset");
+ if (commands == null || commands.length == 0) {
+ return false;
+ }
+
+ String saajClassName = "com.sun.xml.internal.ws.binding.FastInfosetDataContentHandler";
+ for (CommandInfo command : commands) {
+ String commandClass = command.getCommandClass();
+ if (saajClassName.equals(commandClass)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..280b0d62e25
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.messaging.saaj.soap;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java
index 907c8ef9d91..58d14861e40 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java
@@ -25,7 +25,14 @@
package com.sun.xml.internal.messaging.saaj.soap;
-import java.util.logging.Logger;
+import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
+import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource;
+import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
+import com.sun.xml.internal.messaging.saaj.util.ParserPool;
+import com.sun.xml.internal.messaging.saaj.util.RejectDoctypeSaxFilter;
+import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
import javax.xml.parsers.SAXParser;
import javax.xml.soap.SOAPException;
@@ -39,14 +46,11 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource;
-import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
-import com.sun.xml.internal.messaging.saaj.util.*;
import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer;
+import java.util.logging.Logger;
+
/**
* EnvelopeFactory creates SOAP Envelope objects using different
* underlying implementations.
@@ -54,10 +58,16 @@ import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTran
public class EnvelopeFactory {
protected static final Logger
- log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
- "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
+ log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
+ "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
- private static ParserPool parserPool = new ParserPool(5);
+ private static ContextClassloaderLocal parserPool =
+ new ContextClassloaderLocal() {
+ @Override
+ protected ParserPool initialValue() throws Exception {
+ return new ParserPool(5);
+ }
+ };
public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart)
throws SOAPException
@@ -130,15 +140,15 @@ public class EnvelopeFactory {
SAXParser saxParser = null;
if (src instanceof StreamSource) {
try {
- saxParser = parserPool.get();
+ saxParser = parserPool.get().get();
} catch (Exception e) {
log.severe("SAAJ0601.util.newSAXParser.exception");
throw new SOAPExceptionImpl(
- "Couldn't get a SAX parser while constructing a envelope",
- e);
+ "Couldn't get a SAX parser while constructing a envelope",
+ e);
}
InputSource is = SAXSource.sourceToInputSource(src);
- if (is.getEncoding()== null && soapPart.getSourceCharsetEncoding() != null) {
+ if (is.getEncoding() == null && soapPart.getSourceCharsetEncoding() != null) {
is.setEncoding(soapPart.getSourceCharsetEncoding());
}
XMLReader rejectFilter;
@@ -147,15 +157,15 @@ public class EnvelopeFactory {
} catch (Exception ex) {
log.severe("SAAJ0510.soap.cannot.create.envelope");
throw new SOAPExceptionImpl(
- "Unable to create envelope from given source: ",
- ex);
+ "Unable to create envelope from given source: ",
+ ex);
}
src = new SAXSource(rejectFilter, is);
}
try {
Transformer transformer =
- EfficientStreamingTransformer.newTransformer();
+ EfficientStreamingTransformer.newTransformer();
DOMResult result = new DOMResult(soapPart);
transformer.transform(src, result);
@@ -167,11 +177,11 @@ public class EnvelopeFactory {
}
log.severe("SAAJ0511.soap.cannot.create.envelope");
throw new SOAPExceptionImpl(
- "Unable to create envelope from given source: ",
- ex);
+ "Unable to create envelope from given source: ",
+ ex);
} finally {
if (saxParser != null) {
- parserPool.returnParser(saxParser);
+ parserPool.get().returnParser(saxParser);
}
}
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java
index cf014b15623..3d56ae39f03 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -25,11 +25,12 @@
package com.sun.xml.internal.messaging.saaj.soap;
+import com.sun.xml.internal.messaging.saaj.util.stax.SaajStaxWriter;
+
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxReaderEx.java
similarity index 93%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java
rename to jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxReaderEx.java
index 75afe2b1351..bc8a984bd01 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxReaderEx.java
@@ -23,21 +23,19 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.staxex.util;
-
-import java.util.Iterator;
-
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.stream.XMLStreamException;
+package com.sun.xml.internal.messaging.saaj.util.stax;
import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
-
+import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
+import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
+import javax.xml.soap.SOAPElement;
+import javax.xml.stream.XMLStreamException;
+import java.util.Iterator;
+
/**
* SaajStaxReaderEx
*
@@ -63,12 +61,8 @@ public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReader
if (_current instanceof BinaryText) {
binaryText = (BinaryText) _current;
base64AttData = new Base64Data();
- try {
- base64AttData.set(binaryText.getDataHandler());
+ base64AttData.set(binaryText.getDataHandler());
//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
- }
} else {
// if we are currently at text node, make sure that this is a meaningful text node.
Node prev = _current.getPreviousSibling();
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java
similarity index 91%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java
rename to jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java
index 8020bea1de4..7deaf4417a4 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.staxex.util;
+package com.sun.xml.internal.messaging.saaj.util.stax;
import java.util.Arrays;
import java.util.Iterator;
@@ -55,6 +55,8 @@ public class SaajStaxWriter implements XMLStreamWriter {
static final protected String Body = "Body";
static final protected String xmlns = "xmlns";
+ private boolean isHeaderSeen = false;
+
public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
soap = msg;
this.envURI = uri;
@@ -91,6 +93,7 @@ public class SaajStaxWriter implements XMLStreamWriter {
fixPrefix(prefix);
return;
} else if (Header.equals(ln)) {
+ isHeaderSeen = true;
currentElement = soap.getSOAPHeader();
fixPrefix(prefix);
return;
@@ -109,9 +112,13 @@ public class SaajStaxWriter implements XMLStreamWriter {
}
private void fixPrefix(final String prfx) throws XMLStreamException {
- String oldPrfx = currentElement.getPrefix();
+ fixPrefix(prfx, currentElement);
+ }
+
+ private void fixPrefix(final String prfx, SOAPElement element) throws XMLStreamException {
+ String oldPrfx = element.getPrefix();
if (prfx != null && !prfx.equals(oldPrfx)) {
- currentElement.setPrefix(prfx);
+ element.setPrefix(prfx);
}
}
@@ -137,6 +144,21 @@ public class SaajStaxWriter implements XMLStreamWriter {
@Override
public void writeEndDocument() throws XMLStreamException {
+ try {
+ if (!isHeaderSeen) {
+ SOAPElement header = soap.getSOAPHeader();
+ if (header != null) {
+ String prefixAtHeader = header.getPrefix();
+ SOAPElement env = getEnvelope();
+ header.detachNode();
+ if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
+ env.removeNamespaceDeclaration(prefixAtHeader);
+ }
+ }
+ }
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
}
@Override
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java
similarity index 97%
rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java
rename to jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java
index e8b22cf46bd..3295b389207 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -23,7 +23,7 @@
* questions.
*/
-package com.sun.xml.internal.org.jvnet.staxex.util;
+package com.sun.xml.internal.messaging.saaj.util.stax;
import java.io.OutputStream;
import java.util.Arrays;
@@ -42,6 +42,7 @@ import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled;
import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx;
import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler;
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
+import com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter;
//
//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter;
//import com.sun.xml.internal.ws.developer.StreamingDataHandler;
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java
index d3f5e887b34..24310b0244f 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,15 +26,13 @@
package com.sun.xml.internal.org.jvnet.staxex;
import javax.activation.DataHandler;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.Text;
/**
* BinaryText represents a MTOM attachment.
*
* @author shih-chang.chen@oracle.com
*/
-public interface BinaryText extends Text {
+public interface BinaryText {
public String getHref();
- public DataHandler getDataHandler() throws SOAPException;
+ public DataHandler getDataHandler();
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java
index ff1b1f8713c..02293e31c9b 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,7 +26,6 @@
package com.sun.xml.internal.org.jvnet.staxex;
import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
@@ -46,7 +45,6 @@ public interface StAxSOAPBody {
/**
* Retrieve payload qname without materializing its contents
* @return
- * @throws SOAPException
*/
public QName getPayloadQName();
@@ -58,7 +56,7 @@ public interface StAxSOAPBody {
* Retrieve payload attribute value without materializing its contents
* @param localName
* @return
- * @throws SOAPException
+ * @throws XMLStreamException
*/
public String getPayloadAttributeValue(String localName) throws XMLStreamException;
@@ -66,16 +64,16 @@ public interface StAxSOAPBody {
* Retrieve payload attribute value without materializing its contents
* @param qName
* @return
- * @throws SOAPException
+ * @throws XMLStreamException
*/
public String getPayloadAttributeValue(QName qName) throws XMLStreamException;
- public void materialize() throws SOAPException;
+ public void materialize() throws XMLStreamException;
}
- public void setPayload(Payload src) throws SOAPException;
+ public void setPayload(Payload src) throws XMLStreamException;
- public Payload getPayload()throws SOAPException;
+ public Payload getPayload()throws XMLStreamException;
public boolean hasStaxPayload();
}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..fe4a2fe1d5a
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.stream.buffer;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/XMLStreamBuffer.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/XMLStreamBuffer.java
index c6c68344ce3..85166778d73 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/XMLStreamBuffer.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/XMLStreamBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -370,7 +370,12 @@ public abstract class XMLStreamBuffer {
writeTo(handler, errorHandler, isFragment());
}
- private static final TransformerFactory trnsformerFactory = TransformerFactory.newInstance();
+ private static final ContextClassloaderLocal trnsformerFactory = new ContextClassloaderLocal() {
+ @Override
+ protected TransformerFactory initialValue() throws Exception {
+ return TransformerFactory.newInstance();
+ }
+ };
/**
* Writes out the contents of this buffer as DOM node and append that to the given node.
@@ -382,7 +387,7 @@ public abstract class XMLStreamBuffer {
*/
public final Node writeTo(Node n) throws XMLStreamBufferException {
try {
- Transformer t = trnsformerFactory.newTransformer();
+ Transformer t = trnsformerFactory.get().newTransformer();
t.transform(new XMLStreamBufferSource(this), new DOMResult(n));
return n.getLastChild();
} catch (TransformerException e) {
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java
index 7bbbc064e61..2645087f932 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java
@@ -36,7 +36,6 @@ import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException;
import org.xml.sax.SAXException;
-import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
import com.sun.xml.internal.ws.api.SOAPVersion;
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
index 5786a0a2831..886d4d22822 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -42,8 +42,6 @@ import org.w3c.dom.Node;
/**
* SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
*
- * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter
- *
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxWriter implements XMLStreamWriter {
@@ -57,16 +55,21 @@ public class SaajStaxWriter implements XMLStreamWriter {
static final protected String Body = "Body";
static final protected String xmlns = "xmlns";
- public SaajStaxWriter(final SOAPMessage msg) throws SOAPException {
+ private boolean isHeaderSeen = false;
+
+ public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
soap = msg;
- currentElement = soap.getSOAPPart().getEnvelope();
- envURI = currentElement.getNamespaceURI();
+ this.envURI = uri;
}
public SOAPMessage getSOAPMessage() {
return soap;
}
+ protected SOAPElement getEnvelope() throws SOAPException {
+ return soap.getSOAPPart().getEnvelope();
+ }
+
@Override
public void writeStartElement(final String localName) throws XMLStreamException {
try {
@@ -86,10 +89,11 @@ public class SaajStaxWriter implements XMLStreamWriter {
try {
if (envURI.equals(ns)) {
if (Envelope.equals(ln)) {
- currentElement = soap.getSOAPPart().getEnvelope();
+ currentElement = getEnvelope();
fixPrefix(prefix);
return;
} else if (Header.equals(ln)) {
+ isHeaderSeen = true;
currentElement = soap.getSOAPHeader();
fixPrefix(prefix);
return;
@@ -108,9 +112,13 @@ public class SaajStaxWriter implements XMLStreamWriter {
}
private void fixPrefix(final String prfx) throws XMLStreamException {
- String oldPrfx = currentElement.getPrefix();
+ fixPrefix(prfx, currentElement);
+ }
+
+ private void fixPrefix(final String prfx, SOAPElement element) throws XMLStreamException {
+ String oldPrfx = element.getPrefix();
if (prfx != null && !prfx.equals(oldPrfx)) {
- currentElement.setPrefix(prfx);
+ element.setPrefix(prfx);
}
}
@@ -136,6 +144,21 @@ public class SaajStaxWriter implements XMLStreamWriter {
@Override
public void writeEndDocument() throws XMLStreamException {
+ try {
+ if (!isHeaderSeen) {
+ SOAPElement header = soap.getSOAPHeader();
+ if (header != null) {
+ String prefixAtHeader = header.getPrefix();
+ SOAPElement env = getEnvelope();
+ header.detachNode();
+ if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
+ env.removeNamespaceDeclaration(prefixAtHeader);
+ }
+ }
+ }
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
}
@Override
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..d62cb623a86
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.api.streaming;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
index db6cbc625e7..40a51184c89 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,39 +63,43 @@ public abstract class XMLStreamReaderFactory {
private static final Logger LOGGER = Logger.getLogger(XMLStreamReaderFactory.class.getName());
+ private static final String CLASS_NAME_OF_WSTXINPUTFACTORY = "com.ctc.wstx.stax.WstxInputFactory";
+
/**
* Singleton instance.
*/
- private static volatile @NotNull XMLStreamReaderFactory theInstance;
+ private static volatile ContextClassloaderLocal streamReader =
+ new ContextClassloaderLocal() {
- private static final String CLASS_NAME_OF_WSTXINPUTFACTORY = "com.ctc.wstx.stax.WstxInputFactory";
+ @Override
+ protected XMLStreamReaderFactory initialValue() {
- static {
- XMLInputFactory xif = getXMLInputFactory();
- XMLStreamReaderFactory f=null;
+ XMLInputFactory xif = getXMLInputFactory();
+ XMLStreamReaderFactory f=null;
- // this system property can be used to disable the pooling altogether,
- // in case someone hits an issue with pooling in the production system.
- if(!getProperty(XMLStreamReaderFactory.class.getName()+".noPool")) {
- f = Zephyr.newInstance(xif);
- }
+ // this system property can be used to disable the pooling altogether,
+ // in case someone hits an issue with pooling in the production system.
+ if(!getProperty(XMLStreamReaderFactory.class.getName()+".noPool")) {
+ f = Zephyr.newInstance(xif);
+ }
- if(f==null) {
- // is this Woodstox?
- if (xif.getClass().getName().equals(CLASS_NAME_OF_WSTXINPUTFACTORY)) {
- f = new Woodstox(xif);
- }
- }
+ if(f==null) {
+ // is this Woodstox?
+ if (xif.getClass().getName().equals(CLASS_NAME_OF_WSTXINPUTFACTORY)) {
+ f = new Woodstox(xif);
+ }
+ }
- if (f==null) {
- f = new Default();
- }
+ if (f==null) {
+ f = new Default();
+ }
- theInstance = f;
- if (LOGGER.isLoggable(Level.FINE)) {
- LOGGER.log(Level.FINE, "XMLStreamReaderFactory instance is = {0}", theInstance);
- }
- }
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "XMLStreamReaderFactory instance is = {0}", f);
+ }
+ return f;
+ }
+ };
private static XMLInputFactory getXMLInputFactory() {
XMLInputFactory xif = null;
@@ -126,11 +130,11 @@ public abstract class XMLStreamReaderFactory {
if(f==null) {
throw new IllegalArgumentException();
}
- theInstance = f;
+ streamReader.set(f);
}
public static XMLStreamReaderFactory get() {
- return theInstance;
+ return streamReader.get();
}
public static XMLStreamReader create(InputSource source, boolean rejectDTDs) {
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
index 51f5da941b9..6cff489ba7b 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -62,52 +62,54 @@ public abstract class XMLStreamWriterFactory {
/**
* Singleton instance.
*/
- private static volatile @NotNull XMLStreamWriterFactory theInstance;
+ private static volatile ContextClassloaderLocal writerFactory =
+ new ContextClassloaderLocal() {
-
- static {
- XMLOutputFactory xof = null;
- if (Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".woodstox")) {
- try {
- xof = (XMLOutputFactory)Class.forName("com.ctc.wstx.stax.WstxOutputFactory").newInstance();
- } catch (Exception e) {
- // Ignore and fallback to default XMLOutputFactory
- }
- }
- if (xof == null) {
- xof = XMLOutputFactory.newInstance();
- }
-
- XMLStreamWriterFactory f=null;
-
- // this system property can be used to disable the pooling altogether,
- // in case someone hits an issue with pooling in the production system.
- if (!Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".noPool")) {
- try {
- Class> clazz = xof.createXMLStreamWriter(new StringWriter()).getClass();
- if (clazz.getName().startsWith("com.sun.xml.internal.stream.")) {
- f = new Zephyr(xof,clazz);
+ @Override
+ protected XMLStreamWriterFactory initialValue() {
+ XMLOutputFactory xof = null;
+ if (Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".woodstox")) {
+ try {
+ xof = (XMLOutputFactory)Class.forName("com.ctc.wstx.stax.WstxOutputFactory").newInstance();
+ } catch (Exception e) {
+ // Ignore and fallback to default XMLOutputFactory
}
- } catch (XMLStreamException ex) {
- Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
- } catch (NoSuchMethodException ex) {
- Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
}
- }
+ if (xof == null) {
+ xof = XMLOutputFactory.newInstance();
+ }
- if(f==null) {
- // is this Woodstox?
- if(xof.getClass().getName().equals("com.ctc.wstx.stax.WstxOutputFactory"))
- f = new NoLock(xof);
- }
- if (f == null)
- f = new Default(xof);
+ XMLStreamWriterFactory f=null;
- theInstance = f;
- if (LOGGER.isLoggable(Level.FINE)) {
- LOGGER.log(Level.FINE, "XMLStreamWriterFactory instance is = {0}", f);
+ // this system property can be used to disable the pooling altogether,
+ // in case someone hits an issue with pooling in the production system.
+ if (!Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".noPool")) {
+ try {
+ Class> clazz = xof.createXMLStreamWriter(new StringWriter()).getClass();
+ if (clazz.getName().startsWith("com.sun.xml.internal.stream.")) {
+ f = new Zephyr(xof,clazz);
+ }
+ } catch (XMLStreamException ex) {
+ Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
+ } catch (NoSuchMethodException ex) {
+ Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
+ }
+ }
+
+ if(f==null) {
+ // is this Woodstox?
+ if(xof.getClass().getName().equals("com.ctc.wstx.stax.WstxOutputFactory"))
+ f = new NoLock(xof);
+ }
+ if (f == null)
+ f = new Default(xof);
+
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "XMLStreamWriterFactory instance is = {0}", f);
+ }
+ return f;
}
- }
+ };
/**
* See {@link #create(OutputStream)} for the contract.
@@ -170,7 +172,7 @@ public abstract class XMLStreamWriterFactory {
* Gets the singleton instance.
*/
public static @NotNull XMLStreamWriterFactory get() {
- return theInstance;
+ return writerFactory.get();
}
/**
@@ -183,7 +185,7 @@ public abstract class XMLStreamWriterFactory {
@SuppressWarnings({"null", "ConstantConditions"})
public static void set(@NotNull XMLStreamWriterFactory f) {
if(f==null) throw new IllegalArgumentException();
- theInstance = f;
+ writerFactory.set(f);
}
/**
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/BindingImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/BindingImpl.java
index 7e2c908216d..927fad4d4b0 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/BindingImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/BindingImpl.java
@@ -37,6 +37,9 @@ import com.sun.xml.internal.ws.client.HandlerConfiguration;
import com.sun.xml.internal.ws.developer.MemberSubmissionAddressingFeature;
import com.sun.xml.internal.ws.developer.BindingTypeFeature;
+import javax.activation.CommandInfo;
+import javax.activation.CommandMap;
+import javax.activation.MailcapCommandMap;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceFeature;
@@ -151,12 +154,61 @@ public abstract class BindingImpl implements WSBinding {
return addressingVersion;
}
- public final
@NotNull
- Codec createCodec() {
+ public final Codec createCodec() {
+
+ // initialization from here should cover most of cases;
+ // if not, it would be necessary to call
+ // BindingImpl.initializeJavaActivationHandlers()
+ // explicitly by programmer
+ initializeJavaActivationHandlers();
+
return bindingId.createEncoder(this);
}
+ public static void initializeJavaActivationHandlers() {
+ // DataHandler.writeTo() may search for DCH. So adding some default ones.
+ try {
+ CommandMap map = CommandMap.getDefaultCommandMap();
+ if (map instanceof MailcapCommandMap) {
+ MailcapCommandMap mailMap = (MailcapCommandMap) map;
+
+ // registering our DCH since javamail's DCH doesn't handle
+ if (!cmdMapInitialized(mailMap)) {
+ mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
+ mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
+ mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
+ mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
+ }
+ }
+ } catch (Throwable t) {
+ // ignore the exception.
+ }
+ }
+
+ private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
+ CommandInfo[] commands = mailMap.getAllCommands("text/xml");
+ if (commands == null || commands.length == 0) {
+ return false;
+ }
+
+ // SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
+ // see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
+ // so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
+ // is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
+ // This is also reason for duplication of Handler's code by JAX-WS
+ String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
+ String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
+ for (CommandInfo command : commands) {
+ String commandClass = command.getCommandClass();
+ if (saajClassName.equals(commandClass) ||
+ jaxwsClassName.equals(commandClass)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static BindingImpl create(@NotNull BindingID bindingId) {
if (bindingId.equals(BindingID.XML_HTTP))
return new HTTPBindingImpl();
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..63809b00875
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.commons.xmlutil;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/Converter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/Converter.java
index 31d1d713443..375844200e2 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/Converter.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/commons/xmlutil/Converter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -53,7 +53,12 @@ public final class Converter {
// prevents instantiation
}
private static final Logger LOGGER = Logger.getLogger(Converter.class);
- private static final XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
+ private static final ContextClassloaderLocal xmlOutputFactory = new ContextClassloaderLocal() {
+ @Override
+ protected XMLOutputFactory initialValue() throws Exception {
+ return XMLOutputFactory.newInstance();
+ }
+ };
private static final AtomicBoolean logMissingStaxUtilsWarning = new AtomicBoolean(false);
/**
@@ -110,7 +115,7 @@ public final class Converter {
stringOut = new StringWriter();
XMLStreamWriter writer = null;
try {
- writer = xmlOutputFactory.createXMLStreamWriter(stringOut);
+ writer = xmlOutputFactory.get().createXMLStreamWriter(stringOut);
if (createIndenter) {
writer = createIndenter(writer);
}
@@ -143,7 +148,7 @@ public final class Converter {
try {
if (message != null) {
- XMLStreamWriter xsw = xmlOutputFactory.createXMLStreamWriter(baos, encoding);
+ XMLStreamWriter xsw = xmlOutputFactory.get().createXMLStreamWriter(baos, encoding);
try {
message.writeTo(xsw);
} finally {
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..e7d0050e775
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.developer;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/MemberSubmissionEndpointReference.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/MemberSubmissionEndpointReference.java
index e5a96231ba1..ee70a409528 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/MemberSubmissionEndpointReference.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/developer/MemberSubmissionEndpointReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -64,7 +64,12 @@ import java.util.Map;
@XmlType(name = "EndpointReferenceType", namespace = MemberSubmissionEndpointReference.MSNS)
public final class MemberSubmissionEndpointReference extends EndpointReference implements MemberSubmissionAddressingConstants {
- private final static JAXBContext msjc = MemberSubmissionEndpointReference.getMSJaxbContext();
+ private final static ContextClassloaderLocal msjc = new ContextClassloaderLocal() {
+ @Override
+ protected JAXBContext initialValue() throws Exception {
+ return MemberSubmissionEndpointReference.getMSJaxbContext();
+ }
+ };
public MemberSubmissionEndpointReference() {
}
@@ -86,7 +91,7 @@ public final class MemberSubmissionEndpointReference extends EndpointReference i
}
try {
- Unmarshaller unmarshaller = MemberSubmissionEndpointReference.msjc.createUnmarshaller();
+ Unmarshaller unmarshaller = MemberSubmissionEndpointReference.msjc.get().createUnmarshaller();
MemberSubmissionEndpointReference epr = unmarshaller.unmarshal(source,MemberSubmissionEndpointReference.class).getValue();
this.addr = epr.addr;
@@ -106,7 +111,7 @@ public final class MemberSubmissionEndpointReference extends EndpointReference i
@Override
public void writeTo(Result result) {
try {
- Marshaller marshaller = MemberSubmissionEndpointReference.msjc.createMarshaller();
+ Marshaller marshaller = MemberSubmissionEndpointReference.msjc.get().createMarshaller();
//marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
marshaller.marshal(this, result);
} catch (JAXBException e) {
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java
index fb8e5f2a5a6..fb25118fd2c 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/encoding/MimeCodec.java
@@ -34,8 +34,6 @@ import com.sun.xml.internal.ws.api.message.Packet;
import com.sun.xml.internal.ws.api.pipe.Codec;
import com.sun.xml.internal.ws.api.pipe.ContentType;
import com.sun.xml.internal.ws.developer.StreamingAttachmentFeature;
-import javax.activation.CommandMap;
-import javax.activation.MailcapCommandMap;
import java.io.IOException;
import java.io.InputStream;
@@ -63,33 +61,6 @@ import java.util.UUID;
*/
abstract class MimeCodec implements Codec {
- static {
- // DataHandler.writeTo() may search for DCH. So adding some default ones.
- try {
- CommandMap map = CommandMap.getDefaultCommandMap();
- if (map instanceof MailcapCommandMap) {
- MailcapCommandMap mailMap = (MailcapCommandMap) map;
- String hndlrStr = ";;x-java-content-handler=";
- // registering our DCH since javamail's DCH doesn't handle
- // Source
- mailMap.addMailcap(
- "text/xml" + hndlrStr + XmlDataContentHandler.class.getName());
- mailMap.addMailcap(
- "application/xml" + hndlrStr + XmlDataContentHandler.class.getName());
- if (map.createDataContentHandler("image/*") == null) {
- mailMap.addMailcap(
- "image/*" + hndlrStr + ImageDataContentHandler.class.getName());
- }
- if (map.createDataContentHandler("text/plain") == null) {
- mailMap.addMailcap(
- "text/plain" + hndlrStr + StringDataContentHandler.class.getName());
- }
- }
- } catch (Throwable t) {
- // ignore the exception.
- }
- }
-
public static final String MULTIPART_RELATED_MIME_TYPE = "multipart/related";
protected Codec mimeRootCodec;
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..f77560163cb
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.policy.sourcemodel.attach;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public ClassLoader run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..dda20375382
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ContextClassloaderLocal.properties
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+# Error messages for ContextClassloaderLocal utility class
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ExternalAttachmentsUnmarshaller.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ExternalAttachmentsUnmarshaller.java
index f1664c33dc9..aaed1d8f8bd 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ExternalAttachmentsUnmarshaller.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/sourcemodel/attach/ExternalAttachmentsUnmarshaller.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -83,7 +83,13 @@ public class ExternalAttachmentsUnmarshaller {
private static final QName POLICY = new QName("http://www.w3.org/ns/ws-policy", "Policy");
private static final QName URI = new QName("http://www.w3.org/ns/ws-policy", "URI");
private static final QName POLICIES = new QName(PolicyConstants.SUN_MANAGEMENT_NAMESPACE, "Policies");
- private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
+ private static final ContextClassloaderLocal XML_INPUT_FACTORY = new ContextClassloaderLocal() {
+ @Override
+ protected XMLInputFactory initialValue() throws Exception {
+ return XMLInputFactory.newInstance();
+ }
+ };
+
private static final PolicyModelUnmarshaller POLICY_UNMARSHALLER = PolicyModelUnmarshaller.getXmlUnmarshaller();
private final Map map = new HashMap();
@@ -93,7 +99,7 @@ public class ExternalAttachmentsUnmarshaller {
public static Map unmarshal(final Reader source) throws PolicyException {
LOGGER.entering(source);
try {
- XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(source);
+ XMLEventReader reader = XML_INPUT_FACTORY.get().createXMLEventReader(source);
ExternalAttachmentsUnmarshaller instance = new ExternalAttachmentsUnmarshaller();
final Map map = instance.unmarshal(reader, null);
LOGGER.exiting(map);
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..cf0bf26eec3
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.spi;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java
index 05b7a2f080a..30f5a7d8042 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -80,7 +80,12 @@ import java.util.Map;
*/
public class ProviderImpl extends Provider {
- private final static JAXBContext eprjc = getEPRJaxbContext();
+ private final static ContextClassloaderLocal eprjc = new ContextClassloaderLocal() {
+ @Override
+ protected JAXBContext initialValue() throws Exception {
+ return getEPRJaxbContext();
+ }
+ };
/**
* Convenient singleton instance.
@@ -148,7 +153,7 @@ public class ProviderImpl extends Provider {
return AccessController.doPrivileged(new PrivilegedAction() {
public EndpointReference run() {
try {
- Unmarshaller unmarshaller = eprjc.createUnmarshaller();
+ Unmarshaller unmarshaller = eprjc.get().createUnmarshaller();
return (EndpointReference) unmarshaller.unmarshal(eprInfoset);
} catch (JAXBException e) {
throw new WebServiceException("Error creating Marshaller or marshalling.", e);
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..93a44b68050
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.ws.util.xml;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
index f6b63d48823..cd87c3b0e2e 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -215,20 +215,28 @@ public class XmlUtil {
}
}
- static final TransformerFactory transformerFactory = newTransformerFactory();
+ static final ContextClassloaderLocal transformerFactory = new ContextClassloaderLocal() {
+ @Override
+ protected TransformerFactory initialValue() throws Exception {
+ return TransformerFactory.newInstance();
+ }
+ };
- static final SAXParserFactory saxParserFactory = newSAXParserFactory(true);
-
- static {
- saxParserFactory.setNamespaceAware(true);
- }
+ static final ContextClassloaderLocal saxParserFactory = new ContextClassloaderLocal() {
+ @Override
+ protected SAXParserFactory initialValue() throws Exception {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(true);
+ return factory;
+ }
+ };
/**
* Creates a new identity transformer.
*/
public static Transformer newTransformer() {
try {
- return transformerFactory.newTransformer();
+ return transformerFactory.get().newTransformer();
} catch (TransformerConfigurationException tex) {
throw new IllegalStateException("Unable to create a JAXP transformer");
}
@@ -243,9 +251,9 @@ public class XmlUtil {
// work around a bug in JAXP in JDK6u4 and earlier where the namespace processing
// is not turned on by default
StreamSource ssrc = (StreamSource) src;
- TransformerHandler th = ((SAXTransformerFactory) transformerFactory).newTransformerHandler();
+ TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler();
th.setResult(result);
- XMLReader reader = saxParserFactory.newSAXParser().getXMLReader();
+ XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader();
reader.setContentHandler(th);
reader.setProperty(LEXICAL_HANDLER_PROPERTY, th);
reader.parse(toInputSource(ssrc));
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.java
new file mode 100644
index 00000000000..b8b09bf36c1
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.sun.xml.internal.xsom.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+/**
+ * Simple utility ensuring that the value is cached only in case it is non-internal implementation
+ */
+abstract class ContextClassloaderLocal {
+
+ private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
+
+ private WeakHashMap CACHE = new WeakHashMap();
+
+ public V get() throws Error {
+ ClassLoader tccl = getContextClassLoader();
+ V instance = CACHE.get(tccl);
+ if (instance == null) {
+ instance = createNewInstance();
+ CACHE.put(tccl, instance);
+ }
+ return instance;
+ }
+
+ public void set(V instance) {
+ CACHE.put(getContextClassLoader(), instance);
+ }
+
+ protected abstract V initialValue() throws Exception;
+
+ private V createNewInstance() {
+ try {
+ return initialValue();
+ } catch (Exception e) {
+ throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
+ }
+ }
+
+ private static String format(String property, Object... args) {
+ String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
+ return MessageFormat.format(text, args);
+ }
+
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
+}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.properties b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.properties
new file mode 100644
index 00000000000..c0267b823ea
--- /dev/null
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/ContextClassloaderLocal.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+#
+
+FAILED_TO_CREATE_NEW_INSTANCE=Failed to create new instance of {0}
diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/DomAnnotationParserFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/DomAnnotationParserFactory.java
index 23a78672aaf..ed2a05226e7 100644
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/DomAnnotationParserFactory.java
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/xsom/util/DomAnnotationParserFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,10 +63,15 @@ public class DomAnnotationParserFactory implements AnnotationParserFactory {
}
public AnnotationParser create(boolean disableSecureProcessing) {
- return new AnnotationParserImpl();
+ return new AnnotationParserImpl(disableSecureProcessing);
}
- private static final SAXTransformerFactory stf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ private static final ContextClassloaderLocal stf = new ContextClassloaderLocal() {
+ @Override
+ protected SAXTransformerFactory initialValue() throws Exception {
+ return (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ }
+ };
private static class AnnotationParserImpl extends AnnotationParser {
@@ -82,8 +87,9 @@ public class DomAnnotationParserFactory implements AnnotationParserFactory {
AnnotationParserImpl(boolean disableSecureProcessing) {
try {
- transformer = stf.newTransformerHandler();
- stf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing);
+ SAXTransformerFactory factory = stf.get();
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing);
+ transformer = factory.newTransformerHandler();
} catch (TransformerConfigurationException e) {
throw new Error(e); // impossible
}
diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java
index 44e103469a5..a1bc3e2b9c2 100644
--- a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java
+++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -69,7 +69,7 @@ import java.util.Map;
@XmlType(name="EndpointReferenceType",namespace=W3CEndpointReference.NS)
public final class W3CEndpointReference extends EndpointReference {
- private final static JAXBContext w3cjc = getW3CJaxbContext();
+ private final JAXBContext w3cjc = getW3CJaxbContext();
// should be changed to package private, keeping original modifier to keep backwards compatibility
protected static final String NS = "http://www.w3.org/2005/08/addressing";
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 118a09481e8..b513393c195 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -250,3 +250,7 @@ d31cd980e1da31fa496a359caaf1a165aeb5791a jdk8-b120
263198a1d8f1f4cb97d35f40c61704b08ebd3686 jdk9-b05
cac7b28b8b1e0e11d7a8e1ac1fe75a03b3749eab jdk9-b06
f4e624447514f12dd7c51f1e5b0cb97efcd15be2 jdk9-b07
+9e7bd44ea85c72318130379c34b98716b9c7c248 jdk9-b08
+2cef452ba711b17950da275fd15931925799f07c jdk9-b09
+ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
+47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index 3b1839102a7..6f80d632c49 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -176,7 +176,6 @@ $(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*))
$(eval $(call SetupDemo,JTop,management,,JTop,,,README*))
$(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*))
$(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*))
-$(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n))
ifndef OPENJDK
$(eval $(call SetupDemo,Laffy,jfc,,,,closed/,*))
diff --git a/jdk/make/CompileJavaClasses.gmk b/jdk/make/CompileJavaClasses.gmk
index ec003f58c20..aed9bec516c 100644
--- a/jdk/make/CompileJavaClasses.gmk
+++ b/jdk/make/CompileJavaClasses.gmk
@@ -326,7 +326,7 @@ JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
ifeq ($(ENABLE_SJAVAC),yes)
# With sjavac enabled, excluded sources are not even considered for linking.
# Explicitly add the security sources to sourcepath for linking.
- BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
+ BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%/*,$(SECURITY_PKGS)) \
-sourcepath $(JDK_TOPDIR)/src/share/classes
endif
diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk
index 9fba2dd04cc..5566d4628d4 100644
--- a/jdk/make/CopyFiles.gmk
+++ b/jdk/make/CopyFiles.gmk
@@ -158,15 +158,6 @@ COPY_FILES += $(CURSORS_TARGET_FILES)
##########################################################################################
-CONTENT_TYPES_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
-
-$(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties
- $(call install-file)
-
-COPY_FILES += $(LIBDIR)/content-types.properties
-
-##########################################################################################
-
CALENDARS_SRC := $(JDK_TOPDIR)/src/share/lib
$(LIBDIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties
@@ -183,9 +174,9 @@ COPY_FILES += $(LIBDIR)/hijrah-config-umalqura.properties
##########################################################################################
-ifeq ($(OPENJDK_TARGET_OS), windows)
+ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
- TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
+ TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/lib
$(LIBDIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
$(call install-file)
diff --git a/jdk/make/CopyIntoClasses.gmk b/jdk/make/CopyIntoClasses.gmk
index 6c622e12177..36b0919fa2f 100644
--- a/jdk/make/CopyIntoClasses.gmk
+++ b/jdk/make/CopyIntoClasses.gmk
@@ -26,7 +26,7 @@
# Copy icu and _dict files used by the text break iterator
COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
- .png .gif .xml .dtd .txt oqlhelp.html
+ .png .gif .xml .dtd .txt oqlhelp.html content-types.properties
# These directories should not be copied at all
EXCLUDES += \
diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk
index 91145fdb4b7..eebdcf666f0 100644
--- a/jdk/make/CreateJars.gmk
+++ b/jdk/make/CreateJars.gmk
@@ -160,11 +160,13 @@ RT_JAR_EXCLUDES += \
javax/swing/JWindowBeanInfo.class \
javax/swing/SwingBeanInfoBase.class \
javax/swing/text/JTextComponentBeanInfo.class \
+ jdk/nio/zipfs \
META-INF/services/com.sun.jdi.connect.Connector \
META-INF/services/com.sun.jdi.connect.spi.TransportService \
META-INF/services/com.sun.tools.attach.spi.AttachProvider \
META-INF/services/com.sun.tools.xjc.Plugin \
META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
+ META-INF/services/java.nio.file.spi.FileSystemProvider \
org/relaxng/datatype \
sun/awt/HKSCS.class \
sun/awt/motif/X11GB2312.class \
@@ -356,6 +358,16 @@ $(eval $(call SetupArchive,BUILD_CHARSETS_JAR, , \
##########################################################################################
+$(eval $(call SetupArchive,BUILD_ZIPFS_JAR, , \
+ SRCS := $(JDK_OUTPUTDIR)/classes, \
+ INCLUDES := jdk/nio/zipfs, \
+ EXTRA_FILES := META-INF/services/java.nio.file.spi.FileSystemProvider, \
+ JAR := $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar, \
+ SKIP_METAINF := true, \
+ CHECK_COMPRESS_JAR := true))
+
+##########################################################################################
+
ifndef OPENJDK
ifeq ($(ENABLE_JFR), true)
$(eval $(call SetupArchive,BUILD_JFR_JAR, , \
@@ -660,11 +672,6 @@ $(IMAGES_OUTPUTDIR)/lib/management-agent.jar: $(JDK_TOPDIR)/src/share/classes/su
##########################################################################################
-$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar: $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
- $(install-file)
-
-##########################################################################################
-
# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
# all jars can be found in one place when creating images in Images.gmk. It needs to be
# done here so that clean targets can be simple and accurate.
diff --git a/jdk/make/data/jdwp/jdwp.spec b/jdk/make/data/jdwp/jdwp.spec
index 7ddbaf4912b..8d05bebcc02 100644
--- a/jdk/make/data/jdwp/jdwp.spec
+++ b/jdk/make/data/jdwp/jdwp.spec
@@ -1079,7 +1079,7 @@ JDWP "Java(tm) Debug Wire Protocol"
(Command InvokeMethod=3
"Invokes a static method. "
"The method must be member of the class type "
- "or one of its superclasses, superinterfaces, or implemented interfaces. "
+ "or one of its superclasses. "
"Access control is not enforced; for example, private "
"methods can be invoked."
""
@@ -1147,7 +1147,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(ErrorSet
(Error INVALID_CLASS "clazz is not the ID of a class.")
(Error INVALID_OBJECT "clazz is not a known ID.")
- (Error INVALID_METHODID "methodID is not the ID of a method.")
+ (Error INVALID_METHODID "methodID is not the ID of a static method in "
+ "this class type or one of its superclasses.")
(Error INVALID_THREAD)
(Error THREAD_NOT_SUSPENDED)
(Error VM_DEAD)
@@ -1250,6 +1251,83 @@ JDWP "Java(tm) Debug Wire Protocol"
)
)
(CommandSet InterfaceType=5
+ (Command InvokeMethod=1
+ "Invokes a static method. "
+ "The method must not be a static initializer. "
+ "The method must be a member of the interface type. "
+ "
Since JDWP version 1.8 "
+ "
"
+ "The method invocation will occur in the specified thread. "
+ "Method invocation can occur only if the specified thread "
+ "has been suspended by an event. "
+ "Method invocation is not supported "
+ "when the target VM has been suspended by the front-end. "
+ "
"
+ "The specified method is invoked with the arguments in the specified "
+ "argument list. "
+ "The method invocation is synchronous; the reply packet is not "
+ "sent until the invoked method returns in the target VM. "
+ "The return value (possibly the void value) is "
+ "included in the reply packet. "
+ "If the invoked method throws an exception, the "
+ "exception object ID is set in the reply packet; otherwise, the "
+ "exception object ID is null. "
+ "
"
+ "For primitive arguments, the argument value's type must match the "
+ "argument's type exactly. For object arguments, there must exist a "
+ "widening reference conversion from the argument value's type to the "
+ "argument's type and the argument's type must be loaded. "
+ "
"
+ "By default, all threads in the target VM are resumed while "
+ "the method is being invoked if they were previously "
+ "suspended by an event or by a command. "
+ "This is done to prevent the deadlocks "
+ "that will occur if any of the threads own monitors "
+ "that will be needed by the invoked method. It is possible that "
+ "breakpoints or other events might occur during the invocation. "
+ "Note, however, that this implicit resume acts exactly like "
+ "the ThreadReference resume command, so if the thread's suspend "
+ "count is greater than 1, it will remain in a suspended state "
+ "during the invocation. By default, when the invocation completes, "
+ "all threads in the target VM are suspended, regardless their state "
+ "before the invocation. "
+ "
"
+ "The resumption of other threads during the invoke can be prevented "
+ "by specifying the INVOKE_SINGLE_THREADED "
+ "bit flag in the options
field; however, "
+ "there is no protection against or recovery from the deadlocks "
+ "described above, so this option should be used with great caution. "
+ "Only the specified thread will be resumed (as described for all "
+ "threads above). Upon completion of a single threaded invoke, the invoking thread "
+ "will be suspended once again. Note that any threads started during "
+ "the single threaded invocation will not be suspended when the "
+ "invocation completes. "
+ "
"
+ "If the target VM is disconnected during the invoke (for example, through "
+ "the VirtualMachine dispose command) the method invocation continues. "
+ (Out
+ (interfaceType clazz "The interface type ID.")
+ (threadObject thread "The thread in which to invoke.")
+ (method methodID "The method to invoke.")
+ (Repeat arguments
+ (value arg "The argument value.")
+ )
+ (int options "Invocation options")
+ )
+ (Reply
+ (value returnValue "The returned value.")
+ (tagged-object exception "The thrown exception.")
+ )
+ (ErrorSet
+ (Error INVALID_CLASS "clazz is not the ID of an interface.")
+ (Error INVALID_OBJECT "clazz is not a known ID.")
+ (Error INVALID_METHODID "methodID is not the ID of a static method in this "
+ "interface type or is the ID of a static initializer.")
+ (Error INVALID_THREAD)
+ (Error THREAD_NOT_SUSPENDED)
+ (Error VM_DEAD)
+ )
+ )
)
(CommandSet Method=6
(Command LineTable=1
@@ -1543,7 +1621,7 @@ JDWP "Java(tm) Debug Wire Protocol"
"
"
"By default, all threads in the target VM are resumed while "
"the method is being invoked if they were previously "
- "suspended by an event or by command. "
+ "suspended by an event or by a command. "
"This is done to prevent the deadlocks "
"that will occur if any of the threads own monitors "
"that will be needed by the invoked method. It is possible that "
@@ -1586,7 +1664,9 @@ JDWP "Java(tm) Debug Wire Protocol"
(Error INVALID_OBJECT)
(Error INVALID_CLASS "clazz is not the ID of a reference "
"type.")
- (Error INVALID_METHODID "methodID is not the ID of a method.")
+ (Error INVALID_METHODID "methodID is not the ID of an instance method "
+ "in this object's type or one of its superclasses, "
+ "superinterfaces, or implemented interfaces.")
(Error INVALID_THREAD)
(Error THREAD_NOT_SUSPENDED)
(Error VM_DEAD)
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index de86e3f86a4..fd2e516be70 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -798,6 +798,10 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
endif
+# Libfontmanager doesn't actually need X_LIBS to link, but if building
+# on a Solaris machine without X installed, using a devkit, linking
+# to libawt_xawt will fail without the -L parameters from X_LIBS. Filter
+# out the -R parameters since they aren't needed.
$(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
LIBRARY := fontmanager, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -816,7 +820,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
- LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+ LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
+ -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
LDFLAGS_SUFFIX_aix := -lawt -lawt_xawt $(LIBM) $(LIBCXX) -ljava -ljvm,\
LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
-ljava -ljvm, \
diff --git a/jdk/make/mapfiles/libnet/mapfile-vers b/jdk/make/mapfiles/libnet/mapfile-vers
index 879fff4a850..ab621a923a8 100644
--- a/jdk/make/mapfiles/libnet/mapfile-vers
+++ b/jdk/make/mapfiles/libnet/mapfile-vers
@@ -94,6 +94,10 @@ SUNWprivate_1.1 {
Java_sun_net_sdp_SdpSupport_create0;
Java_sun_net_spi_DefaultProxySelector_init;
Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
+ Java_sun_net_ExtendedOptionsImpl_init;
+ Java_sun_net_ExtendedOptionsImpl_setFlowOption;
+ Java_sun_net_ExtendedOptionsImpl_getFlowOption;
+ Java_sun_net_ExtendedOptionsImpl_flowSupported;
NET_AllocSockaddr;
NET_SockaddrToInetAddress;
NET_SockaddrEqualsInetAddress;
diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt
index f8fbef0c69a..f2ae4c1b31c 100644
--- a/jdk/make/profile-includes.txt
+++ b/jdk/make/profile-includes.txt
@@ -56,7 +56,6 @@ PROFILE_1_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
calendars.properties \
classlist \
- content-types.properties \
currency.data \
ext/localedata.jar \
ext/meta-index \
diff --git a/jdk/src/aix/lib/tzmappings b/jdk/src/aix/lib/tzmappings
new file mode 100644
index 00000000000..079d2c937ba
--- /dev/null
+++ b/jdk/src/aix/lib/tzmappings
@@ -0,0 +1,586 @@
+#
+#
+# Copyright (c) 1994, 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.
+#
+
+#
+# Portions Copyright (c) 2014 IBM Corporation
+#
+
+# This table describes mappings between AIX time zone IDs and Java time zone
+# IDs. Fields are separated by a single TAB ('\t'). Lines must be in the ascending
+# order in ASCII. (non-ASCII characters can't be used.)
+# NOTE
+# This table format is not a public interface of any Java
+# platforms. No applications should depend on this file in any form.
+# This file has been generated using programs. Do not edit this file manually.
+#
+# Solaris Java
+
+ACST-9:30ACDT Australia/Adelaide
+AST4 America/Curacao
+AST4ADT America/Halifax
+AST9 Pacific/Gambier
+AST9ADT America/Anchorage
+AZOREST1 Atlantic/Cape_Verde
+AZOREST1AZOREDT Atlantic/Azores
+Africa/Abidjan Africa/Abidjan
+Africa/Accra Africa/Accra
+Africa/Addis_Ababa Africa/Addis_Ababa
+Africa/Algiers Africa/Algiers
+Africa/Asmera Africa/Asmera
+Africa/Bamako GMT
+Africa/Bangui Africa/Bangui
+Africa/Banjul Africa/Banjul
+Africa/Bissau Africa/Bissau
+Africa/Blantyre Africa/Blantyre
+Africa/Brazzaville Africa/Luanda
+Africa/Bujumbura Africa/Bujumbura
+Africa/Cairo Africa/Cairo
+Africa/Casablanca Africa/Casablanca
+Africa/Ceuta Europe/Paris
+Africa/Conakry Africa/Conakry
+Africa/Dakar Africa/Dakar
+Africa/Dar_es_Salaam Africa/Dar_es_Salaam
+Africa/Djibouti Africa/Djibouti
+Africa/Douala Africa/Douala
+Africa/El_Aaiun Africa/Casablanca
+Africa/Freetown Africa/Freetown
+Africa/Gaborone Africa/Gaborone
+Africa/Harare Africa/Harare
+Africa/Johannesburg Africa/Johannesburg
+Africa/Kampala Africa/Kampala
+Africa/Khartoum Africa/Khartoum
+Africa/Kigali Africa/Kigali
+Africa/Kinshasa Africa/Kinshasa
+Africa/Lagos Africa/Lagos
+Africa/Libreville Africa/Libreville
+Africa/Lome Africa/Lome
+Africa/Luanda Africa/Luanda
+Africa/Lubumbashi Africa/Lubumbashi
+Africa/Lusaka Africa/Lusaka
+Africa/Malabo Africa/Malabo
+Africa/Maputo Africa/Maputo
+Africa/Maseru Africa/Maseru
+Africa/Mbabane Africa/Mbabane
+Africa/Mogadishu Africa/Mogadishu
+Africa/Monrovia Africa/Monrovia
+Africa/Nairobi Africa/Nairobi
+Africa/Ndjamena Africa/Ndjamena
+Africa/Niamey Africa/Niamey
+Africa/Nouakchott Africa/Nouakchott
+Africa/Ouagadougou Africa/Ouagadougou
+Africa/Porto-Novo Africa/Porto-Novo
+Africa/Sao_Tome Africa/Sao_Tome
+Africa/Timbuktu Africa/Timbuktu
+Africa/Tripoli Africa/Tripoli
+Africa/Tunis Africa/Tunis
+Africa/Windhoek Africa/Windhoek
+America/Adak America/Adak
+America/Anchorage America/Anchorage
+America/Anguilla America/Anguilla
+America/Antigua America/Antigua
+America/Araguaina America/Sao_Paulo
+America/Argentina/Buenos_Aires America/Argentina/Buenos_Aires
+America/Argentina/Catamarca America/Argentina/Catamarca
+America/Argentina/ComodRivadavia America/Argentina/Catamarca
+America/Argentina/Cordoba America/Argentina/Cordoba
+America/Argentina/Jujuy America/Argentina/Jujuy
+America/Argentina/La_Rioja America/Argentina/La_Rioja
+America/Argentina/Mendoza America/Argentina/Mendoza
+America/Argentina/Rio_Gallegos America/Argentina/Rio_Gallegos
+America/Argentina/Salta America/Argentina/Salta
+America/Argentina/San_Juan America/Argentina/San_Juan
+America/Argentina/San_Luis America/Argentina/San_Luis
+America/Argentina/Tucuman America/Argentina/Tucuman
+America/Argentina/Ushuaia America/Argentina/Ushuaia
+America/Aruba America/Aruba
+America/Asuncion America/Asuncion
+America/Atka America/Adak
+America/Barbados America/Barbados
+America/Belize America/Belize
+America/Bogota America/Bogota
+America/Boise America/Denver
+America/Buenos_Aires America/Argentina/Buenos_Aires
+America/Cancun America/Chicago
+America/Caracas America/Caracas
+America/Catamarca America/Argentina/Catamarca
+America/Cayenne America/Cayenne
+America/Cayman America/Cayman
+America/Chicago America/Chicago
+America/Chihuahua America/Denver
+America/Coral_Harbour America/Atikokan
+America/Cordoba America/Argentina/Cordoba
+America/Costa_Rica America/Costa_Rica
+America/Cuiaba America/Cuiaba
+America/Curacao America/Curacao
+America/Dawson America/Los_Angeles
+America/Dawson_Creek America/Dawson_Creek
+America/Denver America/Denver
+America/Detroit America/New_York
+America/Dominica America/Dominica
+America/Edmonton America/Edmonton
+America/El_Salvador America/El_Salvador
+America/Ensenada America/Los_Angeles
+America/Fort_Wayne America/Indiana/Indianapolis
+America/Fortaleza America/Fortaleza
+America/Glace_Bay America/Halifax
+America/Godthab America/Godthab
+America/Goose_Bay America/Thule
+America/Grand_Turk America/Grand_Turk
+America/Grenada America/Grenada
+America/Guadeloupe America/Guadeloupe
+America/Guatemala America/Guatemala
+America/Guayaquil America/Guayaquil
+America/Guyana America/Guyana
+America/Halifax America/Halifax
+America/Havana America/Havana
+America/Indiana/Indianapolis America/Indianapolis
+America/Indianapolis America/Indiana/Indianapolis
+America/Inuvik America/Denver
+America/Iqaluit America/New_York
+America/Jamaica America/Jamaica
+America/Jujuy America/Argentina/Jujuy
+America/Juneau America/Anchorage
+America/Knox_IN America/Indiana/Knox
+America/La_Paz America/La_Paz
+America/Lima America/Lima
+America/Los_Angeles America/Los_Angeles
+America/Louisville America/Kentucky/Louisville
+America/Managua America/Managua
+America/Manaus America/Manaus
+America/Marigot America/Guadeloupe
+America/Martinique America/Martinique
+America/Mazatlan America/Mazatlan
+America/Mendoza America/Argentina/Mendoza
+America/Menominee America/Winnipeg
+America/Mexico_City America/Mexico_City
+America/Miquelon America/Miquelon
+America/Moncton America/Moncton
+America/Montevideo America/Montevideo
+America/Montreal America/Montreal
+America/Montserrat America/Montserrat
+America/Nassau America/Nassau
+America/New_York America/New_York
+America/Nipigon America/New_York
+America/Nome America/Anchorage
+America/Noronha America/Noronha
+America/Panama America/Panama
+America/Pangnirtung America/Thule
+America/Paramaribo America/Paramaribo
+America/Phoenix America/Phoenix
+America/Port-au-Prince America/Port-au-Prince
+America/Port_of_Spain America/Port_of_Spain
+America/Porto_Acre America/Rio_Branco
+America/Puerto_Rico America/Puerto_Rico
+America/Rainy_River America/Chicago
+America/Rankin_Inlet America/Chicago
+America/Regina America/Regina
+America/Rio_Branco America/Rio_Branco
+America/Rosario America/Argentina/Cordoba
+America/Santiago America/Santiago
+America/Santo_Domingo America/Santo_Domingo
+America/Sao_Paulo America/Sao_Paulo
+America/Scoresbysund America/Scoresbysund
+America/Shiprock America/Denver
+America/St_Barthelemy America/Guadeloupe
+America/St_Johns America/St_Johns
+America/St_Kitts America/St_Kitts
+America/St_Lucia America/St_Lucia
+America/St_Thomas America/St_Thomas
+America/St_Vincent America/St_Vincent
+America/Tegucigalpa America/Tegucigalpa
+America/Thule America/Thule
+America/Thunder_Bay America/New_York
+America/Tijuana America/Tijuana
+America/Toronto America/Toronto
+America/Tortola America/Tortola
+America/Vancouver America/Vancouver
+America/Virgin America/St_Thomas
+America/Whitehorse America/Los_Angeles
+America/Winnipeg America/Winnipeg
+America/Yakutat America/Anchorage
+America/Yellowknife America/Denver
+Antarctica/Casey Antarctica/Casey
+Antarctica/DumontDUrville Antarctica/DumontDUrville
+Antarctica/Mawson Antarctica/Mawson
+Antarctica/McMurdo Antarctica/McMurdo
+Antarctica/Palmer Antarctica/Palmer
+Antarctica/South_Pole Antarctica/McMurdo
+Arctic/Longyearbyen Europe/Oslo
+Asia/Aden Asia/Aden
+Asia/Almaty Asia/Almaty
+Asia/Amman Asia/Amman
+Asia/Anadyr Asia/Anadyr
+Asia/Aqtau Asia/Aqtau
+Asia/Aqtobe Asia/Aqtobe
+Asia/Ashkhabad Asia/Ashkhabad
+Asia/Baghdad Asia/Baghdad
+Asia/Bahrain Asia/Bahrain
+Asia/Baku Asia/Baku
+Asia/Bangkok Asia/Bangkok
+Asia/Beirut Asia/Beirut
+Asia/Bishkek Asia/Bishkek
+Asia/Brunei Asia/Brunei
+Asia/Calcutta Asia/Calcutta
+Asia/Chungking Asia/Shanghai
+Asia/Colombo Asia/Colombo
+Asia/Dacca Asia/Dacca
+Asia/Damascus Asia/Damascus
+Asia/Dhaka Asia/Dhaka
+Asia/Dubai Asia/Dubai
+Asia/Dushanbe Asia/Dushanbe
+Asia/Gaza Asia/Amman
+Asia/Harbin Asia/Shanghai
+Asia/Hong_Kong Asia/Hong_Kong
+Asia/Irkutsk Asia/Irkutsk
+Asia/Istanbul Europe/Istanbul
+Asia/Jakarta Asia/Jakarta
+Asia/Jayapura Asia/Jayapura
+Asia/Jerusalem Asia/Jerusalem
+Asia/Kabul Asia/Kabul
+Asia/Kamchatka Asia/Kamchatka
+Asia/Karachi Asia/Karachi
+Asia/Kashgar Asia/Shanghai
+Asia/Katmandu Asia/Katmandu
+Asia/Kolkata Asia/Kolkata
+Asia/Krasnoyarsk Asia/Krasnoyarsk
+Asia/Kuala_Lumpur Asia/Kuala_Lumpur
+Asia/Kuwait Asia/Kuwait
+Asia/Macao Asia/Macao
+Asia/Magadan Asia/Magadan
+Asia/Manila Asia/Manila
+Asia/Muscat Asia/Muscat
+Asia/Nicosia Asia/Nicosia
+Asia/Novosibirsk Asia/Novosibirsk
+Asia/Omsk Asia/Novosibirsk
+Asia/Phnom_Penh Asia/Phnom_Penh
+Asia/Pyongyang Asia/Pyongyang
+Asia/Qatar Asia/Qatar
+Asia/Rangoon Asia/Rangoon
+Asia/Riyadh Asia/Riyadh
+Asia/Saigon Asia/Ho_Chi_Minh
+Asia/Seoul Asia/Seoul
+Asia/Shanghai Asia/Shanghai
+Asia/Singapore Asia/Singapore
+Asia/Taipei Asia/Taipei
+Asia/Tashkent Asia/Tashkent
+Asia/Tbilisi Asia/Tbilisi
+Asia/Tehran Asia/Tehran
+Asia/Tel_Aviv Asia/Jerusalem
+Asia/Thimbu Asia/Thimbu
+Asia/Tokyo Asia/Tokyo
+Asia/Ujung_Pandang Asia/Ujung_Pandang
+Asia/Ulan_Bator Asia/Ulaanbaatar
+Asia/Urumqi Asia/Shanghai
+Asia/Vientiane Asia/Vientiane
+Asia/Vladivostok Asia/Vladivostok
+Asia/Yakutsk Asia/Yakutsk
+Asia/Yekaterinburg Asia/Yekaterinburg
+Asia/Yerevan Asia/Yerevan
+Atlantic/Azores Atlantic/Azores
+Atlantic/Bermuda Atlantic/Bermuda
+Atlantic/Canary Atlantic/Canary
+Atlantic/Cape_Verde Atlantic/Cape_Verde
+Atlantic/Faeroe Atlantic/Faeroe
+Atlantic/Jan_Mayen Atlantic/Jan_Mayen
+Atlantic/Madeira Europe/London
+Atlantic/Reykjavik Atlantic/Reykjavik
+Atlantic/South_Georgia Atlantic/South_Georgia
+Atlantic/St_Helena Atlantic/St_Helena
+Atlantic/Stanley Atlantic/Stanley
+Australia/ACT Australia/Sydney
+Australia/Adelaide Australia/Adelaide
+Australia/Brisbane Australia/Brisbane
+Australia/Broken_Hill Australia/Broken_Hill
+Australia/Canberra Australia/Sydney
+Australia/Darwin Australia/Darwin
+Australia/Hobart Australia/Hobart
+Australia/LHI Australia/Lord_Howe
+Australia/Lord_Howe Australia/Lord_Howe
+Australia/Melbourne Australia/Sydney
+Australia/NSW Australia/Sydney
+Australia/North Australia/Darwin
+Australia/Perth Australia/Perth
+Australia/Queensland Australia/Brisbane
+Australia/South Australia/Adelaide
+Australia/Sydney Australia/Sydney
+Australia/Tasmania Australia/Hobart
+Australia/Victoria Australia/Melbourne
+Australia/West Australia/Perth
+Australia/Yancowinna Australia/Broken_Hill
+BRT3BRST America/Sao_Paulo
+BST11 Pacific/Apia
+BST11BDT Pacific/Apia
+Brazil/Acre America/Rio_Branco
+Brazil/DeNoronha America/Noronha
+Brazil/East America/Sao_Paulo
+Brazil/West America/Manaus
+CET Europe/Paris
+CET-1CEST Europe/Paris
+CET-1CEST-2 Europe/Berlin
+CET-1CET-2 Europe/Paris
+CST6 America/Costa_Rica
+CST6CDT America/Chicago
+CUT0 UTC
+CUT0GDT Europe/London
+Canada/Atlantic America/Halifax
+Canada/Central America/Winnipeg
+Canada/East-Saskatchewan America/Regina
+Canada/Eastern America/Montreal
+Canada/Mountain America/Edmonton
+Canada/Newfoundland America/St_Johns
+Canada/Pacific America/Vancouver
+Canada/Saskatchewan America/Regina
+Canada/Yukon America/Whitehorse
+Chile/Continental America/Santiago
+Chile/EasterIsland Pacific/Easter
+Cuba America/Havana
+EET Europe/Istanbul
+EET-10 Australia/Brisbane
+EET-10EETDT Australia/Sydney
+EST America/Indianapolis
+EST5 America/Indianapolis
+EST5EDT America/New_York
+Egypt Africa/Cairo
+Eire Europe/Dublin
+Etc/GMT GMT
+Etc/GMT0 GMT
+Etc/Greenwich GMT
+Etc/UCT UTC
+Etc/UTC UTC
+Etc/Universal UTC
+Etc/Zulu UTC
+Europe/Amsterdam Europe/Amsterdam
+Europe/Andorra Europe/Andorra
+Europe/Athens Europe/Athens
+Europe/Belfast Europe/London
+Europe/Belgrade Europe/Belgrade
+Europe/Berlin Europe/Berlin
+Europe/Bratislava Europe/Prague
+Europe/Brussels Europe/Brussels
+Europe/Bucharest Europe/Bucharest
+Europe/Budapest Europe/Budapest
+Europe/Chisinau Europe/Chisinau
+Europe/Copenhagen Europe/Copenhagen
+Europe/Dublin Europe/Dublin
+Europe/Gibraltar Europe/Gibraltar
+Europe/Guernsey Europe/London
+Europe/Helsinki Europe/Helsinki
+Europe/Isle_of_Man Europe/London
+Europe/Istanbul Europe/Istanbul
+Europe/Jersey Europe/London
+Europe/Kaliningrad Europe/Kaliningrad
+Europe/Kiev Europe/Kiev
+Europe/Lisbon Europe/Lisbon
+Europe/Ljubljana Europe/Belgrade
+Europe/London Europe/London
+Europe/Luxembourg Europe/Luxembourg
+Europe/Madrid Europe/Madrid
+Europe/Malta Europe/Malta
+Europe/Mariehamn Europe/Helsinki
+Europe/Minsk Europe/Minsk
+Europe/Monaco Europe/Monaco
+Europe/Moscow Europe/Moscow
+Europe/Nicosia Asia/Nicosia
+Europe/Oslo Europe/Oslo
+Europe/Paris Europe/Paris
+Europe/Podgorica Europe/Belgrade
+Europe/Prague Europe/Prague
+Europe/Riga Europe/Riga
+Europe/Rome Europe/Rome
+Europe/Samara Europe/Samara
+Europe/San_Marino Europe/Rome
+Europe/Sarajevo Europe/Belgrade
+Europe/Simferopol Europe/Simferopol
+Europe/Skopje Europe/Belgrade
+Europe/Sofia Europe/Sofia
+Europe/Stockholm Europe/Stockholm
+Europe/Tallinn Europe/Tallinn
+Europe/Tirane Europe/Tirane
+Europe/Vaduz Europe/Vaduz
+Europe/Vatican Europe/Rome
+Europe/Vienna Europe/Vienna
+Europe/Vilnius Europe/Vilnius
+Europe/Warsaw Europe/Warsaw
+Europe/Zagreb Europe/Belgrade
+Europe/Zurich Europe/Zurich
+FALKST2 Atlantic/South_Georgia
+FALKST2FALKDT Atlantic/South_Georgia
+Factory GMT
+GB Europe/London
+GB-Eire Europe/London
+GMT GMT
+GMT0 GMT
+GMT0BST Europe/London
+GMT0BST-1 Europe/London
+GMT0WET Europe/Lisbon
+GRNLNDST3 America/Buenos_Aires
+GRNLNDST3GRNLNDDT America/Godthab
+Greenwich GMT
+HST Pacific/Honolulu
+HST10 Pacific/Honolulu
+HST10HDT America/Adak
+Hongkong Asia/Hong_Kong
+Iceland Atlantic/Reykjavik
+Indian/Antananarivo Indian/Antananarivo
+Indian/Chagos Indian/Chagos
+Indian/Christmas Indian/Christmas
+Indian/Cocos Indian/Cocos
+Indian/Comoro Indian/Comoro
+Indian/Kerguelen Indian/Kerguelen
+Indian/Mahe Indian/Mahe
+Indian/Maldives Indian/Maldives
+Indian/Mauritius Indian/Mauritius
+Indian/Mayotte Indian/Mayotte
+Indian/Reunion Indian/Reunion
+Iran Asia/Tehran
+Israel Asia/Jerusalem
+JST-9 Asia/Tokyo
+JST-9JSTDT Asia/Tokyo
+Jamaica America/Jamaica
+Japan Asia/Tokyo
+KORST-9 Asia/Seoul
+KORST-9KORDT Asia/Seoul
+Kwajalein Pacific/Kwajalein
+Libya Africa/Tripoli
+MEST-2 Europe/Istanbul
+MEST-2MEDT Europe/Istanbul
+MEST-3 Asia/Riyadh
+MEST-3MEDT Europe/Moscow
+MET Europe/Paris
+MET-11 Pacific/Guadalcanal
+MET-11METDT Asia/Magadan
+MET-1MEST Europe/Paris
+MET-1MST-2 Europe/Berlin
+MEZ-1MESZ Europe/Berlin
+MEZ-1MESZ-2 Europe/Berlin
+MSK-3MSD Europe/Moscow
+MST America/Phoenix
+MST7 America/Phoenix
+MST7MDT America/Denver
+Mexico/BajaNorte America/Tijuana
+Mexico/BajaSur America/Mazatlan
+Mexico/General America/Mexico_City
+Mideast/Riyadh87 Asia/Riyadh87
+Mideast/Riyadh88 Asia/Riyadh88
+Mideast/Riyadh89 Asia/Riyadh89
+NFT-1 Africa/Algiers
+NFT-1DFT Europe/Paris
+NFT-1DST Europe/Paris
+NZ Pacific/Auckland
+NZ-CHAT Pacific/Chatham
+NZST-12 Pacific/Fiji
+NZST-12NZDT Pacific/Auckland
+Navajo America/Denver
+PAKST-5 Asia/Karachi
+PAKST-5PAKDT Asia/Yekaterinburg
+PRC Asia/Shanghai
+PST8 Pacific/Pitcairn
+PST8PDT America/Los_Angeles
+PST8PDT7 America/Tijuana
+Pacific/Apia Pacific/Apia
+Pacific/Auckland Pacific/Auckland
+Pacific/Chatham Pacific/Chatham
+Pacific/Easter Pacific/Easter
+Pacific/Efate Pacific/Efate
+Pacific/Enderbury Pacific/Enderbury
+Pacific/Fakaofo Pacific/Fakaofo
+Pacific/Fiji Pacific/Fiji
+Pacific/Funafuti Pacific/Funafuti
+Pacific/Galapagos Pacific/Galapagos
+Pacific/Gambier Pacific/Gambier
+Pacific/Guadalcanal Pacific/Guadalcanal
+Pacific/Guam Pacific/Guam
+Pacific/Honolulu Pacific/Honolulu
+Pacific/Kiritimati Pacific/Kiritimati
+Pacific/Kosrae Pacific/Kosrae
+Pacific/Majuro Pacific/Majuro
+Pacific/Marquesas Pacific/Marquesas
+Pacific/Nauru Pacific/Nauru
+Pacific/Niue Pacific/Niue
+Pacific/Norfolk Pacific/Norfolk
+Pacific/Noumea Pacific/Noumea
+Pacific/Pago_Pago Pacific/Pago_Pago
+Pacific/Palau Pacific/Palau
+Pacific/Pitcairn Pacific/Pitcairn
+Pacific/Ponape Pacific/Ponape
+Pacific/Port_Moresby Pacific/Port_Moresby
+Pacific/Rarotonga Pacific/Rarotonga
+Pacific/Saipan Pacific/Saipan
+Pacific/Samoa Pacific/Pago_Pago
+Pacific/Tahiti Pacific/Tahiti
+Pacific/Tarawa Pacific/Tarawa
+Pacific/Tongatapu Pacific/Tongatapu
+Pacific/Truk Pacific/Truk
+Pacific/Wake Pacific/Wake
+Pacific/Wallis Pacific/Wallis
+Poland Europe/Warsaw
+Portugal Europe/Lisbon
+ROC Asia/Taipei
+ROK Asia/Seoul
+SAUST-3 Asia/Riyadh
+SAUST-3SAUDT Europe/Moscow
+Singapore Asia/Singapore
+SystemV/AST4ADT America/Thule
+SystemV/CST6CDT America/Chicago
+SystemV/EST5EDT America/New_York
+SystemV/MST7MDT America/Denver
+SystemV/PST8PDT America/Los_Angeles
+SystemV/YST9YDT America/Anchorage
+TAIST-8 Asia/Taipei
+TAIST-8TAIDT Asia/Irkutsk
+TASHST-6 Asia/Dacca
+TASHST-6TASHDT Asia/Novosibirsk
+THAIST-7 Asia/Bangkok
+THAIST-7THAIDT Asia/Krasnoyarsk
+Turkey Europe/Istanbul
+UCT UTC
+US/Alaska America/Anchorage
+US/Aleutian America/Adak
+US/Arizona America/Phoenix
+US/Central America/Chicago
+US/East-Indiana America/Indiana/Indianapolis
+US/Eastern America/New_York
+US/Hawaii Pacific/Honolulu
+US/Indiana-Starke America/Indiana/Knox
+US/Michigan America/New_York
+US/Mountain America/Denver
+US/Pacific America/Los_Angeles
+US/Pacific-New America/Los_Angeles
+US/Samoa Pacific/Pago_Pago
+USAST-2 Africa/Johannesburg
+USAST-2USADT Europe/Istanbul
+UTC UTC
+UYT3UYST America/Montevideo
+Universal UTC
+W-SU Europe/Moscow
+WAUST-8 Australia/Perth
+WAUST-8WAUDT Australia/Perth
+WET WET
+WET-2 Africa/Johannesburg
+WET-2WET Europe/Helsinki
+WST-4 Asia/Dubai
+WST-4WDT Europe/Samara
+Zulu UTC
diff --git a/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java b/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
index 40b2fc2db44..272b1f1f25b 100644
--- a/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
+++ b/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -31,6 +31,13 @@ import java.nio.ByteBuffer;
import java.lang.annotation.Native;
public final class JRSUIConstants {
+
+ /**
+ * There is no way to get width of focus border, so it is hardcoded here.
+ * All components, which can be focused should take care about it.
+ */
+ public static final int FOCUS_SIZE = 4;
+
private static native long getPtrForConstant(final int constant);
static class Key {
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java b/jdk/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
index 2735eb48429..f3520368911 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -36,6 +36,8 @@ import apple.laf.JRSUIConstants.*;
import com.apple.laf.AquaUtilControlSize.*;
import com.apple.laf.AquaUtils.RecyclableSingleton;
+import static apple.laf.JRSUIConstants.FOCUS_SIZE;
+
/**
* All the "magic numbers" in this class should go away once
* "default font" and sizes for controls in Java Aqua Look and Feel
@@ -145,7 +147,8 @@ public class AquaButtonExtendedTypes {
protected static Map getAllTypes() {
final Map specifiersByName = new HashMap();
- final Insets focusInsets = new Insets(4, 4, 4, 4);
+ final Insets focusInsets = new Insets(FOCUS_SIZE, FOCUS_SIZE,
+ FOCUS_SIZE, FOCUS_SIZE);
final TypeSpecifier[] specifiers = {
new TypeSpecifier("toolbar", true) {
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java b/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java
index e40d066ac22..4af5599b600 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaIcon.java
@@ -44,7 +44,8 @@ public class AquaIcon {
}
static UIResource getIconFor(final JRSUIControlSpec spec, final int width, final int height) {
- return new CachableJRSUIIcon(width, height) {
+ return new ScalingJRSUIIcon(width, height) {
+ @Override
public void initIconPainter(final AquaPainter painter) {
spec.initIconPainter(painter);
}
@@ -128,35 +129,12 @@ public class AquaIcon {
if (image != null) return image;
if (!GraphicsEnvironment.isHeadless()) {
- image = getOptimizedImage();
+ image = createImage();
}
return image;
}
- private Image getOptimizedImage() {
- final Image img = createImage();
- // TODO: no RuntimeOptions for now
- //if (RuntimeOptions.getRenderer(null) != RuntimeOptions.Sun) return img;
- return getProgressiveOptimizedImage(img, getIconWidth(), getIconHeight());
- }
-
- static Image getProgressiveOptimizedImage(final Image img, final int w, final int h) {
- if (img == null) return null;
-
- final int halfImgW = img.getWidth(null) / 2;
- final int halfImgH = img.getHeight(null) / 2;
- if (w * 2 > halfImgW && h * 2 > halfImgH) return img;
-
- final BufferedImage halfImage = new BufferedImage(halfImgW, halfImgH, BufferedImage.TYPE_INT_ARGB);
- final Graphics g = halfImage.getGraphics();
- ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
- g.drawImage(img, 0, 0, halfImgW, halfImgH, null);
- g.dispose();
-
- return getProgressiveOptimizedImage(halfImage, w, h);
- }
-
abstract Image createImage();
public boolean hasIconRef() {
@@ -189,24 +167,50 @@ public class AquaIcon {
}
- static abstract class CachableJRSUIIcon extends CachingScalingIcon implements UIResource {
- public CachableJRSUIIcon(final int width, final int height) {
- super(width, height);
+ static abstract class ScalingJRSUIIcon implements Icon, UIResource {
+ final int width;
+ final int height;
+
+ public ScalingJRSUIIcon(final int width, final int height) {
+ this.width = width;
+ this.height = height;
}
- Image createImage() {
- final AquaPainter painter = AquaPainter.create(JRSUIState.getInstance());
+ @Override
+ public void paintIcon(final Component c, Graphics g,
+ final int x, final int y) {
+ if (GraphicsEnvironment.isHeadless()) {
+ return;
+ }
+
+ g = g.create();
+
+ if (g instanceof Graphics2D) {
+ // improves icon rendering quality in Quartz
+ ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
+
+ final AquaPainter painter =
+ AquaPainter.create(JRSUIState.getInstance());
initIconPainter(painter);
- final BufferedImage img = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
- final Graphics g = img.getGraphics();
- g.setClip(new Rectangle(0, 0, getIconWidth(), getIconHeight()));
- painter.paint(g, null, 0, 0, getIconWidth(), getIconHeight());
+ g.setClip(new Rectangle(x, y, width, height));
+ painter.paint(g, c, x, y, width, height);
g.dispose();
- return img;
}
public abstract void initIconPainter(final AquaPainter painter);
+
+ @Override
+ public int getIconWidth() {
+ return width;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return height;
+ }
}
static class FileIcon extends CachingScalingIcon {
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java
index 076b2dec952..90ce8ca5b80 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java
@@ -787,8 +787,9 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
}
static final RecyclableSingleton RESIZE_ICON = new RecyclableSingleton() {
+ @Override
protected Icon getInstance() {
- return new AquaIcon.CachableJRSUIIcon(11, 11) {
+ return new AquaIcon.ScalingJRSUIIcon(11, 11) {
public void initIconPainter(final AquaPainter iconState) {
iconState.state.set(Widget.GROW_BOX_TEXTURED);
iconState.state.set(WindowType.UTILITY);
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java
index 38884ac7e8f..ee4fcba1a4d 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -141,40 +141,71 @@ abstract class AquaPainter {
paintFromSingleCachedImage(g, control, stateToPaint, boundsRect);
}
+ /**
+ * Paints a native control, which identified by its size and a set of
+ * additional arguments using a cached image.
+ *
+ * @param g Graphics to draw the control
+ * @param control the reference to the native control
+ * @param controlState the state of the native control
+ * @param bounds the rectangle where the native part should be drawn.
+ * Note: the focus can/will be drawn outside of this bounds.
+ */
static void paintFromSingleCachedImage(final Graphics2D g,
- final JRSUIControl control, final JRSUIState controlState,
- final Rectangle bounds) {
+ final JRSUIControl control,
+ final JRSUIState controlState,
+ final Rectangle bounds) {
if (bounds.width <= 0 || bounds.height <= 0) {
return;
}
- int scale = 1;
- if (g instanceof SunGraphics2D) {
- scale = ((SunGraphics2D) g).surfaceData.getDefaultScale();
+ int focus = 0;
+ if (controlState.is(JRSUIConstants.Focused.YES)) {
+ focus = JRSUIConstants.FOCUS_SIZE;
}
+
+ final int imgX = bounds.x - focus;
+ final int imgY = bounds.y - focus;
+ final int imgW = bounds.width + (focus << 1);
+ final int imgH = bounds.height + (focus << 1);
final GraphicsConfiguration config = g.getDeviceConfiguration();
final ImageCache cache = ImageCache.getInstance();
- final int imgW = bounds.width * scale;
- final int imgH = bounds.height * scale;
- AquaPixelsKey key = new AquaPixelsKey(config,
- imgW, imgH, scale, controlState);
- BufferedImage img = (BufferedImage) cache.getImage(key);
+ final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
+ bounds, controlState);
+ Image img = cache.getImage(key);
if (img == null) {
- img = new BufferedImage(imgW, imgH, BufferedImage.TYPE_INT_ARGB_PRE);
+
+ Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
+ control, controlState);
+
+ img = new MultiResolutionBufferedImage(baseImage,
+ (rvWidth, rvHeight) -> createImage(imgX, imgY,
+ rvWidth, rvHeight, bounds, control, controlState));
+
if (!controlState.is(JRSUIConstants.Animating.YES)) {
cache.setImage(key, img);
}
-
- final WritableRaster raster = img.getRaster();
- final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
-
- control.set(controlState);
- control.paint(SunWritableRaster.stealData(buffer, 0),
- imgW, imgH, 0, 0, bounds.width, bounds.height);
- SunWritableRaster.markDirty(buffer);
}
- g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null);
+ g.drawImage(img, imgX, imgY, imgW, imgH, null);
+ }
+
+ private static Image createImage(int imgX, int imgY, int imgW, int imgH,
+ final Rectangle bounds,
+ final JRSUIControl control,
+ JRSUIState controlState) {
+ BufferedImage img = new BufferedImage(imgW, imgH,
+ BufferedImage.TYPE_INT_ARGB_PRE);
+
+ final WritableRaster raster = img.getRaster();
+ final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
+
+ control.set(controlState);
+ control.paint(SunWritableRaster.stealData(buffer, 0), imgW, imgH,
+ bounds.x - imgX, bounds.y - imgY, bounds.width,
+ bounds.height);
+ SunWritableRaster.markDirty(buffer);
+ return img;
}
}
@@ -187,21 +218,22 @@ abstract class AquaPainter {
private final GraphicsConfiguration config;
private final int w;
private final int h;
- private final int scale;
+ private final Rectangle bounds;
private final JRSUIState state;
AquaPixelsKey(final GraphicsConfiguration config,
- final int w, final int h, final int scale,
+ final int w, final int h, final Rectangle bounds,
final JRSUIState state) {
this.pixelCount = w * h;
this.config = config;
this.w = w;
this.h = h;
- this.scale = scale;
+ this.bounds = bounds;
this.state = state;
this.hash = hash();
}
+ @Override
public int getPixelCount() {
return pixelCount;
}
@@ -210,7 +242,7 @@ abstract class AquaPainter {
int hash = config != null ? config.hashCode() : 0;
hash = 31 * hash + w;
hash = 31 * hash + h;
- hash = 31 * hash + scale;
+ hash = 31 * hash + bounds.hashCode();
hash = 31 * hash + state.hashCode();
return hash;
}
@@ -225,7 +257,7 @@ abstract class AquaPainter {
if (obj instanceof AquaPixelsKey) {
AquaPixelsKey key = (AquaPixelsKey) obj;
return config == key.config && w == key.w && h == key.h
- && scale == key.scale && state.equals(key.state);
+ && bounds.equals(key.bounds) && state.equals(key.state);
}
return false;
}
diff --git a/jdk/src/macosx/classes/sun/font/CFontManager.java b/jdk/src/macosx/classes/sun/font/CFontManager.java
index a5f36154d64..ad2bfab62ba 100644
--- a/jdk/src/macosx/classes/sun/font/CFontManager.java
+++ b/jdk/src/macosx/classes/sun/font/CFontManager.java
@@ -27,6 +27,8 @@ package sun.font;
import java.awt.*;
import java.io.File;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
@@ -38,6 +40,7 @@ import javax.swing.plaf.FontUIResource;
import sun.awt.FontConfiguration;
import sun.awt.HeadlessToolkit;
+import sun.misc.ThreadGroupUtils;
import sun.lwawt.macosx.*;
public class CFontManager extends SunFontManager {
@@ -215,24 +218,19 @@ public class CFontManager extends SunFontManager {
});
}
};
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction