Merge
authorduke
Wed, 05 Jul 2017 20:20:43 +0200
changeset 29042 7545059c977e
parent 29041 cda0ffc99002 (current diff)
parent 29038 c2058b635c17 (diff)
child 29044 37c6512bd1df
Merge
hotspot/src/os/bsd/vm/dtraceJSDT_bsd.cpp
hotspot/src/os/linux/vm/dtraceJSDT_linux.cpp
hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp
hotspot/src/os/windows/vm/dtraceJSDT_windows.cpp
hotspot/src/share/vm/runtime/dtraceJSDT.cpp
hotspot/src/share/vm/runtime/dtraceJSDT.hpp
jdk/make/data/charsetmapping/dbcs
jdk/make/data/charsetmapping/extsbcs
jdk/make/data/charsetmapping/sbcs
jdk/make/data/charsetmapping/standard-charsets
jdk/src/java.desktop/macosx/classes/sun/datatransfer/resources/flavormap.properties
jdk/src/java.desktop/share/classes/java/awt/datatransfer/Clipboard.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/ClipboardOwner.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/DataFlavor.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorEvent.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorListener.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorMap.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorTable.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParseException.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/StringSelection.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/Transferable.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java
jdk/src/java.desktop/share/classes/java/awt/datatransfer/package.html
jdk/src/java.desktop/share/classes/sun/datatransfer/DataFlavorUtil.java
jdk/src/java.desktop/share/classes/sun/datatransfer/DesktopDatatransferService.java
jdk/src/java.desktop/unix/classes/sun/awt/X11/XAWTFormatter.java
jdk/src/java.desktop/unix/classes/sun/datatransfer/resources/flavormap.properties
jdk/src/java.desktop/windows/classes/sun/datatransfer/resources/flavormap.properties
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_Solaris.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/DelegatableDecoder.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/DoubleByte.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_Open.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/HKSCS.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/Probe.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProbeName.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/Provider.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProviderFactory.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProviderName.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ArgsAttributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/Attributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/DependencyClass.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/FunctionAttributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/FunctionName.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ModuleAttributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ModuleName.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/NameAttributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ProviderAttributes.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/StabilityLevel.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/package-info.java
jdk/src/jdk.runtime/share/classes/com/sun/tracing/package-info.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_de.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_es.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_fr.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_it.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_ja.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_ko.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_sv.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
jdk/src/jdk.runtime/share/classes/sun/tracing/MultiplexProviderFactory.java
jdk/src/jdk.runtime/share/classes/sun/tracing/NullProviderFactory.java
jdk/src/jdk.runtime/share/classes/sun/tracing/PrintStreamProviderFactory.java
jdk/src/jdk.runtime/share/classes/sun/tracing/ProbeSkeleton.java
jdk/src/jdk.runtime/share/classes/sun/tracing/ProviderSkeleton.java
jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/Activation.java
jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProbe.java
jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProvider.java
jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java
jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/JVM.java
jdk/src/jdk.runtime/share/classes/sun/tracing/package-info.java
jdk/src/jdk.runtime/share/native/libjsdt/JVM.c
jdk/src/jdk.runtime/share/native/libjsdt/jvm_symbols.h
jdk/src/jdk.runtime/unix/native/libjsdt/jvm_symbols_md.c
jdk/src/jdk.runtime/windows/native/libjsdt/jvm_symbols_md.c
jdk/test/com/sun/tracing/BasicFunctionality.java
jdk/test/com/sun/tracing/BasicWithSecurityMgr.java
jdk/test/java/awt/color/LoadProfileWithSM.java
jdk/test/java/awt/color/LoadStandardProfilesTest.java
--- a/.hgtags-top-repo	Thu Feb 19 16:36:35 2015 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 20:20:43 2017 +0200
@@ -293,3 +293,4 @@
 0064e246d83f6f9fc245c19b6d05041ecaf4b6d4 jdk9-b48
 d91ed1951b948210590ce1394bea5515357246ba jdk9-b49
 d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50
+6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51
--- a/Makefile	Thu Feb 19 16:36:35 2015 -0800
+++ b/Makefile	Wed Jul 05 20:20:43 2017 +0200
@@ -48,6 +48,17 @@
 endif
 root_dir:=$(patsubst %/,%,$(dir $(makefile_path)))
 
+ifeq ($(MAIN_TARGETS), )
+  COMMAND_LINE_VARIABLES:=$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))))
+  MAKE_CONTROL_VARIABLES:=LOG CONF SPEC JOBS TEST IGNORE_OLD_CONFIG
+  UNKNOWN_COMMAND_LINE_VARIABLES:=$(strip $(filter-out $(MAKE_CONTROL_VARIABLES), $(COMMAND_LINE_VARIABLES)))
+  ifneq ($(UNKNOWN_COMMAND_LINE_VARIABLES), )
+    $(info Note: Command line contains non-control variables: $(UNKNOWN_COMMAND_LINE_VARIABLES).)
+    $(info Make sure it is not mistyped, and that you intend to override this variable.)
+    $(info 'make help' will list known control variables)
+  endif
+endif
+
 ifneq ($(findstring qp,$(MAKEFLAGS)),)
   # When called with -qp, assume an external part (e.g. bash completion) is trying
   # to understand our targets.
@@ -148,62 +159,64 @@
 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
 # If you add more global targets, please update the variable global_targets in MakeHelpers.
 
+# Helper macro to allow $(info) to properly print strings beginning with spaces.
+_:=
+
 help:
 	$(info )
 	$(info OpenJDK Makefile help)
 	$(info =====================)
 	$(info )
 	$(info Common make targets)
-	$(info .  make [default]         # Compile all modules in langtools, hotspot, jaxp, jaxws,)
-	$(info .                         # corba and jdk and create a runnable "exploded" image)
-	$(info .  make all               # Compile everything, all repos, docs and images)
-	$(info .  make images            # Create complete jdk and jre images)
-	$(info .  make <phase>           # Compile the specified phase and everything it depends on)
-	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info .  make *-only            # Applies to most targets and disables compling the)
-	$(info .                         # dependencies for the target. This is faster but may)
-	$(info .                         # result in incorrect build results!)
-	$(info .  make docs              # Create all docs)
-	$(info .  make docs-javadoc      # Create just javadocs, depends on less than full docs)
-	$(info .  make profiles          # Create complete jre compact profile images)
-	$(info .  make bootcycle-images  # Build images twice, second time with newly built JDK)
-	$(info .  make install           # Install the generated images locally)
-	$(info .  make reconfigure       # Rerun configure with the same arguments as last time)
-	$(info .  make help              # Give some help on using make)
-	$(info .  make test              # Run tests, default is all tests (see TEST below))
+	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
+	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
+	$(info $(_) make all               # Compile everything, all repos, docs and images)
+	$(info $(_) make images            # Create complete j2sdk and j2re images)
+	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
+	$(info $(_) make *-only            # Applies to most targets and disables compling the)
+	$(info $(_)                        # dependencies for the target. This is faster but may)
+	$(info $(_)                        # result in incorrect build results!)
+	$(info $(_) make docs              # Create all docs)
+	$(info $(_) make docs-javadoc      # Create just javadocs, depends on less than full docs)
+	$(info $(_) make profiles          # Create complete j2re compact profile images)
+	$(info $(_) make bootcycle-images  # Build images twice, second time with newly built JDK)
+	$(info $(_) make install           # Install the generated images locally)
+	$(info $(_) make reconfigure       # Rerun configure with the same arguments as last time)
+	$(info $(_) make help              # Give some help on using make)
+	$(info $(_) make test              # Run tests, default is all tests (see TEST below))
 	$(info )
 	$(info Targets for cleaning)
-	$(info .  make clean             # Remove all files generated by make, but not those)
-	$(info .                         # generated by configure)
-	$(info .  make dist-clean        # Remove all files, including configuration)
-	$(info .  make clean-<outputdir> # Remove the subdir in the output dir with the name)
-	$(info .  make clean-<phase>     # Remove all build results related to a certain build)
-	$(info .                         # phase (gensrc, java, libs, launchers))
-	$(info .  make clean-<module>    # Remove all build results related to a certain module)
-	$(info .  make clean-<module>-<phase> # Remove all build results related to a certain)
-	$(info .                         # module and phase)
+	$(info $(_) make clean             # Remove all files generated by make, but not those)
+	$(info $(_)                        # generated by configure)
+	$(info $(_) make dist-clean        # Remove all files, including configuration)
+	$(info $(_) make clean-<outputdir> # Remove the subdir in the output dir with the name)
+	$(info $(_) make clean-<phase>     # Remove all build results related to a certain build)
+	$(info $(_)                        # phase (gensrc, java, libs, launchers))
+	$(info $(_) make clean-<module>    # Remove all build results related to a certain module)
+	$(info $(_) make clean-<module>-<phase> # Remove all build results related to a certain)
+	$(info $(_)                        # module and phase)
 	$(info )
 	$(info Targets for specific modules)
-	$(info .  make <module>          # Build <module> and everything it depends on. )
-	$(info .  make <module>-<phase>  # Compile the specified phase for the specified module)
-	$(info .                         # and everything it depends on)
-	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info )
-	$(info Useful make variables)
-	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
-	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
-	$(info .                         # <substring>)
+	$(info $(_) make <module>          # Build <module> and everything it depends on.)
+	$(info $(_) make <module>-<phase>  # Compile the specified phase for the specified module)
+	$(info $(_)                        # and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
 	$(info )
-	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
-	$(info .                         # Available log levels are:)
-	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
-	$(info .                         # To see executed command lines, use LOG=debug)
-	$(info )
-	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
-	$(info .                         # Note that -jN does not work as expected!)
-	$(info )
-	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
-	$(info .                         # make test TEST="jdk_lang jdk_net")
+	$(info Make control variables)
+	$(info $(_) CONF=                  # Build all configurations (note, assignment is empty))
+	$(info $(_) CONF=<substring>       # Build the configuration(s) with a name matching)
+	$(info $(_)                        # <substring>)
+	$(info $(_) SPEC=<spec file>       # Build the configuration given by the spec file)
+	$(info $(_) LOG=<loglevel>         # Change the log level from warn to <loglevel>)
+	$(info $(_)                        # Available log levels are:)
+	$(info $(_)                        # 'warn' (default), 'info', 'debug' and 'trace')
+	$(info $(_)                        # To see executed command lines, use LOG=debug)
+	$(info $(_) JOBS=<n>               # Run <n> parallel make jobs)
+	$(info $(_)                        # Note that -jN does not work as expected!)
+	$(info $(_) IGNORE_OLD_CONFIG=true # Skip tests if spec file is up to date)
+	$(info $(_) make test TEST=<test>  # Only run the given test or tests, e.g.)
+	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
 	$(info )
 
 .PHONY: help
--- a/common/autoconf/basics.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/basics.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -899,10 +899,6 @@
   fi
   AC_SUBST(IS_GNU_TIME)
 
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    BASIC_REQUIRE_PROGS(COMM, comm)
-  fi
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     BASIC_REQUIRE_PROGS(DSYMUTIL, dsymutil)
     BASIC_REQUIRE_PROGS(XATTR, xattr)
--- a/common/autoconf/flags.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/flags.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -558,15 +558,23 @@
     CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
-    -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
-    -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
-    -DWIN32 -DIAL"
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK \
+        -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+        -DWIN32_LEAN_AND_MEAN \
+        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
+        -DWIN32 -DIAL"
     if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
     else
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
     fi
+    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
+    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
+    # studio.
+    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
+      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
+          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+    fi
   fi
 
   ###############################################################################
--- a/common/autoconf/generated-configure.sh	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 20:20:43 2017 +0200
@@ -646,6 +646,7 @@
 ENABLE_INTREE_EC
 SALIB_NAME
 HOTSPOT_MAKE_ARGS
+MSVCP_DLL
 MSVCR_DLL
 LIBCXX
 LLVM_LIBS
@@ -1079,6 +1080,7 @@
 with_override_jdk
 with_import_hotspot
 with_toolchain_type
+with_toolchain_version
 with_jtreg
 with_extra_cflags
 with_extra_cxxflags
@@ -1103,6 +1105,7 @@
 with_zlib
 with_stdc__lib
 with_msvcr_dll
+with_msvcp_dll
 with_dxsdk
 with_dxsdk_lib
 with_dxsdk_include
@@ -1934,6 +1937,10 @@
                           source
   --with-toolchain-type   the toolchain type (or family) to use, use '--help'
                           to show possible values [platform dependent]
+  --with-toolchain-version
+                          the version of the toolchain to look for, use
+                          '--help' to show possible values [platform
+                          dependent]
   --with-jtreg            Regression Test Harness [probed]
   --with-extra-cflags     extra flags to be used when compiling jdk c-files
   --with-extra-cxxflags   extra flags to be used when compiling jdk c++-files
@@ -1969,8 +1976,10 @@
                           force linking of the C++ runtime on Linux to either
                           static or dynamic, default is static with dynamic as
                           fallback
-  --with-msvcr-dll        copy this msvcr100.dll into the built JDK (Windows
-                          only) [probed]
+  --with-msvcr-dll        path to microsoft C runtime dll (msvcr*.dll)
+                          (Windows only) [probed]
+  --with-msvcp-dll        path to microsoft C++ runtime dll (msvcp*.dll)
+                          (Windows only) [probed]
   --with-dxsdk            Deprecated. Option is kept for backwards
                           compatibility and is ignored
   --with-dxsdk-lib        Deprecated. Option is kept for backwards
@@ -4309,12 +4318,59 @@
 # questions.
 #
 
-
-
-
-
-
-
+################################################################################
+
+VALID_VS_VERSIONS="2010 2012 2013"
+
+VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
+VS_VERSION_INTERNAL_2010=100
+VS_MSVCR_2010=msvcr100.dll
+# We don't use msvcp on Visual Studio 2010
+#VS_MSVCP_2010=msvcp100.dll
+VS_ENVVAR_2010="VS100COMNTOOLS"
+VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
+VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
+VS_VS_PLATFORM_NAME_2010="v100"
+VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
+
+VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
+VS_VERSION_INTERNAL_2012=110
+VS_MSVCR_2012=msvcr110.dll
+VS_MSVCP_2012=msvcp110.dll
+VS_ENVVAR_2012="VS110COMNTOOLS"
+VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
+VS_SDK_INSTALLDIR_2012=
+VS_VS_PLATFORM_NAME_2012="v110"
+VS_SDK_PLATFORM_NAME_2012=
+
+VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
+VS_VERSION_INTERNAL_2013=120
+VS_MSVCR_2013=msvcr120.dll
+VS_MSVCP_2013=msvcp120.dll
+VS_ENVVAR_2013="VS120COMNTOOLS"
+VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
+VS_SDK_INSTALLDIR_2013=
+VS_VS_PLATFORM_NAME_2013="v120"
+VS_SDK_PLATFORM_NAME_2013=
+
+################################################################################
+
+
+
+################################################################################
+
+
+
+################################################################################
+# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
+# build environment and assigns it to VS_ENV_CMD
+
+
+################################################################################
+
+
+
+################################################################################
 # Check if the VS env variables were setup prior to running configure.
 # If not, then find vcvarsall.bat and run it automatically, and integrate
 # the set env variables into the spec file.
@@ -4329,13 +4385,15 @@
 
 
 
+
+
 # This line needs to be here, verbatim, after all includes and the dummy hook
 # definitions. It is replaced with custom functionality when building
 # custom sources.
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1423567509
+DATE_WHEN_GENERATED=1424202275
 
 ###############################################################################
 #
@@ -18830,202 +18888,6 @@
   fi
 
 
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-
-
-
-  # Publish this variable in the help.
-
-
-  if test "x$COMM" = x; then
-    # The variable is not set by user, try to locate tool using the code snippet
-    for ac_prog in comm
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$COMM" && break
-done
-
-  else
-    # The variable is set, but is it from the command line or the environment?
-
-    # Try to remove the string !COMM! from our list.
-    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!COMM!/}
-    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
-      # If it failed, the variable was not from the command line. Ignore it,
-      # but warn the user (except for BASH, which is always set by the calling BASH).
-      if test "xCOMM" != xBASH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of COMM from the environment. Use command line variables instead." >&5
-$as_echo "$as_me: WARNING: Ignoring value of COMM from the environment. Use command line variables instead." >&2;}
-      fi
-      # Try to locate tool using the code snippet
-      for ac_prog in comm
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$COMM" && break
-done
-
-    else
-      # If it succeeded, then it was overridden by the user. We will use it
-      # for the tool.
-
-      # First remove it from the list of overridden variables, so we can test
-      # for unknown variables in the end.
-      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
-
-      # Check if the provided tool contains a complete path.
-      tool_specified="$COMM"
-      tool_basename="${tool_specified##*/}"
-      if test "x$tool_basename" = "x$tool_specified"; then
-        # A command without a complete path is provided, search $PATH.
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool COMM=$tool_basename" >&5
-$as_echo "$as_me: Will search for user supplied tool COMM=$tool_basename" >&6;}
-        # Extract the first word of "$tool_basename", so it can be a program name with args.
-set dummy $tool_basename; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test "x$COMM" = x; then
-          as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
-        fi
-      else
-        # Otherwise we believe it is a complete path. Use it as it is.
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool COMM=$tool_specified" >&5
-$as_echo "$as_me: Will use user supplied tool COMM=$tool_specified" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for COMM" >&5
-$as_echo_n "checking for COMM... " >&6; }
-        if test ! -x "$tool_specified"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-          as_fn_error $? "User supplied tool COMM=$tool_specified does not exist or is not executable" "$LINENO" 5
-        fi
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
-$as_echo "$tool_specified" >&6; }
-      fi
-    fi
-  fi
-
-
-
-  if test "x$COMM" = x; then
-    as_fn_error $? "Could not find required tool for COMM" "$LINENO" 5
-  fi
-
-
-  fi
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
 
 
@@ -26700,86 +26562,177 @@
 
   # First-hand choice is to locate and run the vsvars bat file.
 
-  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
-    VCVARSFILE="vc/bin/vcvars32.bat"
-  else
-    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+
+# Check whether --with-toolchain-version was given.
+if test "${with_toolchain_version+set}" = set; then :
+  withval=$with_toolchain_version;
+fi
+
+
+  if test "x$with_toolchain_version" = xlist; then
+    # List all toolchains
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The following toolchain versions are valid on this platform:" >&5
+$as_echo "$as_me: The following toolchain versions are valid on this platform:" >&6;}
+    for version in $VALID_VS_VERSIONS; do
+      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
+      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
+    done
+
+    exit 0
+  elif test "x$with_toolchain_version" != x; then
+    # User override; check that it is valid
+    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Visual Studio version $with_toolchain_version is not valid." >&5
+$as_echo "$as_me: Visual Studio version $with_toolchain_version is not valid." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&5
+$as_echo "$as_me: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&6;}
+      as_fn_error $? "Cannot continue." "$LINENO" 5
+    fi
+    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
+  else
+    # No flag given, use default
+    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
+  fi
+
+  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
+
+  VS_VERSION="$VS_VERSION"
+  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
+  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
+  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
+  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
+
+  # When using --with-tools-dir, assume it points to the correct and default
+  # version of Visual Studio or that --with-toolchain-version was also set.
+  if test "x$with_tools_dir" != x; then
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="$with_tools_dir/../.."
+    METHOD="--with-tools-dir"
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
+        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
+        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="$with_tools_dir/../../.."
+    METHOD="--with-tools-dir"
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
+        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
+        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+    if test "x$VS_ENV_CMD" = x; then
+      # Having specified an argument which is incorrect will produce an instant failure;
+      # we should not go on looking
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path given by --with-tools-dir does not contain a valid" >&5
+$as_echo "$as_me: The path given by --with-tools-dir does not contain a valid" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Visual Studio installation. Please point to the VC/bin or VC/bin/amd64" >&5
+$as_echo "$as_me: Visual Studio installation. Please point to the VC/bin or VC/bin/amd64" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: directory within the Visual Studio installation" >&5
+$as_echo "$as_me: directory within the Visual Studio installation" >&6;}
+      as_fn_error $? "Cannot locate a valid Visual Studio installation" "$LINENO" 5
+    fi
   fi
 
   VS_ENV_CMD=""
   VS_ENV_ARGS=""
-  if test "x$with_toolsdir" != x; then
+
+  if test "x$VS_COMNTOOLS" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$with_toolsdir/../.."
-    METHOD="--with-tools-dir"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="$VS_COMNTOOLS/../.."
+    METHOD="$VS_COMNTOOLS_VAR variable"
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
-$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
-      fi
-    fi
-  fi
-
-  fi
-
-  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
-    # Having specified an argument which is incorrect will produce an instant failure;
-    # we should not go on looking
-    { $as_echo "$as_me:${as_lineno-$LINENO}: The path given by --with-tools-dir does not contain a valid Visual Studio installation" >&5
-$as_echo "$as_me: The path given by --with-tools-dir does not contain a valid Visual Studio installation" >&6;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Please point to the VC/bin directory within the Visual Studio installation" >&5
-$as_echo "$as_me: Please point to the VC/bin directory within the Visual Studio installation" >&6;}
-    as_fn_error $? "Cannot locate a valid Visual Studio installation" "$LINENO" 5
-  fi
-
-  if test "x$VS100COMNTOOLS" != x; then
-
-  if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$VS100COMNTOOLS/../.."
-    METHOD="VS100COMNTOOLS variable"
-
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
-        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
-        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
 $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
       fi
@@ -26790,30 +26743,80 @@
   if test "x$PROGRAMFILES" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$PROGRAMFILES/Microsoft Visual Studio 10.0"
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="$PROGRAMFILES/$VS_INSTALL_DIR"
     METHOD="well-known name"
 
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
+$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
+      fi
+    fi
+  fi
+
+  fi
+  # Work around the insanely named ProgramFiles(x86) env variable
+  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
+  if test "x$PROGRAMFILES_X86" != x; then
+
+  if test "x$VS_ENV_CMD" = x; then
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="$PROGRAMFILES_X86/$VS_INSTALL_DIR"
+    METHOD="well-known name"
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
+        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
+        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
 $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
       fi
@@ -26823,30 +26826,37 @@
   fi
 
   if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="C:/Program Files/Microsoft Visual Studio 10.0"
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="C:/Program Files/$VS_INSTALL_DIR"
     METHOD="well-known name"
 
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
 $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
       fi
@@ -26855,30 +26865,37 @@
 
 
   if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="C:/Program Files (x86)/Microsoft Visual Studio 10.0"
+    VS_VERSION="${VS_VERSION}"
+    VS_BASE="C:/Program Files (x86)/$VS_INSTALL_DIR"
     METHOD="well-known name"
 
-  windows_path="$VS100BASE"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    VS100BASE="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    VS100BASE="$unix_path"
-  fi
-
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+
+
+  windows_path="$VS_BASE"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    VS_BASE="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    VS_BASE="$unix_path"
+  fi
+
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
-$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
+$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
 $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
       fi
@@ -26886,10 +26903,12 @@
   fi
 
 
-  if test "x$ProgramW6432" != x; then
+  if test "x$SDK_INSTALL_DIR" != x; then
+    if test "x$ProgramW6432" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin"
+    VS_VERSION="${VS_VERSION}"
+    WIN_SDK_BASE="$ProgramW6432/$SDK_INSTALL_DIR"
     METHOD="well-known name"
 
   windows_path="$WIN_SDK_BASE"
@@ -26904,15 +26923,15 @@
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
 $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -26921,7 +26940,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
@@ -26931,11 +26950,12 @@
     fi
   fi
 
-  fi
-  if test "x$PROGRAMW6432" != x; then
+    fi
+    if test "x$PROGRAMW6432" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin"
+    VS_VERSION="${VS_VERSION}"
+    WIN_SDK_BASE="$PROGRAMW6432/$SDK_INSTALL_DIR"
     METHOD="well-known name"
 
   windows_path="$WIN_SDK_BASE"
@@ -26950,15 +26970,15 @@
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
 $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -26967,7 +26987,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
@@ -26977,11 +26997,12 @@
     fi
   fi
 
-  fi
-  if test "x$PROGRAMFILES" != x; then
+    fi
+    if test "x$PROGRAMFILES" != x; then
 
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin"
+    VS_VERSION="${VS_VERSION}"
+    WIN_SDK_BASE="$PROGRAMFILES/$SDK_INSTALL_DIR"
     METHOD="well-known name"
 
   windows_path="$WIN_SDK_BASE"
@@ -26996,15 +27017,15 @@
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
 $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -27013,7 +27034,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
@@ -27023,10 +27044,11 @@
     fi
   fi
 
-  fi
+    fi
 
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin"
+    VS_VERSION="${VS_VERSION}"
+    WIN_SDK_BASE="C:/Program Files/$SDK_INSTALL_DIR"
     METHOD="well-known name"
 
   windows_path="$WIN_SDK_BASE"
@@ -27041,15 +27063,15 @@
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
 $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -27058,7 +27080,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
@@ -27070,7 +27092,8 @@
 
 
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin"
+    VS_VERSION="${VS_VERSION}"
+    WIN_SDK_BASE="C:/Program Files (x86)/$SDK_INSTALL_DIR"
     METHOD="well-known name"
 
   windows_path="$WIN_SDK_BASE"
@@ -27085,15 +27108,15 @@
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
 $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -27102,7 +27125,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
 $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
@@ -27112,6 +27135,21 @@
     fi
   fi
 
+  fi
+
+    if test "x$VS_ENV_CMD" != x; then
+      TOOLCHAIN_VERSION=$VS_VERSION
+      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
+      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
+      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
+      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
+      # The rest of the variables are already evaled while probing
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Found $VS_DESCRIPTION" >&5
+$as_echo "$as_me: Found $VS_DESCRIPTION" >&6;}
+      break
+    fi
+  done
+
 
   if test "x$VS_ENV_CMD" != x; then
     # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
@@ -41034,8 +41072,8 @@
     CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
     if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
-      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
-        as_fn_error $? "Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for \"$COMPILER_CPU_TEST\"; expected \"80x86\"." "$LINENO" 5
+      if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
+        as_fn_error $? "Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for \"$COMPILER_CPU_TEST\"; expected \"80x86\" or \"x86\"." "$LINENO" 5
       fi
     elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
       if test "x$COMPILER_CPU_TEST" != "xx64"; then
@@ -42683,15 +42721,23 @@
     CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
-    -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
-    -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
-    -DWIN32 -DIAL"
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK \
+        -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+        -DWIN32_LEAN_AND_MEAN \
+        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
+        -DWIN32 -DIAL"
     if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
     else
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
     fi
+    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
+    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
+    # studio.
+    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
+      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
+          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+    fi
   fi
 
   ###############################################################################
@@ -49842,16 +49888,17 @@
   if test "x$with_msvcr_dll" != x; then
     # If given explicitely by user, do not probe. If not present, fail directly.
 
-  POSSIBLE_MSVCR_DLL="$with_msvcr_dll"
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$with_msvcr_dll"
   METHOD="--with-msvcr-dll"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -49867,28 +49914,32 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-    if test "x$MSVCR_DLL" = x; then
-      as_fn_error $? "Could not find a proper msvcr100.dll as specified by --with-msvcr-dll" "$LINENO" 5
-    fi
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    if test "x$MSVC_DLL" = x; then
+      as_fn_error $? "Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll" "$LINENO" 5
+    fi
+  else
+
+  VAR_NAME="MSVCR_DLL"
+  DLL_NAME="${MSVCR_NAME}"
+  MSVC_DLL=
+
+  if test "x$MSVC_DLL" = x; then
     # Probe: Using well-known location from Visual Studio 10.0
     if test "x$VCINSTALLDIR" != x; then
       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
@@ -49903,21 +49954,23 @@
   fi
 
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
-      else
-        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
-      fi
-
-  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
+      else
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
+      fi
+      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   METHOD="well-known location in VCINSTALLDIR"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -49933,39 +49986,40 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-    fi
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
     # Probe: Check in the Boot JDK directory.
-    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
-
-  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   METHOD="well-known location in Boot JDK"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -49981,25 +50035,25 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+  fi
+
+  if test "x$MSVC_DLL" = x; then
     # Probe: Look in the Windows system32 directory
     CYGWIN_SYSTEMROOT="$SYSTEMROOT"
 
@@ -50012,18 +50066,19 @@
     CYGWIN_SYSTEMROOT="$unix_path"
   fi
 
-    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
-
-  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   METHOD="well-known location in SYSTEMROOT"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -50039,25 +50094,25 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+  fi
+
+  if test "x$MSVC_DLL" = x; then
     # Probe: If Visual Studio Express is installed, there is usually one with the debugger
     if test "x$VS100COMNTOOLS" != x; then
       CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
@@ -50072,21 +50127,24 @@
   fi
 
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
-      else
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
-      fi
-
-  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x64/ | $HEAD --lines 1`
+      else
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x86/ | $HEAD --lines 1`
+      fi
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   METHOD="search of VS100COMNTOOLS"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -50102,50 +50160,54 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-    fi
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
     # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
-    # (This was the original behaviour; kept since it might turn up something)
+    # (This was the original behaviour; kept since it might turn something up)
     if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
-      else
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
-        if test "x$POSSIBLE_MSVCR_DLL" = x; then
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x64 | $HEAD --lines 1`
+      else
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
+        if test "x$POSSIBLE_MSVC_DLL" = x; then
           # We're grasping at straws now...
-          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
-        fi
-      fi
-
-
-  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	      | $HEAD --lines 1`
+        fi
+      fi
+
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   METHOD="search of VCINSTALLDIR"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
-$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
 
     # Need to check if the found msvcr is correct architecture
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
-$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -50161,33 +50223,34 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
 $as_echo "incorrect, ignoring" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
-$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
-    fi
-  fi
-
-    fi
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-    as_fn_error $? "Could not find msvcr100.dll. Please specify using --with-msvcr-dll." "$LINENO" 5
-  fi
-
+    as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5
+  fi
+
+  MSVCR_DLL=$MSVC_DLL
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -50310,6 +50373,512 @@
     MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`"
   fi
 
+  MSVCR_DLL=$MSVCR_DLL
+
+
+  fi
+
+
+# Check whether --with-msvcp-dll was given.
+if test "${with_msvcp_dll+set}" = set; then :
+  withval=$with_msvcp_dll;
+fi
+
+
+  if test "x$MSVCP_NAME" != "x"; then
+    if test "x$with_msvcp_dll" != x; then
+      # If given explicitely by user, do not probe. If not present, fail directly.
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$with_msvcp_dll"
+  METHOD="--with-msvcp-dll"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+      if test "x$MSVC_DLL" = x; then
+        as_fn_error $? "Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll" "$LINENO" 5
+      fi
+    else
+
+  VAR_NAME="MSVCP_DLL"
+  DLL_NAME="${MSVCP_NAME}"
+  MSVC_DLL=
+
+  if test "x$MSVC_DLL" = x; then
+    # Probe: Using well-known location from Visual Studio 10.0
+    if test "x$VCINSTALLDIR" != x; then
+      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
+
+  windows_path="$CYGWIN_VC_INSTALL_DIR"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    CYGWIN_VC_INSTALL_DIR="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    CYGWIN_VC_INSTALL_DIR="$unix_path"
+  fi
+
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
+      else
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
+      fi
+      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
+  METHOD="well-known location in VCINSTALLDIR"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    # Probe: Check in the Boot JDK directory.
+    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
+  METHOD="well-known location in Boot JDK"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    # Probe: Look in the Windows system32 directory
+    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
+
+  windows_path="$CYGWIN_SYSTEMROOT"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    CYGWIN_SYSTEMROOT="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    CYGWIN_SYSTEMROOT="$unix_path"
+  fi
+
+    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
+  METHOD="well-known location in SYSTEMROOT"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
+    if test "x$VS100COMNTOOLS" != x; then
+      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
+
+  windows_path="$CYGWIN_VS_TOOLS_DIR"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    CYGWIN_VS_TOOLS_DIR="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    CYGWIN_VS_TOOLS_DIR="$unix_path"
+  fi
+
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x64/ | $HEAD --lines 1`
+      else
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x86/ | $HEAD --lines 1`
+      fi
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
+  METHOD="search of VS100COMNTOOLS"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
+    # (This was the original behaviour; kept since it might turn something up)
+    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x64 | $HEAD --lines 1`
+      else
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
+        if test "x$POSSIBLE_MSVC_DLL" = x; then
+          # We're grasping at straws now...
+          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	      | $HEAD --lines 1`
+        fi
+      fi
+
+
+  DLL_NAME="$DLL_NAME"
+  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
+  METHOD="search of VCINSTALLDIR"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
+$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
+
+    # Need to check if the found msvcr is correct architecture
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
+$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
+      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH="PE32 executable"
+      else
+        CORRECT_MSVCR_ARCH="PE32+ executable"
+      fi
+    else
+      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+        CORRECT_MSVCR_ARCH=386
+      else
+        CORRECT_MSVCR_ARCH=x86-64
+      fi
+    fi
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
+$as_echo "$MSVC_DLL" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
+    fi
+  fi
+
+    fi
+  fi
+
+  if test "x$MSVC_DLL" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
+$as_echo_n "checking for $DLL_NAME... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5
+  fi
+
+  MSVCP_DLL=$MSVC_DLL
+
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$MSVCP_DLL"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of MSVCP_DLL" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-stile (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    MSVCP_DLL="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;}
+  fi
+
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$MSVCP_DLL"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    MSVCP_DLL="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+  else
+    # We're on a unix platform. Hooray! :)
+    path="$MSVCP_DLL"
+    has_space=`$ECHO "$path" | $GREP " "`
+    if test "x$has_space" != x; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;}
+      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+    fi
+
+    # Use eval to expand a potential ~
+    eval path="$path"
+    if test ! -f "$path" && test ! -d "$path"; then
+      as_fn_error $? "The path of MSVCP_DLL, which resolves as \"$path\", is not found." "$LINENO" 5
+    fi
+
+    MSVCP_DLL="`cd "$path"; $THEPWDCMD -L`"
+  fi
+
+  MSVCP_DLL=$MSVCP_DLL
+
+
+    fi
+  fi
 
 
 
@@ -50341,7 +50910,6 @@
   fi
 
 
-
 ###############################################################################
 #
 # We need to do some final tweaking, when everything else is done.
@@ -52470,7 +53038,10 @@
     printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
   fi
   printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
-  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
+  if test "x$TOOLCHAIN_VERSION" != "x"; then
+    print_version=" $TOOLCHAIN_VERSION"
+  fi
+  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
   printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
   printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
 
--- a/common/autoconf/help.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/help.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -209,7 +209,10 @@
     printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
   fi
   printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
-  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
+  if test "x$TOOLCHAIN_VERSION" != "x"; then
+    print_version=" $TOOLCHAIN_VERSION"
+  fi
+  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" 
   printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
   printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
 
--- a/common/autoconf/libraries.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/libraries.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -1124,10 +1124,9 @@
 AC_DEFUN_ONCE([LIB_SETUP_ON_WINDOWS],
 [
   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    TOOLCHAIN_SETUP_MSVCR_DLL
+    TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
     BASIC_DEPRECATED_ARG_WITH([dxsdk])
     BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
     BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
   fi
-  AC_SUBST(MSVCR_DLL)
 ])
--- a/common/autoconf/spec.gmk.in	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 20:20:43 2017 +0200
@@ -583,6 +583,7 @@
 USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
 LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
 MSVCR_DLL:=@MSVCR_DLL@
+MSVCP_DLL:=@MSVCP_DLL@
 
 
 # ADD_SRCS takes a single argument with source roots
--- a/common/autoconf/toolchain.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -691,8 +691,8 @@
     CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
     if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
-      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
-        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
+      if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
+        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".])
       fi
     elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
       if test "x$COMPILER_CPU_TEST" != "xx64"; then
--- a/common/autoconf/toolchain_windows.m4	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/autoconf/toolchain_windows.m4	Wed Jul 05 20:20:43 2017 +0200
@@ -23,43 +23,90 @@
 # questions.
 #
 
+################################################################################
+
+VALID_VS_VERSIONS="2010 2012 2013"
+
+VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
+VS_VERSION_INTERNAL_2010=100
+VS_MSVCR_2010=msvcr100.dll
+# We don't use msvcp on Visual Studio 2010
+#VS_MSVCP_2010=msvcp100.dll
+VS_ENVVAR_2010="VS100COMNTOOLS"
+VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
+VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
+VS_VS_PLATFORM_NAME_2010="v100"
+VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
+
+VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
+VS_VERSION_INTERNAL_2012=110
+VS_MSVCR_2012=msvcr110.dll
+VS_MSVCP_2012=msvcp110.dll
+VS_ENVVAR_2012="VS110COMNTOOLS"
+VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
+VS_SDK_INSTALLDIR_2012=
+VS_VS_PLATFORM_NAME_2012="v110"
+VS_SDK_PLATFORM_NAME_2012=
+
+VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
+VS_VERSION_INTERNAL_2013=120
+VS_MSVCR_2013=msvcr120.dll
+VS_MSVCP_2013=msvcp120.dll
+VS_ENVVAR_2013="VS120COMNTOOLS"
+VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
+VS_SDK_INSTALLDIR_2013=
+VS_VS_PLATFORM_NAME_2013="v120"
+VS_SDK_PLATFORM_NAME_2013=
+
+################################################################################
+
 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
 [
   if test "x$VS_ENV_CMD" = x; then
-    VS100BASE="$1"
-    METHOD="$2"
-    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
-    if test -d "$VS100BASE"; then
-      if test -f "$VS100BASE/$VCVARSFILE"; then
-        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
-        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+    VS_VERSION="$1"
+    VS_BASE="$2"
+    METHOD="$3"
+
+    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+      VCVARSFILE="vc/bin/vcvars32.bat"
+    else
+      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+    fi
+  
+    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
+    if test -d "$VS_BASE"; then
+      if test -f "$VS_BASE/$VCVARSFILE"; then
+        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
+        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
-        # TODO: improve detection for other versions of VS
-        PLATFORM_TOOLSET="v100"
+        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
       else
-        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
+        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
         AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
       fi
     fi
   fi
 ])
 
+################################################################################
+
 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
 [
   if test "x$VS_ENV_CMD" = x; then
-    WIN_SDK_BASE="$1"
-    METHOD="$2"
+    VS_VERSION="$1"
+    WIN_SDK_BASE="$2"
+    METHOD="$3"
     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
     if test -d "$WIN_SDK_BASE"; then
       # There have been cases of partial or broken SDK installations. A missing
       # lib dir is not going to work.
-      if test ! -d "$WIN_SDK_BASE/../lib"; then
+      if test ! -d "$WIN_SDK_BASE/lib"; then
         AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
         AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
-      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
+      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
         AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
-        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
+        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
         if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
           VS_ENV_ARGS="/x86"
         else
@@ -68,7 +115,7 @@
         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
         # TODO: improve detection for other versions of SDK
-        PLATFORM_TOOLSET="Windows7.1SDK"
+        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
       else
         AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
         AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
@@ -77,50 +124,121 @@
   fi
 ])
 
+################################################################################
+# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
+# build environment and assigns it to VS_ENV_CMD
 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
 [
-  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
-    VCVARSFILE="vc/bin/vcvars32.bat"
-  else
-    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
+  VS_VERSION="$1"
+  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
+  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
+  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
+  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
+
+  # When using --with-tools-dir, assume it points to the correct and default
+  # version of Visual Studio or that --with-toolchain-version was also set.
+  if test "x$with_tools_dir" != x; then
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+        [$with_tools_dir/../..], [--with-tools-dir])
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+        [$with_tools_dir/../../..], [--with-tools-dir])
+    if test "x$VS_ENV_CMD" = x; then
+      # Having specified an argument which is incorrect will produce an instant failure;
+      # we should not go on looking
+      AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
+      AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
+      AC_MSG_NOTICE([directory within the Visual Studio installation])
+      AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
+    fi
   fi
 
   VS_ENV_CMD=""
   VS_ENV_ARGS=""
-  if test "x$with_toolsdir" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
-  fi
 
-  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
-    # Having specified an argument which is incorrect will produce an instant failure;
-    # we should not go on looking
-    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
-    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
-    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
-  fi
-
-  if test "x$VS100COMNTOOLS" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
+  if test "x$VS_COMNTOOLS" != x; then
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+        [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
   fi
   if test "x$PROGRAMFILES" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+        [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
   fi
-  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
-  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
-
-  if test "x$ProgramW6432" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
+  # Work around the insanely named ProgramFiles(x86) env variable
+  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
+  if test "x$PROGRAMFILES_X86" != x; then
+    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+        [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
   fi
-  if test "x$PROGRAMW6432" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
+  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+      [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
+  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
+      [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
+
+  if test "x$SDK_INSTALL_DIR" != x; then
+    if test "x$ProgramW6432" != x; then
+      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
+          [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
+    fi
+    if test "x$PROGRAMW6432" != x; then
+      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
+          [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
+    fi
+    if test "x$PROGRAMFILES" != x; then
+      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
+          [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
+    fi
+    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
+        [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
+    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
+        [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
   fi
-  if test "x$PROGRAMFILES" != x; then
-    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
-  fi
-  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
-  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
 ])
 
+################################################################################
+
+AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
+[
+  AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
+      [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
+
+  if test "x$with_toolchain_version" = xlist; then
+    # List all toolchains
+    AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
+    for version in $VALID_VS_VERSIONS; do
+      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
+      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
+    done
+
+    exit 0
+  elif test "x$with_toolchain_version" != x; then
+    # User override; check that it is valid
+    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
+      AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
+      AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
+      AC_MSG_ERROR([Cannot continue.])
+    fi
+    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
+  else
+    # No flag given, use default
+    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
+  fi
+
+  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
+    TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
+    if test "x$VS_ENV_CMD" != x; then
+      TOOLCHAIN_VERSION=$VS_VERSION
+      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
+      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
+      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
+      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
+      # The rest of the variables are already evaled while probing
+      AC_MSG_NOTICE([Found $VS_DESCRIPTION])
+      break
+    fi
+  done
+])
+
+################################################################################
 # Check if the VS env variables were setup prior to running configure.
 # If not, then find vcvarsall.bat and run it automatically, and integrate
 # the set env variables into the spec file.
@@ -142,7 +260,8 @@
   fi
 
   # First-hand choice is to locate and run the vsvars bat file.
-  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
+  TOOLCHAIN_FIND_VISUAL_STUDIO
+
   if test "x$VS_ENV_CMD" != x; then
     # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
     BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
@@ -262,16 +381,17 @@
   fi
 ])
 
-AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
+AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
 [
-  POSSIBLE_MSVCR_DLL="$1"
-  METHOD="$2"
-  if test -e "$POSSIBLE_MSVCR_DLL"; then
-    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
-
+  DLL_NAME="$1"
+  POSSIBLE_MSVC_DLL="$2"
+  METHOD="$3"
+  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
+    AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD])
+    
     # Need to check if the found msvcr is correct architecture
-    AC_MSG_CHECKING([found msvcr100.dll architecture])
-    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+    AC_MSG_CHECKING([found $1 architecture])
+    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
@@ -287,96 +407,135 @@
         CORRECT_MSVCR_ARCH=x86-64
       fi
     fi
-    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
+    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
       AC_MSG_RESULT([ok])
-      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
-      AC_MSG_CHECKING([for msvcr100.dll])
-      AC_MSG_RESULT([$MSVCR_DLL])
+      MSVC_DLL="$POSSIBLE_MSVC_DLL"
+      AC_MSG_CHECKING([for $1])
+      AC_MSG_RESULT([$MSVC_DLL])
     else
       AC_MSG_RESULT([incorrect, ignoring])
-      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
+      AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE])
     fi
   fi
 ])
 
-AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
+AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 [
-  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
-      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
+  VAR_NAME="$1"
+  DLL_NAME="$2"
+  MSVC_DLL=
 
-  if test "x$with_msvcr_dll" != x; then
-    # If given explicitely by user, do not probe. If not present, fail directly.
-    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
-    if test "x$MSVCR_DLL" = x; then
-      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
-    fi
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+  if test "x$MSVC_DLL" = x; then
     # Probe: Using well-known location from Visual Studio 10.0
     if test "x$VCINSTALLDIR" != x; then
       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
       else
-        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
+        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
       fi
-      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
+      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
+      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
+          [well-known location in VCINSTALLDIR])
     fi
   fi
 
-  if test "x$MSVCR_DLL" = x; then
+  if test "x$MSVC_DLL" = x; then
     # Probe: Check in the Boot JDK directory.
-    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
-    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
+    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
+    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
+        [well-known location in Boot JDK])
+  fi
+  
+  if test "x$MSVC_DLL" = x; then
+    # Probe: Look in the Windows system32 directory 
+    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
+    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
+    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
+    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
+        [well-known location in SYSTEMROOT])
   fi
 
-  if test "x$MSVCR_DLL" = x; then
-    # Probe: Look in the Windows system32 directory
-    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
-    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
-    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
-    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
-  fi
-
-  if test "x$MSVCR_DLL" = x; then
+  if test "x$MSVC_DLL" = x; then
     # Probe: If Visual Studio Express is installed, there is usually one with the debugger
     if test "x$VS100COMNTOOLS" != x; then
       CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x64/ | $HEAD --lines 1`
       else
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
+	    | $GREP -i /x86/ | $HEAD --lines 1`
       fi
-      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
+      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
+          [search of VS100COMNTOOLS])
     fi
   fi
-
-  if test "x$MSVCR_DLL" = x; then
+      
+  if test "x$MSVC_DLL" = x; then
     # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
-    # (This was the original behaviour; kept since it might turn up something)
+    # (This was the original behaviour; kept since it might turn something up)
     if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x64 | $HEAD --lines 1`
       else
-        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
-        if test "x$POSSIBLE_MSVCR_DLL" = x; then
+        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	    | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
+        if test "x$POSSIBLE_MSVC_DLL" = x; then
           # We're grasping at straws now...
-          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
+          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
+	      | $HEAD --lines 1`
         fi
       fi
-
-      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
+      
+      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
+          [search of VCINSTALLDIR])
     fi
   fi
+  
+  if test "x$MSVC_DLL" = x; then
+    AC_MSG_CHECKING([for $DLL_NAME])
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
+  fi
 
-  if test "x$MSVCR_DLL" = x; then
-    AC_MSG_CHECKING([for msvcr100.dll])
-    AC_MSG_RESULT([no])
-    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
+  $1=$MSVC_DLL
+  BASIC_FIXUP_PATH($1)
+  AC_SUBST($1, [$]$1)
+])
+
+AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
+[
+  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
+      [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
+
+  if test "x$with_msvcr_dll" != x; then
+    # If given explicitely by user, do not probe. If not present, fail directly.
+    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll],
+        [--with-msvcr-dll])
+    if test "x$MSVC_DLL" = x; then
+      AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
+    fi
+  else
+    TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}])
   fi
 
-  BASIC_FIXUP_PATH(MSVCR_DLL)
+  AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
+      [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
+
+  if test "x$MSVCP_NAME" != "x"; then
+    if test "x$with_msvcp_dll" != x; then
+      # If given explicitely by user, do not probe. If not present, fail directly.
+      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll],
+          [--with-msvcp-dll])
+      if test "x$MSVC_DLL" = x; then
+        AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
+      fi
+    else
+      TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}])
+    fi
+  fi
 ])
--- a/common/bin/unshuffle_list.txt	Thu Feb 19 16:36:35 2015 -0800
+++ b/common/bin/unshuffle_list.txt	Wed Jul 05 20:20:43 2017 +0200
@@ -1303,6 +1303,7 @@
 jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
 jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
 jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
+jdk/src/jdk.dev/share/classes/sun/security/tools/policytool : jdk/src/share/classes/sun/security/tools/policytool
 jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
 jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
 jdk/src/jdk.hprof.agent/share/classes/com/sun/demo/jvmti/hprof : jdk/src/share/classes/com/sun/demo/jvmti/hprof
@@ -1443,7 +1444,6 @@
 jdk/src/jdk.rmic/share/classes/sun/tools/tree : jdk/src/share/classes/sun/tools/tree
 jdk/src/jdk.rmic/share/classes/sun/tools/util : jdk/src/share/classes/sun/tools/util
 jdk/src/jdk.runtime/share/classes/com/sun/tracing : jdk/src/share/classes/com/sun/tracing
-jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool : jdk/src/share/classes/sun/security/tools/policytool
 jdk/src/jdk.runtime/share/classes/sun/tracing : jdk/src/share/classes/sun/tracing
 jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
 jdk/src/jdk.runtime/share/native/common-unpack/bands.h : jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
--- a/hotspot/.hgtags	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 20:20:43 2017 +0200
@@ -453,3 +453,4 @@
 cc775a4a24c7f5d9e624b4205e9fbd48a17331f6 jdk9-b48
 360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49
 e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50
+403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
--- a/hotspot/agent/src/os/linux/ps_proc.c	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/agent/src/os/linux/ps_proc.c	Wed Jul 05 20:20:43 2017 +0200
@@ -27,9 +27,11 @@
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <elf.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/ptrace.h>
+#include <sys/uio.h>
 #include "libproc_impl.h"
 
 #if defined(x86_64) && !defined(amd64)
@@ -138,6 +140,15 @@
    return false;
  }
  return true;
+#elif defined(PTRACE_GETREGSET)
+ struct iovec iov;
+ iov.iov_base = user;
+ iov.iov_len = sizeof(*user);
+ if (ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, (void*) &iov) < 0) {
+   print_debug("ptrace(PTRACE_GETREGSET, ...) failed for lwp %d\n", pid);
+   return false;
+ }
+ return true;
 #else
  print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n");
  return false;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Wed Jul 05 20:20:43 2017 +0200
@@ -423,12 +423,22 @@
 
     protected void writeMethods() throws IOException {
         MethodArray methods = klass.getMethods();
-        final int len = methods.length();
+        ArrayList<Method> valid_methods = new ArrayList<Method>();
+        for (int i = 0; i < methods.length(); i++) {
+            Method m = methods.at(i);
+            long accessFlags = m.getAccessFlags();
+            // overpass method
+            if (accessFlags == (JVM_ACC_PUBLIC | JVM_ACC_SYNTHETIC | JVM_ACC_BRIDGE)) {
+                continue;
+            }
+            valid_methods.add(m);
+        }
+        final int len = valid_methods.size();
         // write number of methods
         dos.writeShort((short) len);
         if (DEBUG) debugMessage("number of methods = " + len);
         for (int m = 0; m < len; m++) {
-            writeMethod(methods.at(m));
+            writeMethod(valid_methods.get(m));
         }
     }
 
--- a/hotspot/make/aix/makefiles/mapfile-vers-debug	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/aix/makefiles/mapfile-vers-debug	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/aix/makefiles/mapfile-vers-product	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/aix/makefiles/mapfile-vers-product	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug	Wed Jul 05 20:20:43 2017 +0200
@@ -60,11 +60,6 @@
                 _JVM_DefineClassWithSourceCond
                 _JVM_DesiredAssertionStatus
                 _JVM_DoPrivileged
-                _JVM_DTraceGetVersion
-                _JVM_DTraceActivate
-                _JVM_DTraceIsProbeEnabled
-                _JVM_DTraceIsSupported
-                _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
                 _JVM_FillInStackTrace
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product	Wed Jul 05 20:20:43 2017 +0200
@@ -60,11 +60,6 @@
                 _JVM_DefineClassWithSourceCond
                 _JVM_DesiredAssertionStatus
                 _JVM_DoPrivileged
-                _JVM_DTraceGetVersion
-                _JVM_DTraceActivate
-                _JVM_DTraceIsProbeEnabled
-                _JVM_DTraceIsSupported
-                _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
                 _JVM_FillInStackTrace
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-product	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-product	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/make/solaris/makefiles/dtrace.make	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/solaris/makefiles/dtrace.make	Wed Jul 05 20:20:43 2017 +0200
@@ -336,16 +336,10 @@
 
 .PHONY: dtraceCheck
 
-SYSTEM_DTRACE_H = /usr/include/dtrace.h
 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
-systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
-
-ifneq ("$(systemDtraceHdrFound)", "") 
-CFLAGS += -DHAVE_DTRACE_H
-endif
 
 ifneq ("$(patchDtraceFound)", "")
 DTRACE_PROG=$(PATCH_DTRACE_PROG)
--- a/hotspot/make/solaris/makefiles/mapfile-vers	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/make/solaris/makefiles/mapfile-vers	Wed Jul 05 20:20:43 2017 +0200
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
--- a/hotspot/src/cpu/ppc/vm/ppc.ad	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad	Wed Jul 05 20:20:43 2017 +0200
@@ -6365,58 +6365,6 @@
 // Prefetch instructions.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr(indirectMemory mem, iRegLsrc src) %{
-  match(PrefetchRead (AddP mem src));
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem, 0, $src \t// Prefetch read-many" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
-    __ dcbt($src$$Register, $mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchr_no_offset(indirectMemory mem) %{
-  match(PrefetchRead mem);
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
-    __ dcbt($mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchw(indirectMemory mem, iRegLsrc src) %{
-  match(PrefetchWrite (AddP mem src));
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many (and read)" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
-    __ dcbtst($src$$Register, $mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchw_no_offset(indirectMemory mem) %{
-  match(PrefetchWrite mem);
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
-    __ dcbtst($mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
 // Special prefetch versions which use the dcbz instruction.
 instruct prefetch_alloc_zero(indirectMemory mem, iRegLsrc src) %{
   match(PrefetchAllocation (AddP mem src));
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1436,26 +1436,6 @@
 }
 
 
-void LIR_Assembler::prefetchr(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::has_v9()) {
-    __ prefetch(from_addr, Assembler::severalReads);
-  }
-}
-
-
-void LIR_Assembler::prefetchw(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::has_v9()) {
-    __ prefetch(from_addr, Assembler::severalWritesAndPossiblyReads);
-  }
-}
-
-
 void LIR_Assembler::stack2reg(LIR_Opr src, LIR_Opr dest, BasicType type) {
   Address addr;
   if (src->is_single_word()) {
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -630,7 +630,12 @@
 
 inline void MacroAssembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) {
   relocate(a.rspec(offset));
-  ldf(w, a.base(), a.disp() + offset, d);
+  if (a.has_index()) {
+    assert(offset == 0, "");
+    ldf(w, a.base(), a.index(), d);
+  } else {
+    ldf(w, a.base(), a.disp() + offset, d);
+  }
 }
 
 // returns if membar generates anything, obviously this code should mirror
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -36,11 +36,6 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
-
-bool NativeInstruction::is_dtrace_trap() {
-  return !is_nop();
-}
-
 void NativeInstruction::set_data64_sethi(address instaddr, intptr_t x) {
   ResourceMark rm;
   CodeBuffer buf(instaddr, 10 * BytesPerInstWord );
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -51,7 +51,6 @@
     nop_instruction_size        =    4
   };
 
-  bool is_dtrace_trap();
   bool is_nop()                        { return long_at(0) == nop_instruction(); }
   bool is_call()                       { return is_op(long_at(0), Assembler::call_op); }
   bool is_sethi()                      { return (is_op2(long_at(0), Assembler::sethi_op2)
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -2758,540 +2758,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-static int  fp_offset[ConcreteRegisterImpl::number_of_registers] = { 0 };
-static bool offsets_initialized = false;
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(
-    MacroAssembler *masm, methodHandle method) {
-
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  // Skip the receiver as dtrace doesn't want to see it
-  if( !method->is_static() ) {
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      Symbol* s = ss.as_symbol_or_null();
-      if (s == vmSymbols::java_lang_String()) {
-        total_strings++;
-        out_sig_bt[total_c_args-1] = T_ADDRESS;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Byte()) {
-        out_sig_bt[total_c_args-1] = T_BYTE;
-      } else if (s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Short()) {
-        out_sig_bt[total_c_args-1] = T_SHORT;
-      } else if (s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      // We convert double to long
-      out_sig_bt[total_c_args-1] = T_LONG;
-      out_sig_bt[total_c_args++] = T_VOID;
-    } else if ( bt == T_FLOAT) {
-      // We convert float to int
-      out_sig_bt[total_c_args-1] = T_INT;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // We have received a description of where all the java arg are located
-  // on entry to the wrapper. We need to convert these args to where
-  // the a  native (non-jni) function would expect them. To figure out
-  // where they go we convert the java signature to a C signature and remove
-  // T_VOID for any long/double we might have received.
-
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots but space for storing
-  // the 1st six register arguments). It's weird see int_stk_helper.
-  //
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Plus a temp for possible converion of float/double/long register args
-
-  int conversion_temp = stack_slots;
-  stack_slots += 2;
-
-
-  // Now space for the string(s) we must convert
-
-  int string_locs = stack_slots;
-  stack_slots += total_strings *
-                   (max_dtrace_string_size / VMRegImpl::stack_slot_size);
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | temp                |
-  //      |---------------------| <- conversion_temp
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 4 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  {
-    Label L;
-    const Register temp_reg = G3_scratch;
-    AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub());
-    __ verify_oop(O0);
-    __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), temp_reg);
-    __ cmp_and_brx_short(temp_reg, G5_inline_cache_reg, Assembler::equal, Assembler::pt, L);
-
-    __ jump_to(ic_miss, temp_reg);
-    __ delayed()->nop();
-    __ align(CodeEntryAlignment);
-    __ bind(L);
-  }
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check before creating frame
-  __ generate_stack_overflow_check(stack_size);
-
-  assert(((intptr_t)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ save(SP, -stack_size, SP);
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-#ifdef ASSERT
-  bool reg_destroyed[RegisterImpl::number_of_registers];
-  bool freg_destroyed[FloatRegisterImpl::number_of_registers];
-  for ( int r = 0 ; r < RegisterImpl::number_of_registers ; r++ ) {
-    reg_destroyed[r] = false;
-  }
-  for ( int f = 0 ; f < FloatRegisterImpl::number_of_registers ; f++ ) {
-    freg_destroyed[f] = false;
-  }
-
-#endif /* ASSERT */
-
-  VMRegPair zero;
-  const Register g0 = G0; // without this we get a compiler warning (why??)
-  zero.set2(g0->as_VMReg());
-
-  int c_arg, j_arg;
-
-  Register conversion_off = noreg;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-#ifdef ASSERT
-    if (src.first()->is_Register()) {
-      assert(!reg_destroyed[src.first()->as_Register()->encoding()], "ack!");
-    } else if (src.first()->is_FloatRegister()) {
-      assert(!freg_destroyed[src.first()->as_FloatRegister()->encoding(
-                                               FloatRegisterImpl::S)], "ack!");
-    }
-    if (dst.first()->is_Register()) {
-      reg_destroyed[dst.first()->as_Register()->encoding()] = true;
-    } else if (dst.first()->is_FloatRegister()) {
-      freg_destroyed[dst.first()->as_FloatRegister()->encoding(
-                                                 FloatRegisterImpl::S)] = true;
-    }
-#endif /* ASSERT */
-
-    switch (in_sig_bt[j_arg]) {
-      case T_ARRAY:
-      case T_OBJECT:
-        {
-          if (out_sig_bt[c_arg] == T_BYTE  || out_sig_bt[c_arg] == T_SHORT ||
-              out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-            // need to unbox a one-slot value
-            Register in_reg = L0;
-            Register tmp = L2;
-            if ( src.first()->is_reg() ) {
-              in_reg = src.first()->as_Register();
-            } else {
-              assert(Assembler::is_simm13(reg2offset(src.first()) + STACK_BIAS),
-                     "must be");
-              __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, in_reg);
-            }
-            // If the final destination is an acceptable register
-            if ( dst.first()->is_reg() ) {
-              if ( dst.is_single_phys_reg() || out_sig_bt[c_arg] != T_LONG ) {
-                tmp = dst.first()->as_Register();
-              }
-            }
-
-            Label skipUnbox;
-            if ( wordSize == 4 && out_sig_bt[c_arg] == T_LONG ) {
-              __ mov(G0, tmp->successor());
-            }
-            __ br_null(in_reg, true, Assembler::pn, skipUnbox);
-            __ delayed()->mov(G0, tmp);
-
-            BasicType bt = out_sig_bt[c_arg];
-            int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-            switch (bt) {
-                case T_BYTE:
-                  __ ldub(in_reg, box_offset, tmp); break;
-                case T_SHORT:
-                  __ lduh(in_reg, box_offset, tmp); break;
-                case T_INT:
-                  __ ld(in_reg, box_offset, tmp); break;
-                case T_LONG:
-                  __ ld_long(in_reg, box_offset, tmp); break;
-                default: ShouldNotReachHere();
-            }
-
-            __ bind(skipUnbox);
-            // If tmp wasn't final destination copy to final destination
-            if (tmp == L2) {
-              VMRegPair tmp_as_VM = reg64_to_VMRegPair(L2);
-              if (out_sig_bt[c_arg] == T_LONG) {
-                long_move(masm, tmp_as_VM, dst);
-              } else {
-                move32_64(masm, tmp_as_VM, out_regs[c_arg]);
-              }
-            }
-            if (out_sig_bt[c_arg] == T_LONG) {
-              assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-              ++c_arg; // move over the T_VOID to keep the loop indices in sync
-            }
-          } else if (out_sig_bt[c_arg] == T_ADDRESS) {
-            Register s =
-                src.first()->is_reg() ? src.first()->as_Register() : L2;
-            Register d =
-                dst.first()->is_reg() ? dst.first()->as_Register() : L2;
-
-            // We store the oop now so that the conversion pass can reach
-            // while in the inner frame. This will be the only store if
-            // the oop is NULL.
-            if (s != L2) {
-              // src is register
-              if (d != L2) {
-                // dst is register
-                __ mov(s, d);
-              } else {
-                assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                          STACK_BIAS), "must be");
-                __ st_ptr(s, SP, reg2offset(dst.first()) + STACK_BIAS);
-              }
-            } else {
-                // src not a register
-                assert(Assembler::is_simm13(reg2offset(src.first()) +
-                           STACK_BIAS), "must be");
-                __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, d);
-                if (d == L2) {
-                  assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                             STACK_BIAS), "must be");
-                  __ st_ptr(d, SP, reg2offset(dst.first()) + STACK_BIAS);
-                }
-            }
-          } else if (out_sig_bt[c_arg] != T_VOID) {
-            // Convert the arg to NULL
-            if (dst.first()->is_reg()) {
-              __ mov(G0, dst.first()->as_Register());
-            } else {
-              assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                         STACK_BIAS), "must be");
-              __ st_ptr(G0, SP, reg2offset(dst.first()) + STACK_BIAS);
-            }
-          }
-        }
-        break;
-      case T_VOID:
-        break;
-
-      case T_FLOAT:
-        if (src.first()->is_stack()) {
-          // Stack to stack/reg is simple
-          move32_64(masm, src, dst);
-        } else {
-          if (dst.first()->is_reg()) {
-            // freg -> reg
-            int off =
-              STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-            Register d = dst.first()->as_Register();
-            if (Assembler::is_simm13(off)) {
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, off);
-              __ ld(SP, off, d);
-            } else {
-              if (conversion_off == noreg) {
-                __ set(off, L6);
-                conversion_off = L6;
-              }
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, conversion_off);
-              __ ld(SP, conversion_off , d);
-            }
-          } else {
-            // freg -> mem
-            int off = STACK_BIAS + reg2offset(dst.first());
-            if (Assembler::is_simm13(off)) {
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, off);
-            } else {
-              if (conversion_off == noreg) {
-                __ set(off, L6);
-                conversion_off = L6;
-              }
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, conversion_off);
-            }
-          }
-        }
-        break;
-
-      case T_DOUBLE:
-        assert( j_arg + 1 < total_args_passed &&
-                in_sig_bt[j_arg + 1] == T_VOID &&
-                out_sig_bt[c_arg+1] == T_VOID, "bad arg list");
-        if (src.first()->is_stack()) {
-          // Stack to stack/reg is simple
-          long_move(masm, src, dst);
-        } else {
-          Register d = dst.first()->is_reg() ? dst.first()->as_Register() : L2;
-
-          // Destination could be an odd reg on 32bit in which case
-          // we can't load direct to the destination.
-
-          if (!d->is_even() && wordSize == 4) {
-            d = L2;
-          }
-          int off = STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-          if (Assembler::is_simm13(off)) {
-            __ stf(FloatRegisterImpl::D, src.first()->as_FloatRegister(),
-                   SP, off);
-            __ ld_long(SP, off, d);
-          } else {
-            if (conversion_off == noreg) {
-              __ set(off, L6);
-              conversion_off = L6;
-            }
-            __ stf(FloatRegisterImpl::D, src.first()->as_FloatRegister(),
-                   SP, conversion_off);
-            __ ld_long(SP, conversion_off, d);
-          }
-          if (d == L2) {
-            long_move(masm, reg64_to_VMRegPair(L2), dst);
-          }
-        }
-        break;
-
-      case T_LONG :
-        // 32bit can't do a split move of something like g1 -> O0, O1
-        // so use a memory temp
-        if (src.is_single_phys_reg() && wordSize == 4) {
-          Register tmp = L2;
-          if (dst.first()->is_reg() &&
-              (wordSize == 8 || dst.first()->as_Register()->is_even())) {
-            tmp = dst.first()->as_Register();
-          }
-
-          int off = STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-          if (Assembler::is_simm13(off)) {
-            __ stx(src.first()->as_Register(), SP, off);
-            __ ld_long(SP, off, tmp);
-          } else {
-            if (conversion_off == noreg) {
-              __ set(off, L6);
-              conversion_off = L6;
-            }
-            __ stx(src.first()->as_Register(), SP, conversion_off);
-            __ ld_long(SP, conversion_off, tmp);
-          }
-
-          if (tmp == L2) {
-            long_move(masm, reg64_to_VMRegPair(L2), dst);
-          }
-        } else {
-          long_move(masm, src, dst);
-        }
-        break;
-
-      case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-      default:
-        move32_64(masm, src, dst);
-    }
-  }
-
-
-  // If we have any strings we must store any register based arg to the stack
-  // This includes any still live xmm registers too.
-
-  if (total_strings > 0 ) {
-
-    // protect all the arg registers
-    __ save_frame(0);
-    __ mov(G2_thread, L7_thread_cache);
-    const Register L2_string_off = L2;
-
-    // Get first string offset
-    __ set(string_locs * VMRegImpl::stack_slot_size, L2_string_off);
-
-    for (c_arg = 0 ; c_arg < total_c_args ; c_arg++ ) {
-      if (out_sig_bt[c_arg] == T_ADDRESS) {
-
-        VMRegPair dst = out_regs[c_arg];
-        const Register d = dst.first()->is_reg() ?
-            dst.first()->as_Register()->after_save() : noreg;
-
-        // It's a string the oop and it was already copied to the out arg
-        // position
-        if (d != noreg) {
-          __ mov(d, O0);
-        } else {
-          assert(Assembler::is_simm13(reg2offset(dst.first()) + STACK_BIAS),
-                 "must be");
-          __ ld_ptr(FP,  reg2offset(dst.first()) + STACK_BIAS, O0);
-        }
-        Label skip;
-
-        __ br_null(O0, false, Assembler::pn, skip);
-        __ delayed()->add(FP, L2_string_off, O1);
-
-        if (d != noreg) {
-          __ mov(O1, d);
-        } else {
-          assert(Assembler::is_simm13(reg2offset(dst.first()) + STACK_BIAS),
-                 "must be");
-          __ st_ptr(O1, FP,  reg2offset(dst.first()) + STACK_BIAS);
-        }
-
-        __ call(CAST_FROM_FN_PTR(address, SharedRuntime::get_utf),
-                relocInfo::runtime_call_type);
-        __ delayed()->add(L2_string_off, max_dtrace_string_size, L2_string_off);
-
-        __ bind(skip);
-
-      }
-
-    }
-    __ mov(L7_thread_cache, G2_thread);
-    __ restore();
-
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ ret();
-  __ delayed()->restore();
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Jul 05 20:20:43 2017 +0200
@@ -889,8 +889,6 @@
           !(n->ideal_Opcode()==Op_LoadD_unaligned && ld_op==Op_LoadF) &&
           !(n->ideal_Opcode()==Op_ConvI2F   && ld_op==Op_LoadF) &&
           !(n->ideal_Opcode()==Op_ConvI2D   && ld_op==Op_LoadF) &&
-          !(n->ideal_Opcode()==Op_PrefetchRead  && ld_op==Op_LoadI) &&
-          !(n->ideal_Opcode()==Op_PrefetchWrite && ld_op==Op_LoadI) &&
           !(n->ideal_Opcode()==Op_PrefetchAllocation && ld_op==Op_LoadI) &&
           !(n->ideal_Opcode()==Op_LoadVector && ld_op==Op_LoadD) &&
           !(n->rule() == loadUB_rule)) {
@@ -6316,33 +6314,9 @@
   ins_pipe(loadConFD);
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr( memory mem ) %{
-  match( PrefetchRead mem );
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-
-  format %{ "PREFETCH $mem,0\t! Prefetch read-many" %}
-  opcode(Assembler::prefetch_op3);
-  ins_encode( form3_mem_prefetch_read( mem ) );
-  ins_pipe(iload_mem);
-%}
-
-instruct prefetchw( memory mem ) %{
-  match( PrefetchWrite mem );
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-
-  format %{ "PREFETCH $mem,2\t! Prefetch write-many (and read)" %}
-  opcode(Assembler::prefetch_op3);
-  ins_encode( form3_mem_prefetch_write( mem ) );
-  ins_pipe(iload_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc( memory mem ) %{
   predicate(AllocatePrefetchInstr == 0);
   match( PrefetchAllocation mem );
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1398,50 +1398,6 @@
 }
 
 
-void LIR_Assembler::prefetchr(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::supports_sse()) {
-    switch (ReadPrefetchInstr) {
-      case 0:
-        __ prefetchnta(from_addr); break;
-      case 1:
-        __ prefetcht0(from_addr); break;
-      case 2:
-        __ prefetcht2(from_addr); break;
-      default:
-        ShouldNotReachHere(); break;
-    }
-  } else if (VM_Version::supports_3dnow_prefetch()) {
-    __ prefetchr(from_addr);
-  }
-}
-
-
-void LIR_Assembler::prefetchw(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::supports_sse()) {
-    switch (AllocatePrefetchInstr) {
-      case 0:
-        __ prefetchnta(from_addr); break;
-      case 1:
-        __ prefetcht0(from_addr); break;
-      case 2:
-        __ prefetcht2(from_addr); break;
-      case 3:
-        __ prefetchw(from_addr); break;
-      default:
-        ShouldNotReachHere(); break;
-    }
-  } else if (VM_Version::supports_3dnow_prefetch()) {
-    __ prefetchw(from_addr);
-  }
-}
-
-
 NEEDS_CLEANUP; // This could be static?
 Address::ScaleFactor LIR_Assembler::array_element_size(BasicType type) const {
   int elem_size = type2aelembytes(type);
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,9 +90,6 @@
   product(intx, FenceInstruction, 0,                                        \
           "(Unsafe,Unstable) Experimental")                                 \
                                                                             \
-  product(intx,  ReadPrefetchInstr, 0,                                      \
-          "Prefetch instruction to prefetch ahead")                         \
-                                                                            \
   product(bool, UseStoreImmI16, true,                                       \
           "Use store immediate 16-bits value instruction on x86")           \
                                                                             \
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -602,7 +602,3 @@
   else
     return addr_at(0) + length + sbyte_at(offset);
 }
-
-bool NativeInstruction::is_dtrace_trap() {
-  return (*(int32_t*)this & 0xff) == 0xcc;
-}
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -59,7 +59,6 @@
   };
 
   bool is_nop()                        { return ubyte_at(0) == nop_instruction_code; }
-  bool is_dtrace_trap();
   inline bool is_call();
   inline bool is_illegal();
   inline bool is_return();
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -2415,381 +2415,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(
-    MacroAssembler *masm, methodHandle method) {
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  if( !method->is_static() ) {  // Pass in receiver first
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  // We need to convert the java args to where a native (non-jni) function
-  // would expect them. To figure out where they go we convert the java
-  // signature to a C signature.
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      Symbol* s = ss.as_symbol_or_null();   // symbol is created
-      if (s == vmSymbols::java_lang_String()) {
-        total_strings++;
-        out_sig_bt[total_c_args-1] = T_ADDRESS;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Byte() ||
-                 s == vmSymbols::java_lang_Short() ||
-                 s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      out_sig_bt[total_c_args++] = T_VOID;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots).
-
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Now space for the string(s) we must convert
-
-  int* string_locs   = NEW_RESOURCE_ARRAY(int, total_strings + 1);
-  for (i = 0; i < total_strings ; i++) {
-    string_locs[i] = stack_slots;
-    stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
-  }
-
-  // + 2 for return address (which we own) and saved rbp,
-
-  stack_slots += 2;
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 2 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  // We are free to use all registers as temps without saving them and
-  // restoring them except rbp. rbp, is the only callee save register
-  // as far as the interpreter and the compiler(s) are concerned.
-
-  const Register ic_reg = rax;
-  const Register receiver = rcx;
-  Label hit;
-  Label exception_pending;
-
-
-  __ verify_oop(receiver);
-  __ cmpl(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes()));
-  __ jcc(Assembler::equal, hit);
-
-  __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
-
-  // verified entry must be aligned for code patching.
-  // and the first 5 bytes must be in the same cache line
-  // if we align at 8 then we will be sure 5 bytes are in the same line
-  __ align(8);
-
-  __ bind(hit);
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check
-
-
-  if (UseStackBanging) {
-    if (stack_size <= StackShadowPages*os::vm_page_size()) {
-      __ bang_stack_with_offset(StackShadowPages*os::vm_page_size());
-    } else {
-      __ movl(rax, stack_size);
-      __ bang_stack_size(rax, rbx);
-    }
-  } else {
-    // need a 5 byte instruction to allow MT safe patching to non-entrant
-    __ fat_nop();
-  }
-
-  assert(((int)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ enter();
-
-  // -2 because return address is already present and so is saved rbp,
-  if (stack_size - 2*wordSize != 0) {
-    __ subl(rsp, stack_size - 2*wordSize);
-  }
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-  // First thing we do store all the args as if we are doing the call.
-  // Since the C calling convention is stack based that ensures that
-  // all the Java register args are stored before we need to convert any
-  // string we might have.
-
-  int sid = 0;
-  int c_arg, j_arg;
-  int string_reg = 0;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-    assert(dst.first()->is_stack() || in_sig_bt[j_arg] == T_VOID,
-           "stack based abi assumed");
-
-    switch (in_sig_bt[j_arg]) {
-
-      case T_ARRAY:
-      case T_OBJECT:
-        if (out_sig_bt[c_arg] == T_ADDRESS) {
-          // Any register based arg for a java string after the first
-          // will be destroyed by the call to get_utf so we store
-          // the original value in the location the utf string address
-          // will eventually be stored.
-          if (src.first()->is_reg()) {
-            if (string_reg++ != 0) {
-              simple_move32(masm, src, dst);
-            }
-          }
-        } else if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-          // need to unbox a one-word value
-          Register in_reg = rax;
-          if ( src.first()->is_reg() ) {
-            in_reg = src.first()->as_Register();
-          } else {
-            simple_move32(masm, src, in_reg->as_VMReg());
-          }
-          Label skipUnbox;
-          __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
-          if ( out_sig_bt[c_arg] == T_LONG ) {
-            __ movl(Address(rsp, reg2offset_out(dst.second())), NULL_WORD);
-          }
-          __ testl(in_reg, in_reg);
-          __ jcc(Assembler::zero, skipUnbox);
-          assert(dst.first()->is_stack() &&
-                 (!dst.second()->is_valid() || dst.second()->is_stack()),
-                 "value(s) must go into stack slots");
-
-          BasicType bt = out_sig_bt[c_arg];
-          int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-          if ( bt == T_LONG ) {
-            __ movl(rbx, Address(in_reg,
-                                 box_offset + VMRegImpl::stack_slot_size));
-            __ movl(Address(rsp, reg2offset_out(dst.second())), rbx);
-          }
-          __ movl(in_reg,  Address(in_reg, box_offset));
-          __ movl(Address(rsp, reg2offset_out(dst.first())), in_reg);
-          __ bind(skipUnbox);
-        } else {
-          // Convert the arg to NULL
-          __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
-        }
-        if (out_sig_bt[c_arg] == T_LONG) {
-          assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-          ++c_arg; // Move over the T_VOID To keep the loop indices in sync
-        }
-        break;
-
-      case T_VOID:
-        break;
-
-      case T_FLOAT:
-        float_move(masm, src, dst);
-        break;
-
-      case T_DOUBLE:
-        assert( j_arg + 1 < total_args_passed &&
-                in_sig_bt[j_arg + 1] == T_VOID, "bad arg list");
-        double_move(masm, src, dst);
-        break;
-
-      case T_LONG :
-        long_move(masm, src, dst);
-        break;
-
-      case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-      default:
-        simple_move32(masm, src, dst);
-    }
-  }
-
-  // Now we must convert any string we have to utf8
-  //
-
-  for (sid = 0, j_arg = first_arg_to_pass, c_arg = 0 ;
-       sid < total_strings ; j_arg++, c_arg++ ) {
-
-    if (out_sig_bt[c_arg] == T_ADDRESS) {
-
-      Address utf8_addr = Address(
-          rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-      __ leal(rax, utf8_addr);
-
-      // The first string we find might still be in the original java arg
-      // register
-      VMReg orig_loc = in_regs[j_arg].first();
-      Register string_oop;
-
-      // This is where the argument will eventually reside
-      Address dest = Address(rsp, reg2offset_out(out_regs[c_arg].first()));
-
-      if (sid == 1 && orig_loc->is_reg()) {
-        string_oop = orig_loc->as_Register();
-        assert(string_oop != rax, "smashed arg");
-      } else {
-
-        if (orig_loc->is_reg()) {
-          // Get the copy of the jls object
-          __ movl(rcx, dest);
-        } else {
-          // arg is still in the original location
-          __ movl(rcx, Address(rbp, reg2offset_in(orig_loc)));
-        }
-        string_oop = rcx;
-
-      }
-      Label nullString;
-      __ movl(dest, NULL_WORD);
-      __ testl(string_oop, string_oop);
-      __ jcc(Assembler::zero, nullString);
-
-      // Now we can store the address of the utf string as the argument
-      __ movl(dest, rax);
-
-      // And do the conversion
-      __ call_VM_leaf(CAST_FROM_FN_PTR(
-             address, SharedRuntime::get_utf), string_oop, rax);
-      __ bind(nullString);
-    }
-
-    if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-      assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-      ++c_arg; // Move over the T_VOID To keep the loop indices in sync
-    }
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ leave();
-  __ ret(0);
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals ) {
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -2650,630 +2650,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-static int  fp_offset[ConcreteRegisterImpl::number_of_registers] = { 0 };
-static bool offsets_initialized = false;
-
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(MacroAssembler *masm,
-                                                methodHandle method) {
-
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  if (!offsets_initialized) {
-    fp_offset[c_rarg0->as_VMReg()->value()] = -1 * wordSize;
-    fp_offset[c_rarg1->as_VMReg()->value()] = -2 * wordSize;
-    fp_offset[c_rarg2->as_VMReg()->value()] = -3 * wordSize;
-    fp_offset[c_rarg3->as_VMReg()->value()] = -4 * wordSize;
-    fp_offset[c_rarg4->as_VMReg()->value()] = -5 * wordSize;
-    fp_offset[c_rarg5->as_VMReg()->value()] = -6 * wordSize;
-
-    fp_offset[c_farg0->as_VMReg()->value()] = -7 * wordSize;
-    fp_offset[c_farg1->as_VMReg()->value()] = -8 * wordSize;
-    fp_offset[c_farg2->as_VMReg()->value()] = -9 * wordSize;
-    fp_offset[c_farg3->as_VMReg()->value()] = -10 * wordSize;
-    fp_offset[c_farg4->as_VMReg()->value()] = -11 * wordSize;
-    fp_offset[c_farg5->as_VMReg()->value()] = -12 * wordSize;
-    fp_offset[c_farg6->as_VMReg()->value()] = -13 * wordSize;
-    fp_offset[c_farg7->as_VMReg()->value()] = -14 * wordSize;
-
-    offsets_initialized = true;
-  }
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  // Skip the receiver as dtrace doesn't want to see it
-  if( !method->is_static() ) {
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  // We need to convert the java args to where a native (non-jni) function
-  // would expect them. To figure out where they go we convert the java
-  // signature to a C signature.
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      Symbol* s = ss.as_symbol_or_null();   // symbol is created
-      if (s == vmSymbols::java_lang_String()) {
-        total_strings++;
-        out_sig_bt[total_c_args-1] = T_ADDRESS;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Byte() ||
-                 s == vmSymbols::java_lang_Short() ||
-                 s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      // We convert double to long
-      out_sig_bt[total_c_args-1] = T_LONG;
-      out_sig_bt[total_c_args++] = T_VOID;
-    } else if ( bt == T_FLOAT) {
-      // We convert float to int
-      out_sig_bt[total_c_args-1] = T_INT;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots but space for storing
-  // the 1st six register arguments). It's weird see int_stk_helper.
-
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Now space for the string(s) we must convert
-  int* string_locs   = NEW_RESOURCE_ARRAY(int, total_strings + 1);
-  for (i = 0; i < total_strings ; i++) {
-    string_locs[i] = stack_slots;
-    stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
-  }
-
-  // Plus the temps we might need to juggle register args
-  // regs take two slots each
-  stack_slots += (Argument::n_int_register_parameters_c +
-                  Argument::n_float_register_parameters_c) * 2;
-
-
-  // + 4 for return address (which we own) and saved rbp,
-
-  stack_slots += 4;
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 4 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  // We are free to use all registers as temps without saving them and
-  // restoring them except rbp. rbp, is the only callee save register
-  // as far as the interpreter and the compiler(s) are concerned.
-
-  const Register ic_reg = rax;
-  const Register receiver = rcx;
-  Label hit;
-  Label exception_pending;
-
-
-  __ verify_oop(receiver);
-  __ cmpl(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes()));
-  __ jcc(Assembler::equal, hit);
-
-  __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
-
-  // verified entry must be aligned for code patching.
-  // and the first 5 bytes must be in the same cache line
-  // if we align at 8 then we will be sure 5 bytes are in the same line
-  __ align(8);
-
-  __ bind(hit);
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check
-
-  if (UseStackBanging) {
-    if (stack_size <= StackShadowPages*os::vm_page_size()) {
-      __ bang_stack_with_offset(StackShadowPages*os::vm_page_size());
-    } else {
-      __ movl(rax, stack_size);
-      __ bang_stack_size(rax, rbx);
-    }
-  } else {
-    // need a 5 byte instruction to allow MT safe patching to non-entrant
-    __ fat_nop();
-  }
-
-  assert(((uintptr_t)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ enter();
-
-  // -4 because return address is already present and so is saved rbp,
-  if (stack_size - 2*wordSize != 0) {
-    __ subq(rsp, stack_size - 2*wordSize);
-  }
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-  int c_arg, j_arg;
-
-  // State of input register args
-
-  bool  live[ConcreteRegisterImpl::number_of_registers];
-
-  live[j_rarg0->as_VMReg()->value()] = false;
-  live[j_rarg1->as_VMReg()->value()] = false;
-  live[j_rarg2->as_VMReg()->value()] = false;
-  live[j_rarg3->as_VMReg()->value()] = false;
-  live[j_rarg4->as_VMReg()->value()] = false;
-  live[j_rarg5->as_VMReg()->value()] = false;
-
-  live[j_farg0->as_VMReg()->value()] = false;
-  live[j_farg1->as_VMReg()->value()] = false;
-  live[j_farg2->as_VMReg()->value()] = false;
-  live[j_farg3->as_VMReg()->value()] = false;
-  live[j_farg4->as_VMReg()->value()] = false;
-  live[j_farg5->as_VMReg()->value()] = false;
-  live[j_farg6->as_VMReg()->value()] = false;
-  live[j_farg7->as_VMReg()->value()] = false;
-
-
-  bool rax_is_zero = false;
-
-  // All args (except strings) destined for the stack are moved first
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-    // Get the real reg value or a dummy (rsp)
-
-    int src_reg = src.first()->is_reg() ?
-                  src.first()->value() :
-                  rsp->as_VMReg()->value();
-
-    bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                    (in_sig_bt[j_arg] == T_OBJECT &&
-                     out_sig_bt[c_arg] != T_INT &&
-                     out_sig_bt[c_arg] != T_ADDRESS &&
-                     out_sig_bt[c_arg] != T_LONG);
-
-    live[src_reg] = !useless;
-
-    if (dst.first()->is_stack()) {
-
-      // Even though a string arg in a register is still live after this loop
-      // after the string conversion loop (next) it will be dead so we take
-      // advantage of that now for simpler code to manage live.
-
-      live[src_reg] = false;
-      switch (in_sig_bt[j_arg]) {
-
-        case T_ARRAY:
-        case T_OBJECT:
-          {
-            Address stack_dst(rsp, reg2offset_out(dst.first()));
-
-            if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-              // need to unbox a one-word value
-              Register in_reg = rax;
-              if ( src.first()->is_reg() ) {
-                in_reg = src.first()->as_Register();
-              } else {
-                __ movq(rax, Address(rbp, reg2offset_in(src.first())));
-                rax_is_zero = false;
-              }
-              Label skipUnbox;
-              __ movptr(Address(rsp, reg2offset_out(dst.first())),
-                        (int32_t)NULL_WORD);
-              __ testq(in_reg, in_reg);
-              __ jcc(Assembler::zero, skipUnbox);
-
-              BasicType bt = out_sig_bt[c_arg];
-              int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-              Address src1(in_reg, box_offset);
-              if ( bt == T_LONG ) {
-                __ movq(in_reg,  src1);
-                __ movq(stack_dst, in_reg);
-                assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-                ++c_arg; // skip over T_VOID to keep the loop indices in sync
-              } else {
-                __ movl(in_reg,  src1);
-                __ movl(stack_dst, in_reg);
-              }
-
-              __ bind(skipUnbox);
-            } else if (out_sig_bt[c_arg] != T_ADDRESS) {
-              // Convert the arg to NULL
-              if (!rax_is_zero) {
-                __ xorq(rax, rax);
-                rax_is_zero = true;
-              }
-              __ movq(stack_dst, rax);
-            }
-          }
-          break;
-
-        case T_VOID:
-          break;
-
-        case T_FLOAT:
-          // This does the right thing since we know it is destined for the
-          // stack
-          float_move(masm, src, dst);
-          break;
-
-        case T_DOUBLE:
-          // This does the right thing since we know it is destined for the
-          // stack
-          double_move(masm, src, dst);
-          break;
-
-        case T_LONG :
-          long_move(masm, src, dst);
-          break;
-
-        case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-        default:
-          move32_64(masm, src, dst);
-      }
-    }
-
-  }
-
-  // If we have any strings we must store any register based arg to the stack
-  // This includes any still live xmm registers too.
-
-  int sid = 0;
-
-  if (total_strings > 0 ) {
-    for (j_arg = first_arg_to_pass, c_arg = 0 ;
-         j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-      VMRegPair src = in_regs[j_arg];
-      VMRegPair dst = out_regs[c_arg];
-
-      if (src.first()->is_reg()) {
-        Address src_tmp(rbp, fp_offset[src.first()->value()]);
-
-        // string oops were left untouched by the previous loop even if the
-        // eventual (converted) arg is destined for the stack so park them
-        // away now (except for first)
-
-        if (out_sig_bt[c_arg] == T_ADDRESS) {
-          Address utf8_addr = Address(
-              rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-          if (sid != 1) {
-            // The first string arg won't be killed until after the utf8
-            // conversion
-            __ movq(utf8_addr, src.first()->as_Register());
-          }
-        } else if (dst.first()->is_reg()) {
-          if (in_sig_bt[j_arg] == T_FLOAT || in_sig_bt[j_arg] == T_DOUBLE) {
-
-            // Convert the xmm register to an int and store it in the reserved
-            // location for the eventual c register arg
-            XMMRegister f = src.first()->as_XMMRegister();
-            if (in_sig_bt[j_arg] == T_FLOAT) {
-              __ movflt(src_tmp, f);
-            } else {
-              __ movdbl(src_tmp, f);
-            }
-          } else {
-            // If the arg is an oop type we don't support don't bother to store
-            // it remember string was handled above.
-            bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                            (in_sig_bt[j_arg] == T_OBJECT &&
-                             out_sig_bt[c_arg] != T_INT &&
-                             out_sig_bt[c_arg] != T_LONG);
-
-            if (!useless) {
-              __ movq(src_tmp, src.first()->as_Register());
-            }
-          }
-        }
-      }
-      if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-        assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-        ++c_arg; // skip over T_VOID to keep the loop indices in sync
-      }
-    }
-
-    // Now that the volatile registers are safe, convert all the strings
-    sid = 0;
-
-    for (j_arg = first_arg_to_pass, c_arg = 0 ;
-         j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-      if (out_sig_bt[c_arg] == T_ADDRESS) {
-        // It's a string
-        Address utf8_addr = Address(
-            rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-        // The first string we find might still be in the original java arg
-        // register
-
-        VMReg src = in_regs[j_arg].first();
-
-        // We will need to eventually save the final argument to the trap
-        // in the von-volatile location dedicated to src. This is the offset
-        // from fp we will use.
-        int src_off = src->is_reg() ?
-            fp_offset[src->value()] : reg2offset_in(src);
-
-        // This is where the argument will eventually reside
-        VMRegPair dst = out_regs[c_arg];
-
-        if (src->is_reg()) {
-          if (sid == 1) {
-            __ movq(c_rarg0, src->as_Register());
-          } else {
-            __ movq(c_rarg0, utf8_addr);
-          }
-        } else {
-          // arg is still in the original location
-          __ movq(c_rarg0, Address(rbp, reg2offset_in(src)));
-        }
-        Label done, convert;
-
-        // see if the oop is NULL
-        __ testq(c_rarg0, c_rarg0);
-        __ jcc(Assembler::notEqual, convert);
-
-        if (dst.first()->is_reg()) {
-          // Save the ptr to utf string in the origina src loc or the tmp
-          // dedicated to it
-          __ movq(Address(rbp, src_off), c_rarg0);
-        } else {
-          __ movq(Address(rsp, reg2offset_out(dst.first())), c_rarg0);
-        }
-        __ jmp(done);
-
-        __ bind(convert);
-
-        __ lea(c_rarg1, utf8_addr);
-        if (dst.first()->is_reg()) {
-          __ movq(Address(rbp, src_off), c_rarg1);
-        } else {
-          __ movq(Address(rsp, reg2offset_out(dst.first())), c_rarg1);
-        }
-        // And do the conversion
-        __ call(RuntimeAddress(
-                CAST_FROM_FN_PTR(address, SharedRuntime::get_utf)));
-
-        __ bind(done);
-      }
-      if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-        assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-        ++c_arg; // skip over T_VOID to keep the loop indices in sync
-      }
-    }
-    // The get_utf call killed all the c_arg registers
-    live[c_rarg0->as_VMReg()->value()] = false;
-    live[c_rarg1->as_VMReg()->value()] = false;
-    live[c_rarg2->as_VMReg()->value()] = false;
-    live[c_rarg3->as_VMReg()->value()] = false;
-    live[c_rarg4->as_VMReg()->value()] = false;
-    live[c_rarg5->as_VMReg()->value()] = false;
-
-    live[c_farg0->as_VMReg()->value()] = false;
-    live[c_farg1->as_VMReg()->value()] = false;
-    live[c_farg2->as_VMReg()->value()] = false;
-    live[c_farg3->as_VMReg()->value()] = false;
-    live[c_farg4->as_VMReg()->value()] = false;
-    live[c_farg5->as_VMReg()->value()] = false;
-    live[c_farg6->as_VMReg()->value()] = false;
-    live[c_farg7->as_VMReg()->value()] = false;
-  }
-
-  // Now we can finally move the register args to their desired locations
-
-  rax_is_zero = false;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-    // Only need to look for args destined for the interger registers (since we
-    // convert float/double args to look like int/long outbound)
-    if (dst.first()->is_reg()) {
-      Register r =  dst.first()->as_Register();
-
-      // Check if the java arg is unsupported and thereofre useless
-      bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                      (in_sig_bt[j_arg] == T_OBJECT &&
-                       out_sig_bt[c_arg] != T_INT &&
-                       out_sig_bt[c_arg] != T_ADDRESS &&
-                       out_sig_bt[c_arg] != T_LONG);
-
-
-      // If we're going to kill an existing arg save it first
-      if (live[dst.first()->value()]) {
-        // you can't kill yourself
-        if (src.first() != dst.first()) {
-          __ movq(Address(rbp, fp_offset[dst.first()->value()]), r);
-        }
-      }
-      if (src.first()->is_reg()) {
-        if (live[src.first()->value()] ) {
-          if (in_sig_bt[j_arg] == T_FLOAT) {
-            __ movdl(r, src.first()->as_XMMRegister());
-          } else if (in_sig_bt[j_arg] == T_DOUBLE) {
-            __ movdq(r, src.first()->as_XMMRegister());
-          } else if (r != src.first()->as_Register()) {
-            if (!useless) {
-              __ movq(r, src.first()->as_Register());
-            }
-          }
-        } else {
-          // If the arg is an oop type we don't support don't bother to store
-          // it
-          if (!useless) {
-            if (in_sig_bt[j_arg] == T_DOUBLE ||
-                in_sig_bt[j_arg] == T_LONG  ||
-                in_sig_bt[j_arg] == T_OBJECT ) {
-              __ movq(r, Address(rbp, fp_offset[src.first()->value()]));
-            } else {
-              __ movl(r, Address(rbp, fp_offset[src.first()->value()]));
-            }
-          }
-        }
-        live[src.first()->value()] = false;
-      } else if (!useless) {
-        // full sized move even for int should be ok
-        __ movq(r, Address(rbp, reg2offset_in(src.first())));
-      }
-
-      // At this point r has the original java arg in the final location
-      // (assuming it wasn't useless). If the java arg was an oop
-      // we have a bit more to do
-
-      if (in_sig_bt[j_arg] == T_ARRAY || in_sig_bt[j_arg] == T_OBJECT ) {
-        if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-          // need to unbox a one-word value
-          Label skip;
-          __ testq(r, r);
-          __ jcc(Assembler::equal, skip);
-          BasicType bt = out_sig_bt[c_arg];
-          int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-          Address src1(r, box_offset);
-          if ( bt == T_LONG ) {
-            __ movq(r, src1);
-          } else {
-            __ movl(r, src1);
-          }
-          __ bind(skip);
-
-        } else if (out_sig_bt[c_arg] != T_ADDRESS) {
-          // Convert the arg to NULL
-          __ xorq(r, r);
-        }
-      }
-
-      // dst can longer be holding an input value
-      live[dst.first()->value()] = false;
-    }
-    if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-      assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-      ++c_arg; // skip over T_VOID to keep the loop indices in sync
-    }
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ leave();
-  __ ret(0);
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals ) {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -924,15 +924,9 @@
   }
 #endif // COMPILER2
 
-  assert(0 <= ReadPrefetchInstr && ReadPrefetchInstr <= 3, "invalid value");
   assert(0 <= AllocatePrefetchInstr && AllocatePrefetchInstr <= 3, "invalid value");
 
   // set valid Prefetch instruction
-  if( ReadPrefetchInstr < 0 ) ReadPrefetchInstr = 0;
-  if( ReadPrefetchInstr > 3 ) ReadPrefetchInstr = 3;
-  if( ReadPrefetchInstr == 3 && !supports_3dnow_prefetch() ) ReadPrefetchInstr = 0;
-  if( !supports_sse() && supports_3dnow_prefetch() ) ReadPrefetchInstr = 3;
-
   if( AllocatePrefetchInstr < 0 ) AllocatePrefetchInstr = 0;
   if( AllocatePrefetchInstr > 3 ) AllocatePrefetchInstr = 3;
   if( AllocatePrefetchInstr == 3 && !supports_3dnow_prefetch() ) AllocatePrefetchInstr=0;
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -6061,103 +6061,9 @@
   ins_pipe( fpu_reg_mem );
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
-  match(PrefetchRead mem);
-  ins_cost(0);
-  size(0);
-  format %{ "PREFETCHR (non-SSE is empty encoding)" %}
-  ins_encode();
-  ins_pipe(empty);
-%}
-
-instruct prefetchr( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch() || ReadPrefetchInstr==3);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHR $mem\t! Prefetch into level 1 cache for read" %}
-  ins_encode %{
-    __ prefetchr($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrNTA( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==0);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHNTA $mem\t! Prefetch into non-temporal cache for read" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT0( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==1);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHT0 $mem\t! Prefetch into L1 and L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht0($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT2( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==2);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHT2 $mem\t! Prefetch into L2 cache for read" %}
-  ins_encode %{
-    __ prefetcht2($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchw0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
-  match(PrefetchWrite mem);
-  ins_cost(0);
-  size(0);
-  format %{ "Prefetch (non-SSE is empty encoding)" %}
-  ins_encode();
-  ins_pipe(empty);
-%}
-
-instruct prefetchw( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch());
-  match( PrefetchWrite mem );
-  ins_cost(100);
-
-  format %{ "PREFETCHW $mem\t! Prefetch into L1 cache and mark modified" %}
-  ins_encode %{
-    __ prefetchw($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchwNTA( memory mem ) %{
-  predicate(UseSSE>=1);
-  match(PrefetchWrite mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHNTA $mem\t! Prefetch into non-temporal cache for write" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc0( memory mem ) %{
   predicate(UseSSE==0 && AllocatePrefetchInstr!=3);
   match(PrefetchAllocation mem);
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -5319,70 +5319,9 @@
   ins_pipe(pipe_slow); // XXX
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr( memory mem ) %{
-  predicate(ReadPrefetchInstr==3);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHR $mem\t# Prefetch into level 1 cache" %}
-  ins_encode %{
-    __ prefetchr($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrNTA( memory mem ) %{
-  predicate(ReadPrefetchInstr==0);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHNTA $mem\t# Prefetch into non-temporal cache for read" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT0( memory mem ) %{
-  predicate(ReadPrefetchInstr==1);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHT0 $mem\t# prefetch into L1 and L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht0($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT2( memory mem ) %{
-  predicate(ReadPrefetchInstr==2);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHT2 $mem\t# prefetch into L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht2($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchwNTA( memory mem ) %{
-  match(PrefetchWrite mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHNTA $mem\t# Prefetch to non-temporal cache for write" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc( memory mem ) %{
   predicate(AllocatePrefetchInstr==3);
   match(PrefetchAllocation mem);
--- a/hotspot/src/os/aix/vm/vmError_aix.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/os/aix/vm/vmError_aix.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -80,7 +80,6 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  // Handle all program errors.
   for (int i = 0; i < NUM_SIGNALS; i++) {
     if (SIGNALS[i] == sig) {
       return resettedSigflags[i];
@@ -90,7 +89,6 @@
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  // Handle all program errors.
   for (int i = 0; i < NUM_SIGNALS; i++) {
     if (SIGNALS[i] == sig) {
       return resettedSighandler[i];
@@ -100,12 +98,19 @@
 }
 
 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
+
   // Unmask current signal.
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
+  // and all other synchronous signals too.
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 
-  Unimplemented();
+  VMError err(NULL, sig, NULL, info, ucVoid);
+  err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
--- a/hotspot/src/os/bsd/vm/dtraceJSDT_bsd.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-/*
- * JSDT java dtrace probes have never been implemented in macosx.  It is unknown if the solaris implementation
- * is close or if significant implementation work is necessary.  The future of the solaris implementation also
- * appears to be unclear since compiling code with JSDT probes produces the following warning:
- * "warning: ProviderFactory is internal proprietary API and may be removed in a future release"
- */
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/hotspot/src/os/bsd/vm/vmError_bsd.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/os/bsd/vm/vmError_bsd.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -63,9 +63,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -78,19 +84,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -100,16 +106,25 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 }
--- a/hotspot/src/os/linux/vm/dtraceJSDT_linux.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/hotspot/src/os/linux/vm/vmError_linux.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/os/linux/vm/vmError_linux.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -63,9 +63,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -78,19 +84,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -100,16 +106,26 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
+
 }
--- a/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,655 +0,0 @@
-/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-#ifdef HAVE_DTRACE_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dtrace.h>
-
-static const char* devname    = "/dev/dtrace/helper";
-static const char* olddevname = "/devices/pseudo/dtrace@0:helper";
-
-static const char* string_sig = "uintptr_t";
-static const char* int_sig    = "long";
-static const char* long_sig   = "long long";
-
-static void printDOFHelper(dof_helper_t* helper);
-
-static int dofhelper_open() {
-  int fd;
-  if ((fd = open64(devname, O_RDWR)) < 0) {
-    // Optimize next calls
-    devname = olddevname;
-    if ((fd = open64(devname, O_RDWR)) < 0) {
-      return -1;
-    }
-  }
-  return fd;
-}
-
-static jint dof_register(jstring module, uint8_t* dof, void* modaddr) {
-  int probe;
-  dof_helper_t dh;
-  int fd;
-
-  memset(&dh, 0, sizeof(dh));
-
-  char* module_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(module));
-  jio_snprintf(dh.dofhp_mod, sizeof(dh.dofhp_mod), "%s", module_name);
-  dh.dofhp_dof  = (uint64_t)dof;
-  dh.dofhp_addr = (uint64_t)modaddr;
-
-  fd = dofhelper_open();
-  if (fd < 0)
-    return -1;
-  probe = ioctl(fd, DTRACEHIOC_ADDDOF, &dh);
-  close(fd);
-  if (PrintDTraceDOF) {
-    printDOFHelper(&dh);
-    tty->print_cr("DOF helper id = %d", probe);
-  }
-  return probe;
-}
-
-int DTraceJSDT::pd_activate(
-    void* moduleBaseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-
-  // We need sections:
-  //  (1) STRTAB
-  //  (
-  //    (2) PROVIDER
-  //    (3) PROBES
-  //    (4) PROBOFFS
-  //    (5) PROBARGS
-  //  ) * Number of Providers
-
-  // Type of sections we create
-  enum {
-    STRTAB = 0,
-    PROVIDERS = 1,
-    PROBES = 2,
-    PROBE_OFFSETS = 3,
-    ARG_OFFSETS = 4,
-    NUM_SECTIONS = 5
-  };
-
-  static int alignment_for[NUM_SECTIONS] = { 1, 4, 8, 4, 1 };
-
-  ResourceMark rm;
-
-  uint32_t num_sections = 1 + 4 * providers_count;
-  uint32_t offset = sizeof(dof_hdr_t) + (num_sections * sizeof(dof_sec_t));
-  uint32_t* secoffs = NEW_RESOURCE_ARRAY(uint32_t, num_sections);
-  uint32_t* secsize = NEW_RESOURCE_ARRAY(uint32_t, num_sections);
-
-  // Store offsets of all strings here in such order:
-  //  zero-string (always 0)
-  //  provider1-name
-  //    probe1-function
-  //    probe1-name
-  //    arg-1
-  //    arg-2
-  //    ...
-  //    probe2-function
-  //    probe2-name
-  //    arg-1
-  //    arg-2
-  //  provider2-name
-  //    ...
-
-  uint32_t strcount  = 0;
-  // Count the number of strings we'll need
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    // Provider name
-    ++strcount;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      // function + name + one per argument
-      strcount += 2 + ArgumentCount(sig).size();
-    }
-  }
-
-  // Create place for string offsets
-  uint32_t* stroffs = NEW_RESOURCE_ARRAY(uint32_t, strcount + 1);
-  uint32_t string_index = 0;
-  uint32_t curstr = 0;
-
-  // First we need an empty string: ""
-  stroffs[curstr++] = string_index;
-  string_index += strlen("") + 1;
-
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    char* provider_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(provider->name));
-    stroffs[curstr++] = string_index;
-    string_index += strlen(provider_name) + 1;
-
-    // All probes
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-
-      char* function = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->function));
-      stroffs[curstr++] = string_index;
-      string_index += strlen(function) + 1;
-
-      char* name = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->name));
-      stroffs[curstr++] = string_index;
-      string_index += strlen(name) + 1;
-
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      SignatureStream ss(sig);
-      for ( ; !ss.at_return_type(); ss.next()) {
-        BasicType bt = ss.type();
-        const char* t = NULL;
-        if (bt == T_OBJECT &&
-            ss.as_symbol_or_null() == vmSymbols::java_lang_String()) {
-          t = string_sig;
-        } else if (bt == T_LONG) {
-          t = long_sig;
-        } else {
-          t = int_sig;
-        }
-        stroffs[curstr++] = string_index;
-        string_index += strlen(t) + 1;
-      }
-    }
-  }
-  secoffs[STRTAB] = offset;
-  secsize[STRTAB] = string_index;
-  offset += string_index;
-
-  // Calculate the size of the rest
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    size_t provider_sec  = PROVIDERS     + prvc * 4;
-    size_t probe_sec     = PROBES        + prvc * 4;
-    size_t probeoffs_sec = PROBE_OFFSETS + prvc * 4;
-    size_t argoffs_sec   = ARG_OFFSETS   + prvc * 4;
-
-    // Allocate space for the provider data struction
-    secoffs[provider_sec] = align_size_up(offset, alignment_for[PROVIDERS]);
-    secsize[provider_sec] = sizeof(dof_provider_t);
-    offset = secoffs[provider_sec] + secsize[provider_sec];
-
-    // Allocate space for all the probes
-    secoffs[probe_sec] = align_size_up(offset, alignment_for[PROBES]);
-    secsize[probe_sec] = sizeof(dof_probe_t) * provider->probe_count;
-    offset = secoffs[probe_sec] + secsize[probe_sec];
-
-    // Allocate space for the probe offsets
-    secoffs[probeoffs_sec] = align_size_up(offset, alignment_for[PROBE_OFFSETS]);
-    secsize[probeoffs_sec] = sizeof(uint32_t) * provider->probe_count;
-    offset = secoffs[probeoffs_sec] + secsize[probeoffs_sec];
-
-    // We need number of arguments argoffs
-    uint32_t argscount = 0;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-       JVM_DTraceProbe* p = &(provider->probes[prbc]);
-       Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-       argscount += ArgumentCount(sig).size();
-    }
-    secoffs[argoffs_sec] = align_size_up(offset, alignment_for[ARG_OFFSETS]);
-    secsize[argoffs_sec] = sizeof(uint8_t) * argscount;
-    offset = secoffs[argoffs_sec] + secsize[argoffs_sec];
-  }
-
-  uint32_t size = offset;
-
-  uint8_t* dof = NEW_RESOURCE_ARRAY(uint8_t, size);
-  if (!dof) {
-    return -1;
-  }
-  memset((void*)dof, 0, size);
-
-  // Fill memory with proper values
-  dof_hdr_t* hdr = (dof_hdr_t*)dof;
-  hdr->dofh_ident[DOF_ID_MAG0]     = DOF_MAG_MAG0;
-  hdr->dofh_ident[DOF_ID_MAG1]     = DOF_MAG_MAG1;
-  hdr->dofh_ident[DOF_ID_MAG2]     = DOF_MAG_MAG2;
-  hdr->dofh_ident[DOF_ID_MAG3]     = DOF_MAG_MAG3;
-  hdr->dofh_ident[DOF_ID_MODEL]    = DOF_MODEL_NATIVE;  // No variants
-  hdr->dofh_ident[DOF_ID_ENCODING] = DOF_ENCODE_NATIVE; // No variants
-  hdr->dofh_ident[DOF_ID_VERSION]  = DOF_VERSION_1;     // No variants
-  hdr->dofh_ident[DOF_ID_DIFVERS]  = DIF_VERSION_2;     // No variants
-  // all other fields of ident to zero
-
-  hdr->dofh_flags   = 0;
-  hdr->dofh_hdrsize = sizeof(dof_hdr_t);
-  hdr->dofh_secsize = sizeof(dof_sec_t);
-  hdr->dofh_secnum  = num_sections;
-  hdr->dofh_secoff  = sizeof(dof_hdr_t);
-  hdr->dofh_loadsz  = size;
-  hdr->dofh_filesz  = size;
-
-  // First section: STRTAB
-  dof_sec_t* sec = (dof_sec_t*)(dof + sizeof(dof_hdr_t));
-  sec->dofs_type    = DOF_SECT_STRTAB;
-  sec->dofs_align   = alignment_for[STRTAB];
-  sec->dofs_flags   = DOF_SECF_LOAD;
-  sec->dofs_entsize = 0;
-  sec->dofs_offset  = secoffs[STRTAB];
-  sec->dofs_size    = secsize[STRTAB];
-  // Make data for this section
-  char* str = (char*)(dof + sec->dofs_offset);
-
-  *str = 0; str += 1; // ""
-
-  // Run through all strings again
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    char* provider_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(provider->name));
-    strcpy(str, provider_name);
-    str += strlen(provider_name) + 1;
-
-    // All probes
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-
-      char* function = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->function));
-      strcpy(str, function);
-      str += strlen(str) + 1;
-
-      char* name = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->name));
-      strcpy(str, name);
-      str += strlen(name) + 1;
-
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      SignatureStream ss(sig);
-      for ( ; !ss.at_return_type(); ss.next()) {
-        BasicType bt = ss.type();
-        const char* t;
-        if (bt == T_OBJECT &&
-            ss.as_symbol_or_null() == vmSymbols::java_lang_String()) {
-          t = string_sig;
-        } else if (bt == T_LONG) {
-          t = long_sig;
-        } else {
-          t = int_sig;
-        }
-        strcpy(str, t);
-        str += strlen(t) + 1;
-      }
-    }
-  }
-
-  curstr = 1;
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    size_t provider_sec  = PROVIDERS     + prvc * 4;
-    size_t probe_sec     = PROBES        + prvc * 4;
-    size_t probeoffs_sec = PROBE_OFFSETS + prvc * 4;
-    size_t argoffs_sec   = ARG_OFFSETS   + prvc * 4;
-
-    // PROVIDER ///////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * provider_sec);
-    sec->dofs_type    = DOF_SECT_PROVIDER;
-    sec->dofs_align   = alignment_for[PROVIDERS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = 0;
-    sec->dofs_offset  = secoffs[provider_sec];
-    sec->dofs_size    = secsize[provider_sec];
-    // Make provider decriiption
-    dof_provider_t* prv = (dof_provider_t*)(dof + sec->dofs_offset);
-    prv->dofpv_strtab   = STRTAB;
-    prv->dofpv_probes   = probe_sec;
-    prv->dofpv_prargs   = argoffs_sec;
-    prv->dofpv_proffs   = probeoffs_sec;
-    prv->dofpv_name     = stroffs[curstr++]; // Index in string table
-    prv->dofpv_provattr = DOF_ATTR(
-        provider->providerAttributes.nameStability,
-        provider->providerAttributes.dataStability,
-        provider->providerAttributes.dependencyClass);
-    prv->dofpv_modattr = DOF_ATTR(
-        provider->moduleAttributes.nameStability,
-        provider->moduleAttributes.dataStability,
-        provider->moduleAttributes.dependencyClass);
-    prv->dofpv_funcattr = DOF_ATTR(
-        provider->functionAttributes.nameStability,
-        provider->functionAttributes.dataStability,
-        provider->functionAttributes.dependencyClass);
-    prv->dofpv_nameattr = DOF_ATTR(
-        provider->nameAttributes.nameStability,
-        provider->nameAttributes.dataStability,
-        provider->nameAttributes.dependencyClass);
-    prv->dofpv_argsattr = DOF_ATTR(
-        provider->argsAttributes.nameStability,
-        provider->argsAttributes.dataStability,
-        provider->argsAttributes.dependencyClass);
-
-    // PROBES /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * probe_sec);
-    sec->dofs_type    = DOF_SECT_PROBES;
-    sec->dofs_align   = alignment_for[PROBES];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(dof_probe_t);
-    sec->dofs_offset  = secoffs[probe_sec];
-    sec->dofs_size    = secsize[probe_sec];
-    // Make probes descriptions
-    uint32_t argsoffs = 0;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* probe = &(provider->probes[prbc]);
-      Method* m = Method::resolve_jmethod_id(probe->method);
-      int arg_count = ArgumentCount(m->signature()).size();
-      assert(m->code() != NULL, "must have an nmethod");
-
-      dof_probe_t* prb =
-         (dof_probe_t*)(dof + sec->dofs_offset + prbc * sizeof(dof_probe_t));
-
-      prb->dofpr_addr   = (uint64_t)m->code()->entry_point();
-      prb->dofpr_func   = stroffs[curstr++]; // Index in string table
-      prb->dofpr_name   = stroffs[curstr++]; // Index in string table
-      prb->dofpr_nargv  = stroffs[curstr  ]; // Index in string table
-      // We spent siglen strings here
-      curstr += arg_count;
-      prb->dofpr_xargv  = prb->dofpr_nargv;  // Same bunch of strings
-      prb->dofpr_argidx = argsoffs;
-      prb->dofpr_offidx = prbc;
-      prb->dofpr_nargc  = arg_count;
-      prb->dofpr_xargc  = arg_count;
-      prb->dofpr_noffs  = 1; // Number of offsets
-      // Next bunch of offsets
-      argsoffs += arg_count;
-    }
-
-    // PROFFS /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * probeoffs_sec);
-    sec->dofs_type    = DOF_SECT_PROFFS;
-    sec->dofs_align   = alignment_for[PROBE_OFFSETS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(uint32_t);
-    sec->dofs_offset  = secoffs[probeoffs_sec];
-    sec->dofs_size    = secsize[probeoffs_sec];
-    // Make offsets
-    for (int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      uint32_t* pof =
-          (uint32_t*)(dof + sec->dofs_offset + sizeof(uint32_t) * prbc);
-      JVM_DTraceProbe* probe = &(provider->probes[prbc]);
-      Method* m = Method::resolve_jmethod_id(probe->method);
-      *pof = m->code()->trap_offset();
-    }
-
-    // PRARGS /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * argoffs_sec);
-    sec->dofs_type    = DOF_SECT_PRARGS;
-    sec->dofs_align   = alignment_for[ARG_OFFSETS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(uint8_t);
-    sec->dofs_offset  = secoffs[argoffs_sec];
-    sec->dofs_size    = secsize[argoffs_sec];
-    // Make arguments
-    uint8_t* par = (uint8_t*)(dof + sec->dofs_offset);
-    for (int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      uint8_t count = (uint8_t)ArgumentCount(sig).size();
-      for (uint8_t i = 0; i < count; ++i) {
-        *par++ = i;
-      }
-    }
-  }
-
-  // Register module
-  return dof_register(module, dof, moduleBaseAddress);
-}
-
-
-void DTraceJSDT::pd_dispose(int handle) {
-  int fd;
-  if (handle == -1) {
-    return;
-  }
-  fd = dofhelper_open();
-  if (fd < 0)
-    return;
-  ioctl(fd, DTRACEHIOC_REMOVE, handle);
-  close(fd);
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  int fd = dofhelper_open();
-  if (fd < 0) {
-    return false;
-  }
-  close(fd);
-  return true;
-}
-
-static const char* dofSecTypeFor(uint32_t type) {
-  switch (type) {
-    case 0:  return "DOF_SECT_NONE";
-    case 1:  return "DOF_SECT_COMMENTS";
-    case 2:  return "DOF_SECT_SOURCE";
-    case 3:  return "DOF_SECT_ECBDESC";
-    case 4:  return "DOF_SECT_PROBEDESC";
-    case 5:  return "DOF_SECT_ACTDESC";
-    case 6:  return "DOF_SECT_DIFOHDR";
-    case 7:  return "DOF_SECT_DIF";
-    case 8:  return "DOF_SECT_STRTAB";
-    case 9:  return "DOF_SECT_VARTAB";
-    case 10: return "DOF_SECT_RELTAB";
-    case 11: return "DOF_SECT_TYPETAB";
-    case 12: return "DOF_SECT_URELHDR";
-    case 13: return "DOF_SECT_KRELHDR";
-    case 14: return "DOF_SECT_OPTDESC";
-    case 15: return "DOF_SECT_PROVIDER";
-    case 16: return "DOF_SECT_PROBES";
-    case 17: return "DOF_SECT_PRARGS";
-    case 18: return "DOF_SECT_PROFFS";
-    case 19: return "DOF_SECT_INTTAB";
-    case 20: return "DOF_SECT_UTSNAME";
-    case 21: return "DOF_SECT_XLTAB";
-    case 22: return "DOF_SECT_XLMEMBERS";
-    case 23: return "DOF_SECT_XLIMPORT";
-    case 24: return "DOF_SECT_XLEXPORT";
-    case 25: return "DOF_SECT_PREXPORT";
-    case 26: return "DOF_SECT_PRENOFFS";
-    default: return "<unknown>";
-  }
-}
-
-static void printDOFStringTabSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   String Table:");
-  for (size_t idx = 0; idx < limit; /*empty*/) {
-    char* str = ((char*)dof) + tab + idx;
-    tty->print_cr("//   [0x%x + 0x%x] '%s'", tab, idx, str);
-    idx += strlen(str) + 1;
-  }
-}
-
-static void printDOFProviderSec(void* dof, dof_sec_t* sec) {
-  dof_provider_t* prov = (dof_provider_t*)((char*)dof + sec->dofs_offset);
-  tty->print_cr("//   dof_provider_t {");
-  tty->print_cr("//     dofpv_strtab = %d", prov->dofpv_strtab);
-  tty->print_cr("//     dofpv_probes = %d", prov->dofpv_probes);
-  tty->print_cr("//     dofpv_prargs = %d", prov->dofpv_prargs);
-  tty->print_cr("//     dofpv_proffs = %d", prov->dofpv_proffs);
-  tty->print_cr("//     dofpv_name = 0x%x", prov->dofpv_name);
-  tty->print_cr("//     dofpv_provattr = 0x%08x", prov->dofpv_provattr);
-  tty->print_cr("//     dofpv_modattr = 0x%08x", prov->dofpv_modattr);
-  tty->print_cr("//     dofpv_funcattr = 0x%08x", prov->dofpv_funcattr);
-  tty->print_cr("//     dofpv_nameattr = 0x%08x", prov->dofpv_nameattr);
-  tty->print_cr("//     dofpv_argsattr = 0x%08x", prov->dofpv_argsattr);
-  tty->print_cr("//   }");
-}
-
-static void printDOFProbesSec(void* dof, dof_sec_t* sec) {
-  size_t idx = sec->dofs_offset;
-  size_t limit = idx + sec->dofs_size;
-  for (size_t idx = sec->dofs_offset; idx < limit; idx += sec->dofs_entsize) {
-    dof_probe_t* prb = (dof_probe_t*)((char*)dof + idx);
-    tty->print_cr("//   dof_probe_t {");
-    tty->print_cr("//     dofpr_addr = 0x%016llx", prb->dofpr_addr);
-    tty->print_cr("//     dofpr_func = 0x%x", prb->dofpr_func);
-    tty->print_cr("//     dofpr_name = 0x%x", prb->dofpr_name);
-    tty->print_cr("//     dofpr_nargv = 0x%x", prb->dofpr_nargv);
-    tty->print_cr("//     dofpr_xargv = 0x%x", prb->dofpr_xargv);
-    tty->print_cr("//     dofpr_argidx = 0x%x", prb->dofpr_argidx);
-    tty->print_cr("//     dofpr_offidx = 0x%x", prb->dofpr_offidx);
-    tty->print_cr("//     dofpr_nargc = %d", prb->dofpr_nargc);
-    tty->print_cr("//     dofpr_xargc = %d", prb->dofpr_xargc);
-    tty->print_cr("//     dofpr_noffs = %d", prb->dofpr_noffs);
-    tty->print_cr("//   }");
-  }
-}
-
-static void printDOFOffsetsSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   Offsets:");
-  for (size_t idx = 0; idx < limit; idx += sec->dofs_entsize) {
-    uint32_t* off = (uint32_t*)((char*)dof + tab + idx);
-    tty->print_cr("//   [0x%x + 0x%x]: %d", tab, idx, *off);
-  }
-}
-
-static void printDOFArgsSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   Arguments:");
-  for (size_t idx = 0; idx < limit; idx += sec->dofs_entsize) {
-    uint8_t* arg = (uint8_t*)((char*)dof + tab + idx);
-    tty->print_cr("//   [0x%x + 0x%x]: %d", tab, idx, *arg);
-  }
-}
-
-static void printDOFSection(void* dof, dof_sec_t* sec) {
-  tty->print_cr("//   dof_sec_t {");
-  tty->print_cr("//     dofs_type = 0x%x /* %s */",
-                sec->dofs_type, dofSecTypeFor(sec->dofs_type));
-  tty->print_cr("//     dofs_align = %d", sec->dofs_align);
-  tty->print_cr("//     dofs_flags = 0x%x", sec->dofs_flags);
-  tty->print_cr("//     dofs_entsize = %d", sec->dofs_entsize);
-  tty->print_cr("//     dofs_offset = 0x%llx", sec->dofs_offset);
-  tty->print_cr("//     dofs_size = %lld", sec->dofs_size);
-  tty->print_cr("//   }");
-  switch (sec->dofs_type) {
-    case DOF_SECT_STRTAB:    printDOFStringTabSec(dof, sec); break;
-    case DOF_SECT_PROVIDER:  printDOFProviderSec(dof, sec);  break;
-    case DOF_SECT_PROBES:    printDOFProbesSec(dof, sec);    break;
-    case DOF_SECT_PROFFS:    printDOFOffsetsSec(dof, sec);   break;
-    case DOF_SECT_PRARGS:    printDOFArgsSec(dof, sec);      break;
-    default: tty->print_cr("//   <section type not recognized>");
-  }
-}
-
-static void printDOFHeader(dof_hdr_t* hdr) {
-  tty->print_cr("//   dof_hdr_t {");
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG0] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG0]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG1] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG1]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG2] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG2]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG3] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG3]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MODEL] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MODEL]);
-  tty->print_cr("//     dofh_ident[DOF_ID_ENCODING] = 0x%x",
-                hdr->dofh_ident[DOF_ID_ENCODING]);
-  tty->print_cr("//     dofh_ident[DOF_ID_VERSION] = 0x%x",
-                hdr->dofh_ident[DOF_ID_VERSION]);
-  tty->print_cr("//     dofh_ident[DOF_ID_DIFVERS] = 0x%x",
-                hdr->dofh_ident[DOF_ID_DIFVERS]);
-  tty->print_cr("//     dofh_flags = 0x%x", hdr->dofh_flags);
-  tty->print_cr("//     dofh_hdrsize = %d", hdr->dofh_hdrsize);
-  tty->print_cr("//     dofh_secsize = %d", hdr->dofh_secsize);
-  tty->print_cr("//     dofh_secnum = %d", hdr->dofh_secnum);
-  tty->print_cr("//     dofh_secoff = %lld", hdr->dofh_secoff);
-  tty->print_cr("//     dofh_loadsz = %lld", hdr->dofh_loadsz);
-  tty->print_cr("//     dofh_filesz = %lld", hdr->dofh_filesz);
-  tty->print_cr("//   }");
-}
-
-static void printDOF(void* dof) {
-  dof_hdr_t* hdr = (dof_hdr_t*)dof;
-  printDOFHeader(hdr);
-  for (int i = 0; i < hdr->dofh_secnum; ++i) {
-    dof_sec_t* sec =
-      (dof_sec_t*)((char*)dof + sizeof(dof_hdr_t) + i * sizeof(dof_sec_t));
-    tty->print_cr("//   [Section #%d]", i);
-    printDOFSection(dof, sec);
-  }
-}
-
-static void printDOFHelper(dof_helper_t* helper) {
-  tty->print_cr("// dof_helper_t {");
-  tty->print_cr("//   dofhp_mod = \"%s\"", helper->dofhp_mod);
-  tty->print_cr("//   dofhp_addr = 0x%016llx", helper->dofhp_addr);
-  tty->print_cr("//   dofhp_dof = 0x%016llx", helper->dofhp_dof);
-  printDOF((void*)helper->dofhp_dof);
-  tty->print_cr("// }");
-  size_t len = ((dof_hdr_t*)helper)->dofh_loadsz;
-  tty->print_data((void*)helper->dofhp_dof, len, true);
-}
-
-#else // ndef HAVE_DTRACE_H
-
-// Get here if we're not building on at least Solaris 10
-int DTraceJSDT::pd_activate(
-  void* baseAddress, jstring module,
-  jint provider_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
-#endif
--- a/hotspot/src/os/solaris/vm/vmError_solaris.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/os/solaris/vm/vmError_solaris.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -30,6 +30,7 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <thread.h>
 #include <signal.h>
 
 void VMError::show_message_box(char *buf, int buflen) {
@@ -59,9 +60,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -74,19 +81,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -96,16 +103,25 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
 }
--- a/hotspot/src/os/windows/vm/dtraceJSDT_windows.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3489,9 +3489,7 @@
     "GetAndAddL", "GetAndSetL", "GetAndSetN",
   };
   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
-  if( strcmp(_opType,"PrefetchRead")==0 ||
-      strcmp(_opType,"PrefetchWrite")==0 ||
-      strcmp(_opType,"PrefetchAllocation")==0 )
+  if( strcmp(_opType,"PrefetchAllocation")==0 )
     return 1;
   if( _lChild ) {
     const char *opType = _lChild->_opType;
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -42,7 +42,6 @@
                  Verified_Entry,
                  Frame_Complete, // Offset in the code where the frame setup is (for forte stackwalks) is complete
                  OSR_Entry,
-                 Dtrace_trap = OSR_Entry,  // dtrace probes can never have an OSR entry so reuse it
                  Exceptions,     // Offset where exception handler lives
                  Deopt,          // Offset where deopt handler lives
                  DeoptMH,        // Offset where MethodHandle deopt handler lives
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -964,8 +964,6 @@
 void Canonicalizer::do_UnsafeGetObject(UnsafeGetObject* x) {}
 void Canonicalizer::do_UnsafePutObject(UnsafePutObject* x) {}
 void Canonicalizer::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
-void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead*  x) {}
-void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
 void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,8 +101,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType*  x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3497,11 +3497,6 @@
     case vmIntrinsics::_putFloat_raw  : return append_unsafe_put_raw(callee, T_FLOAT);
     case vmIntrinsics::_putDouble_raw : return append_unsafe_put_raw(callee, T_DOUBLE);
 
-    case vmIntrinsics::_prefetchRead        : return append_unsafe_prefetch(callee, false, false);
-    case vmIntrinsics::_prefetchWrite       : return append_unsafe_prefetch(callee, false, true);
-    case vmIntrinsics::_prefetchReadStatic  : return append_unsafe_prefetch(callee, true,  false);
-    case vmIntrinsics::_prefetchWriteStatic : return append_unsafe_prefetch(callee, true,  true);
-
     case vmIntrinsics::_checkIndex    :
       if (!InlineNIOCheckIndex) return false;
       preserves_state = true;
@@ -4258,27 +4253,6 @@
 }
 
 
-bool GraphBuilder::append_unsafe_prefetch(ciMethod* callee, bool is_static, bool is_store) {
-  if (InlineUnsafeOps) {
-    Values* args = state()->pop_arguments(callee->arg_size());
-    int obj_arg_index = 1; // Assume non-static case
-    if (is_static) {
-      obj_arg_index = 0;
-    } else {
-      null_check(args->at(0));
-    }
-    Instruction* offset = args->at(obj_arg_index + 1);
-#ifndef _LP64
-    offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
-#endif
-    Instruction* op = is_store ? append(new UnsafePrefetchWrite(args->at(obj_arg_index), offset))
-                               : append(new UnsafePrefetchRead (args->at(obj_arg_index), offset));
-    compilation()->set_has_unsafe_access(true);
-  }
-  return InlineUnsafeOps;
-}
-
-
 void GraphBuilder::append_unsafe_CAS(ciMethod* callee) {
   ValueStack* state_before = copy_state_for_exception();
   ValueType* result_type = as_ValueType(callee->return_type());
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -368,7 +368,6 @@
   bool append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile);
   bool append_unsafe_get_raw(ciMethod* callee, BasicType t);
   bool append_unsafe_put_raw(ciMethod* callee, BasicType t);
-  bool append_unsafe_prefetch(ciMethod* callee, bool is_store, bool is_static);
   void append_unsafe_CAS(ciMethod* callee);
   bool append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
 
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,9 +103,6 @@
 class       UnsafeGetObject;
 class       UnsafePutObject;
 class         UnsafeGetAndSetObject;
-class       UnsafePrefetch;
-class         UnsafePrefetchRead;
-class         UnsafePrefetchWrite;
 class   ProfileCall;
 class   ProfileReturnType;
 class   ProfileInvoke;
@@ -209,8 +206,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
   virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) = 0;
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) = 0;
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
   virtual void do_ProfileReturnType (ProfileReturnType*  x) = 0;
   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
@@ -2442,34 +2437,6 @@
                                                    f->visit(&_value); }
 };
 
-BASE(UnsafePrefetch, UnsafeObjectOp)
- public:
-  UnsafePrefetch(Value object, Value offset)
-  : UnsafeObjectOp(T_VOID, object, offset, false, false)
-  {
-  }
-};
-
-
-LEAF(UnsafePrefetchRead, UnsafePrefetch)
- public:
-  UnsafePrefetchRead(Value object, Value offset)
-  : UnsafePrefetch(object, offset)
-  {
-    ASSERT_VALUES
-  }
-};
-
-
-LEAF(UnsafePrefetchWrite, UnsafePrefetch)
- public:
-  UnsafePrefetchWrite(Value object, Value offset)
-  : UnsafePrefetch(object, offset)
-  {
-    ASSERT_VALUES
-  }
-};
-
 LEAF(ProfileCall, Instruction)
  private:
   ciMethod*        _method;
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -853,11 +853,6 @@
   output()->put(')');
 }
 
-void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
-  print_unsafe_object_op(x, "UnsafePrefetchRead");
-  output()->put(')');
-}
-
 void InstructionPrinter::do_RangeCheckPredicate(RangeCheckPredicate* x) {
 
   if (x->x() != NULL && x->y() != NULL) {
@@ -880,11 +875,6 @@
 }
 #endif
 
-void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
-  print_unsafe_object_op(x, "UnsafePrefetchWrite");
-  output()->put(')');
-}
-
 void InstructionPrinter::do_ProfileCall(ProfileCall* x) {
   output()->print("profile ");
   print_value(x->recv());
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,8 +129,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType*  x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -527,8 +527,6 @@
     case lir_move:           // input and result always valid, may have info
     case lir_pack64:         // input and result always valid
     case lir_unpack64:       // input and result always valid
-    case lir_prefetchr:      // input always valid, result and info always invalid
-    case lir_prefetchw:      // input always valid, result and info always invalid
     {
       assert(op->as_Op1() != NULL, "must be");
       LIR_Op1* op1 = (LIR_Op1*)op;
@@ -1266,13 +1264,6 @@
 }
 
 
-void LIR_List::prefetch(LIR_Address* addr, bool is_store) {
-  append(new LIR_Op1(
-            is_store ? lir_prefetchw : lir_prefetchr,
-            LIR_OprFact::address(addr)));
-}
-
-
 void LIR_List::store_mem_int(jint v, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
   append(new LIR_Op1(
             lir_move,
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,8 +925,6 @@
       , lir_branch
       , lir_cond_float_branch
       , lir_move
-      , lir_prefetchr
-      , lir_prefetchw
       , lir_convert
       , lir_alloc_object
       , lir_monaddr
@@ -2212,8 +2210,6 @@
 
   void load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none);
 
-  void prefetch(LIR_Address* addr, bool is_store);
-
   void store_mem_int(jint v,    LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code = lir_patch_none);
   void store_mem_oop(jobject o, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code = lir_patch_none);
   void store(LIR_Opr src, LIR_Address* addr, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none);
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -503,14 +503,6 @@
       }
       break;
 
-    case lir_prefetchr:
-      prefetchr(op->in_opr());
-      break;
-
-    case lir_prefetchw:
-      prefetchw(op->in_opr());
-      break;
-
     case lir_roundfp: {
       LIR_OpRoundFP* round_op = op->as_OpRoundFP();
       roundfp_op(round_op->in_opr(), round_op->tmp(), round_op->result_opr(), round_op->pop_fpu_stack());
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -182,9 +182,6 @@
                    LIR_PatchCode patch_code,
                    CodeEmitInfo* info, bool wide, bool unaligned);
 
-  void prefetchr  (LIR_Opr src);
-  void prefetchw  (LIR_Opr src);
-
   void shift_op(LIR_Code code, LIR_Opr left, LIR_Opr count, LIR_Opr dest, LIR_Opr tmp);
   void shift_op(LIR_Code code, LIR_Opr left, jint  count, LIR_Opr dest);
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2385,35 +2385,6 @@
 }
 
 
-void LIRGenerator::do_UnsafePrefetch(UnsafePrefetch* x, bool is_store) {
-  LIRItem src(x->object(), this);
-  LIRItem off(x->offset(), this);
-
-  src.load_item();
-  if (off.is_constant() && can_inline_as_constant(x->offset())) {
-    // let it be a constant
-    off.dont_load_item();
-  } else {
-    off.load_item();
-  }
-
-  set_no_result(x);
-
-  LIR_Address* addr = generate_address(src.result(), off.result(), 0, 0, T_BYTE);
-  __ prefetch(addr, is_store);
-}
-
-
-void LIRGenerator::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
-  do_UnsafePrefetch(x, false);
-}
-
-
-void LIRGenerator::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
-  do_UnsafePrefetch(x, true);
-}
-
-
 void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux) {
   int lng = x->length();
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -251,8 +251,6 @@
   void do_Reference_get(Intrinsic* x);
   void do_update_CRC32(Intrinsic* x);
 
-  void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store);
-
   LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
   LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
 
@@ -539,8 +537,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType* x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -528,8 +528,6 @@
   void do_UnsafeGetObject(UnsafeGetObject* x);
   void do_UnsafePutObject(UnsafePutObject* x);
   void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   void do_ProfileCall    (ProfileCall*     x);
   void do_ProfileReturnType (ProfileReturnType*  x);
   void do_ProfileInvoke  (ProfileInvoke*   x);
@@ -716,8 +714,6 @@
 void NullCheckVisitor::do_UnsafeGetObject(UnsafeGetObject* x) {}
 void NullCheckVisitor::do_UnsafePutObject(UnsafePutObject* x) {}
 void NullCheckVisitor::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
-void NullCheckVisitor::do_UnsafePrefetchRead (UnsafePrefetchRead*  x) {}
-void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void NullCheckVisitor::do_ProfileCall    (ProfileCall*     x) { nce()->clear_last_explicit_null_check();
                                                                 nce()->handle_ProfileCall(x); }
 void NullCheckVisitor::do_ProfileReturnType (ProfileReturnType* x) { nce()->handle_ProfileReturnType(x); }
--- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,8 +159,6 @@
     void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ };
     void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ };
     void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) { /* nothing to do */ };
-    void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ };
-    void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ };
     void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ };
     void do_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ };
     void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
--- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -200,8 +200,6 @@
   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
   void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ }
   void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
-  void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ }
-  void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
   void do_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ }
   void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -501,32 +501,31 @@
   return fields;
 }
 
-void ciInstanceKlass::compute_injected_fields_helper() {
+bool ciInstanceKlass::compute_injected_fields_helper() {
   ASSERT_IN_VM;
   InstanceKlass* k = get_instanceKlass();
 
   for (InternalFieldStream fs(k); !fs.done(); fs.next()) {
     if (fs.access_flags().is_static())  continue;
-    _has_injected_fields++;
-    break;
+    return true;
   }
+  return false;
 }
 
-bool ciInstanceKlass::compute_injected_fields() {
-  assert(_has_injected_fields == -1, "shouldn't be initialized yet");
+void ciInstanceKlass::compute_injected_fields() {
   assert(is_loaded(), "must be loaded");
 
+  int has_injected_fields = 0;
   if (super() != NULL && super()->has_injected_fields()) {
-    _has_injected_fields = 1;
-    return true;
+    has_injected_fields = 1;
+  } else {
+    GUARDED_VM_ENTRY({
+        has_injected_fields = compute_injected_fields_helper() ? 1 : 0;
+      });
   }
-
-  _has_injected_fields = 0;
-  GUARDED_VM_ENTRY({
-      compute_injected_fields_helper();
-    });
-
-  return _has_injected_fields > 0 ? true : false;
+  // may be concurrently initialized for shared ciInstanceKlass objects
+  assert(_has_injected_fields == -1 || _has_injected_fields == has_injected_fields, "broken concurrent initialization");
+  _has_injected_fields = has_injected_fields;
 }
 
 // ------------------------------------------------------------------
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -72,8 +72,8 @@
   //   Itsef: more than one implementors.
   ciInstanceKlass*       _implementor;
 
-  bool compute_injected_fields();
-  void compute_injected_fields_helper();
+  void compute_injected_fields();
+  bool compute_injected_fields_helper();
 
 protected:
   ciInstanceKlass(KlassHandle h_k);
@@ -193,7 +193,7 @@
 
   bool has_injected_fields() {
     if (_has_injected_fields == -1) {
-      return compute_injected_fields();
+      compute_injected_fields();
     }
     return _has_injected_fields > 0 ? true : false;
   }
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -70,7 +70,8 @@
 // Loaded method.
 ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
   ciMetadata(h_m()),
-  _holder(holder)
+  _holder(holder),
+  _has_injected_profile(false)
 {
   assert(h_m() != NULL, "no null method");
 
@@ -168,7 +169,8 @@
   _liveness(               NULL),
   _can_be_statically_bound(false),
   _method_blocks(          NULL),
-  _method_data(            NULL)
+  _method_data(            NULL),
+  _has_injected_profile(   false)
 #if defined(COMPILER2) || defined(SHARK)
   ,
   _flow(                   NULL),
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -79,6 +79,7 @@
   bool _is_c1_compilable;
   bool _is_c2_compilable;
   bool _can_be_statically_bound;
+  bool _has_injected_profile;
 
   // Lazy fields, filled in on demand
   address              _code;
@@ -286,6 +287,9 @@
   int instructions_size();
   int scale_count(int count, float prof_factor = 1.);  // make MDO count commensurate with IIC
 
+  bool has_injected_profile() const { return _has_injected_profile;     }
+  void set_injected_profile(bool x) {        _has_injected_profile = x; }
+
   // Stack walking support
   bool is_ignored_by_security_stack_walk() const;
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -243,7 +243,6 @@
   template(returnType_name,                           "returnType")                               \
   template(signature_name,                            "signature")                                \
   template(slot_name,                                 "slot")                                     \
-  template(selectAlternative_name,                    "selectAlternative")                        \
                                                                                                   \
   /* Support for annotations (JDK 1.5 and above) */                                               \
                                                                                                   \
@@ -295,8 +294,7 @@
   template(setTarget_signature,                       "(Ljava/lang/invoke/MethodHandle;)V")       \
   NOT_LP64(  do_alias(intptr_signature,               int_signature)  )                           \
   LP64_ONLY( do_alias(intptr_signature,               long_signature) )                           \
-  template(selectAlternative_signature, "(ZLjava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle;") \
-                                                                      \
+                                                                                                  \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \
   template(class_initializer_name,                    "<clinit>")                                 \
@@ -868,6 +866,12 @@
    do_name(     fullFence_name,                                  "fullFence")                                           \
    do_alias(    fullFence_signature,                              void_method_signature)                                \
                                                                                                                         \
+  /* Custom branch frequencies profiling support for JSR292 */                                                          \
+  do_class(java_lang_invoke_MethodHandleImpl,               "java/lang/invoke/MethodHandleImpl")                        \
+  do_intrinsic(_profileBoolean, java_lang_invoke_MethodHandleImpl, profileBoolean_name, profileBoolean_signature,    F_S)  \
+   do_name(     profileBoolean_name,                               "profileBoolean")                                     \
+   do_signature(profileBoolean_signature,                           "(Z[I)Z")                                            \
+                                                                                                                        \
   /* unsafe memory references (there are a lot of them...) */                                                           \
   do_signature(getObject_signature,       "(Ljava/lang/Object;J)Ljava/lang/Object;")                                    \
   do_signature(putObject_signature,       "(Ljava/lang/Object;JLjava/lang/Object;)V")                                   \
@@ -1017,18 +1021,6 @@
   do_intrinsic(_getAndSetObject,          sun_misc_Unsafe,        getAndSetObject_name, getAndSetObject_signature,  F_R)\
    do_name(     getAndSetObject_name,                             "getAndSetObject")                                    \
    do_signature(getAndSetObject_signature,                        "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
-                                                                                                                        \
-  /* prefetch_signature is shared by all prefetch variants */                                                           \
-  do_signature( prefetch_signature,        "(Ljava/lang/Object;J)V")                                                    \
-                                                                                                                        \
-  do_intrinsic(_prefetchRead,             sun_misc_Unsafe,        prefetchRead_name, prefetch_signature,         F_RN)  \
-   do_name(     prefetchRead_name,                               "prefetchRead")                                        \
-  do_intrinsic(_prefetchWrite,            sun_misc_Unsafe,        prefetchWrite_name, prefetch_signature,        F_RN)  \
-   do_name(     prefetchWrite_name,                              "prefetchWrite")                                       \
-  do_intrinsic(_prefetchReadStatic,       sun_misc_Unsafe,        prefetchReadStatic_name, prefetch_signature,   F_SN)  \
-   do_name(     prefetchReadStatic_name,                         "prefetchReadStatic")                                  \
-  do_intrinsic(_prefetchWriteStatic,      sun_misc_Unsafe,        prefetchWriteStatic_name, prefetch_signature,  F_SN)  \
-   do_name(     prefetchWriteStatic_name,                        "prefetchWriteStatic")                                 \
     /*== LAST_COMPILER_INLINE*/                                                                                         \
     /*the compiler does have special inlining code for these; bytecode inline is just fine */                           \
                                                                                                                         \
@@ -1203,7 +1195,7 @@
     #undef VM_INTRINSIC_ENUM
 
     ID_LIMIT,
-    LAST_COMPILER_INLINE = _prefetchWriteStatic,
+    LAST_COMPILER_INLINE = _getAndSetObject,
     FIRST_MH_SIG_POLY    = _invokeGeneric,
     FIRST_MH_STATIC      = _linkToVirtual,
     LAST_MH_SIG_POLY     = _linkToInterface,
--- a/hotspot/src/share/vm/code/nmethod.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -477,9 +477,6 @@
 #if INCLUDE_RTM_OPT
   _rtm_state               = NoRTM;
 #endif
-#ifdef HAVE_DTRACE_H
-  _trap_offset             = 0;
-#endif // def HAVE_DTRACE_H
 }
 
 nmethod* nmethod::new_native_nmethod(methodHandle method,
@@ -520,44 +517,6 @@
   return nm;
 }
 
-#ifdef HAVE_DTRACE_H
-nmethod* nmethod::new_dtrace_nmethod(methodHandle method,
-                                     CodeBuffer *code_buffer,
-                                     int vep_offset,
-                                     int trap_offset,
-                                     int frame_complete,
-                                     int frame_size) {
-  code_buffer->finalize_oop_references(method);
-  // create nmethod
-  nmethod* nm = NULL;
-  {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    int nmethod_size = allocation_size(code_buffer, sizeof(nmethod));
-    CodeOffsets offsets;
-    offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
-    offsets.set_value(CodeOffsets::Dtrace_trap, trap_offset);
-    offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
-
-    nm = new (nmethod_size, CompLevel_none) nmethod(method(), nmethod_size,
-                                    &offsets, code_buffer, frame_size);
-
-    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
-    if (PrintAssembly && nm != NULL) {
-      Disassembler::decode(nm);
-    }
-  }
-  // verify nmethod
-  debug_only(if (nm) nm->verify();) // might block
-
-  if (nm != NULL) {
-    nm->log_new_nmethod();
-  }
-
-  return nm;
-}
-
-#endif // def HAVE_DTRACE_H
-
 nmethod* nmethod::new_nmethod(methodHandle method,
   int compile_id,
   int entry_bci,
@@ -718,91 +677,6 @@
   }
 }
 
-// For dtrace wrappers
-#ifdef HAVE_DTRACE_H
-nmethod::nmethod(
-  Method* method,
-  int nmethod_size,
-  CodeOffsets* offsets,
-  CodeBuffer* code_buffer,
-  int frame_size)
-  : CodeBlob("dtrace nmethod", code_buffer, sizeof(nmethod),
-             nmethod_size, offsets->value(CodeOffsets::Frame_Complete), frame_size, NULL),
-  _native_receiver_sp_offset(in_ByteSize(-1)),
-  _native_basic_lock_sp_offset(in_ByteSize(-1))
-{
-  {
-    debug_only(No_Safepoint_Verifier nsv;)
-    assert_locked_or_safepoint(CodeCache_lock);
-
-    init_defaults();
-    _method                  = method;
-    _entry_bci               = InvocationEntryBci;
-    // We have no exception handler or deopt handler make the
-    // values something that will never match a pc like the nmethod vtable entry
-    _exception_offset        = 0;
-    _deoptimize_offset       = 0;
-    _deoptimize_mh_offset    = 0;
-    _unwind_handler_offset   = -1;
-    _trap_offset             = offsets->value(CodeOffsets::Dtrace_trap);
-    _orig_pc_offset          = 0;
-    _consts_offset           = data_offset();
-    _stub_offset             = data_offset();
-    _oops_offset             = data_offset();
-    _metadata_offset         = _oops_offset         + round_to(code_buffer->total_oop_size(), oopSize);
-    _scopes_data_offset      = _metadata_offset     + round_to(code_buffer->total_metadata_size(), wordSize);
-    _scopes_pcs_offset       = _scopes_data_offset;
-    _dependencies_offset     = _scopes_pcs_offset;
-    _handler_table_offset    = _dependencies_offset;
-    _nul_chk_table_offset    = _handler_table_offset;
-    _nmethod_end_offset      = _nul_chk_table_offset;
-    _compile_id              = 0;  // default
-    _comp_level              = CompLevel_none;
-    _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
-    _verified_entry_point    = code_begin()          + offsets->value(CodeOffsets::Verified_Entry);
-    _osr_entry_point         = NULL;
-    _exception_cache         = NULL;
-    _pc_desc_cache.reset_to(NULL);
-    _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
-
-    code_buffer->copy_values_to(this);
-    if (ScavengeRootsInCode) {
-      if (detect_scavenge_root_oops()) {
-        CodeCache::add_scavenge_root_nmethod(this);
-      }
-      Universe::heap()->register_nmethod(this);
-    }
-    DEBUG_ONLY(verify_scavenge_root_oops();)
-    CodeCache::commit(this);
-  }
-
-  if (PrintNMethods || PrintDebugInfo || PrintRelocations || PrintDependencies) {
-    ttyLocker ttyl;  // keep the following output all in one block
-    // This output goes directly to the tty, not the compiler log.
-    // To enable tools to match it up with the compilation activity,
-    // be sure to tag this tty output with the compile ID.
-    if (xtty != NULL) {
-      xtty->begin_head("print_dtrace_nmethod");
-      xtty->method(_method);
-      xtty->stamp();
-      xtty->end_head(" address='" INTPTR_FORMAT "'", (intptr_t) this);
-    }
-    // print the header part first
-    print();
-    // then print the requested information
-    if (PrintNMethods) {
-      print_code();
-    }
-    if (PrintRelocations) {
-      print_relocations();
-    }
-    if (xtty != NULL) {
-      xtty->tail("print_dtrace_nmethod");
-    }
-  }
-}
-#endif // def HAVE_DTRACE_H
-
 void* nmethod::operator new(size_t size, int nmethod_size, int comp_level) throw () {
   return CodeCache::allocate(nmethod_size, CodeCache::get_code_blob_type(comp_level));
 }
@@ -2310,17 +2184,6 @@
 #endif // !SHARK
 }
 
-
-oop nmethod::embeddedOop_at(u_char* p) {
-  RelocIterator iter(this, p, p + 1);
-  while (iter.next())
-    if (iter.type() == relocInfo::oop_type) {
-      return iter.oop_reloc()->oop_value();
-    }
-  return NULL;
-}
-
-
 inline bool includes(void* p, void* from, void* to) {
   return from <= p && p < to;
 }
--- a/hotspot/src/share/vm/code/nmethod.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -157,9 +157,6 @@
   // Offset of the unwind handler if it exists
   int _unwind_handler_offset;
 
-#ifdef HAVE_DTRACE_H
-  int _trap_offset;
-#endif // def HAVE_DTRACE_H
   int _consts_offset;
   int _stub_offset;
   int _oops_offset;                       // offset to where embedded oop table begins (inside data)
@@ -261,15 +258,6 @@
           ByteSize basic_lock_sp_offset,       /* synchronized natives only */
           OopMapSet* oop_maps);
 
-#ifdef HAVE_DTRACE_H
-  // For native wrappers
-  nmethod(Method* method,
-          int nmethod_size,
-          CodeOffsets* offsets,
-          CodeBuffer *code_buffer,
-          int frame_size);
-#endif // def HAVE_DTRACE_H
-
   // Creation support
   nmethod(Method* method,
           int nmethod_size,
@@ -333,22 +321,6 @@
                                      ByteSize basic_lock_sp_offset,
                                      OopMapSet* oop_maps);
 
-#ifdef HAVE_DTRACE_H
-  // The method we generate for a dtrace probe has to look
-  // like an nmethod as far as the rest of the system is concerned
-  // which is somewhat unfortunate.
-  static nmethod* new_dtrace_nmethod(methodHandle method,
-                                     CodeBuffer *code_buffer,
-                                     int vep_offset,
-                                     int trap_offset,
-                                     int frame_complete,
-                                     int frame_size);
-
-  int trap_offset() const      { return _trap_offset; }
-  address trap_address() const { return insts_begin() + _trap_offset; }
-
-#endif // def HAVE_DTRACE_H
-
   // accessors
   Method* method() const                          { return _method; }
   AbstractCompiler* compiler() const              { return _compiler; }
@@ -730,11 +702,6 @@
   int  compile_id() const                         { return _compile_id; }
   const char* compile_kind() const;
 
-  // For debugging
-  // CompiledIC*    IC_at(char* p) const;
-  // PrimitiveIC*   primitiveIC_at(char* p) const;
-  oop embeddedOop_at(address p);
-
   // tells if any of this method's dependencies have been invalidated
   // (this is expensive!)
   static void check_all_dependencies(DepChange& changes);
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -345,21 +345,6 @@
       if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr);
       return;
     }
-
-    oop obj;
-    if (_nm != NULL
-        && (obj = _nm->embeddedOop_at(cur_insn())) != NULL
-        && (address) obj == adr
-        && Universe::heap()->is_in(obj)
-        && Universe::heap()->is_in(obj->klass())) {
-      julong c = st->count();
-      obj->print_value_on(st);
-      if (st->count() == c) {
-        // No output.  (Can happen in product builds.)
-        st->print("(a %s)", obj->klass()->external_name());
-      }
-      return;
-    }
   }
 
   // Fall through to a simple (hexadecimal) numeral.
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -308,7 +308,7 @@
 
   inline ParScanThreadState& thread_state(int i);
 
-  void trace_promotion_failed(YoungGCTracer& gc_tracer);
+  void trace_promotion_failed(const YoungGCTracer* gc_tracer);
   void reset(int active_workers, bool promotion_failed);
   void flush();
 
@@ -357,10 +357,10 @@
   return ((ParScanThreadState*)_data)[i];
 }
 
-void ParScanThreadStateSet::trace_promotion_failed(YoungGCTracer& gc_tracer) {
+void ParScanThreadStateSet::trace_promotion_failed(const YoungGCTracer* gc_tracer) {
   for (int i = 0; i < length(); ++i) {
     if (thread_state(i).promotion_failed()) {
-      gc_tracer.report_promotion_failed(thread_state(i).promotion_failed_info());
+      gc_tracer->report_promotion_failed(thread_state(i).promotion_failed_info());
       thread_state(i).promotion_failed_info().reset();
     }
   }
@@ -883,7 +883,7 @@
 
 // A Generation that does parallel young-gen collection.
 
-void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer) {
+void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set) {
   assert(_promo_failure_scan_stack.is_empty(), "post condition");
   _promo_failure_scan_stack.clear(true); // Clear cached segments.
 
@@ -899,10 +899,10 @@
   _next_gen->promotion_failure_occurred();
 
   // Trace promotion failure in the parallel GC threads
-  thread_state_set.trace_promotion_failed(gc_tracer);
+  thread_state_set.trace_promotion_failed(gc_tracer());
   // Single threaded code may have reported promotion failure to the global state
   if (_promotion_failed_info.has_failed()) {
-    gc_tracer.report_promotion_failed(_promotion_failed_info);
+    _gc_tracer.report_promotion_failed(_promotion_failed_info);
   }
   // Reset the PromotionFailureALot counters.
   NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
@@ -941,9 +941,8 @@
   }
   assert(to()->is_empty(), "Else not collection_attempt_is_safe");
 
-  ParNewTracer gc_tracer;
-  gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
-  gch->trace_heap_before_gc(&gc_tracer);
+  _gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
+  gch->trace_heap_before_gc(gc_tracer());
 
   init_assuming_no_promotion_failure();
 
@@ -952,7 +951,7 @@
     size_policy->minor_collection_begin();
   }
 
-  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, gc_tracer.gc_id());
+  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, _gc_tracer.gc_id());
   // Capture heap used before collection (for printing).
   size_t gch_prev_used = gch->used();
 
@@ -994,7 +993,7 @@
 
   // Trace and reset failed promotion info.
   if (promotion_failed()) {
-    thread_state_set.trace_promotion_failed(gc_tracer);
+    thread_state_set.trace_promotion_failed(gc_tracer());
   }
 
   // Process (weak) reference objects found during scavenge.
@@ -1015,16 +1014,16 @@
     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
     stats = rp->process_discovered_references(&is_alive, &keep_alive,
                                               &evacuate_followers, &task_executor,
-                                              _gc_timer, gc_tracer.gc_id());
+                                              _gc_timer, _gc_tracer.gc_id());
   } else {
     thread_state_set.flush();
     gch->set_par_threads(0);  // 0 ==> non-parallel.
     gch->save_marks();
     stats = rp->process_discovered_references(&is_alive, &keep_alive,
                                               &evacuate_followers, NULL,
-                                              _gc_timer, gc_tracer.gc_id());
+                                              _gc_timer, _gc_tracer.gc_id());
   }
-  gc_tracer.report_gc_reference_stats(stats);
+  _gc_tracer.report_gc_reference_stats(stats);
   if (!promotion_failed()) {
     // Swap the survivor spaces.
     eden()->clear(SpaceDecorator::Mangle);
@@ -1049,7 +1048,7 @@
 
     adjust_desired_tenuring_threshold();
   } else {
-    handle_promotion_failed(gch, thread_state_set, gc_tracer);
+    handle_promotion_failed(gch, thread_state_set);
   }
   // set new iteration safe limit for the survivor spaces
   from()->set_concurrent_iteration_safe_limit(from()->top());
@@ -1088,12 +1087,12 @@
   }
   rp->verify_no_references_recorded();
 
-  gch->trace_heap_after_gc(&gc_tracer);
-  gc_tracer.report_tenuring_threshold(tenuring_threshold());
+  gch->trace_heap_after_gc(gc_tracer());
+  _gc_tracer.report_tenuring_threshold(tenuring_threshold());
 
   _gc_timer->register_gc_end();
 
-  gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
+  _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
 }
 
 static int sum;
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -333,6 +333,9 @@
   // references to live referent.
   DefNewGeneration::IsAliveClosure _is_alive_closure;
 
+  // GC tracer that should be used during collection.
+  ParNewTracer _gc_tracer;
+
   static oop real_forwardee_slow(oop obj);
   static void waste_some_time();
 
@@ -340,7 +343,7 @@
   // word being overwritten with a self-forwarding-pointer.
   void preserve_mark_if_necessary(oop obj, markOop m);
 
-  void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer);
+  void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set);
 
  protected:
 
@@ -411,6 +414,10 @@
     return _plab_stats.desired_plab_sz();
   }
 
+  const ParNewTracer* gc_tracer() const {
+    return &_gc_tracer;
+  }
+
   static oop real_forwardee(oop obj);
 
   DEBUG_ONLY(static bool is_legal_forward_ptr(oop p);)
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -663,7 +663,7 @@
   }
 }
 
-void ParallelScavengeHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
+void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
   const PSHeapSummary& heap_summary = create_ps_heap_summary();
   gc_tracer->report_gc_heap_summary(when, heap_summary);
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -64,7 +64,7 @@
   // The task manager
   static GCTaskManager* _gc_task_manager;
 
-  void trace_heap(GCWhen::Type when, GCTracer* tracer);
+  void trace_heap(GCWhen::Type when, const GCTracer* tracer);
 
  protected:
   static inline size_t total_invocations();
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -162,7 +162,7 @@
   _tenuring_threshold = UNSET_TENURING_THRESHOLD;
 }
 
-void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) {
+void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) const {
   assert_set_gc_id();
 
   send_promotion_failed_event(pf_info);
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -153,7 +153,7 @@
   virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
 
  public:
-  void report_promotion_failed(const PromotionFailedInfo& pf_info);
+  void report_promotion_failed(const PromotionFailedInfo& pf_info) const;
   void report_tenuring_threshold(const uint tenuring_threshold);
 
   /*
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -132,7 +132,7 @@
   assert_locked_or_safepoint(CodeCache_lock);
 }
 
-void CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
+void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
   const GCHeapSummary& heap_summary = create_heap_summary();
   gc_tracer->report_gc_heap_summary(when, heap_summary);
 
@@ -140,11 +140,11 @@
   gc_tracer->report_metaspace_summary(when, metaspace_summary);
 }
 
-void CollectedHeap::trace_heap_before_gc(GCTracer* gc_tracer) {
+void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) {
   trace_heap(GCWhen::BeforeGC, gc_tracer);
 }
 
-void CollectedHeap::trace_heap_after_gc(GCTracer* gc_tracer) {
+void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) {
   trace_heap(GCWhen::AfterGC, gc_tracer);
 }
 
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -175,7 +175,7 @@
   // Fill with a single object (either an int array or a java.lang.Object).
   static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
 
-  virtual void trace_heap(GCWhen::Type when, GCTracer* tracer);
+  virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
 
   // Verification functions
   virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
@@ -606,8 +606,8 @@
   virtual void register_nmethod(nmethod* nm);
   virtual void unregister_nmethod(nmethod* nm);
 
-  void trace_heap_before_gc(GCTracer* gc_tracer);
-  void trace_heap_after_gc(GCTracer* gc_tracer);
+  void trace_heap_before_gc(const GCTracer* gc_tracer);
+  void trace_heap_after_gc(const GCTracer* gc_tracer);
 
   // Heap verification
   virtual void verify(bool silent, VerifyOption option) = 0;
--- a/hotspot/src/share/vm/gc_interface/gcCause.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -103,9 +103,6 @@
     case _last_ditch_collection:
       return "Last ditch collection";
 
-    case _dcmd_gc_run:
-      return "Diagnostic Command";
-
     case _last_gc_cause:
       return "ILLEGAL VALUE - last gc cause - ILLEGAL VALUE";
 
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -74,9 +74,6 @@
     _g1_humongous_allocation,
 
     _last_ditch_collection,
-
-    _dcmd_gc_run,
-
     _last_gc_cause
   };
 
--- a/hotspot/src/share/vm/memory/allocation.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -275,31 +275,30 @@
     Chunk* cur = NULL;
     Chunk* next;
     {
-    // if we have more than n chunks, free all of them
-    ThreadCritical tc;
-    if (_num_chunks > n) {
-      // free chunks at end of queue, for better locality
+      // if we have more than n chunks, free all of them
+      ThreadCritical tc;
+      if (_num_chunks > n) {
+        // free chunks at end of queue, for better locality
         cur = _first;
-      for (size_t i = 0; i < (n - 1) && cur != NULL; i++) cur = cur->next();
+        for (size_t i = 0; i < (n - 1) && cur != NULL; i++) cur = cur->next();
 
-      if (cur != NULL) {
+        if (cur != NULL) {
           next = cur->next();
-        cur->set_next(NULL);
-        cur = next;
+          cur->set_next(NULL);
+          cur = next;
 
-          _num_chunks = n;
+          // Free all remaining chunks while in ThreadCritical lock
+          // so NMT adjustment is stable.
+          while(cur != NULL) {
+            next = cur->next();
+            os::free(cur);
+            _num_chunks--;
+            cur = next;
+          }
         }
       }
     }
-
-    // Free all remaining chunks, outside of ThreadCritical
-    // to avoid deadlock with NMT
-        while(cur != NULL) {
-          next = cur->next();
-      os::free(cur);
-          cur = next;
-        }
-      }
+  }
 
   // Accessors to preallocated pool's
   static ChunkPool* large_pool()  { assert(_large_pool  != NULL, "must be initialized"); return _large_pool;  }
@@ -384,7 +383,9 @@
    case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
    case Chunk::init_size:   ChunkPool::small_pool()->free(c); break;
    case Chunk::tiny_size:   ChunkPool::tiny_pool()->free(c); break;
-   default:                 os::free(c);
+   default:
+     ThreadCritical tc;  // Free chunks under TC lock so that NMT adjustment is stable.
+     os::free(c);
   }
 }
 
--- a/hotspot/src/share/vm/memory/filemap.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -388,7 +388,8 @@
   remove(_full_path);
   int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
   if (fd < 0) {
-    fail_stop("Unable to create shared archive file %s.", _full_path);
+    fail_stop("Unable to create shared archive file %s: (%s).", _full_path,
+              strerror(errno));
   }
   _fd = fd;
   _file_offset = 0;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,12 +108,11 @@
   // Allocate space for the heap.
 
   char* heap_address;
-  size_t total_reserved = 0;
   ReservedSpace heap_rs;
 
   size_t heap_alignment = collector_policy()->heap_alignment();
 
-  heap_address = allocate(heap_alignment, &total_reserved, &heap_rs);
+  heap_address = allocate(heap_alignment, &heap_rs);
 
   if (!heap_rs.is_reserved()) {
     vm_shutdown_during_initialization(
@@ -149,7 +148,6 @@
 
 
 char* GenCollectedHeap::allocate(size_t alignment,
-                                 size_t* _total_reserved,
                                  ReservedSpace* heap_rs){
   const char overflow_msg[] = "The size of the object heap + VM data exceeds "
     "the maximum representable size";
@@ -171,8 +169,6 @@
          err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment="
                  SIZE_FORMAT, total_reserved, alignment));
 
-  *_total_reserved = total_reserved;
-
   *heap_rs = Universe::reserve_heap(total_reserved, alignment);
   return heap_rs->base();
 }
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,9 @@
 
   // Returns JNI_OK on success
   virtual jint initialize();
-  char* allocate(size_t alignment, size_t* _total_reserved, ReservedSpace* heap_rs);
+
+  // Reserve aligned space for the heap as needed by the contained generations.
+  char* allocate(size_t alignment, ReservedSpace* heap_rs);
 
   // Does operations required after initialization has been done.
   void post_initialize();
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 #include "precompiled.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
-#include "gc_implementation/shared/parGCAllocBuffer.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
 #include "memory/cardGeneration.inline.hpp"
--- a/hotspot/src/share/vm/opto/callnode.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1982,6 +1982,7 @@
 
 
 Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  if (remove_dead_region(phase, can_reshape))  return this;
 
   if (StressArrayCopyMacroNode && !can_reshape) return NULL;
 
--- a/hotspot/src/share/vm/opto/classes.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/classes.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -200,6 +200,7 @@
 macro(Opaque1)
 macro(Opaque2)
 macro(Opaque3)
+macro(ProfileBoolean)
 macro(OrI)
 macro(OrL)
 macro(OverflowAddI)
@@ -216,8 +217,6 @@
 macro(PopCountL)
 macro(PowD)
 macro(PrefetchAllocation)
-macro(PrefetchRead)
-macro(PrefetchWrite)
 macro(Proj)
 macro(RShiftI)
 macro(RShiftL)
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -3105,6 +3105,7 @@
   default:
     assert( !n->is_Call(), "" );
     assert( !n->is_Mem(), "" );
+    assert( nop != Op_ProfileBoolean, "should be eliminated during IGVN");
     break;
   }
 
@@ -3321,6 +3322,9 @@
 bool Compile::too_many_traps(ciMethod* method,
                              int bci,
                              Deoptimization::DeoptReason reason) {
+  if (method->has_injected_profile()) {
+    return false;
+  }
   ciMethodData* md = method->method_data();
   if (md->is_empty()) {
     // Assume the trap has not occurred, or that it occurred only
@@ -3370,6 +3374,9 @@
 bool Compile::too_many_recompiles(ciMethod* method,
                                   int bci,
                                   Deoptimization::DeoptReason reason) {
+  if (method->has_injected_profile()) {
+    return false;
+  }
   ciMethodData* md = method->method_data();
   if (md->is_empty()) {
     // Assume the trap has not occurred, or that it occurred only
--- a/hotspot/src/share/vm/opto/divnode.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/divnode.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -219,7 +219,7 @@
 static bool magic_long_divide_constants(jlong d, jlong &M, jint &s) {
   int64_t p;
   uint64_t ad, anc, delta, q1, r1, q2, r2, t;
-  const uint64_t two63 = 0x8000000000000000LL;     // 2**63.
+  const uint64_t two63 = UCONST64(0x8000000000000000);     // 2**63.
 
   ad = ABS(d);
   if (d == 0 || d == 1) return false;
--- a/hotspot/src/share/vm/opto/escape.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/escape.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -206,6 +206,11 @@
     _verify = false;
   }
 #endif
+  // Bytecode analyzer BCEscapeAnalyzer, used for Call nodes
+  // processing, calls to CI to resolve symbols (types, fields, methods)
+  // referenced in bytecode. During symbol resolution VM may throw
+  // an exception which CI cleans and converts to compilation failure.
+  if (C->failing())  return false;
 
   // 2. Finish Graph construction by propagating references to all
   //    java objects through graph.
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1986,6 +1986,11 @@
         Deoptimization::trap_request_index(trap_request) < 0 &&
         too_many_recompiles(reason)) {
       // This BCI is causing too many recompilations.
+      if (C->log() != NULL) {
+        C->log()->elem("observe that='trap_action_change' reason='%s' from='%s' to='none'",
+                Deoptimization::trap_reason_name(reason),
+                Deoptimization::trap_action_name(action));
+      }
       action = Deoptimization::Action_none;
       trap_request = Deoptimization::make_trap_request(reason, action);
     } else {
@@ -2760,7 +2765,7 @@
   Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
 
   // Make sure we haven't already deoptimized from this tactic.
-  if (too_many_traps(reason))
+  if (too_many_traps(reason) || too_many_recompiles(reason))
     return NULL;
 
   // (No, this isn't a call, but it's enough like a virtual call
@@ -2782,8 +2787,7 @@
                                             &exact_obj);
       { PreserveJVMState pjvms(this);
         set_control(slow_ctl);
-        uncommon_trap(reason,
-                      Deoptimization::Action_maybe_recompile);
+        uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
       }
       if (safe_for_replace) {
         replace_in_map(not_null_obj, exact_obj);
@@ -2812,8 +2816,12 @@
   if (type != NULL) {
     Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
     Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
-    if (!too_many_traps(null_reason) &&
-        !too_many_traps(class_reason)) {
+    ciMethod* trap_method = (sfpt == NULL) ? method() : sfpt->jvms()->method();
+    int trap_bci = (sfpt == NULL) ? bci() : sfpt->jvms()->bci();
+
+    if (!too_many_traps(null_reason) && !too_many_recompiles(null_reason) &&
+        !C->too_many_traps(trap_method, trap_bci, class_reason) &&
+        !C->too_many_recompiles(trap_method, trap_bci, class_reason)) {
       Node* not_null_obj = NULL;
       // not_null is true if we know the object is not null and
       // there's no need for a null check
@@ -2833,19 +2841,18 @@
         GraphKit kit(sfpt->jvms());
         PreserveJVMState pjvms(&kit);
         kit.set_control(slow_ctl);
-        kit.uncommon_trap(class_reason,
-                          Deoptimization::Action_maybe_recompile);
+        kit.uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
       } else {
         PreserveJVMState pjvms(this);
         set_control(slow_ctl);
-        uncommon_trap(class_reason,
-                      Deoptimization::Action_maybe_recompile);
+        uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
       }
       replace_in_map(not_null_obj, exact_obj);
       obj = exact_obj;
     }
   } else {
-    if (!too_many_traps(Deoptimization::Reason_null_assert)) {
+    if (!too_many_traps(Deoptimization::Reason_null_assert) &&
+        !too_many_recompiles(Deoptimization::Reason_null_assert)) {
       Node* exact_obj = null_assert(obj);
       replace_in_map(obj, exact_obj);
       obj = exact_obj;
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -714,6 +714,15 @@
                   klass, reason_string, must_throw, keep_exact_action);
   }
 
+  // Bail out to the interpreter and keep exact action (avoid switching to Action_none).
+  void uncommon_trap_exact(Deoptimization::DeoptReason reason,
+                           Deoptimization::DeoptAction action,
+                           ciKlass* klass = NULL, const char* reason_string = NULL,
+                           bool must_throw = false) {
+    uncommon_trap(Deoptimization::make_trap_request(reason, action),
+                  klass, reason_string, must_throw, /*keep_exact_action=*/true);
+  }
+
   // SP when bytecode needs to be reexecuted.
   virtual int reexecute_sp() { return sp(); }
 
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -145,10 +145,18 @@
       Node* v = u->fast_out(k); // User of the phi
       // CNC - Allow only really simple patterns.
       // In particular I disallow AddP of the Phi, a fairly common pattern
-      if( v == cmp ) continue;  // The compare is OK
-      if( (v->is_ConstraintCast()) &&
-          v->in(0)->in(0) == iff )
-        continue;               // CastPP/II of the IfNode is OK
+      if (v == cmp) continue;  // The compare is OK
+      if (v->is_ConstraintCast()) {
+        // If the cast is derived from data flow edges, it may not have a control edge.
+        // If so, it should be safe to split. But follow-up code can not deal with
+        // this (l. 359). So skip.
+        if (v->in(0) == NULL) {
+          return NULL;
+        }
+        if (v->in(0)->in(0) == iff) {
+          continue;               // CastPP/II of the IfNode is OK
+        }
+      }
       // Disabled following code because I cannot tell if exactly one
       // path dominates without a real dominator check. CNC 9/9/1999
       //uint vop = v->Opcode();
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -41,6 +41,7 @@
 #include "opto/movenode.hpp"
 #include "opto/mulnode.hpp"
 #include "opto/narrowptrnode.hpp"
+#include "opto/opaquenode.hpp"
 #include "opto/parse.hpp"
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
@@ -232,7 +233,6 @@
   // Unsafe.getObject should be recorded in an SATB log buffer.
   void insert_pre_barrier(Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar);
   bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, bool is_volatile);
-  bool inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static);
   static bool klass_needs_init_guard(Node* kls);
   bool inline_unsafe_allocate();
   bool inline_unsafe_copyMemory();
@@ -287,6 +287,8 @@
   bool inline_updateBytesCRC32();
   bool inline_updateByteBufferCRC32();
   bool inline_multiplyToLen();
+
+  bool inline_profileBoolean();
 };
 
 
@@ -796,11 +798,6 @@
   case vmIntrinsics::_putFloatVolatile:         return inline_unsafe_access(!is_native_ptr,  is_store, T_FLOAT,    is_volatile);
   case vmIntrinsics::_putDoubleVolatile:        return inline_unsafe_access(!is_native_ptr,  is_store, T_DOUBLE,   is_volatile);
 
-  case vmIntrinsics::_prefetchRead:             return inline_unsafe_prefetch(!is_native_ptr, !is_store, !is_static);
-  case vmIntrinsics::_prefetchWrite:            return inline_unsafe_prefetch(!is_native_ptr,  is_store, !is_static);
-  case vmIntrinsics::_prefetchReadStatic:       return inline_unsafe_prefetch(!is_native_ptr, !is_store,  is_static);
-  case vmIntrinsics::_prefetchWriteStatic:      return inline_unsafe_prefetch(!is_native_ptr,  is_store,  is_static);
-
   case vmIntrinsics::_compareAndSwapObject:     return inline_unsafe_load_store(T_OBJECT, LS_cmpxchg);
   case vmIntrinsics::_compareAndSwapInt:        return inline_unsafe_load_store(T_INT,    LS_cmpxchg);
   case vmIntrinsics::_compareAndSwapLong:       return inline_unsafe_load_store(T_LONG,   LS_cmpxchg);
@@ -900,6 +897,9 @@
   case vmIntrinsics::_updateByteBufferCRC32:
     return inline_updateByteBufferCRC32();
 
+  case vmIntrinsics::_profileBoolean:
+    return inline_profileBoolean();
+
   default:
     // If you get here, it may be that someone has added a new intrinsic
     // to the list in vmSymbols.hpp without implementing it here.
@@ -2506,7 +2506,7 @@
 
   Node* receiver = argument(0);  // type: oop
 
-  // Build address expression.  See the code in inline_unsafe_prefetch.
+  // Build address expression.
   Node* adr;
   Node* heap_base_oop = top();
   Node* offset = top();
@@ -2695,73 +2695,6 @@
   return true;
 }
 
-//----------------------------inline_unsafe_prefetch----------------------------
-
-bool LibraryCallKit::inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static) {
-#ifndef PRODUCT
-  {
-    ResourceMark rm;
-    // Check the signatures.
-    ciSignature* sig = callee()->signature();
-#ifdef ASSERT
-    // Object getObject(Object base, int/long offset), etc.
-    BasicType rtype = sig->return_type()->basic_type();
-    if (!is_native_ptr) {
-      assert(sig->count() == 2, "oop prefetch has 2 arguments");
-      assert(sig->type_at(0)->basic_type() == T_OBJECT, "prefetch base is object");
-      assert(sig->type_at(1)->basic_type() == T_LONG, "prefetcha offset is correct");
-    } else {
-      assert(sig->count() == 1, "native prefetch has 1 argument");
-      assert(sig->type_at(0)->basic_type() == T_LONG, "prefetch base is long");
-    }
-#endif // ASSERT
-  }
-#endif // !PRODUCT
-
-  C->set_has_unsafe_access(true);  // Mark eventual nmethod as "unsafe".
-
-  const int idx = is_static ? 0 : 1;
-  if (!is_static) {
-    null_check_receiver();
-    if (stopped()) {
-      return true;
-    }
-  }
-
-  // Build address expression.  See the code in inline_unsafe_access.
-  Node *adr;
-  if (!is_native_ptr) {
-    // The base is either a Java object or a value produced by Unsafe.staticFieldBase
-    Node* base   = argument(idx + 0);  // type: oop
-    // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
-    Node* offset = argument(idx + 1);  // type: long
-    // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
-    // to be plain byte offsets, which are also the same as those accepted
-    // by oopDesc::field_base.
-    assert(Unsafe_field_offset_to_byte_offset(11) == 11,
-           "fieldOffset must be byte-scaled");
-    // 32-bit machines ignore the high half!
-    offset = ConvL2X(offset);
-    adr = make_unsafe_address(base, offset);
-  } else {
-    Node* ptr = argument(idx + 0);  // type: long
-    ptr = ConvL2X(ptr);  // adjust Java long to machine word
-    adr = make_unsafe_address(NULL, ptr);
-  }
-
-  // Generate the read or write prefetch
-  Node *prefetch;
-  if (is_store) {
-    prefetch = new PrefetchWriteNode(i_o(), adr);
-  } else {
-    prefetch = new PrefetchReadNode(i_o(), adr);
-  }
-  prefetch->init_req(0, control());
-  set_i_o(_gvn.transform(prefetch));
-
-  return true;
-}
-
 //----------------------------inline_unsafe_load_store----------------------------
 // This method serves a couple of different customers (depending on LoadStoreKind):
 //
@@ -4734,6 +4667,8 @@
   // tightly_coupled_allocation()
   AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
 
+  ciMethod* trap_method = method();
+  int trap_bci = bci();
   SafePointNode* sfpt = NULL;
   if (alloc != NULL) {
     // The JVM state for uncommon traps between the allocation and
@@ -4758,6 +4693,9 @@
 
     sfpt->set_i_o(map()->i_o());
     sfpt->set_memory(map()->memory());
+
+    trap_method = jvms->method();
+    trap_bci = jvms->bci();
   }
 
   bool validated = false;
@@ -4862,7 +4800,7 @@
     }
   }
 
-  if (!too_many_traps(Deoptimization::Reason_intrinsic) && !src->is_top() && !dest->is_top()) {
+  if (!C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_intrinsic) && !src->is_top() && !dest->is_top()) {
     // validate arguments: enables transformation the ArrayCopyNode
     validated = true;
 
@@ -5867,3 +5805,47 @@
 
   return instof_false;  // even if it is NULL
 }
+
+bool LibraryCallKit::inline_profileBoolean() {
+  Node* counts = argument(1);
+  const TypeAryPtr* ary = NULL;
+  ciArray* aobj = NULL;
+  if (counts->is_Con()
+      && (ary = counts->bottom_type()->isa_aryptr()) != NULL
+      && (aobj = ary->const_oop()->as_array()) != NULL
+      && (aobj->length() == 2)) {
+    // Profile is int[2] where [0] and [1] correspond to false and true value occurrences respectively.
+    jint false_cnt = aobj->element_value(0).as_int();
+    jint  true_cnt = aobj->element_value(1).as_int();
+
+    method()->set_injected_profile(true);
+
+    if (C->log() != NULL) {
+      C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
+                     false_cnt, true_cnt);
+    }
+
+    if (false_cnt + true_cnt == 0) {
+      // According to profile, never executed.
+      uncommon_trap_exact(Deoptimization::Reason_intrinsic,
+                          Deoptimization::Action_reinterpret);
+      return true;
+    }
+    // Stop profiling.
+    // MethodHandleImpl::profileBoolean() has profiling logic in it's bytecode.
+    // By replacing method's body with profile data (represented as ProfileBooleanNode
+    // on IR level) we effectively disable profiling.
+    // It enables full speed execution once optimized code is generated.
+    Node* profile = _gvn.transform(new ProfileBooleanNode(argument(0), false_cnt, true_cnt));
+    C->record_for_igvn(profile);
+    set_result(profile);
+    return true;
+  } else {
+    // Continue profiling.
+    // Profile data isn't available at the moment. So, execute method's bytecode version.
+    // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
+    // is compiled and counters aren't available since corresponding MethodHandle
+    // isn't a compile-time constant.
+    return false;
+  }
+}
--- a/hotspot/src/share/vm/opto/matcher.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -884,8 +884,6 @@
   // %%% Kludgery.  Instead, fix ideal adr_type methods for all these cases:
   if (nidx == Compile::AliasIdxTop && midx == Compile::AliasIdxRaw) {
     switch (n->Opcode()) {
-    case Op_PrefetchRead:
-    case Op_PrefetchWrite:
     case Op_PrefetchAllocation:
       nidx = Compile::AliasIdxRaw;
       nat = TypeRawPtr::BOTTOM;
--- a/hotspot/src/share/vm/opto/memnode.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/memnode.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1376,26 +1376,6 @@
 
 //------------------------------Prefetch---------------------------------------
 
-// Non-faulting prefetch load.  Prefetch for many reads.
-class PrefetchReadNode : public Node {
-public:
-  PrefetchReadNode(Node *abio, Node *adr) : Node(0,abio,adr) {}
-  virtual int Opcode() const;
-  virtual uint ideal_reg() const { return NotAMachineReg; }
-  virtual uint match_edge(uint idx) const { return idx==2; }
-  virtual const Type *bottom_type() const { return Type::ABIO; }
-};
-
-// Non-faulting prefetch load.  Prefetch for many reads & many writes.
-class PrefetchWriteNode : public Node {
-public:
-  PrefetchWriteNode(Node *abio, Node *adr) : Node(0,abio,adr) {}
-  virtual int Opcode() const;
-  virtual uint ideal_reg() const { return NotAMachineReg; }
-  virtual uint match_edge(uint idx) const { return idx==2; }
-  virtual const Type *bottom_type() const { return Type::ABIO; }
-};
-
 // Allocation prefetch which may fault, TLAB size have to be adjusted.
 class PrefetchAllocationNode : public Node {
 public:
--- a/hotspot/src/share/vm/opto/opaquenode.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/opaquenode.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -60,4 +60,27 @@
   return (&n == this);          // Always fail except on self
 }
 
+//=============================================================================
 
+uint ProfileBooleanNode::hash() const { return NO_HASH; }
+uint ProfileBooleanNode::cmp( const Node &n ) const {
+  return (&n == this);
+}
+
+Node *ProfileBooleanNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  if (can_reshape && _delay_removal) {
+    _delay_removal = false;
+    return this;
+  } else {
+    return NULL;
+  }
+}
+
+Node *ProfileBooleanNode::Identity( PhaseTransform *phase ) {
+  if (_delay_removal) {
+    return this;
+  } else {
+    assert(_consumed, "profile should be consumed before elimination");
+    return in(1);
+  }
+}
--- a/hotspot/src/share/vm/opto/opaquenode.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/opaquenode.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -87,5 +87,31 @@
   bool rtm_opt() const { return (_opt == RTM_OPT); }
 };
 
+//------------------------------ProfileBooleanNode-------------------------------
+// A node represents value profile for a boolean during parsing.
+// Once parsing is over, the node goes away (during IGVN).
+// It is used to override branch frequencies from MDO (see has_injected_profile in parse2.cpp).
+class ProfileBooleanNode : public Node {
+  uint _false_cnt;
+  uint _true_cnt;
+  bool _consumed;
+  bool _delay_removal;
+  virtual uint hash() const ;                  // { return NO_HASH; }
+  virtual uint cmp( const Node &n ) const;
+  public:
+  ProfileBooleanNode(Node *n, uint false_cnt, uint true_cnt) : Node(0, n),
+          _false_cnt(false_cnt), _true_cnt(true_cnt), _delay_removal(true), _consumed(false) {}
+
+  uint false_count() const { return _false_cnt; }
+  uint  true_count() const { return  _true_cnt; }
+
+  void consume() { _consumed = true;  }
+
+  virtual int Opcode() const;
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+  virtual Node *Identity(PhaseTransform *phase);
+  virtual const Type *bottom_type() const { return TypeInt::BOOL; }
+};
+
 #endif // SHARE_VM_OPTO_OPAQUENODE_HPP
 
--- a/hotspot/src/share/vm/opto/parse.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/parse.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -555,8 +555,8 @@
   void do_jsr();
   void do_ret();
 
-  float   dynamic_branch_prediction(float &cnt);
-  float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci);
+  float   dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
+  float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
   bool    seems_never_taken(float prob) const;
   bool    path_is_suitable_for_uncommon_trap(float prob) const;
   bool    seems_stable_comparison() const;
--- a/hotspot/src/share/vm/opto/parse2.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -37,6 +37,7 @@
 #include "opto/matcher.hpp"
 #include "opto/memnode.hpp"
 #include "opto/mulnode.hpp"
+#include "opto/opaquenode.hpp"
 #include "opto/parse.hpp"
 #include "opto/runtime.hpp"
 #include "runtime/deoptimization.hpp"
@@ -763,35 +764,64 @@
   merge_common(target, pnum);
 }
 
+static bool has_injected_profile(BoolTest::mask btest, Node* test, int& taken, int& not_taken) {
+  if (btest != BoolTest::eq && btest != BoolTest::ne) {
+    // Only ::eq and ::ne are supported for profile injection.
+    return false;
+  }
+  if (test->is_Cmp() &&
+      test->in(1)->Opcode() == Op_ProfileBoolean) {
+    ProfileBooleanNode* profile = (ProfileBooleanNode*)test->in(1);
+    int false_cnt = profile->false_count();
+    int  true_cnt = profile->true_count();
+
+    // Counts matching depends on the actual test operation (::eq or ::ne).
+    // No need to scale the counts because profile injection was designed
+    // to feed exact counts into VM.
+    taken     = (btest == BoolTest::eq) ? false_cnt :  true_cnt;
+    not_taken = (btest == BoolTest::eq) ?  true_cnt : false_cnt;
+
+    profile->consume();
+    return true;
+  }
+  return false;
+}
 //--------------------------dynamic_branch_prediction--------------------------
 // Try to gather dynamic branch prediction behavior.  Return a probability
 // of the branch being taken and set the "cnt" field.  Returns a -1.0
 // if we need to use static prediction for some reason.
-float Parse::dynamic_branch_prediction(float &cnt) {
+float Parse::dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test) {
   ResourceMark rm;
 
   cnt  = COUNT_UNKNOWN;
 
-  // Use MethodData information if it is available
-  // FIXME: free the ProfileData structure
-  ciMethodData* methodData = method()->method_data();
-  if (!methodData->is_mature())  return PROB_UNKNOWN;
-  ciProfileData* data = methodData->bci_to_data(bci());
-  if (!data->is_JumpData())  return PROB_UNKNOWN;
+  int     taken = 0;
+  int not_taken = 0;
+
+  bool use_mdo = !has_injected_profile(btest, test, taken, not_taken);
 
-  // get taken and not taken values
-  int     taken = data->as_JumpData()->taken();
-  int not_taken = 0;
-  if (data->is_BranchData()) {
-    not_taken = data->as_BranchData()->not_taken();
+  if (use_mdo) {
+    // Use MethodData information if it is available
+    // FIXME: free the ProfileData structure
+    ciMethodData* methodData = method()->method_data();
+    if (!methodData->is_mature())  return PROB_UNKNOWN;
+    ciProfileData* data = methodData->bci_to_data(bci());
+    if (!data->is_JumpData())  return PROB_UNKNOWN;
+
+    // get taken and not taken values
+    taken = data->as_JumpData()->taken();
+    not_taken = 0;
+    if (data->is_BranchData()) {
+      not_taken = data->as_BranchData()->not_taken();
+    }
+
+    // scale the counts to be commensurate with invocation counts:
+    taken = method()->scale_count(taken);
+    not_taken = method()->scale_count(not_taken);
   }
 
-  // scale the counts to be commensurate with invocation counts:
-  taken = method()->scale_count(taken);
-  not_taken = method()->scale_count(not_taken);
-
   // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful.
-  // We also check that individual counters are positive first, overwise the sum can become positive.
+  // We also check that individual counters are positive first, otherwise the sum can become positive.
   if (taken < 0 || not_taken < 0 || taken + not_taken < 40) {
     if (C->log() != NULL) {
       C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d'", iter().get_dest(), taken, not_taken);
@@ -841,8 +871,9 @@
 //-----------------------------branch_prediction-------------------------------
 float Parse::branch_prediction(float& cnt,
                                BoolTest::mask btest,
-                               int target_bci) {
-  float prob = dynamic_branch_prediction(cnt);
+                               int target_bci,
+                               Node* test) {
+  float prob = dynamic_branch_prediction(cnt, btest, test);
   // If prob is unknown, switch to static prediction
   if (prob != PROB_UNKNOWN)  return prob;
 
@@ -932,7 +963,7 @@
   Block* next_block   = successor_for_bci(iter().next_bci());
 
   float cnt;
-  float prob = branch_prediction(cnt, btest, target_bci);
+  float prob = branch_prediction(cnt, btest, target_bci, c);
   if (prob == PROB_UNKNOWN) {
     // (An earlier version of do_ifnull omitted this trap for OSR methods.)
 #ifndef PRODUCT
@@ -1013,7 +1044,7 @@
   Block* next_block   = successor_for_bci(iter().next_bci());
 
   float cnt;
-  float prob = branch_prediction(cnt, btest, target_bci);
+  float prob = branch_prediction(cnt, btest, target_bci, c);
   float untaken_prob = 1.0 - prob;
 
   if (prob == PROB_UNKNOWN) {
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -45,7 +45,6 @@
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.inline.hpp"
-#include "runtime/dtraceJSDT.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -304,7 +303,7 @@
 // java.lang.System, but we choose to keep it here so that it stays next
 // to JVM_CurrentTimeMillis and JVM_NanoTime
 
-const jlong MAX_DIFF_SECS = 0x0100000000LL; //  2^32
+const jlong MAX_DIFF_SECS = CONST64(0x0100000000); //  2^32
 const jlong MIN_DIFF_SECS = -MAX_DIFF_SECS; // -2^32
 
 JVM_LEAF(jlong, JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs))
@@ -3562,36 +3561,6 @@
   return VM_Version::supports_cx8();
 JVM_END
 
-// DTrace ///////////////////////////////////////////////////////////////////
-
-JVM_ENTRY(jint, JVM_DTraceGetVersion(JNIEnv* env))
-  JVMWrapper("JVM_DTraceGetVersion");
-  return (jint)JVM_TRACING_DTRACE_VERSION;
-JVM_END
-
-JVM_ENTRY(jlong,JVM_DTraceActivate(
-    JNIEnv* env, jint version, jstring module_name, jint providers_count,
-    JVM_DTraceProvider* providers))
-  JVMWrapper("JVM_DTraceActivate");
-  return DTraceJSDT::activate(
-    version, module_name, providers_count, providers, THREAD);
-JVM_END
-
-JVM_ENTRY(jboolean,JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method))
-  JVMWrapper("JVM_DTraceIsProbeEnabled");
-  return DTraceJSDT::is_probe_enabled(method);
-JVM_END
-
-JVM_ENTRY(void,JVM_DTraceDispose(JNIEnv* env, jlong handle))
-  JVMWrapper("JVM_DTraceDispose");
-  DTraceJSDT::dispose(handle);
-JVM_END
-
-JVM_ENTRY(jboolean,JVM_DTraceIsSupported(JNIEnv* env))
-  JVMWrapper("JVM_DTraceIsSupported");
-  return DTraceJSDT::is_supported();
-JVM_END
-
 // Returns an array of all live Thread objects (VM internal JavaThreads,
 // jvmti agent threads, and JNI attaching threads  are skipped)
 // See CR 6404306 regarding JNI attaching threads
--- a/hotspot/src/share/vm/prims/jvm.h	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvm.h	Wed Jul 05 20:20:43 2017 +0200
@@ -568,83 +568,6 @@
 JNIEXPORT jboolean JNICALL
 JVM_SupportsCX8(void);
 
-/*
- * com.sun.dtrace.jsdt support
- */
-
-#define JVM_TRACING_DTRACE_VERSION 1
-
-/*
- * Structure to pass one probe description to JVM.
- *
- * The VM will overwrite the definition of the referenced method with
- * code that will fire the probe.
- */
-typedef struct {
-    jmethodID method;
-    jstring   function;
-    jstring   name;
-    void*     reserved[4];     // for future use
-} JVM_DTraceProbe;
-
-/**
- * Encapsulates the stability ratings for a DTrace provider field
- */
-typedef struct {
-    jint nameStability;
-    jint dataStability;
-    jint dependencyClass;
-} JVM_DTraceInterfaceAttributes;
-
-/*
- * Structure to pass one provider description to JVM
- */
-typedef struct {
-    jstring                       name;
-    JVM_DTraceProbe*              probes;
-    jint                          probe_count;
-    JVM_DTraceInterfaceAttributes providerAttributes;
-    JVM_DTraceInterfaceAttributes moduleAttributes;
-    JVM_DTraceInterfaceAttributes functionAttributes;
-    JVM_DTraceInterfaceAttributes nameAttributes;
-    JVM_DTraceInterfaceAttributes argsAttributes;
-    void*                         reserved[4]; // for future use
-} JVM_DTraceProvider;
-
-/*
- * Get the version number the JVM was built with
- */
-JNIEXPORT jint JNICALL
-JVM_DTraceGetVersion(JNIEnv* env);
-
-/*
- * Register new probe with given signature, return global handle
- *
- * The version passed in is the version that the library code was
- * built with.
- */
-JNIEXPORT jlong JNICALL
-JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
-  jint providers_count, JVM_DTraceProvider* providers);
-
-/*
- * Check JSDT probe
- */
-JNIEXPORT jboolean JNICALL
-JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
-
-/*
- * Destroy custom DOF
- */
-JNIEXPORT void JNICALL
-JVM_DTraceDispose(JNIEnv* env, jlong handle);
-
-/*
- * Check to see if DTrace is supported by OS
- */
-JNIEXPORT jboolean JNICALL
-JVM_DTraceIsSupported(JNIEnv* env);
-
 /*************************************************************************
  PART 2: Support for the Verifier and Class File Format Checker
  ************************************************************************/
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -30,10 +30,8 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/reflection.hpp"
-#include "runtime/synchronizer.hpp"
 #include "runtime/vm_version.hpp"
 #include "services/threadService.hpp"
 #include "trace/tracing.hpp"
@@ -596,17 +594,7 @@
   os::free(p);
 UNSAFE_END
 
-UNSAFE_ENTRY(void, Unsafe_SetMemory(JNIEnv *env, jobject unsafe, jlong addr, jlong size, jbyte value))
-  UnsafeWrapper("Unsafe_SetMemory");
-  size_t sz = (size_t)size;
-  if (sz != (julong)size || size < 0) {
-    THROW(vmSymbols::java_lang_IllegalArgumentException());
-  }
-  char* p = (char*) addr_from_java(addr);
-  Copy::fill_to_memory_atomic(p, sz, value);
-UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetMemory2(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong size, jbyte value))
+UNSAFE_ENTRY(void, Unsafe_SetMemory(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong size, jbyte value))
   UnsafeWrapper("Unsafe_SetMemory");
   size_t sz = (size_t)size;
   if (sz != (julong)size || size < 0) {
@@ -617,21 +605,7 @@
   Copy::fill_to_memory_atomic(p, sz, value);
 UNSAFE_END
 
-UNSAFE_ENTRY(void, Unsafe_CopyMemory(JNIEnv *env, jobject unsafe, jlong srcAddr, jlong dstAddr, jlong size))
-  UnsafeWrapper("Unsafe_CopyMemory");
-  if (size == 0) {
-    return;
-  }
-  size_t sz = (size_t)size;
-  if (sz != (julong)size || size < 0) {
-    THROW(vmSymbols::java_lang_IllegalArgumentException());
-  }
-  void* src = addr_from_java(srcAddr);
-  void* dst = addr_from_java(dstAddr);
-  Copy::conjoint_memory_atomic(src, dst, sz);
-UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_CopyMemory2(JNIEnv *env, jobject unsafe, jobject srcObj, jlong srcOffset, jobject dstObj, jlong dstOffset, jlong size))
+UNSAFE_ENTRY(void, Unsafe_CopyMemory(JNIEnv *env, jobject unsafe, jobject srcObj, jlong srcOffset, jobject dstObj, jlong dstOffset, jlong size))
   UnsafeWrapper("Unsafe_CopyMemory");
   if (size == 0) {
     return;
@@ -725,24 +699,6 @@
   return JNIHandles::make_local(env, mirror);
 UNSAFE_END
 
-//@deprecated
-UNSAFE_ENTRY(jint, Unsafe_FieldOffset(JNIEnv *env, jobject unsafe, jobject field))
-  UnsafeWrapper("Unsafe_FieldOffset");
-  // tries (but fails) to be polymorphic between static and non-static:
-  jlong offset = find_field_offset(field, -1, THREAD);
-  guarantee(offset == (jint)offset, "offset fits in 32 bits");
-  return (jint)offset;
-UNSAFE_END
-
-//@deprecated
-UNSAFE_ENTRY(jobject, Unsafe_StaticFieldBaseFromClass(JNIEnv *env, jobject unsafe, jobject clazz))
-  UnsafeWrapper("Unsafe_StaticFieldBase");
-  if (clazz == NULL) {
-    THROW_0(vmSymbols::java_lang_NullPointerException());
-  }
-  return JNIHandles::make_local(env, JNIHandles::resolve_non_null(clazz));
-UNSAFE_END
-
 UNSAFE_ENTRY(void, Unsafe_EnsureClassInitialized(JNIEnv *env, jobject unsafe, jobject clazz)) {
   UnsafeWrapper("Unsafe_EnsureClassInitialized");
   if (clazz == NULL) {
@@ -915,31 +871,7 @@
   }
 UNSAFE_END
 
-static jobject get_class_loader(JNIEnv* env, jclass cls) {
-  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
-    return NULL;
-  }
-  Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
-  oop loader = k->class_loader();
-  return JNIHandles::make_local(env, loader);
-}
 
-UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length))
-  UnsafeWrapper("Unsafe_DefineClass");
-  {
-    ThreadToNativeFromVM ttnfv(thread);
-
-    int depthFromDefineClass0 = 1;
-    jclass  caller = JVM_GetCallerClass(env, depthFromDefineClass0);
-    jobject loader = (caller == NULL) ? NULL : get_class_loader(env, caller);
-    jobject pd     = (caller == NULL) ? NULL : JVM_GetProtectionDomain(env, caller);
-
-    return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd);
-  }
-UNSAFE_END
-
-
-#define DAC_Args CLS"[B["OBJ
 // define a class but do not make it known to the class loader or system dictionary
 // - host_class:  supplies context for linkage, access control, protection domain, and class loader
 // - data:  bytes of a class file, a raw memory address (length gives the number of bytes)
@@ -1233,20 +1165,6 @@
   return ret;
 UNSAFE_END
 
-UNSAFE_ENTRY(void, Unsafe_PrefetchRead(JNIEnv* env, jclass ignored, jobject obj, jlong offset))
-  UnsafeWrapper("Unsafe_PrefetchRead");
-  oop p = JNIHandles::resolve(obj);
-  void* addr = index_oop_from_field_offset_long(p, 0);
-  Prefetch::read(addr, (intx)offset);
-UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_PrefetchWrite(JNIEnv* env, jclass ignored, jobject obj, jlong offset))
-  UnsafeWrapper("Unsafe_PrefetchWrite");
-  oop p = JNIHandles::resolve(obj);
-  void* addr = index_oop_from_field_offset_long(p, 0);
-  Prefetch::write(addr, (intx)offset);
-UNSAFE_END
-
 
 /// JVM_RegisterUnsafeMethods
 
@@ -1256,256 +1174,50 @@
 
 #define OBJ LANG"Object;"
 #define CLS LANG"Class;"
-#define CTR LANG"reflect/Constructor;"
 #define FLD LANG"reflect/Field;"
-#define MTH LANG"reflect/Method;"
 #define THR LANG"Throwable;"
 
-#define DC0_Args LANG"String;[BII"
-#define DC_Args  DC0_Args LANG"ClassLoader;" "Ljava/security/ProtectionDomain;"
+#define DC_Args  LANG"String;[BII" LANG"ClassLoader;" "Ljava/security/ProtectionDomain;"
+#define DAC_Args CLS"[B["OBJ
 
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
 
-// define deprecated accessors for compabitility with 1.4.0
-#define DECLARE_GETSETOOP_140(Boolean, Z) \
-    {CC"get"#Boolean,      CC"("OBJ"I)"#Z,      FN_PTR(Unsafe_Get##Boolean##140)}, \
-    {CC"put"#Boolean,      CC"("OBJ"I"#Z")V",   FN_PTR(Unsafe_Set##Boolean##140)}
-
-// Note:  In 1.4.1, getObject and kin take both int and long offsets.
-#define DECLARE_GETSETOOP_141(Boolean, Z) \
-    {CC"get"#Boolean,      CC"("OBJ"J)"#Z,      FN_PTR(Unsafe_Get##Boolean)}, \
-    {CC"put"#Boolean,      CC"("OBJ"J"#Z")V",   FN_PTR(Unsafe_Set##Boolean)}
-
-// Note:  In 1.5.0, there are volatile versions too
-#define DECLARE_GETSETOOP(Boolean, Z) \
+#define DECLARE_GETPUTOOP(Boolean, Z) \
     {CC"get"#Boolean,      CC"("OBJ"J)"#Z,      FN_PTR(Unsafe_Get##Boolean)}, \
     {CC"put"#Boolean,      CC"("OBJ"J"#Z")V",   FN_PTR(Unsafe_Set##Boolean)}, \
     {CC"get"#Boolean"Volatile",      CC"("OBJ"J)"#Z,      FN_PTR(Unsafe_Get##Boolean##Volatile)}, \
     {CC"put"#Boolean"Volatile",      CC"("OBJ"J"#Z")V",   FN_PTR(Unsafe_Set##Boolean##Volatile)}
 
 
-#define DECLARE_GETSETNATIVE(Byte, B) \
+#define DECLARE_GETPUTNATIVE(Byte, B) \
     {CC"get"#Byte,         CC"("ADR")"#B,       FN_PTR(Unsafe_GetNative##Byte)}, \
     {CC"put"#Byte,         CC"("ADR#B")V",      FN_PTR(Unsafe_SetNative##Byte)}
 
 
 
-// These are the methods for 1.4.0
-static JNINativeMethod methods_140[] = {
-    DECLARE_GETSETOOP_140(Boolean, Z),
-    DECLARE_GETSETOOP_140(Byte, B),
-    DECLARE_GETSETOOP_140(Short, S),
-    DECLARE_GETSETOOP_140(Char, C),
-    DECLARE_GETSETOOP_140(Int, I),
-    DECLARE_GETSETOOP_140(Long, J),
-    DECLARE_GETSETOOP_140(Float, F),
-    DECLARE_GETSETOOP_140(Double, D),
-
-    DECLARE_GETSETNATIVE(Byte, B),
-    DECLARE_GETSETNATIVE(Short, S),
-    DECLARE_GETSETNATIVE(Char, C),
-    DECLARE_GETSETNATIVE(Int, I),
-    DECLARE_GETSETNATIVE(Long, J),
-    DECLARE_GETSETNATIVE(Float, F),
-    DECLARE_GETSETNATIVE(Double, D),
-
-    {CC"getAddress",         CC"("ADR")"ADR,             FN_PTR(Unsafe_GetNativeAddress)},
-    {CC"putAddress",         CC"("ADR""ADR")V",          FN_PTR(Unsafe_SetNativeAddress)},
-
-    {CC"allocateMemory",     CC"(J)"ADR,                 FN_PTR(Unsafe_AllocateMemory)},
-    {CC"reallocateMemory",   CC"("ADR"J)"ADR,            FN_PTR(Unsafe_ReallocateMemory)},
-    {CC"freeMemory",         CC"("ADR")V",               FN_PTR(Unsafe_FreeMemory)},
-
-    {CC"fieldOffset",        CC"("FLD")I",               FN_PTR(Unsafe_FieldOffset)},
-    {CC"staticFieldBase",    CC"("CLS")"OBJ,             FN_PTR(Unsafe_StaticFieldBaseFromClass)},
-    {CC"ensureClassInitialized",CC"("CLS")V",            FN_PTR(Unsafe_EnsureClassInitialized)},
-    {CC"arrayBaseOffset",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayBaseOffset)},
-    {CC"arrayIndexScale",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayIndexScale)},
-    {CC"addressSize",        CC"()I",                    FN_PTR(Unsafe_AddressSize)},
-    {CC"pageSize",           CC"()I",                    FN_PTR(Unsafe_PageSize)},
-
-    {CC"defineClass",        CC"("DC0_Args")"CLS,        FN_PTR(Unsafe_DefineClass0)},
-    {CC"defineClass",        CC"("DC_Args")"CLS,         FN_PTR(Unsafe_DefineClass)},
-    {CC"allocateInstance",   CC"("CLS")"OBJ,             FN_PTR(Unsafe_AllocateInstance)},
-    {CC"throwException",     CC"("THR")V",               FN_PTR(Unsafe_ThrowException)}
-};
-
-// These are the methods prior to the JSR 166 changes in 1.5.0
-static JNINativeMethod methods_141[] = {
-    {CC"getObject",        CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObject)},
-    {CC"putObject",        CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObject)},
-
-    DECLARE_GETSETOOP_141(Boolean, Z),
-    DECLARE_GETSETOOP_141(Byte, B),
-    DECLARE_GETSETOOP_141(Short, S),
-    DECLARE_GETSETOOP_141(Char, C),
-    DECLARE_GETSETOOP_141(Int, I),
-    DECLARE_GETSETOOP_141(Long, J),
-    DECLARE_GETSETOOP_141(Float, F),
-    DECLARE_GETSETOOP_141(Double, D),
-
-    DECLARE_GETSETNATIVE(Byte, B),
-    DECLARE_GETSETNATIVE(Short, S),
-    DECLARE_GETSETNATIVE(Char, C),
-    DECLARE_GETSETNATIVE(Int, I),
-    DECLARE_GETSETNATIVE(Long, J),
-    DECLARE_GETSETNATIVE(Float, F),
-    DECLARE_GETSETNATIVE(Double, D),
-
-    {CC"getAddress",         CC"("ADR")"ADR,             FN_PTR(Unsafe_GetNativeAddress)},
-    {CC"putAddress",         CC"("ADR""ADR")V",          FN_PTR(Unsafe_SetNativeAddress)},
-
-    {CC"allocateMemory",     CC"(J)"ADR,                 FN_PTR(Unsafe_AllocateMemory)},
-    {CC"reallocateMemory",   CC"("ADR"J)"ADR,            FN_PTR(Unsafe_ReallocateMemory)},
-    {CC"freeMemory",         CC"("ADR")V",               FN_PTR(Unsafe_FreeMemory)},
-
-    {CC"objectFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_ObjectFieldOffset)},
-    {CC"staticFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_StaticFieldOffset)},
-    {CC"staticFieldBase",    CC"("FLD")"OBJ,             FN_PTR(Unsafe_StaticFieldBaseFromField)},
-    {CC"ensureClassInitialized",CC"("CLS")V",            FN_PTR(Unsafe_EnsureClassInitialized)},
-    {CC"arrayBaseOffset",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayBaseOffset)},
-    {CC"arrayIndexScale",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayIndexScale)},
-    {CC"addressSize",        CC"()I",                    FN_PTR(Unsafe_AddressSize)},
-    {CC"pageSize",           CC"()I",                    FN_PTR(Unsafe_PageSize)},
-
-    {CC"defineClass",        CC"("DC0_Args")"CLS,        FN_PTR(Unsafe_DefineClass0)},
-    {CC"defineClass",        CC"("DC_Args")"CLS,         FN_PTR(Unsafe_DefineClass)},
-    {CC"allocateInstance",   CC"("CLS")"OBJ,             FN_PTR(Unsafe_AllocateInstance)},
-    {CC"throwException",     CC"("THR")V",               FN_PTR(Unsafe_ThrowException)}
-
-};
-
-// These are the methods prior to the JSR 166 changes in 1.6.0
-static JNINativeMethod methods_15[] = {
+static JNINativeMethod methods[] = {
     {CC"getObject",        CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObject)},
     {CC"putObject",        CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObject)},
     {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObjectVolatile)},
     {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObjectVolatile)},
 
-
-    DECLARE_GETSETOOP(Boolean, Z),
-    DECLARE_GETSETOOP(Byte, B),
-    DECLARE_GETSETOOP(Short, S),
-    DECLARE_GETSETOOP(Char, C),
-    DECLARE_GETSETOOP(Int, I),
-    DECLARE_GETSETOOP(Long, J),
-    DECLARE_GETSETOOP(Float, F),
-    DECLARE_GETSETOOP(Double, D),
-
-    DECLARE_GETSETNATIVE(Byte, B),
-    DECLARE_GETSETNATIVE(Short, S),
-    DECLARE_GETSETNATIVE(Char, C),
-    DECLARE_GETSETNATIVE(Int, I),
-    DECLARE_GETSETNATIVE(Long, J),
-    DECLARE_GETSETNATIVE(Float, F),
-    DECLARE_GETSETNATIVE(Double, D),
-
-    {CC"getAddress",         CC"("ADR")"ADR,             FN_PTR(Unsafe_GetNativeAddress)},
-    {CC"putAddress",         CC"("ADR""ADR")V",          FN_PTR(Unsafe_SetNativeAddress)},
-
-    {CC"allocateMemory",     CC"(J)"ADR,                 FN_PTR(Unsafe_AllocateMemory)},
-    {CC"reallocateMemory",   CC"("ADR"J)"ADR,            FN_PTR(Unsafe_ReallocateMemory)},
-    {CC"freeMemory",         CC"("ADR")V",               FN_PTR(Unsafe_FreeMemory)},
-
-    {CC"objectFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_ObjectFieldOffset)},
-    {CC"staticFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_StaticFieldOffset)},
-    {CC"staticFieldBase",    CC"("FLD")"OBJ,             FN_PTR(Unsafe_StaticFieldBaseFromField)},
-    {CC"ensureClassInitialized",CC"("CLS")V",            FN_PTR(Unsafe_EnsureClassInitialized)},
-    {CC"arrayBaseOffset",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayBaseOffset)},
-    {CC"arrayIndexScale",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayIndexScale)},
-    {CC"addressSize",        CC"()I",                    FN_PTR(Unsafe_AddressSize)},
-    {CC"pageSize",           CC"()I",                    FN_PTR(Unsafe_PageSize)},
-
-    {CC"defineClass",        CC"("DC0_Args")"CLS,        FN_PTR(Unsafe_DefineClass0)},
-    {CC"defineClass",        CC"("DC_Args")"CLS,         FN_PTR(Unsafe_DefineClass)},
-    {CC"allocateInstance",   CC"("CLS")"OBJ,             FN_PTR(Unsafe_AllocateInstance)},
-    {CC"throwException",     CC"("THR")V",               FN_PTR(Unsafe_ThrowException)},
-    {CC"compareAndSwapObject", CC"("OBJ"J"OBJ""OBJ")Z",  FN_PTR(Unsafe_CompareAndSwapObject)},
-    {CC"compareAndSwapInt",  CC"("OBJ"J""I""I"")Z",      FN_PTR(Unsafe_CompareAndSwapInt)},
-    {CC"compareAndSwapLong", CC"("OBJ"J""J""J"")Z",      FN_PTR(Unsafe_CompareAndSwapLong)},
-    {CC"park",               CC"(ZJ)V",                  FN_PTR(Unsafe_Park)},
-    {CC"unpark",             CC"("OBJ")V",               FN_PTR(Unsafe_Unpark)}
-
-};
-
-// These are the methods for 1.6.0 and 1.7.0
-static JNINativeMethod methods_16[] = {
-    {CC"getObject",        CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObject)},
-    {CC"putObject",        CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObject)},
-    {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObjectVolatile)},
-    {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObjectVolatile)},
-
-    DECLARE_GETSETOOP(Boolean, Z),
-    DECLARE_GETSETOOP(Byte, B),
-    DECLARE_GETSETOOP(Short, S),
-    DECLARE_GETSETOOP(Char, C),
-    DECLARE_GETSETOOP(Int, I),
-    DECLARE_GETSETOOP(Long, J),
-    DECLARE_GETSETOOP(Float, F),
-    DECLARE_GETSETOOP(Double, D),
+    DECLARE_GETPUTOOP(Boolean, Z),
+    DECLARE_GETPUTOOP(Byte, B),
+    DECLARE_GETPUTOOP(Short, S),
+    DECLARE_GETPUTOOP(Char, C),
+    DECLARE_GETPUTOOP(Int, I),
+    DECLARE_GETPUTOOP(Long, J),
+    DECLARE_GETPUTOOP(Float, F),
+    DECLARE_GETPUTOOP(Double, D),
 
-    DECLARE_GETSETNATIVE(Byte, B),
-    DECLARE_GETSETNATIVE(Short, S),
-    DECLARE_GETSETNATIVE(Char, C),
-    DECLARE_GETSETNATIVE(Int, I),
-    DECLARE_GETSETNATIVE(Long, J),
-    DECLARE_GETSETNATIVE(Float, F),
-    DECLARE_GETSETNATIVE(Double, D),
-
-    {CC"getAddress",         CC"("ADR")"ADR,             FN_PTR(Unsafe_GetNativeAddress)},
-    {CC"putAddress",         CC"("ADR""ADR")V",          FN_PTR(Unsafe_SetNativeAddress)},
-
-    {CC"allocateMemory",     CC"(J)"ADR,                 FN_PTR(Unsafe_AllocateMemory)},
-    {CC"reallocateMemory",   CC"("ADR"J)"ADR,            FN_PTR(Unsafe_ReallocateMemory)},
-    {CC"freeMemory",         CC"("ADR")V",               FN_PTR(Unsafe_FreeMemory)},
-
-    {CC"objectFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_ObjectFieldOffset)},
-    {CC"staticFieldOffset",  CC"("FLD")J",               FN_PTR(Unsafe_StaticFieldOffset)},
-    {CC"staticFieldBase",    CC"("FLD")"OBJ,             FN_PTR(Unsafe_StaticFieldBaseFromField)},
-    {CC"ensureClassInitialized",CC"("CLS")V",            FN_PTR(Unsafe_EnsureClassInitialized)},
-    {CC"arrayBaseOffset",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayBaseOffset)},
-    {CC"arrayIndexScale",    CC"("CLS")I",               FN_PTR(Unsafe_ArrayIndexScale)},
-    {CC"addressSize",        CC"()I",                    FN_PTR(Unsafe_AddressSize)},
-    {CC"pageSize",           CC"()I",                    FN_PTR(Unsafe_PageSize)},
-
-    {CC"defineClass",        CC"("DC0_Args")"CLS,        FN_PTR(Unsafe_DefineClass0)},
-    {CC"defineClass",        CC"("DC_Args")"CLS,         FN_PTR(Unsafe_DefineClass)},
-    {CC"allocateInstance",   CC"("CLS")"OBJ,             FN_PTR(Unsafe_AllocateInstance)},
-    {CC"throwException",     CC"("THR")V",               FN_PTR(Unsafe_ThrowException)},
-    {CC"compareAndSwapObject", CC"("OBJ"J"OBJ""OBJ")Z",  FN_PTR(Unsafe_CompareAndSwapObject)},
-    {CC"compareAndSwapInt",  CC"("OBJ"J""I""I"")Z",      FN_PTR(Unsafe_CompareAndSwapInt)},
-    {CC"compareAndSwapLong", CC"("OBJ"J""J""J"")Z",      FN_PTR(Unsafe_CompareAndSwapLong)},
-    {CC"putOrderedObject",   CC"("OBJ"J"OBJ")V",         FN_PTR(Unsafe_SetOrderedObject)},
-    {CC"putOrderedInt",      CC"("OBJ"JI)V",             FN_PTR(Unsafe_SetOrderedInt)},
-    {CC"putOrderedLong",     CC"("OBJ"JJ)V",             FN_PTR(Unsafe_SetOrderedLong)},
-    {CC"park",               CC"(ZJ)V",                  FN_PTR(Unsafe_Park)},
-    {CC"unpark",             CC"("OBJ")V",               FN_PTR(Unsafe_Unpark)}
-};
-
-// These are the methods for 1.8.0
-static JNINativeMethod methods_18[] = {
-    {CC"getObject",        CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObject)},
-    {CC"putObject",        CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObject)},
-    {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"",   FN_PTR(Unsafe_GetObjectVolatile)},
-    {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V",  FN_PTR(Unsafe_SetObjectVolatile)},
-
-    DECLARE_GETSETOOP(Boolean, Z),
-    DECLARE_GETSETOOP(Byte, B),
-    DECLARE_GETSETOOP(Short, S),
-    DECLARE_GETSETOOP(Char, C),
-    DECLARE_GETSETOOP(Int, I),
-    DECLARE_GETSETOOP(Long, J),
-    DECLARE_GETSETOOP(Float, F),
-    DECLARE_GETSETOOP(Double, D),
-
-    DECLARE_GETSETNATIVE(Byte, B),
-    DECLARE_GETSETNATIVE(Short, S),
-    DECLARE_GETSETNATIVE(Char, C),
-    DECLARE_GETSETNATIVE(Int, I),
-    DECLARE_GETSETNATIVE(Long, J),
-    DECLARE_GETSETNATIVE(Float, F),
-    DECLARE_GETSETNATIVE(Double, D),
+    DECLARE_GETPUTNATIVE(Byte, B),
+    DECLARE_GETPUTNATIVE(Short, S),
+    DECLARE_GETPUTNATIVE(Char, C),
+    DECLARE_GETPUTNATIVE(Int, I),
+    DECLARE_GETPUTNATIVE(Long, J),
+    DECLARE_GETPUTNATIVE(Float, F),
+    DECLARE_GETPUTNATIVE(Double, D),
 
     {CC"getAddress",         CC"("ADR")"ADR,             FN_PTR(Unsafe_GetNativeAddress)},
     {CC"putAddress",         CC"("ADR""ADR")V",          FN_PTR(Unsafe_SetNativeAddress)},
@@ -1533,39 +1245,17 @@
     {CC"putOrderedInt",      CC"("OBJ"JI)V",             FN_PTR(Unsafe_SetOrderedInt)},
     {CC"putOrderedLong",     CC"("OBJ"JJ)V",             FN_PTR(Unsafe_SetOrderedLong)},
     {CC"park",               CC"(ZJ)V",                  FN_PTR(Unsafe_Park)},
-    {CC"unpark",             CC"("OBJ")V",               FN_PTR(Unsafe_Unpark)}
-};
-
-JNINativeMethod loadavg_method[] = {
-    {CC"getLoadAverage",     CC"([DI)I",                 FN_PTR(Unsafe_Loadavg)}
-};
+    {CC"unpark",             CC"("OBJ")V",               FN_PTR(Unsafe_Unpark)},
 
-JNINativeMethod prefetch_methods[] = {
-    {CC"prefetchRead",       CC"("OBJ"J)V",              FN_PTR(Unsafe_PrefetchRead)},
-    {CC"prefetchWrite",      CC"("OBJ"J)V",              FN_PTR(Unsafe_PrefetchWrite)},
-    {CC"prefetchReadStatic", CC"("OBJ"J)V",              FN_PTR(Unsafe_PrefetchRead)},
-    {CC"prefetchWriteStatic",CC"("OBJ"J)V",              FN_PTR(Unsafe_PrefetchWrite)}
-};
+    {CC"getLoadAverage",     CC"([DI)I",                 FN_PTR(Unsafe_Loadavg)},
 
-JNINativeMethod memcopy_methods_17[] = {
-    {CC"copyMemory",         CC"("OBJ"J"OBJ"JJ)V",       FN_PTR(Unsafe_CopyMemory2)},
-    {CC"setMemory",          CC"("OBJ"JJB)V",            FN_PTR(Unsafe_SetMemory2)}
-};
-
-JNINativeMethod memcopy_methods_15[] = {
-    {CC"setMemory",          CC"("ADR"JB)V",             FN_PTR(Unsafe_SetMemory)},
-    {CC"copyMemory",         CC"("ADR ADR"J)V",          FN_PTR(Unsafe_CopyMemory)}
-};
+    {CC"copyMemory",         CC"("OBJ"J"OBJ"JJ)V",       FN_PTR(Unsafe_CopyMemory)},
+    {CC"setMemory",          CC"("OBJ"JJB)V",            FN_PTR(Unsafe_SetMemory)},
 
-JNINativeMethod anonk_methods[] = {
     {CC"defineAnonymousClass", CC"("DAC_Args")"CLS,      FN_PTR(Unsafe_DefineAnonymousClass)},
-};
 
-JNINativeMethod lform_methods[] = {
     {CC"shouldBeInitialized",CC"("CLS")Z",               FN_PTR(Unsafe_ShouldBeInitialized)},
-};
 
-JNINativeMethod fence_methods[] = {
     {CC"loadFence",          CC"()V",                    FN_PTR(Unsafe_LoadFence)},
     {CC"storeFence",         CC"()V",                    FN_PTR(Unsafe_StoreFence)},
     {CC"fullFence",          CC"()V",                    FN_PTR(Unsafe_FullFence)},
@@ -1578,35 +1268,13 @@
 #undef LANG
 #undef OBJ
 #undef CLS
-#undef CTR
 #undef FLD
-#undef MTH
 #undef THR
-#undef DC0_Args
 #undef DC_Args
-
-#undef DECLARE_GETSETOOP
-#undef DECLARE_GETSETNATIVE
-
+#undef DAC_Args
 
-/**
- * Helper method to register native methods.
- */
-static bool register_natives(const char* message, JNIEnv* env, jclass clazz, const JNINativeMethod* methods, jint nMethods) {
-  int status = env->RegisterNatives(clazz, methods, nMethods);
-  if (status < 0 || env->ExceptionOccurred()) {
-    if (PrintMiscellaneous && (Verbose || WizardMode)) {
-      tty->print_cr("Unsafe:  failed registering %s", message);
-    }
-    env->ExceptionClear();
-    return false;
-  } else {
-    if (PrintMiscellaneous && (Verbose || WizardMode)) {
-      tty->print_cr("Unsafe:  successfully registered %s", message);
-    }
-    return true;
-  }
-}
+#undef DECLARE_GETPUTOOP
+#undef DECLARE_GETPUTNATIVE
 
 
 // This one function is exported, used by NativeLookup.
@@ -1614,57 +1282,12 @@
 // The optimizer looks at names and signatures to recognize
 // individual functions.
 
-JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls))
+JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafeclass))
   UnsafeWrapper("JVM_RegisterUnsafeMethods");
   {
     ThreadToNativeFromVM ttnfv(thread);
 
-    // Unsafe methods
-    {
-      bool success = false;
-      // We need to register the 1.6 methods first because the 1.8 methods would register fine on 1.7 and 1.6
-      if (!success) {
-        success = register_natives("1.6 methods",   env, unsafecls, methods_16,  sizeof(methods_16)/sizeof(JNINativeMethod));
-      }
-      if (!success) {
-        success = register_natives("1.8 methods",   env, unsafecls, methods_18,  sizeof(methods_18)/sizeof(JNINativeMethod));
-      }
-      if (!success) {
-        success = register_natives("1.5 methods",   env, unsafecls, methods_15,  sizeof(methods_15)/sizeof(JNINativeMethod));
-      }
-      if (!success) {
-        success = register_natives("1.4.1 methods", env, unsafecls, methods_141, sizeof(methods_141)/sizeof(JNINativeMethod));
-      }
-      if (!success) {
-        success = register_natives("1.4.0 methods", env, unsafecls, methods_140, sizeof(methods_140)/sizeof(JNINativeMethod));
-      }
-      guarantee(success, "register unsafe natives");
-    }
-
-    // Unsafe.getLoadAverage
-    register_natives("1.6 loadavg method", env, unsafecls, loadavg_method, sizeof(loadavg_method)/sizeof(JNINativeMethod));
-
-    // Prefetch methods
-    register_natives("1.6 prefetch methods", env, unsafecls, prefetch_methods, sizeof(prefetch_methods)/sizeof(JNINativeMethod));
-
-    // Memory copy methods
-    {
-      bool success = false;
-      if (!success) {
-        success = register_natives("1.7 memory copy methods", env, unsafecls, memcopy_methods_17, sizeof(memcopy_methods_17)/sizeof(JNINativeMethod));
-      }
-      if (!success) {
-        success = register_natives("1.5 memory copy methods", env, unsafecls, memcopy_methods_15, sizeof(memcopy_methods_15)/sizeof(JNINativeMethod));
-      }
-    }
-
-    // Unsafe.defineAnonymousClass
-    register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
-
-    // Unsafe.shouldBeInitialized
-    register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod));
-
-    // Fence methods
-    register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod));
+    int ok = env->RegisterNatives(unsafeclass, methods, sizeof(methods)/sizeof(JNINativeMethod));
+    guarantee(ok == 0, "register unsafe natives");
   }
 JVM_END
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1114,34 +1114,39 @@
 }
 #endif
 
+// Returns threshold scaled with the value of scale.
+// If scale < 0.0, threshold is returned without scaling.
 intx Arguments::scaled_compile_threshold(intx threshold, double scale) {
-  if (scale == 1.0 || scale <= 0.0) {
+  if (scale == 1.0 || scale < 0.0) {
     return threshold;
   } else {
     return (intx)(threshold * scale);
   }
 }
 
-// Returns freq_log scaled with CompileThresholdScaling
+// Returns freq_log scaled with the value of scale.
+// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1].
+// If scale < 0.0, freq_log is returned without scaling.
 intx Arguments::scaled_freq_log(intx freq_log, double scale) {
-  // Check if scaling is necessary or negative value was specified.
+  // Check if scaling is necessary or if negative value was specified.
   if (scale == 1.0 || scale < 0.0) {
     return freq_log;
   }
-
-  // Check value to avoid calculating log2 of 0.
-  if (scale == 0.0) {
-    return freq_log;
+  // Check values to avoid calculating log2 of 0.
+  if (scale == 0.0 || freq_log == 0) {
+    return 0;
   }
-
-  intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);
   // Determine the maximum notification frequency value currently supported.
   // The largest mask value that the interpreter/C1 can handle is
   // of length InvocationCounter::number_of_count_bits. Mask values are always
   // one bit shorter then the value of the notification frequency. Set
   // max_freq_bits accordingly.
   intx max_freq_bits = InvocationCounter::number_of_count_bits + 1;
-  if (scaled_freq > nth_bit(max_freq_bits)) {
+  intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);
+  if (scaled_freq == 0) {
+    // Return 0 right away to avoid calculating log2 of 0.
+    return 0;
+  } else if (scaled_freq > nth_bit(max_freq_bits)) {
     return max_freq_bits;
   } else {
     return log2_intptr(scaled_freq);
@@ -1192,8 +1197,9 @@
     vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);
   }
 
-  // Scale tiered compilation thresholds
-  if (!FLAG_IS_DEFAULT(CompileThresholdScaling)) {
+  // Scale tiered compilation thresholds.
+  // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.
+  if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
     FLAG_SET_ERGO(intx, Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));
     FLAG_SET_ERGO(intx, Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));
 
@@ -3912,7 +3918,8 @@
         "Incompatible compilation policy selected", NULL);
     }
     // Scale CompileThreshold
-    if (!FLAG_IS_DEFAULT(CompileThresholdScaling)) {
+    // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.
+    if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
       FLAG_SET_ERGO(intx, CompileThreshold, scaled_compile_threshold(CompileThreshold));
     }
   }
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "code/nativeInst.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "utilities/exceptions.hpp"
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/utf8.hpp"
-
-#ifdef HAVE_DTRACE_H
-
-jlong DTraceJSDT::activate(
-    jint version, jstring module_name, jint providers_count,
-    JVM_DTraceProvider* providers, TRAPS) {
-
-  size_t count = 0;
-  RegisteredProbes* probes = NULL;
-
-  if (!is_supported()) {
-    return 0;
-  }
-
-  assert(module_name != NULL, "valid module name");
-  assert(providers != NULL, "valid provider array");
-
-  for (int i = 0; i < providers_count; ++i) {
-    count += providers[i].probe_count;
-  }
-  probes = new RegisteredProbes(count);
-  count = 0;
-
-  for (int i = 0; i < providers_count; ++i) {
-    assert(providers[i].name != NULL, "valid provider name");
-    assert(providers[i].probe_count == 0 || providers[i].probes != NULL,
-           "valid probe count");
-    for (int j = 0; j < providers[i].probe_count; ++j) {
-      JVM_DTraceProbe* probe = &(providers[i].probes[j]);
-      assert(probe != NULL, "valid probe");
-      assert(probe->method != NULL, "valid method");
-      assert(probe->name != NULL, "valid probe name");
-      assert(probe->function != NULL, "valid probe function spec");
-      methodHandle h_method =
-        methodHandle(THREAD, Method::resolve_jmethod_id(probe->method));
-      nmethod* nm = AdapterHandlerLibrary::create_dtrace_nmethod(h_method);
-      if (nm == NULL) {
-        delete probes;
-        THROW_MSG_0(vmSymbols::java_lang_RuntimeException(),
-          "Unable to register DTrace probes (CodeCache: no room for DTrace nmethods).");
-      }
-      h_method()->set_not_compilable();
-      h_method()->set_code(h_method, nm);
-      probes->nmethod_at_put(count++, nm);
-    }
-  }
-
-  int handle = pd_activate((void*)probes,
-    module_name, providers_count, providers);
-  if (handle < 0) {
-    delete probes;
-    THROW_MSG_0(vmSymbols::java_lang_RuntimeException(),
-      "Unable to register DTrace probes (internal error).");
-  }
-  probes->set_helper_handle(handle);
-  return RegisteredProbes::toOpaqueProbes(probes);
-}
-
-jboolean DTraceJSDT::is_probe_enabled(jmethodID method) {
-  Method* m = Method::resolve_jmethod_id(method);
-  return nativeInstruction_at(m->code()->trap_address())->is_dtrace_trap();
-}
-
-void DTraceJSDT::dispose(OpaqueProbes probes) {
-  RegisteredProbes* p = RegisteredProbes::toRegisteredProbes(probes);
-  if (probes != -1 && p != NULL) {
-    pd_dispose(p->helper_handle());
-    delete p;
-  }
-}
-
-jboolean DTraceJSDT::is_supported() {
-  return pd_is_supported();
-}
-
-#else // HAVE_DTRACE_H
-
-jlong DTraceJSDT::activate(
-    jint version, jstring module_name, jint providers_count,
-    JVM_DTraceProvider* providers, TRAPS) {
-  return 0;
-}
-
-jboolean DTraceJSDT::is_probe_enabled(jmethodID method) {
-  return false;
-}
-
-void DTraceJSDT::dispose(OpaqueProbes probes) {
-  return;
-}
-
-jboolean DTraceJSDT::is_supported() {
-  return false;
-}
-
-#endif // ndef HAVE_DTRACE_H
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_RUNTIME_DTRACEJSDT_HPP
-#define SHARE_VM_RUNTIME_DTRACEJSDT_HPP
-
-#include "code/nmethod.hpp"
-
-class RegisteredProbes;
-typedef jlong OpaqueProbes;
-
-class DTraceJSDT : AllStatic {
- private:
-
-  static int pd_activate(void* moduleBaseAddress, jstring module,
-      jint providers_count, JVM_DTraceProvider* providers);
-  static void pd_dispose(int handle);
-  static jboolean pd_is_supported();
-
- public:
-
-  static OpaqueProbes activate(
-      jint version, jstring module_name, jint providers_count,
-      JVM_DTraceProvider* providers, TRAPS);
-  static jboolean is_probe_enabled(jmethodID method);
-  static void dispose(OpaqueProbes handle);
-  static jboolean is_supported();
-};
-
-class RegisteredProbes : public CHeapObj<mtInternal> {
- private:
-  nmethod** _nmethods;      // all the probe methods
-  size_t    _count;         // number of probe methods
-  int       _helper_handle; // DTrace-assigned identifier
-
- public:
-  RegisteredProbes(size_t count) {
-    _count = count;
-    _nmethods = NEW_C_HEAP_ARRAY(nmethod*, count, mtInternal);
-  }
-
-  ~RegisteredProbes() {
-    for (size_t i = 0; i < _count; ++i) {
-      // Let the sweeper reclaim it
-      _nmethods[i]->make_not_entrant();
-      _nmethods[i]->method()->clear_code();
-    }
-    FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
-    _nmethods = NULL;
-    _count = 0;
-  }
-
-  static RegisteredProbes* toRegisteredProbes(OpaqueProbes p) {
-    return (RegisteredProbes*)(intptr_t)p;
-  }
-
-  static OpaqueProbes toOpaqueProbes(RegisteredProbes* p) {
-    return (OpaqueProbes)(intptr_t)p;
-  }
-
-  void set_helper_handle(int handle) { _helper_handle = handle; }
-  int helper_handle() const { return _helper_handle; }
-
-  nmethod* nmethod_at(size_t i) {
-    assert(i >= 0 && i < _count, "bad nmethod index");
-    return _nmethods[i];
-  }
-
-  void nmethod_at_put(size_t i, nmethod* nm) {
-    assert(i >= 0 && i < _count, "bad nmethod index");
-    _nmethods[i] = nm;
-  }
-};
-
-#endif // SHARE_VM_RUNTIME_DTRACEJSDT_HPP
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -905,6 +905,10 @@
           "determines which error to provoke. See test_error_handler() "    \
           "in debug.cpp.")                                                  \
                                                                             \
+  notproduct(uintx, TestCrashInErrorHandler, 0,                             \
+          "If > 0, provokes an error inside VM error handler (a secondary " \
+          "crash). see test_error_handler() in debug.cpp.")                 \
+                                                                            \
   develop(bool, Verbose, false,                                             \
           "Print additional debugging information from other modes")        \
                                                                             \
@@ -1501,7 +1505,7 @@
                                                                             \
   product(bool, ExplicitGCInvokesConcurrent, false,                         \
           "A System.gc() request invokes a concurrent collection; "         \
-          "(effective only when UseConcMarkSweepGC)")                       \
+          "(effective only when using concurrent collectors)")              \
                                                                             \
   product(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false,        \
           "A System.gc() request invokes a concurrent collection and "      \
@@ -3531,7 +3535,7 @@
           "(both with and without tiered compilation): "                    \
           "values greater than 1.0 delay counter overflow, "                \
           "values between 0 and 1.0 rush counter overflow, "                \
-          "value of 1.0 leave compilation thresholds unchanged "            \
+          "value of 1.0 leaves compilation thresholds unchanged "           \
           "value of 0.0 is equivalent to -Xint. "                           \
           ""                                                                \
           "Flag can be set as per-method option. "                          \
@@ -3843,9 +3847,6 @@
   product(bool, RelaxAccessControlCheck, false,                             \
           "Relax the access control checks in the verifier")                \
                                                                             \
-  diagnostic(bool, PrintDTraceDOF, false,                                   \
-          "Print the DTrace DOF passed to the system for JSDT probes")      \
-                                                                            \
   product(uintx, StringTableSize, defaultStringTableSize,                   \
           "Number of buckets in the interned String table")                 \
                                                                             \
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -2610,68 +2610,6 @@
   GC_locker::unlock_critical(thread);
 JRT_END
 
-#ifdef HAVE_DTRACE_H
-/**
- * Create a dtrace nmethod for this method.  The wrapper converts the
- * Java-compiled calling convention to the native convention, makes a dummy call
- * (actually nops for the size of the call instruction, which become a trap if
- * probe is enabled), and finally returns to the caller. Since this all looks like a
- * leaf, no thread transition is needed.
- */
-nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) {
-  ResourceMark rm;
-  nmethod* nm = NULL;
-
-  if (PrintCompilation) {
-    ttyLocker ttyl;
-    tty->print("---   n  ");
-    method->print_short_name(tty);
-    if (method->is_static()) {
-      tty->print(" (static)");
-    }
-    tty->cr();
-  }
-
-  {
-    // perform the work while holding the lock, but perform any printing
-    // outside the lock
-    MutexLocker mu(AdapterHandlerLibrary_lock);
-    // See if somebody beat us to it
-    nm = method->code();
-    if (nm) {
-      return nm;
-    }
-
-    ResourceMark rm;
-
-    BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
-    if (buf != NULL) {
-      CodeBuffer buffer(buf);
-      // Need a few relocation entries
-      double locs_buf[20];
-      buffer.insts()->initialize_shared_locs(
-        (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
-      MacroAssembler _masm(&buffer);
-
-      // Generate the compiled-to-native wrapper code
-      nm = SharedRuntime::generate_dtrace_nmethod(&_masm, method);
-    }
-  }
-  return nm;
-}
-
-// the dtrace method needs to convert java lang string to utf8 string.
-void SharedRuntime::get_utf(oopDesc* src, address dst) {
-  typeArrayOop jlsValue  = java_lang_String::value(src);
-  int          jlsOffset = java_lang_String::offset(src);
-  int          jlsLen    = java_lang_String::length(src);
-  jchar*       jlsPos    = (jlsLen == 0) ? NULL :
-                                           jlsValue->char_at_addr(jlsOffset);
-  assert(TypeArrayKlass::cast(jlsValue->klass())->element_type() == T_CHAR, "compressed string");
-  (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size);
-}
-#endif // ndef HAVE_DTRACE_H
-
 int SharedRuntime::convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt) {
   int argcnt = in_args_count;
   if (CCallingConventionRequiresIntsAsLongs) {
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -466,19 +466,6 @@
   // Block before entering a JNI critical method
   static void block_for_jni_critical(JavaThread* thread);
 
-#ifdef HAVE_DTRACE_H
-  // Generate a dtrace wrapper for a given method.  The method takes arguments
-  // in the Java compiled code convention, marshals them to the native
-  // convention (handlizes oops, etc), transitions to native, makes the call,
-  // returns to java state (possibly blocking), unhandlizes any result and
-  // returns.
-  static nmethod *generate_dtrace_nmethod(MacroAssembler* masm,
-                                          methodHandle method);
-
-  // dtrace support to convert a Java string to utf8
-  static void get_utf(oopDesc* src, address dst);
-#endif // def HAVE_DTRACE_H
-
   // A compiled caller has just called the interpreter, but compiled code
   // exists.  Patch the caller so he no longer calls into the interpreter.
   static void fixup_callers_callsite(Method* moop, address ret_pc);
@@ -680,10 +667,6 @@
   static void create_native_wrapper(methodHandle method);
   static AdapterHandlerEntry* get_adapter(methodHandle method);
 
-#ifdef HAVE_DTRACE_H
-  static nmethod* create_dtrace_nmethod (methodHandle method);
-#endif // HAVE_DTRACE_H
-
   static void print_handler(CodeBlob* b) { print_handler_on(tty, b); }
   static void print_handler_on(outputStream* st, CodeBlob* b);
   static bool contains(CodeBlob* b);
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -503,11 +503,12 @@
     // But leave room for the compressed class pointers, which is allocated above
     // the heap.
     char *zerobased_max = (char *)OopEncodingHeapMax;
+    const size_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
     // For small heaps, save some space for compressed class pointer
     // space so it can be decoded with no base.
     if (UseCompressedClassPointers && !UseSharedSpaces &&
-        OopEncodingHeapMax <= KlassEncodingMetaspaceMax) {
-      const size_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
+        OopEncodingHeapMax <= KlassEncodingMetaspaceMax &&
+        (uint64_t)(aligned_heap_base_min_address + size + class_space) <= KlassEncodingMetaspaceMax) {
       zerobased_max = (char *)OopEncodingHeapMax - class_space;
     }
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1920,8 +1920,6 @@
   declare_c2_type(CompareAndSwapINode, LoadStoreNode)                     \
   declare_c2_type(CompareAndSwapPNode, LoadStoreNode)                     \
   declare_c2_type(CompareAndSwapNNode, LoadStoreNode)                     \
-  declare_c2_type(PrefetchReadNode, Node)                                 \
-  declare_c2_type(PrefetchWriteNode, Node)                                \
   declare_c2_type(MulNode, Node)                                          \
   declare_c2_type(MulINode, MulNode)                                      \
   declare_c2_type(MulLNode, MulNode)                                      \
--- a/hotspot/src/share/vm/services/attachListener.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 #include "runtime/os.hpp"
 #include "services/attachListener.hpp"
 #include "services/diagnosticCommand.hpp"
+#include "services/writeableFlags.hpp"
 #include "services/heapDumper.hpp"
 
 volatile bool AttachListener::_initialized;
@@ -229,133 +230,6 @@
   return JNI_OK;
 }
 
-// set a boolean global flag using value from AttachOperation
-static jint set_bool_flag(const char* name, AttachOperation* op, outputStream* out) {
-  bool value = true;
-  const char* arg1;
-  if ((arg1 = op->arg(1)) != NULL) {
-    int tmp;
-    int n = sscanf(arg1, "%d", &tmp);
-    if (n != 1) {
-      out->print_cr("flag value must be a boolean (1 or 0)");
-      return JNI_ERR;
-    }
-    value = (tmp != 0);
-  }
-  bool res = CommandLineFlags::boolAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (! res) {
-    out->print_cr("setting flag %s failed", name);
-  }
-  return res? JNI_OK : JNI_ERR;
-}
-
-// set a intx global flag using value from AttachOperation
-static jint set_intx_flag(const char* name, AttachOperation* op, outputStream* out) {
-  intx value;
-  const char* arg1;
-  if ((arg1 = op->arg(1)) != NULL) {
-    int n = sscanf(arg1, INTX_FORMAT, &value);
-    if (n != 1) {
-      out->print_cr("flag value must be an integer");
-      return JNI_ERR;
-    }
-  }
-  bool res = CommandLineFlags::intxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (! res) {
-    out->print_cr("setting flag %s failed", name);
-  }
-
-  return res? JNI_OK : JNI_ERR;
-}
-
-// set a uintx global flag using value from AttachOperation
-static jint set_uintx_flag(const char* name, AttachOperation* op, outputStream* out) {
-  uintx value;
-  const char* arg1;
-  if ((arg1 = op->arg(1)) != NULL) {
-    int n = sscanf(arg1, UINTX_FORMAT, &value);
-    if (n != 1) {
-      out->print_cr("flag value must be an unsigned integer");
-      return JNI_ERR;
-    }
-  }
-
-  if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("%s", "");
-    if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
-      out->print_cr("%s", err_msg.buffer());
-      return JNI_ERR;
-    }
-  } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("%s", "");
-    if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) {
-      out->print_cr("%s", err_msg.buffer());
-      return JNI_ERR;
-    }
-  }
-  bool res = CommandLineFlags::uintxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (! res) {
-    out->print_cr("setting flag %s failed", name);
-  }
-
-  return res? JNI_OK : JNI_ERR;
-}
-
-// set a uint64_t global flag using value from AttachOperation
-static jint set_uint64_t_flag(const char* name, AttachOperation* op, outputStream* out) {
-  uint64_t value;
-  const char* arg1;
-  if ((arg1 = op->arg(1)) != NULL) {
-    int n = sscanf(arg1, UINT64_FORMAT, &value);
-    if (n != 1) {
-      out->print_cr("flag value must be an unsigned 64-bit integer");
-      return JNI_ERR;
-    }
-  }
-  bool res = CommandLineFlags::uint64_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (! res) {
-    out->print_cr("setting flag %s failed", name);
-  }
-
-  return res? JNI_OK : JNI_ERR;
-}
-
-// set a size_t global flag using value from AttachOperation
-static jint set_size_t_flag(const char* name, AttachOperation* op, outputStream* out) {
-  size_t value;
-  const char* arg1;
-  if ((arg1 = op->arg(1)) != NULL) {
-    int n = sscanf(arg1, SIZE_FORMAT, &value);
-    if (n != 1) {
-      out->print_cr("flag value must be an unsigned integer");
-      return JNI_ERR;
-    }
-  }
-  bool res = CommandLineFlags::size_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (! res) {
-    out->print_cr("setting flag %s failed", name);
-  }
-
-  return res? JNI_OK : JNI_ERR;
-}
-
-// set a string global flag using value from AttachOperation
-static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream* out) {
-  const char* value;
-  if ((value = op->arg(1)) == NULL) {
-    out->print_cr("flag value must be a string");
-    return JNI_ERR;
-  }
-  bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
-  if (res) {
-    FREE_C_HEAP_ARRAY(char, value);
-  } else {
-    out->print_cr("setting flag %s failed", name);
-  }
-
-  return res? JNI_OK : JNI_ERR;
-}
-
 // Implementation of "setflag" command
 static jint set_flag(AttachOperation* op, outputStream* out) {
 
@@ -365,27 +239,21 @@
     return JNI_ERR;
   }
 
-  Flag* f = Flag::find_flag((char*)name, strlen(name));
-  if (f && f->is_external() && f->is_writeable()) {
-    if (f->is_bool()) {
-      return set_bool_flag(name, op, out);
-    } else if (f->is_intx()) {
-      return set_intx_flag(name, op, out);
-    } else if (f->is_uintx()) {
-      return set_uintx_flag(name, op, out);
-    } else if (f->is_uint64_t()) {
-      return set_uint64_t_flag(name, op, out);
-    } else if (f->is_size_t()) {
-      return set_size_t_flag(name, op, out);
-    } else if (f->is_ccstr()) {
-      return set_ccstr_flag(name, op, out);
+  FormatBuffer<80> err_msg("%s", "");
+
+  int ret = WriteableFlags::set_flag(op->arg(0), op->arg(1), Flag::ATTACH_ON_DEMAND, err_msg);
+  if (ret != WriteableFlags::SUCCESS) {
+    if (ret == WriteableFlags::NON_WRITABLE) {
+      // if the flag is not manageable try to change it through
+      // the platform dependent implementation
+      return AttachListener::pd_set_flag(op, out);
     } else {
-      ShouldNotReachHere();
-      return JNI_ERR;
+      out->print_cr("%s", err_msg.buffer());
     }
-  } else {
-    return AttachListener::pd_set_flag(op, out);
+
+    return JNI_ERR;
   }
+  return JNI_OK;
 }
 
 // Implementation of "printflag" command
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -267,7 +267,7 @@
 
 void SystemGCDCmd::execute(DCmdSource source, TRAPS) {
   if (!DisableExplicitGC) {
-    Universe::heap()->collect(GCCause::_dcmd_gc_run);
+    Universe::heap()->collect(GCCause::_java_lang_system_gc);
   } else {
     output()->print_cr("Explicit GC is disabled, no GC has been performed.");
   }
--- a/hotspot/src/share/vm/services/mallocSiteTable.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/mallocSiteTable.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -136,7 +136,7 @@
 MallocSite* MallocSiteTable::lookup_or_add(const NativeCallStack& key, size_t* bucket_idx,
   size_t* pos_idx) {
   int index = hash_to_index(key.hash());
-  assert(index >= 0, "Negative index");
+  assert(index >= 0, err_msg("Negative index %d", index));
   *bucket_idx = (size_t)index;
   *pos_idx = 0;
 
--- a/hotspot/src/share/vm/services/mallocTracker.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/mallocTracker.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -52,7 +52,7 @@
 }
 
 // Make adjustment by subtracting chunks used by arenas
-// from total chunks to get total free chunck size
+// from total chunks to get total free chunk size
 void MallocMemorySnapshot::make_adjustment() {
   size_t arena_size = total_arena();
   int chunk_idx = NMTUtil::flag_to_index(mtChunk);
--- a/hotspot/src/share/vm/services/mallocTracker.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/mallocTracker.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 
 #include "memory/allocation.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/threadCritical.hpp"
 #include "services/nmtCommon.hpp"
 #include "utilities/nativeCallStack.hpp"
 
@@ -164,6 +165,10 @@
   }
 
   void copy_to(MallocMemorySnapshot* s) {
+    // Need to make sure that mtChunks don't get deallocated while the
+    // copy is going on, because their size is adjusted using this
+    // buffer in make_adjustment().
+    ThreadCritical tc;
     s->_tracking_header = _tracking_header;
     for (int index = 0; index < mt_number_of_types; index ++) {
       s->_malloc[index] = _malloc[index];
--- a/hotspot/src/share/vm/services/management.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 #include "services/classLoadingService.hpp"
 #include "services/diagnosticCommand.hpp"
 #include "services/diagnosticFramework.hpp"
+#include "services/writeableFlags.hpp"
 #include "services/heapDumper.hpp"
 #include "services/jmm.h"
 #include "services/lowMemoryDetector.hpp"
@@ -1698,56 +1699,21 @@
               "The flag name cannot be null.");
   }
   char* name = java_lang_String::as_utf8_string(fn);
-  Flag* flag = Flag::find_flag(name, strlen(name));
-  if (flag == NULL) {
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Flag does not exist.");
-  }
-  if (!flag->is_writeable()) {
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "This flag is not writeable.");
-  }
 
-  bool succeed = false;
-  if (flag->is_bool()) {
-    bool bvalue = (new_value.z == JNI_TRUE ? true : false);
-    succeed = CommandLineFlags::boolAtPut(name, &bvalue, Flag::MANAGEMENT);
-  } else if (flag->is_intx()) {
-    intx ivalue = (intx)new_value.j;
-    succeed = CommandLineFlags::intxAtPut(name, &ivalue, Flag::MANAGEMENT);
-  } else if (flag->is_uintx()) {
-    uintx uvalue = (uintx)new_value.j;
+  FormatBuffer<80> err_msg("%s", "");
+  int succeed = WriteableFlags::set_flag(name, new_value, Flag::MANAGEMENT, err_msg);
 
-    if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("%s", "");
-      if (!Arguments::verify_MaxHeapFreeRatio(err_msg, uvalue)) {
-        THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
-      }
-    } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("%s", "");
-      if (!Arguments::verify_MinHeapFreeRatio(err_msg, uvalue)) {
-        THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
-      }
-    }
-    succeed = CommandLineFlags::uintxAtPut(name, &uvalue, Flag::MANAGEMENT);
-  } else if (flag->is_uint64_t()) {
-    uint64_t uvalue = (uint64_t)new_value.j;
-    succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, Flag::MANAGEMENT);
-  } else if (flag->is_size_t()) {
-    size_t svalue = (size_t)new_value.j;
-    succeed = CommandLineFlags::size_tAtPut(name, &svalue, Flag::MANAGEMENT);
-  } else if (flag->is_ccstr()) {
-    oop str = JNIHandles::resolve_external_guard(new_value.l);
-    if (str == NULL) {
+  if (succeed != WriteableFlags::SUCCESS) {
+    if (succeed == WriteableFlags::MISSING_VALUE) {
+      // missing value causes NPE to be thrown
       THROW(vmSymbols::java_lang_NullPointerException());
-    }
-    ccstr svalue = java_lang_String::as_utf8_string(str);
-    succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
-    if (succeed) {
-      FREE_C_HEAP_ARRAY(char, svalue);
+    } else {
+      // all the other errors are reported as IAE with the appropriate error message
+      THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
+                err_msg.buffer());
     }
   }
-  assert(succeed, "Setting flag should succeed");
+  assert(succeed == WriteableFlags::SUCCESS, "Setting flag should succeed");
 JVM_END
 
 class ThreadTimesClosure: public ThreadClosure {
--- a/hotspot/src/share/vm/services/nmtDCmd.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/services/nmtDCmd.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,8 +137,8 @@
     }
   } else if (_detail_diff.value()) {
     if (!check_detail_tracking_level(output())) {
-    return;
-  }
+      return;
+    }
     MemBaseline& baseline = MemTracker::get_baseline();
     if (baseline.baseline_type() == MemBaseline::Detail_baselined) {
       report_diff(false, scale_unit);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/services/writeableFlags.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/javaClasses.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/java.hpp"
+#include "runtime/jniHandles.hpp"
+#include "services/writeableFlags.hpp"
+
+// set a boolean global flag
+int WriteableFlags::set_bool_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  int value = true;
+
+  if (sscanf(arg, "%d", &value)) {
+    return set_bool_flag(name, value != 0, origin, err_msg);
+  }
+  err_msg.print("flag value must be a boolean (1 or 0)");
+  return WRONG_FORMAT;
+}
+
+int WriteableFlags::set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return CommandLineFlags::boolAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
+}
+
+// set a intx global flag
+int WriteableFlags::set_intx_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  intx value;
+
+  if (sscanf(arg, INTX_FORMAT, &value)) {
+    return set_intx_flag(name, value, origin, err_msg);
+  }
+  err_msg.print("flag value must be an integer");
+  return WRONG_FORMAT;
+}
+
+int WriteableFlags::set_intx_flag(const char* name, intx value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return CommandLineFlags::intxAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
+}
+
+// set a uintx global flag
+int WriteableFlags::set_uintx_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  uintx value;
+
+  if (sscanf(arg, UINTX_FORMAT, &value)) {
+    return set_uintx_flag(name, value, origin, err_msg);
+  }
+  err_msg.print("flag value must be an unsigned integer");
+  return WRONG_FORMAT;
+}
+
+int WriteableFlags::set_uintx_flag(const char* name, uintx value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
+      if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
+        return OUT_OF_BOUNDS;
+      }
+    } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
+      if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) {
+        return OUT_OF_BOUNDS;
+      }
+    }
+    return CommandLineFlags::uintxAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
+}
+
+// set a uint64_t global flag
+int WriteableFlags::set_uint64_t_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  uint64_t value;
+
+  if (sscanf(arg, UINT64_FORMAT, &value)) {
+    return set_uint64_t_flag(name, value, origin, err_msg);
+  }
+  err_msg.print("flag value must be an unsigned 64-bit integer");
+  return WRONG_FORMAT;
+}
+
+int WriteableFlags::set_uint64_t_flag(const char* name, uint64_t value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return CommandLineFlags::uint64_tAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
+}
+
+// set a size_t global flag
+int WriteableFlags::set_size_t_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  size_t value;
+
+  if (sscanf(arg, SIZE_FORMAT, &value)) {
+    return set_size_t_flag(name, value, origin, err_msg);
+  }
+  err_msg.print("flag value must be an unsigned integer");
+  return WRONG_FORMAT;
+}
+
+int WriteableFlags::set_size_t_flag(const char* name, size_t value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return CommandLineFlags::size_tAtPut((char*)name, &value, origin) ? SUCCESS : ERR_OTHER;
+}
+
+// set a string global flag using value from AttachOperation
+int WriteableFlags::set_ccstr_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  bool res = CommandLineFlags::ccstrAtPut((char*)name, &arg, origin);
+
+  return res? SUCCESS : ERR_OTHER;
+}
+
+/* sets a writeable flag to the provided value
+ *
+ * - return status is one of the WriteableFlags::err enum values
+ * - an eventual error message will be generated to the provided err_msg buffer
+ */
+int WriteableFlags::set_flag(const char* flag_name, const char* flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return set_flag(flag_name, &flag_value, set_flag_from_char, origin, err_msg);
+}
+
+/* sets a writeable flag to the provided value
+ *
+ * - return status is one of the WriteableFlags::err enum values
+ * - an eventual error message will be generated to the provided err_msg buffer
+ */
+int WriteableFlags::set_flag(const char* flag_name, jvalue flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  return set_flag(flag_name, &flag_value, set_flag_from_jvalue, origin, err_msg);
+}
+
+// a writeable flag setter accepting either 'jvalue' or 'char *' values
+int WriteableFlags::set_flag(const char* name, const void* value, int(*setter)(Flag*,const void*,Flag::Flags,FormatBuffer<80>&), Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  if (name == NULL) {
+    err_msg.print("flag name is missing");
+    return MISSING_NAME;
+  }
+  if (value == NULL) {
+    err_msg.print("flag value is missing");
+    return MISSING_VALUE;
+  }
+
+  Flag* f = Flag::find_flag((char*)name, strlen(name));
+  if (f) {
+    // only writeable flags are allowed to be set
+    if (f->is_writeable()) {
+      return setter(f, value, origin, err_msg);
+    } else {
+      err_msg.print("only 'writeable' flags can be set");
+      return NON_WRITABLE;
+    }
+  }
+
+  err_msg.print("flag %s does not exist", name);
+  return INVALID_FLAG;
+}
+
+// a writeable flag setter accepting 'char *' values
+int WriteableFlags::set_flag_from_char(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  char* flag_value = *(char**)value;
+  if (flag_value == NULL) {
+    err_msg.print("flag value is missing");
+    return MISSING_VALUE;
+  }
+  if (f->is_bool()) {
+    return set_bool_flag(f->_name, flag_value, origin, err_msg);
+  } else if (f->is_intx()) {
+    return set_intx_flag(f->_name, flag_value, origin, err_msg);
+  } else if (f->is_uintx()) {
+    return set_uintx_flag(f->_name, flag_value, origin, err_msg);
+  } else if (f->is_uint64_t()) {
+    return set_uint64_t_flag(f->_name, flag_value, origin, err_msg);
+  } else if (f->is_size_t()) {
+    return set_size_t_flag(f->_name, flag_value, origin, err_msg);
+  } else if (f->is_ccstr()) {
+    return set_ccstr_flag(f->_name, flag_value, origin, err_msg);
+  } else {
+    ShouldNotReachHere();
+  }
+  return ERR_OTHER;
+}
+
+// a writeable flag setter accepting 'jvalue' values
+int WriteableFlags::set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
+  jvalue new_value = *(jvalue*)value;
+  if (f->is_bool()) {
+    bool bvalue = (new_value.z == JNI_TRUE ? true : false);
+    return set_bool_flag(f->_name, bvalue, origin, err_msg);
+  } else if (f->is_intx()) {
+    intx ivalue = (intx)new_value.j;
+    return set_intx_flag(f->_name, ivalue, origin, err_msg);
+  } else if (f->is_uintx()) {
+    uintx uvalue = (uintx)new_value.j;
+    return set_uintx_flag(f->_name, uvalue, origin, err_msg);
+  } else if (f->is_uint64_t()) {
+    uint64_t uvalue = (uint64_t)new_value.j;
+    return set_uint64_t_flag(f->_name, uvalue, origin, err_msg);
+  } else if (f->is_size_t()) {
+    size_t svalue = (size_t)new_value.j;
+    return set_size_t_flag(f->_name, svalue, origin, err_msg);
+  } else if (f->is_ccstr()) {
+    oop str = JNIHandles::resolve_external_guard(new_value.l);
+    if (str == NULL) {
+      err_msg.print("flag value is missing");
+      return MISSING_VALUE;
+    }
+    ccstr svalue = java_lang_String::as_utf8_string(str);
+    int ret = WriteableFlags::set_ccstr_flag(f->_name, svalue, origin, err_msg);
+    if (ret != SUCCESS) {
+      FREE_C_HEAP_ARRAY(char, svalue);
+    }
+    return ret;
+  } else {
+    ShouldNotReachHere();
+  }
+  return ERR_OTHER;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/services/writeableFlags.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
+#define SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
+
+class WriteableFlags : AllStatic {
+public:
+  enum error {
+    // no error
+    SUCCESS,
+    // flag name is missing
+    MISSING_NAME,
+    // flag value is missing
+    MISSING_VALUE,
+    // error parsing the textual form of the value
+    WRONG_FORMAT,
+    // flag is not writeable
+    NON_WRITABLE,
+    // flag value is outside of its bounds
+    OUT_OF_BOUNDS,
+    // there is no flag with the given name
+    INVALID_FLAG,
+    // other, unspecified error related to setting the flag
+    ERR_OTHER
+  } err;
+
+private:
+  // a writeable flag setter accepting either 'jvalue' or 'char *' values
+  static int set_flag(const char* name, const void* value, int(*setter)(Flag*, const void*, Flag::Flags, FormatBuffer<80>&), Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // a writeable flag setter accepting 'char *' values
+  static int set_flag_from_char(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // a writeable flag setter accepting 'jvalue' values
+  static int set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+
+  // set a boolean global flag
+  static int set_bool_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a intx global flag
+  static int set_intx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a uintx global flag
+  static int set_uintx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a uint64_t global flag
+  static int set_uint64_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a size_t global flag using value from AttachOperation
+  static int set_size_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a boolean global flag
+  static int set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a intx global flag
+  static int set_intx_flag(const char* name, intx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a uintx global flag
+  static int set_uintx_flag(const char* name, uintx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a uint64_t global flag
+  static int set_uint64_t_flag(const char* name, uint64_t value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a size_t global flag using value from AttachOperation
+  static int set_size_t_flag(const char* name, size_t value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+  // set a string global flag
+  static int set_ccstr_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+
+public:
+  /* sets a writeable flag to the provided value
+   *
+   * - return status is one of the WriteableFlags::err enum values
+   * - an eventual error message will be generated to the provided err_msg buffer
+   */
+  static int set_flag(const char* flag_name, const char* flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+
+  /* sets a writeable flag to the provided value
+   *
+   * - return status is one of the WriteableFlags::err enum values
+   * - an eventual error message will be generated to the provided err_msg buffer
+   */
+  static int set_flag(const char* flag_name, jvalue flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg);
+};
+
+#endif /* SHARE_VM_SERVICES_WRITEABLEFLAG_HPP */
+
--- a/hotspot/src/share/vm/utilities/debug.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -316,13 +316,47 @@
 #ifndef PRODUCT
 #include <signal.h>
 
+typedef void (*voidfun_t)();
+// Crash with an authentic sigfpe
+static void crash_with_sigfpe() {
+  // generate a native synchronous SIGFPE where possible;
+  // if that did not cause a signal (e.g. on ppc), just
+  // raise the signal.
+  volatile int x = 0;
+  volatile int y = 1/x;
+#ifndef _WIN32
+  raise(SIGFPE);
+#endif
+} // end: crash_with_sigfpe
+
+// crash with sigsegv at non-null address.
+static void crash_with_segfault() {
+
+  char* const crash_addr = (char*) get_segfault_address();
+  *crash_addr = 'X';
+
+} // end: crash_with_segfault
+
+// returns an address which is guaranteed to generate a SIGSEGV on read,
+// for test purposes, which is not NULL and contains bits in every word
+void* get_segfault_address() {
+  return (void*)
+#ifdef _LP64
+    0xABC0000000000ABCULL;
+#else
+    0x00000ABC;
+#endif
+}
+
 void test_error_handler() {
-  uintx test_num = ErrorHandlerTest;
-  if (test_num == 0) return;
+  controlled_crash(ErrorHandlerTest);
+}
+
+void controlled_crash(int how) {
+  if (how == 0) return;
 
   // If asserts are disabled, use the corresponding guarantee instead.
-  size_t n = test_num;
-  NOT_DEBUG(if (n <= 2) n += 2);
+  NOT_DEBUG(if (how <= 2) how += 2);
 
   const char* const str = "hello";
   const size_t      num = (size_t)os::vm_page_size();
@@ -333,7 +367,7 @@
   const void (*funcPtr)(void) = (const void(*)()) 0xF;  // bad function pointer
 
   // Keep this in sync with test/runtime/6888954/vmerrors.sh.
-  switch (n) {
+  switch (how) {
     case  1: vmassert(str == NULL, "expected null");
     case  2: vmassert(num == 1023 && *str == 'X',
                       err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
@@ -358,8 +392,10 @@
     // There's no guarantee the bad function pointer will crash us
     // so "break" out to the ShouldNotReachHere().
     case 13: (*funcPtr)(); break;
+    case 14: crash_with_segfault(); break;
+    case 15: crash_with_sigfpe(); break;
 
-    default: tty->print_cr("ERROR: %d: unexpected test_num value.", n);
+    default: tty->print_cr("ERROR: %d: unexpected test_num value.", how);
   }
   ShouldNotReachHere();
 }
--- a/hotspot/src/share/vm/utilities/debug.hpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Wed Jul 05 20:20:43 2017 +0200
@@ -248,6 +248,24 @@
 /* Test vmassert(), fatal(), guarantee(), etc. */
 NOT_PRODUCT(void test_error_handler();)
 
+// crash in a controlled way:
+// how can be one of:
+// 1,2 - asserts
+// 3,4 - guarantee
+// 5-7 - fatal
+// 8 - vm_exit_out_of_memory
+// 9 - ShouldNotCallThis
+// 10 - ShouldNotReachHere
+// 11 - Unimplemented
+// 12,13 - (not guaranteed) crashes
+// 14 - SIGSEGV
+// 15 - SIGFPE
+NOT_PRODUCT(void controlled_crash(int how);)
+
+// returns an address which is guaranteed to generate a SIGSEGV on read,
+// for test purposes, which is not NULL and contains bits in every word
+NOT_PRODUCT(void* get_segfault_address();)
+
 void pd_ps(frame f);
 void pd_obfuscate_location(char *buf, size_t buflen);
 
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -353,6 +353,26 @@
                    "Runtime Environment to continue.");
     }
 
+#ifndef PRODUCT
+  // Error handler self tests
+
+  // test secondary error handling. Test it twice, to test that resetting
+  // error handler after a secondary crash works.
+  STEP(13, "(test secondary crash 1)")
+    if (_verbose && TestCrashInErrorHandler != 0) {
+      st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
+        TestCrashInErrorHandler);
+      controlled_crash(TestCrashInErrorHandler);
+    }
+
+  STEP(14, "(test secondary crash 2)")
+    if (_verbose && TestCrashInErrorHandler != 0) {
+      st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
+        TestCrashInErrorHandler);
+      controlled_crash(TestCrashInErrorHandler);
+    }
+#endif // PRODUCT
+
   STEP(15, "(printing type of error)")
 
      switch(_id) {
@@ -786,6 +806,15 @@
        st->cr();
      }
 
+#ifndef PRODUCT
+  // print a defined marker to show that error handling finished correctly.
+  STEP(290, "(printing end marker)" )
+
+     if (_verbose) {
+       st->print_cr("END.");
+     }
+#endif
+
   END
 
 # undef BEGIN
--- a/hotspot/test/TEST.ROOT	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/TEST.ROOT	Wed Jul 05 20:20:43 2017 +0200
@@ -31,3 +31,6 @@
 
 groups=TEST.groups [closed/TEST.groups]
 requires.properties=sun.arch.data.model
+
+# Tests using jtreg 4.1 b10 features
+requiredVersion=4.1 b10
--- a/hotspot/test/TEST.groups	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/TEST.groups	Wed Jul 05 20:20:43 2017 +0200
@@ -235,7 +235,8 @@
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/startup_warnings/TestG1.java \
-  gc/whitebox/TestConcMarkCycleWB.java
+  gc/whitebox/TestConcMarkCycleWB.java \
+  gc/arguments/TestG1ConcRefinementThreads.java
 
 # All tests that explicitly set the serial GC
 #
--- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Wed Jul 05 20:20:43 2017 +0200
@@ -26,7 +26,7 @@
 /*
  * @test CheckCompileThresholdScaling
  * @bug 8059604
- * @summary "Add CompileThresholdScalingPercentage flag to control when methods are first compiled (with +/-TieredCompilation)"
+ * @summary "Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)"
  * @library /testlibrary
  * @run main CheckCompileThresholdScaling
  */
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,8 +29,6 @@
  *
  */
 
-import java.lang.invoke.*;
-
 public class TestArrayCopyNoInit {
 
     static int[] m1(int[] src) {
@@ -134,7 +132,7 @@
         return dest;
     }
 
-    static public void main(String[] args) throws Throwable {
+    static public void main(String[] args) {
         boolean success = true;
         int[] src = new int[10];
         TestArrayCopyNoInit[] src2 = new TestArrayCopyNoInit[10];
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8072016
+ * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
+ * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @build TestArrayCopyNoInitDeopt
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
+ * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
+ *                   TestArrayCopyNoInitDeopt
+ *
+ */
+
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.NMethod;
+import com.oracle.java.testlibrary.Platform;
+import java.lang.reflect.*;
+
+public class TestArrayCopyNoInitDeopt {
+
+    public static int[] m1(Object src) {
+        if (src == null) return null;
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, 10);
+        } catch (ArrayStoreException npe) {
+        }
+        return dest;
+    }
+
+    static Object m2_src(Object src) {
+        return src;
+    }
+
+    public static int[] m2(Object src) {
+        if (src == null) return null;
+        src = m2_src(src);
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, 10);
+        } catch (ArrayStoreException npe) {
+        }
+        return dest;
+    }
+
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+    static boolean deoptimize(Method method, Object src_obj) throws Exception {
+        for (int i = 0; i < 10; i++) {
+            method.invoke(null, src_obj);
+            if (!WHITE_BOX.isMethodCompiled(method)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    static public void main(String[] args) throws Exception {
+        if (Platform.isServer()) {
+            int[] src = new int[10];
+            Object src_obj = new Object();
+            Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class);
+            Method method_m2 = TestArrayCopyNoInitDeopt.class.getMethod("m2", Object.class);
+
+            // Warm up
+            for (int i = 0; i < 20000; i++) {
+                m1(src);
+            }
+
+            // And make sure m1 is compiled by C2
+            WHITE_BOX.enqueueMethodForCompilation(method_m1, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+            if (!WHITE_BOX.isMethodCompiled(method_m1)) {
+                throw new RuntimeException("m1 not compiled");
+            }
+
+            // should deoptimize for type check
+            if (!deoptimize(method_m1, src_obj)) {
+                throw new RuntimeException("m1 not deoptimized");
+            }
+
+            WHITE_BOX.enqueueMethodForCompilation(method_m1, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+            if (!WHITE_BOX.isMethodCompiled(method_m1)) {
+                throw new RuntimeException("m1 not recompiled");
+            }
+
+            if (deoptimize(method_m1, src_obj)) {
+                throw new RuntimeException("m1 deoptimized again");
+            }
+
+            // Same test as above but with speculative types
+
+            // Warm up & make sure we collect type profiling
+            for (int i = 0; i < 20000; i++) {
+                m2(src);
+            }
+
+            // And make sure m2 is compiled by C2
+            WHITE_BOX.enqueueMethodForCompilation(method_m2, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+            if (!WHITE_BOX.isMethodCompiled(method_m2)) {
+                throw new RuntimeException("m2 not compiled");
+            }
+
+            // should deoptimize for speculative type check
+            if (!deoptimize(method_m2, src_obj)) {
+                throw new RuntimeException("m2 not deoptimized");
+            }
+
+            WHITE_BOX.enqueueMethodForCompilation(method_m2, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+            if (!WHITE_BOX.isMethodCompiled(method_m2)) {
+                throw new RuntimeException("m2 not recompiled");
+            }
+
+            // should deoptimize for actual type check
+            if (!deoptimize(method_m2, src_obj)) {
+                throw new RuntimeException("m2 not deoptimized");
+            }
+
+            WHITE_BOX.enqueueMethodForCompilation(method_m2, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
+
+            if (!WHITE_BOX.isMethodCompiled(method_m2)) {
+                throw new RuntimeException("m2 not recompiled");
+            }
+
+            if (deoptimize(method_m2, src_obj)) {
+                throw new RuntimeException("m2 deoptimized again");
+            }
+        }
+    }
+}
--- a/hotspot/test/compiler/c2/6857159/Test6857159.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/c2/6857159/Test6857159.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,24 @@
  * @test
  * @bug 6857159
  * @summary local schedule failed with checkcast of Thread.currentThread()
- *
- * @run shell Test6857159.sh
+ * @library /testlibrary
  */
 
-public class Test6857159 extends Thread {
-    static class ct0 extends Test6857159 {
-        public void message() {
-            // System.out.println("message");
-        }
+import com.oracle.java.testlibrary.*;
+
+public class Test6857159 {
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbatch", "-XX:+PrintCompilation",
+                                                                  "-XX:CompileOnly=Test$ct.run", "Test");
+        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+        analyzer.shouldNotContain("COMPILE SKIPPED");
+        analyzer.shouldContain("Test$ct0::run (16 bytes)");
+    }
+}
+
+class Test extends Thread {
+    static class ct0 extends Test {
+        public void message() { }
 
         public void run() {
              message();
@@ -43,14 +52,10 @@
         }
     }
     static class ct1 extends ct0 {
-        public void message() {
-            // System.out.println("message");
-        }
+        public void message() { }
     }
     static class ct2 extends ct0 {
-        public void message() {
-            // System.out.println("message");
-        }
+        public void message() { }
     }
 
     public static void main(String[] args) throws Exception {
--- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -36,7 +36,7 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing
  *     -XX:-MethodFlushing -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *     -XX:+SegmentedCodeCache -XX:CompileCommand=compileonly,null::*
- *     InitialAndMaxUsageTest
+ *     -XX:-UseLargePages InitialAndMaxUsageTest
  * @summary testing of initial and max usage
  */
 public class InitialAndMaxUsageTest {
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -30,6 +30,7 @@
 /*
  * @test OverloadCompileQueueTest
  * @library /testlibrary /../../test/lib
+ * @ignore 8071905
  * @build OverloadCompileQueueTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -31,11 +31,11 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xmixed
  *                   -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
- *                   -XX:-DeoptimizeRandom DeoptimizeFramesTest true
+ *                   -XX:-DeoptimizeRandom -XX:-DeoptimizeALot DeoptimizeFramesTest true
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -Xmixed
  *                   -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
- *                   -XX:-DeoptimizeRandom DeoptimizeFramesTest false
+ *                   -XX:-DeoptimizeRandom -XX:-DeoptimizeALot DeoptimizeFramesTest false
  * @summary testing of WB::deoptimizeFrames()
  */
 import java.lang.reflect.Executable;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,105 @@
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.Platform;
+import com.oracle.java.testlibrary.ProcessTools;
+
+/*
+ * @test
+ * @bug 8065896
+ * @summary Synchronous signals during error reporting may terminate or hang VM process
+ * @library /testlibrary
+ * @author Thomas Stuefe (SAP)
+ */
+
+public class SecondaryErrorTest {
+
+
+  public static void main(String[] args) throws Exception {
+
+    // Do not execute for windows, nor for non-debug builds
+    if (Platform.isWindows()) {
+      return;
+    }
+
+    if (!Platform.isDebugBuild()) {
+      return;
+    }
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:+UnlockDiagnosticVMOptions",
+        "-Xmx100M",
+        "-XX:ErrorHandlerTest=15",
+        "-XX:TestCrashInErrorHandler=14",
+        "-version");
+
+    OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
+
+    // we should have crashed with a SIGFPE
+    output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
+    output_detail.shouldMatch("# +SIGFPE.*");
+
+    // extract hs-err file
+    String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
+    if (hs_err_file == null) {
+      throw new RuntimeException("Did not find hs-err file in output.\n");
+    }
+
+    // scan hs-err file: File should contain the "[error occurred during error reporting..]"
+    // markers which show that the secondary error handling kicked in and handled the
+    // error successfully. As an added test, we check that the last line contains "END.",
+    // which is an end marker written in the last step and proves that hs-err file was
+    // completely written.
+    File f = new File(hs_err_file);
+    if (!f.exists()) {
+      throw new RuntimeException("hs-err file missing at "
+          + f.getAbsolutePath() + ".\n");
+    }
+
+    System.out.println("Found hs_err file. Scanning...");
+
+    FileInputStream fis = new FileInputStream(f);
+    BufferedReader br = new BufferedReader(new InputStreamReader(fis));
+    String line = null;
+
+    Pattern [] pattern = new Pattern[] {
+        Pattern.compile("Will crash now \\(TestCrashInErrorHandler=14\\)..."),
+        Pattern.compile("\\[error occurred during error reporting \\(test secondary crash 1\\).*\\]"),
+        Pattern.compile("Will crash now \\(TestCrashInErrorHandler=14\\)..."),
+        Pattern.compile("\\[error occurred during error reporting \\(test secondary crash 2\\).*\\]"),
+    };
+    int currentPattern = 0;
+
+    String lastLine = null;
+    while ((line = br.readLine()) != null) {
+      if (currentPattern < pattern.length) {
+        if (pattern[currentPattern].matcher(line).matches()) {
+          System.out.println("Found: " + line + ".");
+          currentPattern ++;
+        }
+      }
+      lastLine = line;
+    }
+    br.close();
+
+    if (currentPattern < pattern.length) {
+      throw new RuntimeException("hs-err file incomplete (first missing pattern: " +  currentPattern + ")");
+    }
+
+    if (!lastLine.equals("END.")) {
+      throw new RuntimeException("hs-err file incomplete (missing END marker.)");
+    } else {
+      System.out.println("End marker found.");
+    }
+
+    System.out.println("OK.");
+
+  }
+
+}
+
+
--- a/hotspot/test/runtime/Unsafe/FieldOffset.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/FieldOffset.java	Wed Jul 05 20:20:43 2017 +0200
@@ -37,18 +37,31 @@
 public class FieldOffset {
     public static void main(String args[]) throws Exception {
         Unsafe unsafe = Utils.getUnsafe();
-        Field fields[] = Test.class.getDeclaredFields();
+        Field[] fields = Test.class.getDeclaredFields();
 
         for (int i = 0; i < fields.length; i++) {
-            int offset = unsafe.fieldOffset(fields[i]);
+            long offset = unsafe.objectFieldOffset(fields[i]);
             // Ensure we got a valid offset value back
             assertNotEquals(offset, unsafe.INVALID_FIELD_OFFSET);
 
             // Make sure the field offset is unique
             for (int j = 0; j < i; j++) {
-                assertNotEquals(offset, unsafe.fieldOffset(fields[j]));
+                assertNotEquals(offset, unsafe.objectFieldOffset(fields[j]));
             }
         }
+
+        fields = StaticTest.class.getDeclaredFields();
+        for (int i = 0; i < fields.length; i++) {
+            long offset = unsafe.staticFieldOffset(fields[i]);
+            // Ensure we got a valid offset value back
+            assertNotEquals(offset, unsafe.INVALID_FIELD_OFFSET);
+
+            // Make sure the field offset is unique
+            for (int j = 0; j < i; j++) {
+                assertNotEquals(offset, unsafe.staticFieldOffset(fields[j]));
+            }
+        }
+
     }
 
     class Test {
@@ -62,4 +75,17 @@
         Object objectField;
         short shortField;
     }
+
+    static class StaticTest {
+        static boolean booleanField;
+        static byte byteField;
+        static char charField;
+        static double doubleField;
+        static float floatField;
+        static int intField;
+        static long longField;
+        static Object objectField;
+        static short shortField;
+    }
+
 }
--- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("b1");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(false, unsafe.getBoolean(t, offset));
         unsafe.putBoolean(t, offset, true);
         assertEquals(true, unsafe.getBoolean(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutByte.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutByte.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("b");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals((byte)0, unsafe.getByte(t, offset));
         unsafe.putByte(t, offset, (byte)1);
         assertEquals((byte)1, unsafe.getByte(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutChar.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutChar.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("c");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals('\u0000', unsafe.getChar(t, offset));
         unsafe.putChar(t, offset, '\u0001');
         assertEquals('\u0001', unsafe.getChar(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutDouble.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("d");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(-1.0, unsafe.getDouble(t, offset));
         unsafe.putDouble(t, offset, 0.0);
         assertEquals(0.0, unsafe.getDouble(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutFloat.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("f");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(-1.0f, unsafe.getFloat(t, offset));
         unsafe.putFloat(t, offset, 0.0f);
         assertEquals(0.0f, unsafe.getFloat(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutInt.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutInt.java	Wed Jul 05 20:20:43 2017 +0200
@@ -38,7 +38,7 @@
         Test t = new Test();
         Field field = Test.class.getField("i");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(-1, unsafe.getInt(t, offset));
         unsafe.putInt(t, offset, 0);
         assertEquals(0, unsafe.getInt(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutLong.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutLong.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("l");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(-1L, unsafe.getLong(t, offset));
         unsafe.putLong(t, offset, 0L);
         assertEquals(0L, unsafe.getLong(t, offset));
--- a/hotspot/test/runtime/Unsafe/GetPutObject.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutObject.java	Wed Jul 05 20:20:43 2017 +0200
@@ -40,7 +40,7 @@
         Object o = new Object();
         Field field = Test.class.getField("o");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals(t.o, unsafe.getObject(t, offset));
 
         unsafe.putObject(t, offset, o);
--- a/hotspot/test/runtime/Unsafe/GetPutShort.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/runtime/Unsafe/GetPutShort.java	Wed Jul 05 20:20:43 2017 +0200
@@ -39,7 +39,7 @@
         Test t = new Test();
         Field field = Test.class.getField("s");
 
-        int offset = unsafe.fieldOffset(field);
+        long offset = unsafe.objectFieldOffset(field);
         assertEquals((short)-1, unsafe.getShort(t, offset));
         unsafe.putShort(t, offset, (short)0);
         assertEquals((short)0, unsafe.getShort(t, offset));
--- a/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -33,6 +33,7 @@
  * @test
  * @summary Test of diagnostic command help (tests all DCMD executors)
  * @library /testlibrary
+ * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+UsePerfData HelpTest
--- a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -33,6 +33,7 @@
  * @test
  * @summary Test of invalid diagnostic command (tests all DCMD executors)
  * @library /testlibrary
+ * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+UsePerfData InvalidCommandTest
--- a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -34,6 +34,7 @@
  * @test
  * @summary Test of diagnostic command VM.version (tests all DCMD executors)
  * @library /testlibrary
+ * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+UsePerfData VMVersionTest
--- a/jdk/.hgtags	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/.hgtags	Wed Jul 05 20:20:43 2017 +0200
@@ -293,3 +293,4 @@
 ebb2eb7f1aec78eb6d8cc4c96f018afa11093cde jdk9-b48
 541a8cef4e0d54c3e4b52a98c6af3c31e2096669 jdk9-b49
 f6b8edd397ee463be208fee27517c99101293267 jdk9-b50
+a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51
--- a/jdk/make/copy/Copy-java.base.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/copy/Copy-java.base.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -60,16 +60,28 @@
 endif
 
 ################################################################################
-# Copy msvcrXX.dll on windows
+# Copy the microsoft runtime libraries on windows
+ifeq ($(OPENJDK_TARGET_OS), windows)
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  MSVCR_TARGET := $(LIB_DST_DIR)/$(notdir $(MSVCR_DLL))
   # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
-  $(MSVCR_TARGET): $(MSVCR_DLL)
-	$(call install-file)
+  define copy-and-chmod
+	$(install-file)
 	$(CHMOD) a+rx $@
+  endef
 
-  TARGETS += $(MSVCR_TARGET)
+  # Use separate macro calls in case the source files are not in the same
+  # directory.
+  $(eval $(call SetupCopyFiles,COPY_MSVCR, \
+      DEST := $(LIB_DST_DIR), \
+      FILES := $(MSVCR_DLL), \
+      MACRO := copy-and-chmod))
+
+  $(eval $(call SetupCopyFiles,COPY_MSVCP, \
+      DEST := $(LIB_DST_DIR), \
+      FILES := $(MSVCP_DLL), \
+      MACRO := copy-and-chmod))
+
+  TARGETS += $(COPY_MSVCR) $(COPY_MSVCP)
 endif
 
 ################################################################################
--- a/jdk/make/data/charsetmapping/DoubleByte-X.java.template	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/data/charsetmapping/DoubleByte-X.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -32,7 +32,8 @@
 import java.nio.charset.CharsetEncoder;
 import java.util.Arrays;
 import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.ext.DoubleByte;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.*;
 
 public class $NAME_CLZ$ extends Charset
                         $IMPLEMENTS$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/charsets	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,1818 @@
+#
+# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+########################################################
+#
+# Standard charsets provided by StandardCharsets provider.
+#
+# Note that these "standard" charsets listed here are not
+# necessary to be the "Standard charsets" defined in the
+# specification of java.nio.charset.Charset. Instead these
+# are the charsets that this implementation believes should
+# be packaged into the charsets provider class "StandardCharsets"
+# which is initialized at startup time by java.nio.charset.Charset,
+# compared to the charsets packaged in "ExtendedCharsets" provider,
+# which is lazy initialized.
+########################################################
+
+charset US-ASCII US_ASCII
+    package sun.nio.cs
+    type    source
+    alias   iso-ir-6                    # IANA aliases
+    alias   ANSI_X3.4-1986
+    alias   ISO_646.irv:1991
+    alias   ASCII
+    alias   ISO646-US
+    alias   us
+    alias   IBM367
+    alias   cp367
+    alias   csASCII
+    alias   default
+                                        # Other aliases
+    alias   646                         # Solaris POSIX locale
+    alias   iso_646.irv:1983
+    alias   ANSI_X3.4-1968		# Linux POSIX locale (RedHat)
+    alias   ascii7
+
+charset UTF-8 UTF_8
+    package sun.nio.cs
+    type    source
+    alias   UTF8			# JDK historical
+    alias   unicode-1-1-utf-8
+
+charset CESU-8 CESU_8
+    package sun.nio.cs
+    type    source
+    alias   CESU8
+    alias   csCESU-8
+
+charset UTF-16 UTF_16
+    package sun.nio.cs
+    type    source
+    alias   UTF_16			# JDK historical
+    alias   utf16
+    alias   unicode
+    alias   UnicodeBig
+
+charset UTF-16BE UTF_16BE
+    package sun.nio.cs
+    type    source
+    alias   UTF_16BE
+    alias   ISO-10646-UCS-2
+    alias   X-UTF-16BE
+    alias   UnicodeBigUnmarked
+
+charset UTF-16LE UTF_16LE
+    package sun.nio.cs
+    type    source
+    alias   UTF_16LE
+    alias   X-UTF-16LE
+    alias   UnicodeLittleUnmarked
+
+charset x-UTF-16LE-BOM UTF_16LE_BOM
+    package sun.nio.cs
+    type    source
+    alias   UnicodeLittle
+
+charset UTF-32 UTF_32
+    package sun.nio.cs
+    type    source
+    alias   UTF_32
+    alias   UTF32
+
+charset UTF-32LE UTF_32LE
+    package sun.nio.cs
+    type    source
+    alias   UTF_32LE
+    alias   X-UTF-32LE
+
+charset UTF-32BE UTF_32BE
+    package sun.nio.cs
+    type    source
+    alias   UTF_32BE
+    alias   X-UTF-32BE
+
+charset X-UTF-32LE-BOM UTF_32LE_BOM
+    package sun.nio.cs
+    type    source
+    alias   UTF_32LE_BOM
+    alias   UTF-32LE-BOM
+
+charset X-UTF-32BE-BOM UTF_32BE_BOM
+    package sun.nio.cs
+    type    source
+    alias   UTF_32BE_BOM
+    alias   UTF-32BE-BOM
+
+charset ISO-8859-1 ISO_8859_1
+    package sun.nio.cs
+    type    source
+    alias   iso-ir-100                 # IANA aliases
+    alias   ISO_8859-1
+    alias   latin1
+    alias   l1
+    alias   IBM819
+    alias   cp819
+    alias   csISOLatin1
+    alias   819                        # Other aliases
+    alias   IBM-819
+    alias   ISO8859_1
+    alias   ISO_8859-1:1987
+    alias   ISO_8859_1
+    alias   8859_1
+    alias   ISO8859-1
+
+charset ISO-8859-2 ISO_8859_2
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_2
+    ascii   true
+    alias   iso8859_2			# JDK historical
+    alias   8859_2
+    alias   iso-ir-101
+    alias   ISO_8859-2
+    alias   ISO_8859-2:1987
+    alias   ISO8859-2
+    alias   latin2
+    alias   l2
+    alias   ibm912
+    alias   ibm-912
+    alias   cp912
+    alias   912
+    alias   csISOLatin2
+
+charset ISO-8859-4 ISO_8859_4
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_4
+    ascii   true
+    alias   iso8859_4			# JDK historical
+    alias   iso8859-4
+    alias   8859_4
+    alias   iso-ir-110
+    alias   ISO_8859-4
+    alias   ISO_8859-4:1988
+    alias   latin4
+    alias   l4
+    alias   ibm914
+    alias   ibm-914
+    alias   cp914
+    alias   914
+    alias   csISOLatin4
+
+charset ISO-8859-5 ISO_8859_5
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_5
+    ascii   true
+    alias   iso8859_5			# JDK historical
+    alias   8859_5
+    alias   iso-ir-144
+    alias   ISO_8859-5
+    alias   ISO_8859-5:1988
+    alias   ISO8859-5
+    alias   cyrillic
+    alias   ibm915
+    alias   ibm-915
+    alias   cp915
+    alias   915
+    alias   csISOLatinCyrillic
+
+charset ISO-8859-7 ISO_8859_7
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_7
+    ascii   true
+    alias   iso8859_7			# JDK historical
+    alias   8859_7
+    alias   iso-ir-126
+    alias   ISO_8859-7
+    alias   ISO_8859-7:1987
+    alias   ELOT_928
+    alias   ECMA-118
+    alias   greek
+    alias   greek8
+    alias   csISOLatinGreek
+    alias   sun_eu_greek		# Solaris 7/8 compatibility
+    alias   ibm813
+    alias   ibm-813
+    alias   813
+    alias   cp813
+    alias   iso8859-7			# Solaris 9 compatibility
+
+charset ISO-8859-9 ISO_8859_9
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_9
+    ascii   true
+    alias   iso8859_9			# JDK historical
+    alias   8859_9
+    alias   iso-ir-148
+    alias   ISO_8859-9
+    alias   ISO_8859-9:1989
+    alias   ISO8859-9
+    alias   latin5
+    alias   l5
+    alias   ibm920
+    alias   ibm-920
+    alias   920
+    alias   cp920
+    alias   csISOLatin5
+
+charset ISO-8859-13 ISO_8859_13
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_13
+    ascii   true
+    alias   iso8859_13			# JDK historical
+    alias   8859_13
+    alias   iso_8859-13
+    alias   ISO8859-13
+
+charset ISO-8859-15 ISO_8859_15
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_15
+    ascii   true
+    alias   ISO_8859-15                # IANA alias
+    alias   8859_15                    # Other aliases
+    alias   ISO-8859-15
+    alias   ISO8859_15
+    alias   ISO8859-15
+    alias   IBM923
+    alias   IBM-923
+    alias   cp923
+    alias   923
+    alias   LATIN0
+    alias   LATIN9
+    alias   L9
+    alias   csISOlatin0
+    alias   csISOlatin9
+    alias   ISO8859_15_FDIS
+
+charset KOI8-R KOI8_R
+    package sun.nio.cs
+    type    sbcs
+    hisname KOI8_R
+    ascii   true
+    alias   koi8_r			# JDK historical
+    alias   koi8
+    alias   cskoi8r
+
+charset KOI8-U KOI8_U
+    package sun.nio.cs
+    type    sbcs
+    hisname KOI8_U
+    ascii   true
+    alias   koi8_u
+
+charset windows-1250 MS1250
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1250
+    ascii   true
+    alias   cp1250			# JDK historical
+    alias   cp5346			# Euro IBM CCSID
+
+charset windows-1251 MS1251
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1251
+    ascii   true
+    alias   cp1251			# JDK historical
+    alias   cp5347			# Euro IBM CCSID
+    alias   ansi-1251			# Solaris compatibility
+
+charset windows-1252 MS1252
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1252
+    ascii   true
+    alias   cp1252			# JDK historical
+    alias   cp5348			# Euro IBM CCSID
+
+charset windows-1253 MS1253
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1253
+    ascii   true
+    alias   cp1253			# JDK historical
+    alias   cp5349			# Euro IBM CCSID
+
+charset windows-1254 MS1254
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1254
+    ascii   true
+    alias   cp1254			# JDK historical
+    alias   cp5350			# Euro IBM CCSID
+
+charset windows-1257 MS1257
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp1257
+    ascii   true
+    alias   cp1257			# JDK historical
+    alias   cp5353			# Euro IBM CCSID
+
+
+charset IBM437 IBM437
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp437
+    ascii   false
+    alias   cp437                      #JDK historical
+    alias   ibm437
+    alias   ibm-437
+    alias   437
+    alias   cspc8codepage437
+    alias   windows-437
+
+charset x-IBM737 IBM737
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp737
+    ascii   false
+    alias   cp737                      #JDK historical
+    alias   ibm737
+    alias   ibm-737
+    alias   737
+
+charset IBM775 IBM775
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp775
+    ascii   false
+    alias   cp775                      #JDK historical
+    alias   ibm775
+    alias   ibm-775
+    alias   775
+
+charset IBM850 IBM850
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp850
+    ascii   false
+    alias   cp850                      #JDK historical
+    alias   ibm-850
+    alias   ibm850
+    alias   850
+    alias   cspc850multilingual
+
+charset IBM852 IBM852
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp852
+    ascii   false
+    alias   cp852                      #JDK historical
+    alias   ibm852
+    alias   ibm-852
+    alias   852
+    alias   csPCp852
+
+charset IBM855 IBM855
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp855
+    ascii   false
+    alias   cp855                      #JDK historical
+    alias   ibm-855
+    alias   ibm855
+    alias   855
+    alias   cspcp855
+
+charset IBM857 IBM857
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp857
+    ascii   false
+    alias   cp857                      #JDK historical
+    alias   ibm857
+    alias   ibm-857
+    alias   857
+    alias   csIBM857
+
+charset IBM00858 IBM858
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp858
+    ascii   false
+    alias   cp858                      #JDK historical
+    alias   ccsid00858
+    alias   cp00858
+    alias   858
+    alias   PC-Multilingual-850+euro
+
+charset IBM862 IBM862
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp862
+    ascii   false
+    alias   cp862                      #JDK historical
+    alias   ibm862
+    alias   ibm-862
+    alias   862
+    alias   csIBM862
+    alias   cspc862latinhebrew
+
+charset IBM866 IBM866
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp866
+    ascii   false
+    alias   cp866                      #JDK historical
+    alias   ibm866
+    alias   ibm-866
+    alias   866
+    alias   csIBM866
+
+charset x-IBM874 IBM874
+    package sun.nio.cs
+    type    sbcs
+    hisname Cp874
+    ascii   false
+    alias   cp874                      #JDK historical
+    alias   ibm874
+    alias   ibm-874
+    alias   874
+
+########################################################
+#
+# charsets provided by ExtendedCharsets provider.
+#
+########################################################
+charset Big5 Big5
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Big5
+    ascii   true
+    minmax  0xa1 0xf9 0x40 0xfe
+    alias   csBig5               # IANA aliases
+
+charset x-MS950-HKSCS-XP MS950_HKSCS_XP
+    package sun.nio.cs.ext
+    type    template
+    alias   MS950_HKSCS_XP       # JDK historical;
+
+charset x-MS950-HKSCS MS950_HKSCS
+    package sun.nio.cs.ext
+    type    source
+    hisname MS950_HKSCS
+    ascii   true
+    alias   MS950_HKSCS          # JDK historical;
+
+charset x-windows-950 MS950
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname MS950
+    ascii   true
+    minmax  0x81 0xfe 0x40 0xfe
+    alias   ms950                # JDK historical
+    alias   windows-950
+
+charset x-windows-874 MS874
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MS874
+    ascii   true
+    alias   ms874                # JDK historical
+    alias   ms-874
+    alias   windows-874
+
+charset x-EUC-TW EUC_TW
+    package sun.nio.cs.ext
+    type    source
+    alias   euc_tw               # JDK historical
+    alias   euctw
+    alias   cns11643
+    alias   EUC-TW
+
+charset Big5-HKSCS Big5_HKSCS
+    package sun.nio.cs.ext
+    type    template
+    hisname Big5_HKSCS
+    ascii   true
+    alias   Big5_HKSCS           # JDK historical
+    alias   big5hk
+    alias   big5-hkscs
+    alias   big5hkscs            # Linux alias
+
+charset x-Big5-HKSCS-2001 Big5_HKSCS_2001
+    package sun.nio.cs.ext
+    type    source
+    alias   Big5_HKSCS_2001
+    alias   big5hk-2001
+    alias   big5-hkscs-2001
+    alias   big5-hkscs:unicode3.0
+    alias   big5hkscs-2001
+
+charset x-Big5-Solaris Big5_Solaris
+    package sun.nio.cs.ext
+    type    template
+    hisname Big5_Solaris
+    ascii   true
+    alias   Big5_Solaris         # JDK historical
+
+
+charset GBK GBK                  # Simplified Chinese
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname GBK
+    ascii   true
+    minmax  0x81 0xfe 0x40 0xfe
+    alias   windows-936
+    alias   CP936
+
+charset GB18030 GB18030
+    package sun.nio.cs.ext
+    type    source
+    alias   gb18030-2000
+
+charset GB2312 EUC_CN
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname EUC_CN
+    ascii   true
+    minmax  0xa1 0xf7 0xa1 0xfe
+                                 # IANA aliases
+    alias   gb2312
+    alias   gb2312-80
+    alias   gb2312-1980
+    alias   euc-cn
+    alias   euccn
+    alias   x-EUC-CN             # 1.4 compatibility
+    alias   EUC_CN               # JDK historical
+
+charset x-mswin-936 MS936
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname MS936
+    ascii   true
+    minmax  0x81 0xfe 0x40 0xfe
+    alias   ms936                # JDK historical
+    alias   ms_936 // IANA aliases
+
+# The definition of this charset may be overridden by the init method,
+# below, if the sun.nio.cs.map property is defined.
+# 
+charset Shift_JIS SJIS
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname SJIS
+    ascii   true
+    minmax  0x81 0xfc 0x40 0xfc
+                                 # IANA aliases
+    alias   sjis                 # historical
+    alias   shift_jis
+    alias   shift-jis
+    alias   ms_kanji
+    alias   x-sjis
+    alias   csShiftJIS
+
+# The definition of this charset may be overridden by the init method,
+# below, if the sun.nio.cs.map property is defined.
+charset windows-31j MS932
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname MS932
+    ascii   true
+    minmax  0x81 0xfc 0x40 0xfc
+    alias   MS932                # JDK historical
+    alias   windows-932
+    alias   csWindows31J
+
+charset JIS_X0201 JIS_X_0201
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname JIS_X0201
+    ascii   true
+    alias   JIS0201              # JDK historical
+                                 # IANA aliases
+    alias   JIS_X0201
+    alias   X0201
+    alias   csHalfWidthKatakana
+
+charset x-JIS0208 JIS_X_0208
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS0208
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    alias   JIS0208              # JDK historical
+                                 # IANA aliases
+    alias   JIS_C6226-1983
+    alias   iso-ir-87
+    alias   x0208
+    alias   JIS_X0208-1983
+    alias   csISO87JISX0208
+
+charset JIS_X0212-1990 JIS_X_0212
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS0212
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    alias   JIS0212              # JDK historical
+                                 # IANA aliases
+    alias   jis_x0212-1990
+    alias   x0212
+    alias   iso-ir-159
+    alias   csISO159JISX02121990
+
+charset x-SJIS_0213 SJIS_0213
+    package sun.nio.cs.ext
+    type    source
+    alias   sjis-0213
+    alias   sjis_0213
+    alias   sjis:2004
+    alias   sjis_0213:2004
+    alias   shift_jis_0213:2004
+    alias   shift_jis:2004
+
+charset x-MS932_0213 MS932_0213
+    package sun.nio.cs.ext
+    type    source
+    alias   MS932-0213
+    alias   MS932_0213
+    alias   MS932:2004
+    alias   windows-932-0213
+    alias   windows-932:2004
+
+charset EUC-JP EUC_JP
+    package sun.nio.cs.ext
+    type    template
+    hisname EUC_JP
+    ascii   true
+    alias   euc_jp               # JDK historical
+    alias   eucjis               # IANA aliases
+    alias   eucjp
+    alias   Extended_UNIX_Code_Packed_Format_for_Japanese
+    alias   csEUCPkdFmtjapanese
+    alias   x-euc-jp
+    alias   x-eucjp
+
+charset x-euc-jp-linux EUC_JP_LINUX
+    package sun.nio.cs.ext
+    type    template
+    hisname EUC_JP_LINUX
+    ascii   true
+    alias   euc_jp_linux         # JDK historical
+    alias   euc-jp-linux
+
+charset x-eucjp-open EUC_JP_Open
+    package sun.nio.cs.ext
+    type    template
+    hisname EUC_JP_Solari
+    ascii   true
+    alias   EUC_JP_Solaris       # JDK historical
+    alias   eucJP-open
+
+charset x-PCK PCK
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname PCK
+    ascii   true
+    minmax  0x81 0xfc 0x40 0xfc
+                                 # IANA aliases
+    alias   pck                  # JDK historical
+
+charset ISO-2022-JP ISO2022_JP
+    package sun.nio.cs.ext
+    type    source
+                                 # IANA aliases
+    alias     iso2022jp          # JDK historical
+    alias     jis
+    alias     csISO2022JP
+    alias     jis_encoding
+    alias     csjisencoding
+
+charset ISO-2022-JP-2 ISO2022_JP_2
+    package sun.nio.cs.ext
+    type    source
+                                 # IANA aliases
+    alias     csISO2022JP2
+    alias     iso2022jp2
+
+charset x-windows-50221 MS50221
+    package sun.nio.cs.ext
+    type    source
+    alias     ms50221            # JDK historical
+    alias     cp50221
+
+charset x-windows-50220 MS50220
+    package sun.nio.cs.ext
+    type    source
+    alias     ms50220            # JDK historical
+    alias     cp50220
+
+charset x-windows-iso2022jp MSISO2022JP
+    package sun.nio.cs.ext
+    type    source
+     alias         windows-iso2022jp  # JDK historical
+
+charset x-JISAutoDetect JISAutoDetect
+    package sun.nio.cs.ext
+    type    source
+    alias   JISAutoDetect        # JDK historical
+
+
+charset EUC-KR EUC_KR            # Korean
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname EUC_KR
+    ascii   true
+    minmax  0xa1 0xfd 0xa1 0xfe
+    alias   euc_kr               # JDK historical
+                                 # IANA aliases
+    alias   ksc5601
+    alias   euckr
+    alias   ks_c_5601-1987
+    alias   ksc5601-1987
+    alias   ksc5601_1987
+    alias   ksc_5601
+    alias   csEUCKR
+    alias   5601
+
+charset x-windows-949 MS949
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname MS949
+    ascii   true
+    minmax  0x81 0xfe 0x41 0xfe
+    alias   ms949                # JDK historical
+    alias   windows949
+    alias   windows-949
+    alias   ms_949               # IANA aliases
+
+charset x-Johab Johab
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname x-Johab
+    ascii   true
+    minmax  0x84 0xf9 0x31 0xfe
+    alias   ksc5601-1992
+    alias   ksc5601_1992
+    alias   ms1361
+    alias   johab                # JDK historical
+
+charset ISO-2022-KR ISO2022_KR
+    package sun.nio.cs.ext
+    type    source
+    alias   ISO2022KR            # JDK historical
+    alias   csISO2022KR
+
+charset ISO-2022-CN ISO2022_CN
+    package sun.nio.cs.ext
+    type    source
+    alias   ISO2022CN            # JDK historical
+    alias   csISO2022CN
+
+charset x-ISO-2022-CN-CNS ISO2022_CN_CNS
+    package sun.nio.cs.ext
+    type    source
+    alias   ISO2022CN_CNS        # JDK historical
+    alias   ISO-2022-CN-CNS
+
+charset x-ISO-2022-CN-GB ISO2022_CN_GB
+    package sun.nio.cs.ext
+    type    source
+    alias   ISO2022CN_GB         # JDK historical
+    alias   ISO-2022-CN-GB
+
+charset x-ISCII91 ISCII91
+    package sun.nio.cs.ext
+    type    source
+    alias   iscii
+    alias   ST_SEV_358-88
+    alias   iso-ir-153
+    alias   csISO153GOST1976874
+    alias   ISCII91              # JDK historical
+
+charset ISO-8859-3 ISO_8859_3
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname ISO8859_3
+    ascii   true
+    alias   iso8859_3            # JDK historical
+    alias   8859_3
+    alias   ISO_8859-3:1988
+    alias   iso-ir-109
+    alias   ISO_8859-3
+    alias   ISO8859-3
+    alias   latin3
+    alias   l3
+    alias   ibm913
+    alias   ibm-913
+    alias   cp913
+    alias   913
+    alias   csISOLatin3
+
+charset ISO-8859-6 ISO_8859_6
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname ISO8859_6
+    ascii   true
+    alias   iso8859_6            # JDK historical
+    alias   8859_6
+    alias   iso-ir-127
+    alias   ISO_8859-6
+    alias   ISO_8859-6:1987
+    alias   ISO8859-6
+    alias   ECMA-114
+    alias   ASMO-708
+    alias   arabic
+    alias   ibm1089
+    alias   ibm-1089
+    alias   cp1089
+    alias   1089
+    alias   csISOLatinArabic
+
+charset ISO-8859-8 ISO_8859_8
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname ISO8859_8
+    ascii   true
+    alias   iso8859_8            # JDK historical
+    alias   8859_8
+    alias   iso-ir-138
+    alias   ISO_8859-8
+    alias   ISO_8859-8:1988
+    alias   ISO8859-8
+    alias   cp916
+    alias   916
+    alias   ibm916
+    alias   ibm-916
+    alias   hebrew
+    alias   csISOLatinHebrew
+
+charset x-iso-8859-11 ISO_8859_11
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname x-iso-8859-11
+    ascii   true
+    alias   iso-8859-11
+    alias   iso8859_11
+
+charset TIS-620 TIS_620
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname TIS620
+    ascii   true
+    alias   tis620               # JDK historical
+    alias   tis620.2533
+
+# Microsoft Windows codepages
+
+charset windows-1255 MS1255
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1255
+    ascii   true
+    alias   cp1255               # JDK historical
+
+charset windows-1256 MS1256
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1256
+    ascii   true
+    alias   cp1256               # JDK historical
+
+charset windows-1258 MS1258
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1258
+    ascii   true
+    alias   cp1258               # JDK historical
+
+charset x-IBM942 IBM942          # IBM & PC/MSDOS encodings
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp942
+    ascii   false
+    minmax  0x81 0xfc 0x40 0xfc
+    alias   cp942                # JDK historical
+    alias   ibm942
+    alias   ibm-942
+    alias   942
+
+charset x-IBM942C IBM942C
+    package sun.nio.cs.ext
+    type    source
+    alias   cp942C               # JDK historical
+    alias   ibm942C
+    alias   ibm-942C
+    alias   942C
+
+charset x-IBM943 IBM943
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp943
+    ascii   false
+    minmax  0x81 0xfc 0x40 0xfc
+    alias   cp943                # JDK historical
+    alias   ibm943
+    alias   ibm-943
+    alias   943
+
+charset x-IBM943C IBM943C
+    package sun.nio.cs.ext
+    type    source
+    alias   cp943C               # JDK historical
+    alias   ibm943C
+    alias   ibm-943C
+    alias   943C
+
+charset x-IBM948 IBM948
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp948
+    ascii   true
+    minmax  0x81 0xfe 0x40 0xfc
+    alias   cp948                # JDK historical
+    alias   ibm948
+    alias   ibm-948
+    alias   948
+
+charset x-IBM950 IBM950
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp950
+    ascii   true
+    minmax  0x81 0xfe 0x40 0xfe
+    alias   cp950                # JDK historical
+    alias   ibm950
+    alias   ibm-950
+    alias   950
+
+charset x-IBM930 IBM930
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp930
+    ascii   false
+    minmax  0x40 0x7f 0x40 0xfe
+    alias   cp930                # JDK historical
+    alias   ibm930
+    alias   ibm-930
+    alias   930
+
+charset x-IBM935 IBM935
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp935
+    ascii   false
+    minmax  0x40 0x7f 0x40 0xfe
+    alias   cp935                # JDK historical
+    alias   ibm935
+    alias   ibm-935
+    alias   935
+
+charset x-IBM937 IBM937
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp937
+    ascii   false
+    minmax  0x40 0xe2 0x40 0xfe
+    alias   cp937                # JDK historical
+    alias   ibm937
+    alias   ibm-937
+    alias   937
+
+charset x-IBM856 IBM856
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp856
+    ascii   false
+    alias   cp856                # JDK historical
+    alias   ibm-856
+    alias   ibm856
+    alias   856
+
+charset IBM860 IBM860
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp860
+    ascii   false
+    alias   cp860                # JDK historical
+    alias   ibm860
+    alias   ibm-860
+    alias   860
+    alias   csIBM860
+
+charset IBM861 IBM861
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp861
+    ascii   false
+    alias   cp861                # JDK historical
+    alias   ibm861
+    alias   ibm-861
+    alias   861
+    alias   csIBM861
+    alias   cp-is
+
+charset IBM863 IBM863
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp863
+    ascii   false
+    alias   cp863                # JDK historical
+    alias   ibm863
+    alias   ibm-863
+    alias   863
+    alias   csIBM863
+
+charset IBM864 IBM864
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp864
+    ascii   false
+    alias   cp864                # JDK historical
+    alias   ibm864
+    alias   ibm-864
+    alias   864
+    alias   csIBM864
+
+
+charset IBM865 IBM865
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp865
+    ascii   false
+    alias   cp865                # JDK historical
+    alias   ibm865
+    alias   ibm-865
+    alias   865
+    alias   csIBM865
+
+charset IBM868 IBM868
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp868
+    ascii   false
+    alias   cp868                # JDK historical
+    alias   ibm868
+    alias   ibm-868
+    alias   868
+    alias   cp-ar
+    alias   csIBM868
+
+charset IBM869 IBM869
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp869
+    ascii   false
+    alias   cp869                # JDK historical
+    alias   ibm869
+    alias   ibm-869
+    alias   869
+    alias   cp-gr
+    alias   csIBM869
+
+charset x-IBM921 IBM921
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp921
+    ascii   false
+    alias   cp921                # JDK historical
+    alias   ibm921
+    alias   ibm-921
+    alias   921
+
+charset x-IBM1006 IBM1006
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1006
+    ascii   false
+    alias   cp1006               # JDK historical
+    alias   ibm1006
+    alias   ibm-1006
+    alias   1006
+
+charset x-IBM1046 IBM1046
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1046
+    ascii   false
+    alias   cp1046               # JDK historical
+    alias   ibm1046
+    alias   ibm-1046
+    alias   1046
+
+charset IBM1047 IBM1047
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1047
+    ascii   false
+    alias   cp1047               # JDK historical
+    alias   ibm-1047
+    alias   1047
+
+charset x-IBM1098 IBM1098
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1098
+    ascii   false
+    alias   cp1098               # JDK historical
+    alias   ibm1098
+    alias   ibm-1098
+    alias   1098
+
+charset IBM037 IBM037
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp037
+    ascii   false
+    alias   cp037                # JDK historical
+    alias   ibm037
+    alias   ebcdic-cp-us
+    alias   ebcdic-cp-ca
+    alias   ebcdic-cp-wt
+    alias   ebcdic-cp-nl
+    alias   csIBM037
+    alias   cs-ebcdic-cp-us
+    alias   cs-ebcdic-cp-ca
+    alias   cs-ebcdic-cp-wt
+    alias   cs-ebcdic-cp-nl
+    alias   ibm-037
+    alias   ibm-37
+    alias   cpibm37
+    alias   037
+
+charset x-IBM1025 IBM1025
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1025
+    ascii   false
+    alias   cp1025               # JDK historical
+    alias   ibm1025
+    alias   ibm-1025
+    alias   1025
+
+charset IBM1026 IBM1026
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1026
+    ascii   false
+    alias   cp1026               # JDK historical
+    alias   ibm1026
+    alias   ibm-1026
+    alias   1026
+
+charset x-IBM1112 IBM1112
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1112
+    ascii   false
+    alias   cp1112               # JDK historical
+    alias   ibm1112
+    alias   ibm-1112
+    alias   1112
+
+charset x-IBM1122 IBM1122
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1122
+    ascii   false
+    alias   cp1122               # JDK historical
+    alias   ibm1122
+    alias   ibm-1122
+    alias   1122
+
+charset x-IBM1123 IBM1123
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1123
+    ascii   false
+    alias   cp1123               # JDK historical
+    alias   ibm1123
+    alias   ibm-1123
+    alias   1123
+
+charset x-IBM1124 IBM1124
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1124
+    ascii   false
+    alias   cp1124               # JDK historical
+    alias   ibm1124
+    alias   ibm-1124
+    alias   1124
+
+charset x-IBM1364 IBM1364
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp1364
+    ascii   false
+    minmax  0x40 0xde 0x40 0xfe
+    alias   cp1364
+    alias   ibm1364
+    alias   ibm-1364
+    alias   1364
+
+charset IBM273 IBM273
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp273
+    ascii   false
+    alias   cp273               # JDK historical
+    alias   ibm273
+    alias   ibm-273
+    alias   273
+
+charset IBM277 IBM277
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp277
+    ascii   false
+    alias   cp277               # JDK historical
+    alias   ibm277
+    alias   ibm-277
+    alias   277
+
+charset IBM278 IBM278
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp278
+    ascii   false
+    alias   cp278               # JDK historical
+    alias   ibm278
+    alias   ibm-278
+    alias   278
+    alias   ebcdic-sv
+    alias   ebcdic-cp-se
+    alias   csIBM278
+
+charset IBM280 IBM280
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp280
+    ascii   false
+    alias   cp280               # JDK historical
+    alias   ibm280
+    alias   ibm-280
+    alias   280
+
+charset IBM284 IBM284
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp284
+    ascii   false
+    alias   cp284               # JDK historical
+    alias   ibm284
+    alias   ibm-284
+    alias   284
+    alias   csIBM284
+    alias   cpibm284
+
+charset IBM285 IBM285
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp285
+    ascii   false
+    alias   cp285               # JDK historical
+    alias   ibm285
+    alias   ibm-285
+    alias   285
+    alias   ebcdic-cp-gb
+    alias   ebcdic-gb
+    alias   csIBM285
+    alias   cpibm285
+
+charset IBM297 IBM297
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp297
+    ascii   false
+    alias   cp297               # JDK historical
+    alias   ibm297
+    alias   ibm-297
+    alias   297
+    alias   ebcdic-cp-fr
+    alias   cpibm297
+    alias   csIBM297
+
+charset IBM420 IBM420
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp420
+    ascii   false
+    alias   cp420               # JDK historical
+    alias   ibm420
+    alias   ibm-420
+    alias   ebcdic-cp-ar1
+    alias   420
+    alias   csIBM420
+
+charset IBM424 IBM424
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp424
+    ascii   false
+    alias   cp424               # JDK historical
+    alias   ibm424
+    alias   ibm-424
+    alias   424
+    alias   ebcdic-cp-he
+    alias   csIBM424
+
+charset IBM500 IBM500
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp500
+    ascii   false
+    alias   cp500               # JDK historical
+    alias   ibm500
+    alias   ibm-500
+    alias   500
+    alias   ebcdic-cp-ch
+    alias   ebcdic-cp-bh
+    alias   csIBM500
+
+charset x-IBM833 IBM833
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp833
+    ascii   false
+     alias   cp833
+     alias   ibm833
+     alias   ibm-833
+
+
+charset x-IBM834 IBM834 # EBCDIC DBCS-only Korean
+    package sun.nio.cs.ext
+    type    source
+    alias   cp834
+    alias   ibm834
+    alias   834
+    alias   ibm-834
+
+charset IBM-Thai IBM838
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp838
+    ascii   false
+    alias   cp838               # JDK historical
+    alias   ibm838
+    alias   ibm-838
+    alias   838
+
+charset IBM870 IBM870
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp870
+    ascii   false
+    alias   cp870               # JDK historical
+    alias   ibm870
+    alias   ibm-870
+    alias   870
+    alias   ebcdic-cp-roece
+    alias   ebcdic-cp-yu
+    alias   csIBM870
+
+charset IBM871 IBM871
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp871
+    ascii   false
+    alias   cp871               # JDK historical
+    alias   ibm871
+    alias   ibm-871
+    alias   871
+    alias   ebcdic-cp-is
+    alias   csIBM871
+
+charset x-IBM875 IBM875
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp875
+    ascii   false
+    alias   cp875               # JDK historical
+    alias   ibm875
+    alias   ibm-875
+    alias   875
+
+charset IBM918 IBM918
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp918
+    ascii   false
+    alias   cp918               # JDK historical
+    alias   ibm-918
+    alias   918
+    alias   ebcdic-cp-ar2
+
+charset x-IBM922 IBM922
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp922
+    ascii   false
+    alias   cp922               # JDK historical
+    alias   ibm922
+    alias   ibm-922
+    alias   922
+
+charset x-IBM1097 IBM1097
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1097
+    ascii   false
+    alias   cp1097              # JDK historical
+    alias   ibm1097
+    alias   ibm-1097
+    alias   1097
+
+charset x-IBM949 IBM949
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp949
+    ascii   false
+    minmax  0x8f 0xfe 0xa1 0xfe
+    alias   cp949               # JDK historical
+    alias   ibm949
+    alias   ibm-949
+    alias   949
+
+charset x-IBM949C IBM949C
+    package sun.nio.cs.ext
+    type    source
+    alias   cp949C              # JDK historical
+    alias   ibm949C
+    alias   ibm-949C
+    alias   949C
+
+charset x-IBM939 IBM939
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp939
+    ascii   false
+    minmax  0x40 0x7f 0x40 0xfe
+    alias   cp939               # JDK historical
+    alias   ibm939
+    alias   ibm-939
+    alias   939
+
+charset x-IBM933 IBM933
+    package sun.nio.cs.ext
+    type    ebcdic
+    hisname Cp933
+    ascii   false
+    minmax  0x40 0xdd 0x40 0xfe
+    alias   cp933               # JDK historical
+    alias   ibm933
+    alias   ibm-933
+    alias   933
+
+charset x-IBM1381 IBM1381
+    package sun.nio.cs.ext
+    type    dbcs
+    hisname Cp1381
+    ascii   true
+    minmax  0x8c 0xf7 0xa1 0xfe
+    alias   cp1381              # JDK historical
+    alias   ibm1381
+    alias   ibm-1381
+    alias   1381
+
+charset x-IBM1383 IBM1383
+    package sun.nio.cs.ext
+    type    euc_sim
+    hisname Cp1383
+    ascii   true
+    minmax  0xa1 0xfe 0xa1 0xfe
+    alias   cp1383              # JDK historical
+    alias   ibm1383
+    alias   ibm-1383
+    alias   1383
+
+charset x-IBM970 IBM970
+    package sun.nio.cs.ext
+    type    euc_sim
+    hisname Cp970
+    ascii   true
+    minmax  0xa1 0xfe 0xa1 0xfe
+    alias   cp970               # JDK historical
+    alias   ibm970
+    alias   ibm-970
+    alias   ibm-eucKR
+    alias   970
+
+charset x-IBM964 IBM964
+    package sun.nio.cs.ext
+    type    source
+    alias   cp964               # JDK historical
+    alias   ibm964
+    alias   ibm-964
+    alias   964
+
+charset x-IBM33722 IBM33722
+    package sun.nio.cs.ext
+    type    source
+    alias   cp33722             # JDK historical
+    alias   ibm33722
+    alias   ibm-33722
+    alias   ibm-5050            # from IBM alias list
+    alias   ibm-33722_vascii_vpua # from IBM alias list
+    alias   33722
+
+charset IBM01140 IBM1140
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1140
+    ascii   false
+    alias   cp1140              # JDK historical
+    alias   ccsid01140
+    alias   cp01140
+    alias   1140
+    alias   ebcdic-us-037+euro
+
+charset IBM01141 IBM1141
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1141
+    ascii   false
+    alias   cp1141              # JDK historical
+    alias   ccsid01141
+    alias   cp01141
+    alias   1141
+    alias   ebcdic-de-273+euro
+
+charset IBM01142 IBM1142
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1142
+    ascii   false
+    alias   cp1142              # JDK historical
+    alias   ccsid01142
+    alias   cp01142
+    alias   1142
+    alias   ebcdic-no-277+euro
+    alias   ebcdic-dk-277+euro
+
+charset IBM01143 IBM1143
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1143
+    ascii   false
+    alias   cp1143              # JDK historical
+    alias   ccsid01143
+    alias   cp01143
+    alias   1143
+    alias   ebcdic-fi-278+euro
+    alias   ebcdic-se-278+euro
+
+charset IBM01144 IBM1144
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1144
+    ascii   false
+    alias   cp1144              # JDK historical
+    alias   ccsid01144
+    alias   cp01144
+    alias   1144
+    alias   ebcdic-it-280+euro
+
+charset IBM01145 IBM1145
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1145
+    ascii   false
+    alias   cp1145              # JDK historical
+    alias   ccsid01145
+    alias   cp01145
+    alias   1145
+    alias   ebcdic-es-284+euro
+
+charset IBM01146 IBM1146
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1146
+    ascii   false
+    alias   cp1146              # JDK historical
+    alias   ccsid01146
+    alias   cp01146
+    alias   1146
+    alias   ebcdic-gb-285+euro
+
+charset IBM01147 IBM1147
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1147
+    ascii   false
+    alias   cp1147              # JDK historical
+    alias   ccsid01147
+    alias   cp01147
+    alias   1147
+    alias   ebcdic-fr-277+euro
+
+charset IBM01148 IBM1148
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1148
+    ascii   false
+    alias   cp1148              # JDK historical
+    alias   ccsid01148
+    alias   cp01148
+    alias   1148
+    alias   ebcdic-international-500+euro
+
+charset IBM01149 IBM1149
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp1149
+    ascii   false
+    alias   cp1149              # JDK historical
+    alias   ccsid01149
+    alias   cp01149
+    alias   1149
+    alias   ebcdic-s-871+euro
+
+charset IBM290 IBM290
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname Cp290
+    ascii   false
+    alias   cp290
+    alias   ibm290
+    alias   ibm-290
+    alias   csIBM290
+    alias   EBCDIC-JP-kana
+    alias   290
+
+charset x-IBM300 IBM300
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname Cp300
+    ascii   false
+    minmax  0x40 0x7f 0x40 0xfe
+    alias   cp300
+    alias   ibm300
+    alias   ibm-300
+    alias   300
+
+# Macintosh MacOS/Apple char encodingd
+
+charset x-MacRoman MacRoman
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacRoman
+    ascii   false
+    alias   MacRoman            # JDK historical
+
+charset x-MacCentralEurope MacCentralEurope
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacCentralEurope
+    ascii   false
+    alias   MacCentralEurope    # JDK historical
+
+charset x-MacCroatian MacCroatian
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacCroatian
+    ascii   false
+    alias   MacCroatian         # JDK historical
+
+charset x-MacGreek MacGreek
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacGreek
+    ascii   false
+    alias   MacGreek         # JDK historical
+
+charset x-MacCyrillic MacCyrillic
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacCyrillic
+    ascii   false
+    alias   MacCyrillic         # JDK historical
+
+charset x-MacUkraine MacUkraine
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacUkraine
+    ascii   false
+    alias   MacUkraine          # JDK historical
+
+charset x-MacTurkish MacTurkish
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacTurkish
+    ascii   false
+    alias   MacTurkish          # JDK historical
+
+charset x-MacArabic MacArabic
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacArabic
+    ascii   false
+    alias   MacArabic           # JDK historical
+
+charset x-MacHebrew MacHebrew
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacHebrew
+    ascii   false
+    alias   MacHebrew           # JDK historical
+
+charset x-MacIceland MacIceland
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacIceland
+    ascii   false
+    alias   MacIceland          # JDK historical
+
+charset x-MacRomania MacRomania
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacRomania
+    ascii   false
+    alias   MacRomania          # JDK historical
+
+charset x-MacThai MacThai
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacThai
+    ascii   false
+    alias   MacThai             # JDK historical
+
+charset x-MacSymbol MacSymbol
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacSymbol
+    ascii   false
+    alias   MacSymbol           # JDK historical
+
+charset x-MacDingbat MacDingbat
+    package sun.nio.cs.ext
+    type    sbcs
+    hisname MacDingbat
+    ascii   false
+    alias   MacDingbat          # JDK historical
+
+########################################################
+#
+# internal use, not to be registered into spi
+#
+########################################################
+
+charset x-JIS0208_Solaris JIS_X_0208_Solaris
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS0208
+    ascii   false
+    minmax  0x21 0x9e 0x21 0x7e
+    internal true
+
+charset x-JIS0208_MS5022X JIS_X_0208_MS5022X
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS_X_0208_MS5022X
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    internal true
+
+charset x-JIS0208_MS932 JIS_X_0208_MS932
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS_X_0208_MS932
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    internal true               # "internal implementation
+
+charset x-JIS0212_Solaris JIS_X_0212_Solaris
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS_X_0212_Solaris
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    internal true               # "internal implementation
+
+charset x-JIS0212_MS5022X JIS_X_0212_MS5022X
+    package sun.nio.cs.ext
+    type    dbcsonly
+    hisname JIS_X_0212_MS5022X
+    ascii   false
+    minmax  0x21 0x7e 0x21 0x7e
+    internal true               # "internal implementation
--- a/jdk/make/data/charsetmapping/dbcs	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#
-#clzName  csName     hisName  dbtype    pkg               ascii   b1min  b1max  b2min b2max
-#
-Big5      Big5       Big5     basic     sun.nio.cs.ext    true    0xa1   0xf9   0x40  0xfe
-Johab     x-Johab    x-Johab  basic     sun.nio.cs.ext    true    0x84   0xf9   0x31  0xfe
-EUC_CN	  GB2312     EUC_CN   basic     sun.nio.cs.ext    true    0xa1   0xf7   0xa1  0xfe
-EUC_KR	  EUC-KR     EUC_KR   basic     sun.nio.cs.ext    true    0xa1   0xfd   0xa1  0xfe
-MS932	  windows-31j MS932   basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
-MS936	  x-mswin-936 MS936   basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
-MS949	  x-windows-949 MS949 basic     sun.nio.cs.ext    true    0x81   0xfe   0x41  0xfe
-MS950	  x-windows-950 MS950 basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
-GBK	  GBK        GBK      basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
-SJIS	  Shift_JIS  SJIS     basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
-PCK	  x-PCK      PCK      basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
-IBM1364	  x-IBM1364  Cp1364   ebcdic	sun.nio.cs.ext	  false   0x40   0xde   0x40  0xfe
-IBM1381	  x-IBM1381  Cp1381   basic     sun.nio.cs.ext    true    0x8c   0xf7   0xa1  0xfe
-IBM1383	  x-IBM1383  Cp1383   euc_sim   sun.nio.cs.ext    true    0xa1   0xfe   0xa1  0xfe
-IBM300	  x-IBM300   Cp300    dbcsonly  sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
-IBM930	  x-IBM930   Cp930    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
-IBM933	  x-IBM933   Cp933    ebcdic    sun.nio.cs.ext    false   0x40   0xdd   0x40  0xfe
-IBM935	  x-IBM935   Cp935    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
-IBM937	  x-IBM937   Cp937    ebcdic    sun.nio.cs.ext    false   0x40   0xe2   0x40  0xfe
-IBM939	  x-IBM939   Cp939    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
-IBM942	  x-IBM942   Cp942    basic     sun.nio.cs.ext    false   0x81   0xfc   0x40  0xfc
-IBM943	  x-IBM943   Cp943    basic     sun.nio.cs.ext    false   0x81   0xfc   0x40  0xfc
-IBM948	  x-IBM948   Cp948    basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfc
-IBM949	  x-IBM949   Cp949    basic     sun.nio.cs.ext    false   0x8f   0xfe   0xa1  0xfe
-IBM950	  x-IBM950   Cp950    basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
-IBM970	  x-IBM970   Cp970    euc_sim   sun.nio.cs.ext    true    0xa1   0xfe   0xa1  0xfe
-JIS_X_0208          x-JIS0208          JIS0208          dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
-JIS_X_0212          JIS_X0212-1990     JIS0212          dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
-JIS_X_0208_Solaris  x-JIS0208_Solaris  JIS0208_Solaris  dbcsonly  sun.nio.cs.ext  false  0x21  0x9e  0x21  0x7e
-JIS_X_0208_MS5022X  x-JIS0208_MS5022X  JIS0208_MS5022X  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
-JIS_X_0208_MS932    x-JIS0208_MS932    JIS0208_MS932    dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
-JIS_X_0212_Solaris  x-JIS0212_Solaris  JIS0212_Solaris  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
-JIS_X_0212_MS5022X  x-JIS0212_MS5022X  JIS0212_MS5022X  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
--- a/jdk/make/data/charsetmapping/extsbcs	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-# clzName	csName		hisName		containASCII	pkg
-IBM037		IBM037		Cp037		false		sun.nio.cs.ext
-IBM1006		x-IBM1006	Cp1006		false		sun.nio.cs.ext
-IBM1025		x-IBM1025	Cp1025		false		sun.nio.cs.ext
-IBM1026		IBM1026		Cp1026		false		sun.nio.cs.ext
-IBM1046		x-IBM1046	Cp1046		false		sun.nio.cs.ext
-IBM1047		IBM1047		Cp1047		false		sun.nio.cs.ext
-IBM1097		x-IBM1097	Cp1097		false		sun.nio.cs.ext
-IBM1098		x-IBM1098	Cp1098		false		sun.nio.cs.ext
-IBM1112		x-IBM1112	Cp1112		false		sun.nio.cs.ext
-IBM1122		x-IBM1122	Cp1122		false		sun.nio.cs.ext
-IBM1123		x-IBM1123	Cp1123		false		sun.nio.cs.ext
-IBM1124		x-IBM1124	Cp1124		false		sun.nio.cs.ext
-# map tables for 1140-1149 are updated manualy with the u+20ac entry          
-IBM1140		IBM01140	Cp1140		false		sun.nio.cs.ext
-IBM1141		IBM01141	Cp1141		false		sun.nio.cs.ext
-IBM1142		IBM01142	Cp1142		false		sun.nio.cs.ext
-IBM1143		IBM01143	Cp1143		false		sun.nio.cs.ext
-IBM1144		IBM01144	Cp1144		false		sun.nio.cs.ext
-IBM1145		IBM01145	Cp1145		false		sun.nio.cs.ext
-IBM1146		IBM01146	Cp1146		false		sun.nio.cs.ext
-IBM1147		IBM01147	Cp1147		false		sun.nio.cs.ext
-IBM1148		IBM01148	Cp1148		false		sun.nio.cs.ext
-IBM1149		IBM01149	Cp1149		false		sun.nio.cs.ext
-IBM273		IBM273		Cp273		false		sun.nio.cs.ext
-IBM277		IBM277		Cp277		false		sun.nio.cs.ext
-IBM278		IBM278		Cp278		false		sun.nio.cs.ext
-IBM280		IBM280		Cp280		false		sun.nio.cs.ext
-IBM284		IBM284		Cp284		false		sun.nio.cs.ext
-IBM285		IBM285		Cp285		false		sun.nio.cs.ext
-IBM290		IBM290		Cp290		false		sun.nio.cs.ext
-IBM297		IBM297		Cp297		false		sun.nio.cs.ext
-IBM420		IBM420		Cp420		false		sun.nio.cs.ext
-IBM424		IBM424		Cp424		false		sun.nio.cs.ext
-IBM500		IBM500		Cp500		false		sun.nio.cs.ext
-IBM833		x-IBM833	Cp833		false		sun.nio.cs.ext
-IBM838		IBM-Thai	Cp838		false		sun.nio.cs.ext
-IBM856		x-IBM856	Cp856		false		sun.nio.cs.ext
-IBM860		IBM860		Cp860		false		sun.nio.cs.ext
-IBM861		IBM861		Cp861		false		sun.nio.cs.ext
-IBM863		IBM863		Cp863		false		sun.nio.cs.ext
-IBM864		IBM864		Cp864		false		sun.nio.cs.ext
-IBM865		IBM865		Cp865		false		sun.nio.cs.ext
-IBM868		IBM868		Cp868		false		sun.nio.cs.ext
-IBM869		IBM869		Cp869		false		sun.nio.cs.ext
-IBM870		IBM870		Cp870		false		sun.nio.cs.ext
-IBM871		IBM871		Cp871		false		sun.nio.cs.ext
-IBM875		x-IBM875	Cp875		false		sun.nio.cs.ext
-IBM918		IBM918		Cp918		false		sun.nio.cs.ext
-IBM921		x-IBM921	Cp921		false		sun.nio.cs.ext
-IBM922		x-IBM922	Cp922		false		sun.nio.cs.ext
-# use name as hisname as well, cs did not support hisname prevously           
-ISO_8859_11	x-iso-8859-11	x-iso-8859-11	true		sun.nio.cs.ext
-ISO_8859_3	ISO-8859-3	ISO8859_3	true		sun.nio.cs.ext
-ISO_8859_6	ISO-8859-6	ISO8859_6	true		sun.nio.cs.ext
-ISO_8859_8	ISO-8859-8	ISO8859_8	true		sun.nio.cs.ext
-JIS_X_0201	JIS_X0201	JIS_X0201	true		sun.nio.cs.ext
-MS1255		windows-1255	Cp1255		true		sun.nio.cs.ext
-MS1256		windows-1256	Cp1256		true		sun.nio.cs.ext
-MS1258		windows-1258	Cp1258		true		sun.nio.cs.ext
-MS874		x-windows-874	MS874		true		sun.nio.cs.ext
-MacArabic	x-MacArabic	MacArabic	false		sun.nio.cs.ext
-MacCentralEurope	x-MacCentralEurope	MacCentralEurope	false	sun.nio.cs.ext
-MacCroatian	x-MacCroatian	MacCroatian	false		sun.nio.cs.ext
-MacCyrillic	x-MacCyrillic	MacCyrillic	false		sun.nio.cs.ext
-MacDingbat	x-MacDingbat	MacDingbat	false		sun.nio.cs.ext
-MacGreek	x-MacGreek	MacGreek	false		sun.nio.cs.ext
-MacHebrew	x-MacHebrew	MacHebrew	false		sun.nio.cs.ext
-MacIceland	x-MacIceland	MacIceland	false		sun.nio.cs.ext
-MacRoman	x-MacRoman	MacRoman	false		sun.nio.cs.ext
-MacRomania	x-MacRomania	MacRomania	false		sun.nio.cs.ext
-MacSymbol	x-MacSymbol	MacSymbol	false		sun.nio.cs.ext
-MacThai		x-MacThai	MacThai		false		sun.nio.cs.ext
-MacTurkish	x-MacTurkish	MacTurkish	false		sun.nio.cs.ext
-MacUkraine	x-MacUkraine	MacUkraine	false		sun.nio.cs.ext
-TIS_620		TIS-620		TIS620		true		sun.nio.cs.ext
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/list_old	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,149 @@
+#
+# This is the copy of the old configuration files sbcs, dbcs and extsbcs
+# used in jdk8.
+############################### sbcs #########################################
+#
+# clzName	csName		hisName		containASCII	pkg
+#
+IBM437		IBM437		Cp437		false		sun.nio.cs
+IBM737		x-IBM737	Cp737		false		sun.nio.cs	
+IBM775		IBM775		Cp775		false		sun.nio.cs
+IBM850		IBM850		Cp850		false		sun.nio.cs
+IBM852		IBM852		Cp852		false		sun.nio.cs
+IBM855		IBM855		Cp855		false		sun.nio.cs
+IBM857		IBM857		Cp857		false		sun.nio.cs	
+IBM858		IBM00858	Cp858		false		sun.nio.cs
+IBM862		IBM862		Cp862		false		sun.nio.cs
+IBM866		IBM866		Cp866		false		sun.nio.cs
+IBM874		x-IBM874	Cp874		false		sun.nio.cs
+ISO_8859_2	ISO-8859-2	ISO8859_2	true		sun.nio.cs
+ISO_8859_4	ISO-8859-4	ISO8859_4	true		sun.nio.cs
+ISO_8859_5	ISO-8859-5	ISO8859_5	true		sun.nio.cs
+ISO_8859_7	ISO-8859-7	ISO8859_7	true		sun.nio.cs
+ISO_8859_9	ISO-8859-9	ISO8859_9	true		sun.nio.cs
+ISO_8859_13	ISO-8859-13	ISO8859_13	true		sun.nio.cs
+ISO_8859_15	ISO-8859-15	ISO8859_15	true		sun.nio.cs
+KOI8_R		KOI8-R		KOI8_R		true		sun.nio.cs
+KOI8_U		KOI8-U		KOI8_U		true		sun.nio.cs
+MS1250		windows-1250	Cp1250		true		sun.nio.cs
+MS1251		windows-1251	Cp1251		true		sun.nio.cs
+MS1252		windows-1252	Cp1252		true		sun.nio.cs
+MS1253		windows-1253	Cp1253		true		sun.nio.cs
+MS1254		windows-1254	Cp1254		true		sun.nio.cs
+MS1257		windows-1257	Cp1257		true		sun.nio.cs
+#
+############################### extsbcs #######################################
+#
+IBM037		IBM037		Cp037		false		sun.nio.cs.ext
+IBM1006		x-IBM1006	Cp1006		false		sun.nio.cs.ext
+IBM1025		x-IBM1025	Cp1025		false		sun.nio.cs.ext
+IBM1026		IBM1026		Cp1026		false		sun.nio.cs.ext
+IBM1046		x-IBM1046	Cp1046		false		sun.nio.cs.ext
+IBM1047		IBM1047		Cp1047		false		sun.nio.cs.ext
+IBM1097		x-IBM1097	Cp1097		false		sun.nio.cs.ext
+IBM1098		x-IBM1098	Cp1098		false		sun.nio.cs.ext
+IBM1112		x-IBM1112	Cp1112		false		sun.nio.cs.ext
+IBM1122		x-IBM1122	Cp1122		false		sun.nio.cs.ext
+IBM1123		x-IBM1123	Cp1123		false		sun.nio.cs.ext
+IBM1124		x-IBM1124	Cp1124		false		sun.nio.cs.ext
+# map tables for 1140-1149 are updated manualy with the u+20ac entry          
+IBM1140		IBM01140	Cp1140		false		sun.nio.cs.ext
+IBM1141		IBM01141	Cp1141		false		sun.nio.cs.ext
+IBM1142		IBM01142	Cp1142		false		sun.nio.cs.ext
+IBM1143		IBM01143	Cp1143		false		sun.nio.cs.ext
+IBM1144		IBM01144	Cp1144		false		sun.nio.cs.ext
+IBM1145		IBM01145	Cp1145		false		sun.nio.cs.ext
+IBM1146		IBM01146	Cp1146		false		sun.nio.cs.ext
+IBM1147		IBM01147	Cp1147		false		sun.nio.cs.ext
+IBM1148		IBM01148	Cp1148		false		sun.nio.cs.ext
+IBM1149		IBM01149	Cp1149		false		sun.nio.cs.ext
+IBM273		IBM273		Cp273		false		sun.nio.cs.ext
+IBM277		IBM277		Cp277		false		sun.nio.cs.ext
+IBM278		IBM278		Cp278		false		sun.nio.cs.ext
+IBM280		IBM280		Cp280		false		sun.nio.cs.ext
+IBM284		IBM284		Cp284		false		sun.nio.cs.ext
+IBM285		IBM285		Cp285		false		sun.nio.cs.ext
+IBM290		IBM290		Cp290		false		sun.nio.cs.ext
+IBM297		IBM297		Cp297		false		sun.nio.cs.ext
+IBM420		IBM420		Cp420		false		sun.nio.cs.ext
+IBM424		IBM424		Cp424		false		sun.nio.cs.ext
+IBM500		IBM500		Cp500		false		sun.nio.cs.ext
+IBM833		x-IBM833	Cp833		false		sun.nio.cs.ext
+IBM838		IBM-Thai	Cp838		false		sun.nio.cs.ext
+IBM856		x-IBM856	Cp856		false		sun.nio.cs.ext
+IBM860		IBM860		Cp860		false		sun.nio.cs.ext
+IBM861		IBM861		Cp861		false		sun.nio.cs.ext
+IBM863		IBM863		Cp863		false		sun.nio.cs.ext
+IBM864		IBM864		Cp864		false		sun.nio.cs.ext
+IBM865		IBM865		Cp865		false		sun.nio.cs.ext
+IBM868		IBM868		Cp868		false		sun.nio.cs.ext
+IBM869		IBM869		Cp869		false		sun.nio.cs.ext
+IBM870		IBM870		Cp870		false		sun.nio.cs.ext
+IBM871		IBM871		Cp871		false		sun.nio.cs.ext
+IBM875		x-IBM875	Cp875		false		sun.nio.cs.ext
+IBM918		IBM918		Cp918		false		sun.nio.cs.ext
+IBM921		x-IBM921	Cp921		false		sun.nio.cs.ext
+IBM922		x-IBM922	Cp922		false		sun.nio.cs.ext
+# use name as hisname as well, cs did not support hisname prevously           
+ISO_8859_11	x-iso-8859-11	x-iso-8859-11	true		sun.nio.cs.ext
+ISO_8859_3	ISO-8859-3	ISO8859_3	true		sun.nio.cs.ext
+ISO_8859_6	ISO-8859-6	ISO8859_6	true		sun.nio.cs.ext
+ISO_8859_8	ISO-8859-8	ISO8859_8	true		sun.nio.cs.ext
+JIS_X_0201	JIS_X0201	JIS_X0201	true		sun.nio.cs.ext
+MS1255		windows-1255	Cp1255		true		sun.nio.cs.ext
+MS1256		windows-1256	Cp1256		true		sun.nio.cs.ext
+MS1258		windows-1258	Cp1258		true		sun.nio.cs.ext
+MS874		x-windows-874	MS874		true		sun.nio.cs.ext
+MacArabic	x-MacArabic	MacArabic	false		sun.nio.cs.ext
+MacCentralEurope	x-MacCentralEurope	MacCentralEurope	false	sun.nio.cs.ext
+MacCroatian	x-MacCroatian	MacCroatian	false		sun.nio.cs.ext
+MacCyrillic	x-MacCyrillic	MacCyrillic	false		sun.nio.cs.ext
+MacDingbat	x-MacDingbat	MacDingbat	false		sun.nio.cs.ext
+MacGreek	x-MacGreek	MacGreek	false		sun.nio.cs.ext
+MacHebrew	x-MacHebrew	MacHebrew	false		sun.nio.cs.ext
+MacIceland	x-MacIceland	MacIceland	false		sun.nio.cs.ext
+MacRoman	x-MacRoman	MacRoman	false		sun.nio.cs.ext
+MacRomania	x-MacRomania	MacRomania	false		sun.nio.cs.ext
+MacSymbol	x-MacSymbol	MacSymbol	false		sun.nio.cs.ext
+MacThai		x-MacThai	MacThai		false		sun.nio.cs.ext
+MacTurkish	x-MacTurkish	MacTurkish	false		sun.nio.cs.ext
+MacUkraine	x-MacUkraine	MacUkraine	false		sun.nio.cs.ext
+TIS_620		TIS-620		TIS620		true		sun.nio.cs.ext
+#
+############################### dbcs #########################################
+#
+#clzName  csName     hisName  dbtype    pkg               ascii   b1min  b1max  b2min b2max
+#
+Big5      Big5       Big5     basic     sun.nio.cs.ext    true    0xa1   0xf9   0x40  0xfe
+Johab     x-Johab    x-Johab  basic     sun.nio.cs.ext    true    0x84   0xf9   0x31  0xfe
+EUC_CN	  GB2312     EUC_CN   basic     sun.nio.cs.ext    true    0xa1   0xf7   0xa1  0xfe
+EUC_KR	  EUC-KR     EUC_KR   basic     sun.nio.cs.ext    true    0xa1   0xfd   0xa1  0xfe
+MS932	  windows-31j MS932   basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
+MS936	  x-mswin-936 MS936   basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
+MS949	  x-windows-949 MS949 basic     sun.nio.cs.ext    true    0x81   0xfe   0x41  0xfe
+MS950	  x-windows-950 MS950 basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
+GBK	  GBK        GBK      basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
+SJIS	  Shift_JIS  SJIS     basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
+PCK	  x-PCK      PCK      basic     sun.nio.cs.ext    true    0x81   0xfc   0x40  0xfc
+IBM1364	  x-IBM1364  Cp1364   ebcdic	sun.nio.cs.ext	  false   0x40   0xde   0x40  0xfe
+IBM1381	  x-IBM1381  Cp1381   basic     sun.nio.cs.ext    true    0x8c   0xf7   0xa1  0xfe
+IBM1383	  x-IBM1383  Cp1383   euc_sim   sun.nio.cs.ext    true    0xa1   0xfe   0xa1  0xfe
+IBM300	  x-IBM300   Cp300    dbcsonly  sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
+IBM930	  x-IBM930   Cp930    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
+IBM933	  x-IBM933   Cp933    ebcdic    sun.nio.cs.ext    false   0x40   0xdd   0x40  0xfe
+IBM935	  x-IBM935   Cp935    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
+IBM937	  x-IBM937   Cp937    ebcdic    sun.nio.cs.ext    false   0x40   0xe2   0x40  0xfe
+IBM939	  x-IBM939   Cp939    ebcdic    sun.nio.cs.ext    false   0x40   0x7f   0x40  0xfe
+IBM942	  x-IBM942   Cp942    basic     sun.nio.cs.ext    false   0x81   0xfc   0x40  0xfc
+IBM943	  x-IBM943   Cp943    basic     sun.nio.cs.ext    false   0x81   0xfc   0x40  0xfc
+IBM948	  x-IBM948   Cp948    basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfc
+IBM949	  x-IBM949   Cp949    basic     sun.nio.cs.ext    false   0x8f   0xfe   0xa1  0xfe
+IBM950	  x-IBM950   Cp950    basic     sun.nio.cs.ext    true    0x81   0xfe   0x40  0xfe
+IBM970	  x-IBM970   Cp970    euc_sim   sun.nio.cs.ext    true    0xa1   0xfe   0xa1  0xfe
+JIS_X_0208          x-JIS0208          JIS0208          dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
+JIS_X_0212          JIS_X0212-1990     JIS0212          dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
+JIS_X_0208_Solaris  x-JIS0208_Solaris  JIS0208_Solaris  dbcsonly  sun.nio.cs.ext  false  0x21  0x9e  0x21  0x7e
+JIS_X_0208_MS5022X  x-JIS0208_MS5022X  JIS0208_MS5022X  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
+JIS_X_0208_MS932    x-JIS0208_MS932    JIS0208_MS932    dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
+JIS_X_0212_Solaris  x-JIS0212_Solaris  JIS0212_Solaris  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
+JIS_X_0212_MS5022X  x-JIS0212_MS5022X  JIS0212_MS5022X  dbcsonly  sun.nio.cs.ext  false  0x21  0x7e  0x21  0x7e
--- a/jdk/make/data/charsetmapping/sbcs	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-# clzName	csName		hisName		containASCII	pkg
-IBM437		IBM437		Cp437		false		sun.nio.cs
-IBM737		x-IBM737	Cp737		false		sun.nio.cs	
-IBM775		IBM775		Cp775		false		sun.nio.cs
-IBM850		IBM850		Cp850		false		sun.nio.cs
-IBM852		IBM852		Cp852		false		sun.nio.cs
-IBM855		IBM855		Cp855		false		sun.nio.cs
-IBM857		IBM857		Cp857		false		sun.nio.cs	
-IBM858		IBM00858	Cp858		false		sun.nio.cs
-IBM862		IBM862		Cp862		false		sun.nio.cs
-IBM866		IBM866		Cp866		false		sun.nio.cs
-IBM874		x-IBM874	Cp874		false		sun.nio.cs
-ISO_8859_2	ISO-8859-2	ISO8859_2	true		sun.nio.cs
-ISO_8859_4	ISO-8859-4	ISO8859_4	true		sun.nio.cs
-ISO_8859_5	ISO-8859-5	ISO8859_5	true		sun.nio.cs
-ISO_8859_7	ISO-8859-7	ISO8859_7	true		sun.nio.cs
-ISO_8859_9	ISO-8859-9	ISO8859_9	true		sun.nio.cs
-ISO_8859_13	ISO-8859-13	ISO8859_13	true		sun.nio.cs
-ISO_8859_15	ISO-8859-15	ISO8859_15	true		sun.nio.cs
-KOI8_R		KOI8-R		KOI8_R		true		sun.nio.cs
-KOI8_U		KOI8-U		KOI8_U		true		sun.nio.cs
-MS1250		windows-1250	Cp1250		true		sun.nio.cs
-MS1251		windows-1251	Cp1251		true		sun.nio.cs
-MS1252		windows-1252	Cp1252		true		sun.nio.cs
-MS1253		windows-1253	Cp1253		true		sun.nio.cs
-MS1254		windows-1254	Cp1254		true		sun.nio.cs
-MS1257		windows-1257	Cp1257		true		sun.nio.cs
-
--- a/jdk/make/data/charsetmapping/standard-charsets	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-#
-# 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
-# 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.
-#
-
-# Standard charsets provided by StandardCharsets provider.
-#
-# Note that these "standard" charsets listed here are not
-# necessary to be the "Standard charsets" defined in the
-# specification of java.nio.charset.Charset. Instead these
-# are the charsets that this implementation believes should
-# be packaged into the charsets provider class "StandardCharsets"
-# which is initialized at startup time by java.nio.charset.Charset,
-# compared to the charsets packaged in "ExtendedCharsets" provider,
-# which is lazy initialized.
-
-charset US-ASCII US_ASCII
-
-    # IANA aliases
-    alias iso-ir-6
-    alias ANSI_X3.4-1986
-    alias ISO_646.irv:1991
-    alias ASCII
-    alias ISO646-US
-    alias us
-    alias IBM367
-    alias cp367
-    alias csASCII
-    alias default
-
-    # Other aliases
-    alias 646				# Solaris POSIX locale
-    alias iso_646.irv:1983
-    alias ANSI_X3.4-1968		# Linux POSIX locale (RedHat)
-    alias ascii7
-
-charset UTF-8 UTF_8
-    alias UTF8				# JDK historical
-    alias unicode-1-1-utf-8
-
-charset CESU-8 CESU_8
-    alias CESU8
-    alias csCESU-8
-
-charset UTF-16 UTF_16
-    alias UTF_16			# JDK historical
-    alias utf16
-    alias unicode
-    alias UnicodeBig
-
-charset UTF-16BE UTF_16BE
-    alias UTF_16BE
-    alias ISO-10646-UCS-2
-    alias X-UTF-16BE
-    alias UnicodeBigUnmarked
-
-charset UTF-16LE UTF_16LE
-    alias UTF_16LE
-    alias X-UTF-16LE
-    alias UnicodeLittleUnmarked
-
-charset x-UTF-16LE-BOM UTF_16LE_BOM
-    alias UnicodeLittle
-
-charset UTF-32 UTF_32
-    alias UTF_32
-    alias UTF32
-
-charset UTF-32LE UTF_32LE
-    alias UTF_32LE
-    alias X-UTF-32LE
-
-charset UTF-32BE UTF_32BE
-    alias UTF_32BE
-    alias X-UTF-32BE
-
-charset X-UTF-32LE-BOM UTF_32LE_BOM
-    alias UTF_32LE_BOM
-    alias UTF-32LE-BOM
-
-charset X-UTF-32BE-BOM UTF_32BE_BOM
-    alias UTF_32BE_BOM
-    alias UTF-32BE-BOM
-
-charset ISO-8859-1 ISO_8859_1
-
-    # IANA aliases
-    alias iso-ir-100
-    alias ISO_8859-1
-    alias latin1
-    alias l1
-    alias IBM819
-    alias cp819
-    alias csISOLatin1
-
-    # Other aliases
-    alias 819
-    alias IBM-819
-    alias ISO8859_1
-    alias ISO_8859-1:1987
-    alias ISO_8859_1
-    alias 8859_1
-    alias ISO8859-1
-
-charset ISO-8859-2 ISO_8859_2
-    alias iso8859_2			# JDK historical
-    alias 8859_2
-    alias iso-ir-101
-    alias ISO_8859-2
-    alias ISO_8859-2:1987
-    alias ISO8859-2
-    alias latin2
-    alias l2
-    alias ibm912
-    alias ibm-912
-    alias cp912
-    alias 912
-    alias csISOLatin2
-
-charset ISO-8859-4 ISO_8859_4
-    alias iso8859_4			# JDK historical
-    alias iso8859-4
-    alias 8859_4
-    alias iso-ir-110
-    alias ISO_8859-4
-    alias ISO_8859-4:1988
-    alias latin4
-    alias l4
-    alias ibm914
-    alias ibm-914
-    alias cp914
-    alias 914
-    alias csISOLatin4
-
-charset ISO-8859-5 ISO_8859_5
-    alias iso8859_5			# JDK historical
-    alias 8859_5
-    alias iso-ir-144
-    alias ISO_8859-5
-    alias ISO_8859-5:1988
-    alias ISO8859-5
-    alias cyrillic
-    alias ibm915
-    alias ibm-915
-    alias cp915
-    alias 915
-    alias csISOLatinCyrillic
-
-charset ISO-8859-7 ISO_8859_7
-    alias iso8859_7			# JDK historical
-    alias 8859_7
-    alias iso-ir-126
-    alias ISO_8859-7
-    alias ISO_8859-7:1987
-    alias ELOT_928
-    alias ECMA-118
-    alias greek
-    alias greek8
-    alias csISOLatinGreek
-    alias sun_eu_greek			# Solaris 7/8 compatibility
-    alias ibm813
-    alias ibm-813
-    alias 813
-    alias cp813
-    alias iso8859-7			# Solaris 9 compatibility
-
-charset ISO-8859-9 ISO_8859_9
-    alias iso8859_9			# JDK historical
-    alias 8859_9
-    alias iso-ir-148
-    alias ISO_8859-9
-    alias ISO_8859-9:1989
-    alias ISO8859-9
-    alias latin5
-    alias l5
-    alias ibm920
-    alias ibm-920
-    alias 920
-    alias cp920
-    alias csISOLatin5
-
-charset ISO-8859-13 ISO_8859_13
-    alias iso8859_13			# JDK historical
-    alias 8859_13
-    alias iso_8859-13
-    alias ISO8859-13
-
-charset ISO-8859-15 ISO_8859_15
-
-    # IANA alias
-    alias ISO_8859-15
-
-    # Other aliases
-    alias 8859_15
-    alias ISO-8859-15
-    alias ISO8859_15
-    alias ISO8859-15
-    alias IBM923
-    alias IBM-923
-    alias cp923
-    alias 923
-    alias LATIN0
-    alias LATIN9
-    alias L9
-    alias csISOlatin0
-    alias csISOlatin9
-    alias ISO8859_15_FDIS
-
-charset KOI8-R KOI8_R
-    alias koi8_r			# JDK historical
-    alias koi8
-    alias cskoi8r
-
-charset KOI8-U KOI8_U
-    alias koi8_u
-
-charset windows-1250 MS1250
-    alias cp1250			# JDK historical
-    alias cp5346			# Euro IBM CCSID
-
-charset windows-1251 MS1251
-    alias cp1251			# JDK historical
-    alias cp5347			# Euro IBM CCSID
-    alias ansi-1251			# Solaris compatibility
-
-charset windows-1252 MS1252
-    alias cp1252			# JDK historical
-    alias cp5348			# Euro IBM CCSID
-
-charset windows-1253 MS1253
-    alias cp1253			# JDK historical
-    alias cp5349			# Euro IBM CCSID
-
-charset windows-1254 MS1254
-    alias cp1254			# JDK historical
-    alias cp5350			# Euro IBM CCSID
-
-charset windows-1257 MS1257
-    alias cp1257			# JDK historical
-    alias cp5353			# Euro IBM CCSID
-
-
-charset IBM437 IBM437
-    alias cp437                         #JDK historical
-    alias ibm437
-    alias ibm-437
-    alias 437
-    alias cspc8codepage437
-    alias windows-437
-
-charset x-IBM737 IBM737
-    alias cp737                         #JDK historical
-    alias ibm737
-    alias ibm-737
-    alias 737
-
-charset IBM775 IBM775
-    alias cp775                         #JDK historical
-    alias ibm775
-    alias ibm-775
-    alias 775
-
-charset IBM850 IBM850
-    alias cp850                         #JDK historical
-    alias ibm-850
-    alias ibm850
-    alias 850
-    alias cspc850multilingual
-
-charset IBM852 IBM852
-    alias cp852                         #JDK historical
-    alias ibm852
-    alias ibm-852
-    alias 852
-    alias csPCp852
-
-charset IBM855 IBM855
-    alias cp855                         #JDK historical
-    alias ibm-855
-    alias ibm855
-    alias 855
-    alias cspcp855
-
-charset IBM857 IBM857
-    alias cp857                         #JDK historical
-    alias ibm857
-    alias ibm-857
-    alias 857
-    alias csIBM857
-
-charset IBM00858 IBM858
-    alias cp858                         #JDK historical
-    alias ccsid00858
-    alias cp00858
-    alias 858
-    alias PC-Multilingual-850+euro
-
-charset IBM862 IBM862
-    alias cp862                         #JDK historical
-    alias ibm862
-    alias ibm-862
-    alias 862
-    alias csIBM862
-    alias cspc862latinhebrew
-
-charset IBM866 IBM866
-    alias cp866                         #JDK historical
-    alias ibm866
-    alias ibm-866
-    alias 866
-    alias csIBM866
-
-charset x-IBM874 IBM874
-    alias cp874                         #JDK historical
-    alias ibm874
-    alias ibm-874
-    alias 874
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/stdcs-linux	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,19 @@
+#
+#   generate these charsets into sun.nio.cs
+#
+Big5
+Big5_Solaris
+Big5_HKSCS
+EUC_CN
+EUC_KR
+EUC_JP
+EUC_JP_LINUX
+EUC_JP_Open
+GBK
+Johab
+PCK
+JIS_X_0201
+JIS_X_0208
+JIS_X_0212
+JIS_X_0208_Solaris
+JIS_X_0212_Solaris
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/stdcs-solaris	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,23 @@
+#
+#   generate these charsets into sun.nio.cs
+#
+Big5
+Big5_Solaris
+Big5_HKSCS        # always together with Big5
+EUC_CN
+EUC_KR
+EUC_JP
+EUC_JP_LINUX
+EUC_JP_Open
+GBK
+ISO_8859_11
+ISO_8859_3
+ISO_8859_6
+ISO_8859_8
+Johab
+PCK
+JIS_X_0201
+JIS_X_0208
+JIS_X_0212
+JIS_X_0208_Solaris
+JIS_X_0212_Solaris
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/stdcs-windows	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,16 @@
+#
+#   generate these charsets into sun.nio.cs
+#
+GBK
+Johab
+MS1255
+MS1256
+MS1258
+MS874
+MS932
+JIS_X_0201 # JIS_X_0201 is used by MS932 in its contains() method
+SJIS       # SJIS must go together with MS932 to support sun.nio.cs.map
+MS936
+MS949
+MS950
+MS950_HKSCS_XP
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -30,23 +30,27 @@
 # Generate files using the charsetmapping tool
 #
 CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
+
 CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
 CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
 CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
 CHARSET_TEMPLATES := \
     $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
     $(CHARSET_DATA_DIR)/DoubleByte-X.java.template
+CHARSET_EXTENDED_JAVA_TEMPLATES := \
+    $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template
+CHARSET_EXTENDED_JAVA_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
+CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
 
-$(CHARSET_DONE_CS)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs  \
-    $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
+$(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
+    $(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
+    $(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
+    $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(@D)
-	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) extsbcs
-	$(TOUCH) '$@'
-
-$(CHARSET_DONE_CS)-dbcs: $(CHARSET_DATA_DIR)/dbcs \
-    $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
-	$(MKDIR) -p $(@D)
-	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) dbcs
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
+	    extcs charsets  $(CHARSET_STANDARD_OS) \
+	    $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
+	    $(CHARSET_EXTENDED_JAVA_DIR) $(LOG_INFO)
 	$(TOUCH) '$@'
 
 $(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
@@ -67,8 +71,7 @@
 	$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
 
 GENSRC_JDK_CHARSETS += \
-    $(CHARSET_DONE_CS)-extsbcs \
-    $(CHARSET_DONE_CS)-dbcs \
+    $(CHARSET_DONE_CS)-extcs \
     $(CHARSET_DONE_CS)-hkscs \
     $(CHARSET_DONE_CS)-euctw \
     $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -25,112 +25,29 @@
 
 ################################################################################
 #
-# Generate files using the charsetmapping tool
+# Generate StandardCharsets.java and individul sun.nio.cs charset class using
+# the charsetmapping tool
 #
 CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
+CHARSET_EXTSRC_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
 CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
 CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
 CHARSET_TEMPLATES := \
     $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
     $(CHARSET_DATA_DIR)/DoubleByte-X.java.template
+CHARSET_STANDARD_JAVA_TEMPLATES := \
+    $(JDK_TOPDIR)/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
+CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
 
-$(CHARSET_DONE_BASE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \
-    $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
+$(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
+    $(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
+    $(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
+    $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(@D)
-	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) sbcs
+	$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
+	    stdcs charsets $(CHARSET_STANDARD_OS) \
+	    $(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) $(LOG_INFO)
 	$(TOUCH) '$@'
 
-GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-sbcs
-
-################################################################################
-#
-# Generate the sun/nio/cs/StandardCharsets.java file
-#
-CHARSET_STANDARD_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_standardcharsets
-CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
-CHARSET_STANDARD_JAVA :=  sun/nio/cs/StandardCharsets.java
-
-CHARSET_ALIASES_TABLES_AWK := ' \
-    BEGIN { n = 1; m = 1; } \
-    /^[ \t]*charset / { \
-      csn = $$2; cln = $$3; \
-      lcsn = tolower(csn); \
-      lcsns[n++] = lcsn; \
-      csns[lcsn] = csn; \
-      classMap[lcsn] = cln; \
-      if (n > 2) \
-        printf "    };\n\n"; \
-      printf "    static final String[] aliases_%s = new String[] {\n", cln; \
-    } \
-    /^[ \t]*alias / { \
-      acsns[m++] = tolower($$2); \
-      aliasMap[tolower($$2)] = lcsn; \
-      printf "        \"%s\",\n", $$2; \
-    } \
-    END { \
-      printf "    };\n\n"; \
-    } '
-
-CHARSET_ALIASES_MAP_AWK := ' \
-    /^[ \t]*charset / { \
-      csn = $$2; \
-      lcsn = tolower(csn); \
-    } \
-    /^[ \t]*alias / { \
-      an = tolower($$2); \
-      printf "%-20s \"%s\"\n", an, lcsn; \
-    } '
+GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
 
-CHARSET_CLASSES_MAP_AWK := ' \
-    /^[ \t]*charset / { \
-      csn = $$2; cln = $$3; \
-      lcsn = tolower(csn); \
-      printf "%-20s \"%s\"\n", lcsn, cln; \
-    } '
-
-# This target should be referenced using the order-only operator (|)
-$(CHARSET_STANDARD_GENSRC_DIR):
-	$(MKDIR) -p '$@'
-
-$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet: $(CHARSET_STANDARD_DATA) \
-    | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_TABLES_AWK)
-
-$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map: $(CHARSET_STANDARD_DATA) \
-    | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_MAP_AWK)
-
-$(CHARSET_STANDARD_GENSRC_DIR)/classes-map: $(CHARSET_STANDARD_DATA) \
-    | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(NAWK) < '$<' > '$@' $(CHARSET_CLASSES_MAP_AWK)
-
-$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map \
-    $(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(TOOL_HASHER) -i Aliases < '$<' > '$@'
-
-$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
-    $(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(TOOL_HASHER) -i Classes < '$<' > '$@'
-
-$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
-    $(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
-	$(TOOL_HASHER) -i -e Cache -t Charset < '$<' > '$@'
-
-$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
-    SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/$(CHARSET_STANDARD_JAVA).template, \
-    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
-    INCLUDES := \
-        _INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
-        _INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
-        _INCLUDE_CLASSES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet ; \
-        _INCLUDE_CACHE_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet ; , \
-))
-
-# Processing of template depends on the snippets being generated first
-$(BUILD_CHARSET_STANDARD): \
-    $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet \
-    $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet \
-    $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet \
-    $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet
-
-GENSRC_JAVA_BASE += $(BUILD_CHARSET_STANDARD)
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -31,6 +31,12 @@
 $(eval $(call SetupLauncher,jarsigner, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
 
+ifndef BUILD_HEADLESS_ONLY
+  $(eval $(call SetupLauncher,policytool, \
+      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
+      $(XLIBS)))
+endif
+
 $(eval $(call SetupLauncher,jdeps, \
     -DEXPAND_CLASSPATH_WILDCARDS \
     -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -25,12 +25,6 @@
 
 include LauncherCommon.gmk
 
-ifndef BUILD_HEADLESS_ONLY
-  $(eval $(call SetupLauncher,policytool, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
-      $(XLIBS)))
-endif
-
 $(eval $(call SetupLauncher,pack200, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
 
--- a/jdk/make/lib/Awt2dLibraries.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -515,6 +515,77 @@
 
 ################################################################################
 
+ifeq ($(BUILD_HEADLESS), true)
+  # Mac and Windows only use the native AWT lib, do not build libawt_headless
+  ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
+
+    LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
+        $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
+        $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
+        #
+
+    LIBAWT_HEADLESS_EXCLUDES := medialib
+    LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+        $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
+        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
+        $(LIBJAVA_HEADER_FLAGS) \
+        #
+
+    LIBAWT_HEADLESS_REORDER :=
+    ifeq ($(OPENJDK_TARGET_OS), solaris)
+      ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+        LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
+      endif
+    endif
+
+    $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
+        LIBRARY := awt_headless, \
+        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+        SRC := $(LIBAWT_HEADLESS_DIRS), \
+        EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
+        LANG := C, \
+        OPTIMIZATION := LOW, \
+        CFLAGS := $(CFLAGS_JDKLIB) \
+            -DHEADLESS=true \
+            -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
+            $(CUPS_CFLAGS) \
+            $(X_CFLAGS) \
+            $(LIBAWT_HEADLESS_CFLAGS), \
+        MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
+        LDFLAGS := $(LDFLAGS_JDKLIB) \
+            $(call SET_SHARED_LIBRARY_ORIGIN), \
+        LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
+        LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+        LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+        LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
+        REORDER := $(LIBAWT_HEADLESS_REORDER), \
+        LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
+        LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
+        LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
+        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+    $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
+
+    TARGETS += $(BUILD_LIBAWT_HEADLESS)
+
+  endif
+endif
+
+################################################################################
+
 LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \
     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 LIBFONTMANAGER_CFLAGS := \
@@ -562,10 +633,6 @@
   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), \
@@ -583,9 +650,8 @@
     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
     LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
-    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_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+    LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\
     LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
         -ljava -ljvm, \
     LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
@@ -601,7 +667,7 @@
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
-  $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
+  $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 endif
 
 TARGETS += $(BUILD_LIBFONTMANAGER)
@@ -723,77 +789,6 @@
 
 ################################################################################
 
-ifeq ($(BUILD_HEADLESS), true)
-  # Mac and Windows only use the native AWT lib, do not build libawt_headless
-  ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
-
-    LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
-        $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-        #
-
-    LIBAWT_HEADLESS_EXCLUDES := medialib
-    LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-        $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
-        -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
-        $(LIBJAVA_HEADER_FLAGS) \
-        #
-
-    LIBAWT_HEADLESS_REORDER :=
-    ifeq ($(OPENJDK_TARGET_OS), solaris)
-      ifneq ($(OPENJDK_TARGET_CPU), x86_64)
-        LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
-      endif
-    endif
-
-    $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
-        LIBRARY := awt_headless, \
-        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-        SRC := $(LIBAWT_HEADLESS_DIRS), \
-        EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
-        LANG := C, \
-        OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            -DHEADLESS=true \
-            -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-            $(CUPS_CFLAGS) \
-            $(X_CFLAGS) \
-            $(LIBAWT_HEADLESS_CFLAGS), \
-        MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
-        LDFLAGS := $(LDFLAGS_JDKLIB) \
-            $(call SET_SHARED_LIBRARY_ORIGIN), \
-        LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
-        LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
-        LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
-        LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
-        REORDER := $(LIBAWT_HEADLESS_REORDER), \
-        LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
-        LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
-        LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
-        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
-        DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-    $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
-
-    TARGETS += $(BUILD_LIBAWT_HEADLESS)
-
-  endif
-endif
-
-################################################################################
-
 ifndef BUILD_HEADLESS_ONLY
 
   LIBSPLASHSCREEN_DIRS := \
--- a/jdk/make/lib/CoreLibraries.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/lib/CoreLibraries.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -271,6 +271,11 @@
   # Staticically link with c runtime on windows.
   LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
+  # Supply the name of the C runtime lib.
+  LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
+  ifneq ($(MSVCP_DLL), )
+    LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
+  endif
 else
   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
 endif
--- a/jdk/make/lib/Lib-jdk.runtime.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/lib/Lib-jdk.runtime.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -59,37 +59,3 @@
 TARGETS += $(BUILD_LIBUNPACK)
 
 ################################################################################
-
-LIBJSDT_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libjsdt \
-    $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_TYPE)/native/libjsdt
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
-    LIBRARY := jsdt, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(LIBJSDT_SRC), \
-    LANG := C, \
-    OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
-        $(addprefix -I, $(LIBJSDT_SRC)) \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.runtime, \
-    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \
-    LDFLAGS := $(LDFLAGS_JDKLIB) \
-        $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_SUFFIX_linux := $(LIBDL), \
-    LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL), \
-    LDFLAGS_SUFFIX_macosx := $(LIBDL), \
-    LDFLAGS_SUFFIX_solaris := -lc, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jsdt.dll" \
-        -D "JDK_INTERNAL_NAME=jsdt" \
-        -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsdt, \
-    DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBJSDT): $(call FindLib, java.base, java)
-
-TARGETS += $(BUILD_LIBJSDT)
-
-################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/charsetmapping/Charset.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.charsetmapping;
+
+class Charset {
+    String   pkgName;
+    String   clzName;
+    String   csName;
+    String   hisName;
+    String   type;
+    boolean  isASCII;
+    int      b1Min;
+    int      b1Max;
+    int      b2Min;
+    int      b2Max;
+    String[] aliases;
+    boolean  isGenSrc = false;
+    boolean  isInternal = false;
+}
--- a/jdk/make/src/classes/build/tools/charsetmapping/DBCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/charsetmapping/DBCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,71 +24,32 @@
  */
 
 package build.tools.charsetmapping;
+
 import java.io.*;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Scanner;
 import java.util.Formatter;
-import java.util.regex.*;
-import java.nio.charset.*;
+import java.util.regex.Pattern;
 import static build.tools.charsetmapping.Utils.*;
 
 public class DBCS {
     // pattern used by this class to read in mapping table
     static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
 
-    public static void genClass(String args[]) throws Exception {
-
-        Scanner s = new Scanner(new File(args[0], args[2]));
-        while (s.hasNextLine()) {
-            String line = s.nextLine();
-            if (line.startsWith("#") || line.length() == 0)
-                continue;
-            String[] fields = line.split("\\s+");
-            if (fields.length < 10) {
-                System.err.println("Misconfiged sbcs line <" + line + ">?");
-                continue;
-            }
-            String clzName = fields[0];
-            String csName  = fields[1];
-            String hisName = ("null".equals(fields[2]))?null:fields[2];
-            String type = fields[3].toUpperCase();
-            if ("BASIC".equals(type))
-                type = "";
-            else
-                type = "_" + type;
-            String pkgName  = fields[4];
-            boolean isASCII = Boolean.valueOf(fields[5]);
-            int    b1Min = toInteger(fields[6]);
-            int    b1Max = toInteger(fields[7]);
-            int    b2Min    = toInteger(fields[8]);
-            int    b2Max    = toInteger(fields[9]);
-            System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
-            genClass0(args[0], args[1], "DoubleByte-X.java.template",
-                    clzName, csName, hisName, pkgName,
-                    isASCII, type,
-                    b1Min, b1Max, b2Min, b2Max);
-        }
-    }
-
-    static int toInteger(String s) {
-        if (s.startsWith("0x") || s.startsWith("0X"))
-            return Integer.valueOf(s.substring(2), 16);
-        else
-            return Integer.valueOf(s);
-    }
-
-    private static void genClass0(String srcDir, String dstDir, String template,
-                                  String clzName,
-                                  String csName,
-                                  String hisName,
-                                  String pkgName,
-                                  boolean isASCII,
-                                  String type,
-                                  int b1Min, int b1Max,
-                                  int b2Min, int b2Max)
+    public static void genClass(String type, Charset cs,
+                                String srcDir, String dstDir, String template)
         throws Exception
     {
+        String clzName = cs.clzName;
+        String csName  = cs.csName;
+        String hisName = cs.hisName;
+        String pkgName = cs.pkgName;
+        boolean isASCII = cs.isASCII;
+        int b1Min = cs.b1Min;
+        int b1Max = cs.b1Max;
+        int b2Min = cs.b2Min;
+        int b2Max = cs.b2Max;
 
         StringBuilder b2cSB = new StringBuilder();
         StringBuilder b2cNRSB = new StringBuilder();
--- a/jdk/make/src/classes/build/tools/charsetmapping/HKSCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/charsetmapping/HKSCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -42,38 +42,51 @@
     private static Pattern hkscs =
         Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
 
-    static void genClass(String args[]) throws Exception {
-
+    static void genClass2008(String srcDir, String dstDir, String pkgName)
+        throws Exception
+    {
         // hkscs2008
-        genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
-                  new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
-                  new PrintStream(new File(args[1], "HKSCSMapping.java"),
+        genClass0(new FileInputStream(new File(srcDir, "HKSCS2008.map")),
+                  new FileInputStream(new File(srcDir, "HKSCS2008.c2b")),
+                  new PrintStream(new File(dstDir, "HKSCSMapping.java"),
                                   "ISO-8859-1"),
+                  pkgName,
                   "HKSCSMapping",
-                  getCopyright(new File(args[3])));
+                  true,
+                  "");
+    }
 
-
-        // xp2001
-        genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
+    static void genClassXP(String srcDir, String dstDir, String pkgName)
+        throws Exception
+    {
+        genClass0(new FileInputStream(new File(srcDir, "HKSCS_XP.map")),
                   null,
-                  new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
+                  new PrintStream(new File(dstDir, "HKSCS_XPMapping.java"),
                                   "ISO-8859-1"),
+                  pkgName,
                   "HKSCS_XPMapping",
-                  getCopyright(new File(args[3])));
+                  false,
+                  "");
+    }
 
+    static void genClass2001(String args[]) throws Exception {
         // hkscs2001
         genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
                   new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
                   new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
                                   "ISO-8859-1"),
+                  "sun.nio.cs.ext",
                   "HKSCS2001Mapping",
+                  false,
                   getCopyright(new File(args[3])));
     }
 
     static void genClass0(InputStream isB2C,
                           InputStream isC2B,
                           PrintStream ps,
+                          String pkgName,
                           String clzName,
+                          boolean isPublic,
                           String copyright)
         throws Exception
     {
@@ -132,8 +145,8 @@
 
             out.format(copyright);
             out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
-            out.format("package sun.nio.cs.ext;%n%n");
-            out.format("class %s {%n%n", clzName);
+            out.format("package %s;%n%n", pkgName);
+            out.format("%sclass %s {%n%n", isPublic ? "public " : "", clzName);
 
             /* hardcoded in sun.nio.cs.ext.HKSCS.java
             out.format("    final static int b1Min = 0x%x;%n", b1Min);
@@ -143,7 +156,8 @@
             */
 
             // bmp tables
-            out.format("%n    static final String[] b2cBmpStr = new String[] {%n");
+            out.format("%n    %sstatic final String[] b2cBmpStr = new String[] {%n",
+                       isPublic ? "public " : "");
             for (int i = 0; i < 0x100; i++) {
                 if (b2cBmp[i])
                     out.format(bmp, i, b2Min, b2Max, ",");
@@ -153,7 +167,8 @@
             out.format("        };%n");
 
             // supp tables
-            out.format("%n    static final String[] b2cSuppStr =");
+            out.format("%n    %sstatic final String[] b2cSuppStr =",
+                       isPublic ? "public " : "");
             if (hasSupp) {
                 out.format(" new String[] {%n");
                 for (int i = 0; i < 0x100; i++) {
@@ -168,7 +183,8 @@
             }
 
             // private area tables
-            out.format("%n    final static String pua =");
+            out.format("%n    %sfinal static String pua =",
+                       isPublic ? "public " : "");
             if (hasPua) {
                 out.format("%n");
                 out.format(pua, 0, pua.length, ";");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/charsetmapping/Hasher.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.charsetmapping;
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * Reads a map in the form of a sequence of key/value-expression pairs from the
+ * standard input, attempts to construct a hash map that fits within the given
+ * table-size and chain-depth constraints, and, if successful, writes source
+ * code to the standard output for a subclass of sun.util.PreHashedMap that
+ * implements the map.
+ *
+ * @see sun.util.PreHashedMap
+ *
+ * @author Mark Reinhold
+ */
+
+public class Hasher {
+
+    private PrintStream err = System.err;
+
+    boolean verbose = false;
+    List<String> keys = new ArrayList<>();      // Key strings
+    List<String> values = new ArrayList<>();    // Value expressions
+    String pkg = null;                          // Package prefix for generated class
+    String cln = null;                          // Name of generated class
+    String vtype = null;                        // Value type
+    int maxBits = 11;                           // lg table size
+    int maxDepth = 3;                           // Max chain depth
+    boolean inner = false;                      // Generating an inner class?
+    boolean empty = false;                      // Generating an empty table?
+
+    Object[] ht;                                // Hash table itself
+    int nb;                                     // Number of bits (lg table size)
+    int md;                                     // Maximum chain depth
+    int mask;                                   // Hash-code mask
+    int shift;                                  // Hash-code shift size
+
+    int hash(String w) {
+        return (w.hashCode() >> shift) & mask;
+    }
+
+    // Build a hash table of size 2^nb, shifting the hash code by s bits
+    //
+    void build(int nb, int s) {
+
+        this.nb = nb;
+        this.shift = s;
+        int n = 1 << nb;
+        this.mask = n - 1;
+        ht = new Object[n];
+        int nw = keys.size();
+
+        for (int i = 0; i < nw; i++) {
+            String w = keys.get(i);
+            String v = values.get(i);
+            int h = hash(w);
+            if (ht[h] == null)
+                ht[h] = new Object[] { w, v };
+            else
+                ht[h] = new Object[] { w, v, ht[h] };
+        }
+
+        this.md = 0;
+        for (int i = 0; i < n; i++) {
+            int d = 1;
+            for (Object[] a = (Object[])ht[i];
+                 a != null && a.length > 2;
+                 a = (Object[])a[2], d++);
+            this.md = Math.max(md, d);
+        }
+
+    }
+
+    Hasher build() {
+        // Iterate through acceptable table sizes
+        for (int nb = 2; nb < maxBits; nb++) {
+            // Iterate through possible shift sizes
+            for (int s = 0; s < (32 - nb); s++) {
+                build(nb, s);
+                if (verbose)
+                    err.println("nb=" + nb + " s=" + s + " md=" + md);
+                if (md <= maxDepth) {
+                    // Success
+                     if (verbose) {
+                        if (cln != null)
+                            err.print(cln + ": ");
+                        err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
+                                    + ", shift " + shift
+                                    + ", max chain depth " + md);
+                    }
+                    return this;
+                }
+            }
+        }
+        throw new RuntimeException("Cannot find a suitable size"
+                                   + " within given constraints");
+    }
+
+    // Look for the given key in the hash table
+    //
+    String get(String k) {
+        int h = hash(k);
+        Object[] a = (Object[])ht[h];
+        for (;;) {
+            if (a[0].equals(k))
+                return (String)a[1];
+            if (a.length < 3)
+                return null;
+            a = (Object[])a[2];
+        }
+    }
+
+    // Test that all input keys can be found in the table
+    //
+    Hasher test() {
+        if (verbose)
+            err.println();
+        for (int i = 0, n = keys.size(); i < n; i++) {
+            String w = keys.get(i);
+            String v = get(w);
+            if (verbose)
+                err.println(hash(w) + "\t" + w);
+            if (!v.equals(values.get(i)))
+                throw new Error("Incorrect value: " + w + " --> "
+                                + v + ", should be " + values.get(i));
+        }
+        return this;
+    }
+
+    String ind = "";                    // Indent prefix
+
+    // Generate code for a single table entry
+    //
+    void genEntry(Object[] a, int depth, PrintStream out) {
+        Object v = empty ? null : a[1];
+        out.print("new Object[] { \"" + a[0] + "\", " + v);
+        if (a.length < 3) {
+            out.print(" }");
+            return;
+        }
+        out.println(",");
+        out.print(ind + "                     ");
+        for (int i = 0; i < depth; i++)
+            out.print("    ");
+        genEntry((Object[])a[2], depth + 1, out);
+        out.print(" }");
+    }
+
+    // Generate a PreHashedMap subclass from the computed hash table
+    //
+    Hasher generate(PrintStream out) throws IOException {
+        if (cln == null)
+            return this;
+
+        if (inner)
+            ind = "    ";
+
+        if (!inner && pkg != null) {
+            out.println();
+            out.println("package " + pkg + ";");
+            out.println();
+        }
+
+        if (inner) {
+            out.println(ind + "private static final class " + cln);
+        } else {
+            out.println();
+            out.println("public final class " + cln);
+        }
+        out.println(ind + "    extends sun.util.PreHashedMap<" + vtype +">");
+        out.println(ind + "{");
+
+        out.println();
+        out.println(ind + "    private static final int ROWS = "
+                    + ht.length + ";");
+        out.println(ind + "    private static final int SIZE = "
+                    + keys.size() + ";");
+        out.println(ind + "    private static final int SHIFT = "
+                    + shift + ";");
+        out.println(ind + "    private static final int MASK = 0x"
+                    + Integer.toHexString(mask) + ";");
+        out.println();
+
+        out.println(ind + "    " + (inner ? "private " : "public ")
+                    + cln + "() {");
+        out.println(ind + "        super(ROWS, SIZE, SHIFT, MASK);");
+        out.println(ind + "    }");
+        out.println();
+
+        out.println(ind + "    protected void init(Object[] ht) {");
+        for (int i = 0; i < ht.length; i++) {
+            if (ht[i] == null)
+                continue;
+            Object[] a = (Object[])ht[i];
+            out.print(ind + "        ht[" + i + "] = ");
+            genEntry(a, 0, out);
+            out.println(";");
+        }
+        out.println(ind + "    }");
+        out.println();
+
+        out.println(ind + "}");
+        if (inner)
+            out.println();
+
+        return this;
+    }
+
+    private Hasher(List<String> keys, List<String> values,
+                   String pkg, String cln, String vtype,
+                   int maxBits, int maxDepth,
+                   boolean inner, boolean empty,
+                   boolean verbose) {
+        this.keys = keys;
+        this.values = values;
+        this.pkg = pkg;
+        this.cln = cln;
+        this.vtype = vtype;
+        this.maxBits = maxBits;
+        this.maxDepth = maxDepth;
+        this.inner = inner;
+        this.empty = empty;
+        this.verbose = verbose;
+    }
+
+    public static void genClass(PrintStream out,
+                                List<String> keys, List<String> values,
+                                String pkg, String cln, String vtype,
+                                int maxBits, int maxDepth,
+                                boolean inner, boolean empty, boolean verbose)
+        throws IOException {
+        new Hasher(keys, values, pkg, cln, vtype,
+                   maxBits, maxDepth, inner, empty, verbose)
+            .build()
+            .test()
+            .generate(out);
+    }
+}
--- a/jdk/make/src/classes/build/tools/charsetmapping/Main.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/charsetmapping/Main.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,193 @@
 package build.tools.charsetmapping;
 
 import java.io.*;
+import java.util.ArrayList;
 import java.util.Scanner;
+import java.util.LinkedHashMap;
+import java.util.Locale;
 
 public class Main {
 
-    public static void main(String args[]) throws Exception {
+    public static void main(String args[]) throws Throwable {
+        int SRC_DIR  = 0;
+        int DST_DIR  = 1;
+        int TYPE     = 2;
+        int CHARSETS = 3;
+        int OS       = 4;
+        int TEMPLATE = 5;
+        int EXT_SRC  = 6;
+
         if (args.length < 3 ) {
-            System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
+            System.out.println("Usage: java -jar charsetmapping.jar src dst spiType charsets os [template]");
             System.exit(1);
         }
-        if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
-            SBCS.genClass(args);
-        } else if ("dbcs".equals(args[2])) {
-            DBCS.genClass(args);
-        } else if ("euctw".equals(args[2])) {
+        boolean isStandard = "stdcs".equals(args[TYPE]);
+        boolean isExtended = "extcs".equals(args[TYPE]);
+        if (isStandard || isExtended) {
+            LinkedHashMap<String, Charset> charsets = getCharsets(
+                new File(args[SRC_DIR], args[CHARSETS]));
+            String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
+            boolean hasBig5_HKSCS = false;
+            boolean hasMS950_HKSCS_XP = false;
+            for (String name : osStdcs) {
+                Charset cs = charsets.get(name);
+                if (cs != null) {
+                    cs.pkgName = "sun.nio.cs";
+                }
+                if (name.equals("Big5_HKSCS")) {
+                    hasBig5_HKSCS = true;
+                } else if (name.equals("MS950_HKSCS_XP")) {
+                    hasMS950_HKSCS_XP = true;
+                }
+            }
+            for (Charset cs : charsets.values()) {
+                if (isStandard && cs.pkgName.equals("sun.nio.cs.ext") ||
+                    isExtended && cs.pkgName.equals("sun.nio.cs")) {
+                    continue;
+                }
+                verbose(cs);
+                switch (cs.type) {
+                case "template":
+                    SRC.genClass(cs, args[EXT_SRC], args[DST_DIR]);
+                    break;
+                case "sbcs":
+                    SBCS.genClass(cs, args[SRC_DIR], args[DST_DIR],
+                                  "SingleByte-X.java.template");
+                    break;
+                case "source":
+                    break;                   // source file, do nothing
+                default:                     // dbcs
+                    DBCS.genClass("dbcs".equals(cs.type) ?
+                                      "" :  "_" + cs.type.toUpperCase(Locale.ENGLISH),
+                                  cs, args[SRC_DIR], args[DST_DIR],
+                                  "DoubleByte-X.java.template");
+                }
+            }
+            // provider StandardCharsets.java / ExtendedCharsets.java
+            SPI.genClass(args[TYPE], charsets, args[SRC_DIR], args[DST_DIR], args[TEMPLATE]);
+
+            // HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
+            if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
+                HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
+                                   isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
+            }
+            if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
+                HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
+                                 isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
+            }
+        } else if ("euctw".equals(args[TYPE])) {
             EUC_TW.genClass(args);
-        } else if ("sjis0213".equals(args[2])) {
+        } else if ("sjis0213".equals(args[TYPE])) {
             JIS0213.genClass(args);
-        } else if ("hkscs".equals(args[2])) {
-            HKSCS.genClass(args);
+        } else if ("hkscs".equals(args[TYPE])) {
+            HKSCS.genClass2001(args);
         }
     }
+
+    private static LinkedHashMap<String, Charset> getCharsets(File cslist)
+        throws Throwable
+    {
+        LinkedHashMap<String, Charset> charsets = new LinkedHashMap<>();
+        try (Scanner s = new Scanner(cslist)) {
+            Charset cs = null;
+            ArrayList<String> names = new ArrayList<>();
+            while (s.hasNextLine()) {
+                String line = s.nextLine();
+                if (line.startsWith("#") || line.length() == 0) {
+                    continue;
+                }
+                String[] tokens = line.split("\\s+");
+                if (tokens.length < 2) {
+                    continue;
+                }
+                if ("charset".equals(tokens[0])) {
+                    if (cs != null) {
+                        cs.aliases = names.toArray(new String[names.size()]);
+                        charsets.put(cs.clzName, cs);
+                        cs = null;
+                        names.clear();
+                    }
+                    if (tokens.length < 3) {
+                        throw new RuntimeException("Error: incorrect charset line [" + line + "]");
+                    }
+                    if ((cs = charsets.get(tokens[2])) != null) {
+                        throw new RuntimeException("Error: deplicate charset line [" + line + "]");
+                    }
+                    cs = new Charset();
+                    cs.csName = tokens[1];
+                    cs.clzName = tokens[2];
+                } else {
+                    String key = tokens[1];           // leading empty str
+                    switch (key) {
+                    case "alias":
+                        if (tokens.length < 3) {
+                            throw new RuntimeException("Error: incorrect alias line [" + line + "]");
+                        } else if (names != null) {
+                            names.add(tokens[2]);     // ALIAS_NAME
+                        }
+                        break;
+                    case "package":
+                        cs.pkgName = tokens[2];
+                        break;
+                    case "type":
+                        cs.type = tokens[2];
+                        break;
+                    case "hisname":
+                        cs.hisName = tokens[2];
+                        break;
+                    case "ascii":
+                        cs.isASCII = Boolean.parseBoolean(tokens[2]);
+                        break;
+                    case "minmax":
+                        cs.b1Min = toInteger(tokens[2]);
+                        cs.b1Max = toInteger(tokens[3]);
+                        cs.b2Min = toInteger(tokens[4]);
+                        cs.b2Max = toInteger(tokens[5]);
+                        break;
+                    case "internal":
+                        cs.isInternal = Boolean.parseBoolean(tokens[2]);
+                        break;
+                    default:  // ignore
+                    }
+                }
+            }
+            if (cs != null) {
+                cs.aliases = names.toArray(new String[names.size()]);
+                charsets.put(cs.clzName, cs);
+            }
+        }
+        return charsets;
+    }
+
+    private static String[] getOSStdCSList(File stdcsos) throws Throwable
+    {
+        ArrayList<String> names = new ArrayList<>();
+        if (stdcsos.exists()) {
+            try (Scanner s = new Scanner(stdcsos)) {
+                while (s.hasNextLine()) {
+                    String line = s.nextLine();
+                    int i = line.indexOf('#');
+                    if (i != -1) {
+                        line = line.substring(0, i);
+                    }
+                    line = line.trim();
+                    if (line.length() != 0) {
+                        names.add(line);
+                    }
+                }
+            }
+        }
+        return names.toArray(new String[names.size()]);
+    }
+
+    static void verbose(Charset cs) {
+         System.out.printf("%s, %s, %s, %s, %s  %b%n",
+                           cs.clzName, cs.csName, cs.hisName, cs.pkgName, cs.type, cs.isASCII);
+    }
+
+    static int toInteger(String s) {
+        return (s.startsWith("0x") || s.startsWith("0X"))
+               ? Integer.valueOf(s.substring(2), 16)
+               : Integer.valueOf(s);
+    }
 }
--- a/jdk/make/src/classes/build/tools/charsetmapping/SBCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/charsetmapping/SBCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,93 +30,23 @@
 import java.util.ArrayList;
 import java.util.Scanner;
 import java.util.Formatter;
-import java.util.regex.*;
-import java.nio.charset.*;
+import java.util.regex.Pattern;
 import static build.tools.charsetmapping.Utils.*;
 
 public class SBCS {
 
-    public static void genClass(String args[]) throws Exception {
-
-        Scanner s = new Scanner(new File(args[0], args[2]));
-        while (s.hasNextLine()) {
-            String line = s.nextLine();
-            if (line.startsWith("#") || line.length() == 0)
-                continue;
-            String[] fields = line.split("\\s+");
-            if (fields.length < 5) {
-                System.err.println("Misconfiged sbcs line <" + line + ">?");
-                continue;
-            }
-            String clzName = fields[0];
-            String csName  = fields[1];
-            String hisName = fields[2];
-            boolean isASCII = Boolean.valueOf(fields[3]);
-            String pkgName  = fields[4];
-            System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
-
-            genClass0(args[0], args[1], "SingleByte-X.java.template",
-                      clzName, csName, hisName, pkgName, isASCII);
-        }
-    }
-
-    private static void toString(char[] sb, int off, int end,
-                                 Formatter out, String closure,
-                                 boolean comment) {
-        while (off < end) {
-            out.format("        \"");
-            for (int j = 0; j < 8; j++) {
-                if (off == end)
-                    break;
-                char c = sb[off++];
-                switch (c) {
-                case '\b':
-                    out.format("\\b"); break;
-                case '\t':
-                    out.format("\\t"); break;
-                case '\n':
-                    out.format("\\n"); break;
-                case '\f':
-                    out.format("\\f"); break;
-                case '\r':
-                    out.format("\\r"); break;
-                case '\"':
-                    out.format("\\\""); break;
-                case '\'':
-                    out.format("\\'"); break;
-                case '\\':
-                    out.format("\\\\"); break;
-                default:
-                    out.format("\\u%04X", c & 0xffff);
-                }
-            }
-            if (comment) {
-                if (off == end)
-                    out.format("\" %s      // 0x%02x - 0x%02x%n",
-                               closure, off-8, off-1);
-                else
-                    out.format("\" +      // 0x%02x - 0x%02x%n",
-                               off-8, off-1);
-            } else {
-                if (off == end)
-                    out.format("\"%s%n", closure);
-                else
-                    out.format("\" +%n");
-            }
-        }
-    }
-
     static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++(?:U\\+|0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
 
-    private static void genClass0(String srcDir, String dstDir,
-                                  String template,
-                                  String clzName,
-                                  String csName,
-                                  String hisName,
-                                  String pkgName,
-                                  boolean isASCII)
+    public static void genClass(Charset cs,
+                                String srcDir, String dstDir, String template)
         throws Exception
     {
+        String clzName = cs.clzName;
+        String csName  = cs.csName;
+        String hisName = cs.hisName;
+        String pkgName = cs.pkgName;
+        boolean isASCII = cs.isASCII;
+
         StringBuilder b2cSB = new StringBuilder();
         StringBuilder b2cNRSB = new StringBuilder();
         StringBuilder c2bNRSB = new StringBuilder();
@@ -266,4 +196,50 @@
         }
         out.close();
     }
+
+    private static void toString(char[] sb, int off, int end,
+                                 Formatter out, String closure, boolean comment)
+    {
+        while (off < end) {
+            out.format("        \"");
+            for (int j = 0; j < 8; j++) {
+                if (off == end)
+                    break;
+                char c = sb[off++];
+                switch (c) {
+                case '\b':
+                    out.format("\\b"); break;
+                case '\t':
+                    out.format("\\t"); break;
+                case '\n':
+                    out.format("\\n"); break;
+                case '\f':
+                    out.format("\\f"); break;
+                case '\r':
+                    out.format("\\r"); break;
+                case '\"':
+                    out.format("\\\""); break;
+                case '\'':
+                    out.format("\\'"); break;
+                case '\\':
+                    out.format("\\\\"); break;
+                default:
+                    out.format("\\u%04X", c & 0xffff);
+                }
+            }
+            if (comment) {
+                if (off == end)
+                    out.format("\" %s      // 0x%02x - 0x%02x%n",
+                               closure, off-8, off-1);
+                else
+                    out.format("\" +      // 0x%02x - 0x%02x%n",
+                               off-8, off-1);
+            } else {
+                if (off == end)
+                    out.format("\"%s%n", closure);
+                else
+                    out.format("\" +%n");
+            }
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/charsetmapping/SPI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.charsetmapping;
+
+import java.io.*;
+import java.util.Locale;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Scanner;
+
+public class SPI {
+
+    public static void genClass(String type, LinkedHashMap<String, Charset> charsets,
+                                String srcDir, String dstDir, String template)
+        throws Exception
+    {
+        try (Scanner s = new Scanner(new File(template));
+             PrintStream out = new PrintStream(new FileOutputStream(
+                 new File(dstDir, new File(
+                     template.replace(".template", "")).getName()))); ) {
+            if (type.startsWith("extcs")) {           // ExtendedCharsets.java
+                while (s.hasNextLine()) {
+                    String line = s.nextLine();
+                    if (line.indexOf("_CHARSETS_DEF_LIST_") == -1) {
+                        out.println(line);
+                    } else {
+                        charsets.values()
+                                .stream()
+                                .filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") &&
+                                              !cs.isInternal)
+                                .forEach( cs -> {
+                            out.printf("        charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName);
+                            out.printf("                new String[] {%n");
+                            for (String alias : cs.aliases) {
+                                out.printf("                    \"%s\",%n", alias);
+                            }
+                            out.printf("                });%n%n");
+                        });
+                    }
+                }
+            } else if (type.startsWith("stdcs")) {    // StandardCharsets.java
+                 ArrayList<String> aliasKeys = new ArrayList<>();
+                 ArrayList<String> aliasValues = new ArrayList<>();
+                 ArrayList<String> clzKeys = new ArrayList<>();
+                 ArrayList<String> clzValues = new ArrayList<>();
+                 charsets.values()
+                         .stream()
+                         .filter(cs -> cs.pkgName.equals("sun.nio.cs") &&
+                                       !cs.isInternal)
+                         .forEach( cs -> {
+                     String csname = cs.csName.toLowerCase(Locale.ENGLISH);
+                     clzKeys.add(csname);
+                     clzValues.add("\"" + cs.clzName + "\"");
+                     if (cs.aliases != null) {
+                         csname = "\"" + csname + "\"";
+                         for (String alias : cs.aliases) {
+                             aliasKeys.add(alias.toLowerCase(Locale.ENGLISH));
+                             aliasValues.add(csname);
+                         }
+                     }
+                 });
+                 while (s.hasNextLine()) {
+                     String line = s.nextLine();
+                     if (line.indexOf("_INCLUDE_ALIASES_TABLES_") != -1) {
+                         charsets.values()
+                                 .stream()
+                                 .filter(cs -> cs.pkgName.equals("sun.nio.cs"))
+                                 .forEach( cs -> {
+                             if (cs.aliases == null || cs.aliases.length == 0) {
+                                 out.printf("    static final String[] aliases_%s = null;%n%n",
+                                            cs.clzName);
+                             } else {
+                                 // non-final for SJIS and MS932 to support sun.nio.cs.map
+                                 if (cs.clzName.equals("SJIS") || cs.clzName.equals("MS932")) {
+                                     out.printf("    static String[] aliases_%s = new String[] {%n",
+                                                cs.clzName);
+                                 } else {
+                                     out.printf("    static final String[] aliases_%s = new String[] {%n",
+                                                cs.clzName);
+                                 }
+                                 for (String alias : cs.aliases) {
+                                     out.printf("        \"%s\",%n", alias);
+                                 }
+                                 out.printf("    };%n%n");
+                             }
+                         });
+                         Charset cs = charsets.get("SJIS");
+                         if (cs == null || cs.pkgName.equals("sun.nio.cs.ext")) {
+                              // StandardCharsets.java has explicit reference
+                              // to aliases_SJIS/MS932. If we don't have these
+                              // two in std, just put a pair of dummy fields to
+                              // make the compiler happy.
+                              out.printf("    static String[] aliases_SJIS = null;%n%n");
+                              out.printf("    static String[] aliases_MS932 = null;%n%n");
+                         }
+                     } else if (line.indexOf("_INCLUDE_ALIASES_MAP_") != -1) {
+                         Hasher.genClass(out, aliasKeys, aliasValues,
+                                         null, "Aliases", "String",
+                                         11, 3, true, false, false);
+                     } else if (line.indexOf("_INCLUDE_CLASSES_MAP_") != -1) {
+                         Hasher.genClass(out, clzKeys, clzValues,
+                                         null, "Classes", "String",
+                                         11, 3, true, false, false);
+                     } else if (line.indexOf("_INCLUDE_CACHE_MAP_") != -1) {
+                         Hasher.genClass(out, clzKeys, clzValues,
+                                         null, "Cache", "Charset",
+                                         11, 3, true, true, false);
+                     } else {
+                         out.println(line);
+                     }
+                }
+            } else {
+                throw new RuntimeException("Unknown type:" + type);
+            }
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/charsetmapping/SRC.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.charsetmapping;
+
+import java.io.*;
+import java.util.Scanner;
+
+public class SRC {
+
+    public static void genClass(Charset cs, String srcDir, String dstDir)
+        throws Exception
+    {
+        String clzName = cs.clzName;
+        String csName  = cs.csName;
+        String pkgName = cs.pkgName;
+
+        try (Scanner s = new Scanner(new File(srcDir, clzName + ".java.template"));
+             PrintStream out = new PrintStream(new FileOutputStream(
+                                  new File(dstDir, clzName + ".java")));) {
+            while (s.hasNextLine()) {
+                String line = s.nextLine();
+                if (line.indexOf("$") < 0) {
+                    out.println(line);
+                    continue;
+                }
+                if (line.indexOf("$PACKAGE$") != -1) {
+                    out.println(line.replace("$PACKAGE$", pkgName));
+                } else if (line.indexOf("$ALIASES$") != -1) {
+                    if ("sun.nio.cs".equals(pkgName))
+                        out.println(line.replace("$ALIASES$",
+                                                 "StandardCharsets.aliases_" + clzName));
+                    else
+                        out.println(line.replace("$ALIASES$",
+                                                 "ExtendedCharsets.aliasesFor(\"" + csName + "\")"));
+                } else {
+                    out.println(line);
+                }
+            }
+        }
+    }
+}
--- a/jdk/make/src/classes/build/tools/module/boot.modules	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/module/boot.modules	Wed Jul 05 20:20:43 2017 +0200
@@ -1,7 +1,7 @@
 java.base
+java.compiler
+java.datatransfer
 java.desktop
-java.compiler
-java.corba
 java.instrument
 java.logging
 java.management
@@ -14,7 +14,6 @@
 java.smartcardio
 java.sql
 java.sql.rowset
-java.transaction
 java.xml
 java.xml.crypto
 jdk.charsets
@@ -22,9 +21,9 @@
 jdk.deploy.osx
 jdk.hprof.agent
 jdk.httpserver
+jdk.jfr
 jdk.naming.rmi
 jdk.sctp
 jdk.security.auth
 jdk.security.jgss
-jdk.jfr
 jdk.snmp
--- a/jdk/make/src/classes/build/tools/module/ext.modules	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/make/src/classes/build/tools/module/ext.modules	Wed Jul 05 20:20:43 2017 +0200
@@ -1,7 +1,10 @@
 java.activation
 java.annotations.common
+java.corba
+java.transaction
 java.xml.bind
 java.xml.ws
+jdk.accessbridge
 jdk.crypto.ec
 jdk.crypto.mscapi
 jdk.crypto.pkcs11
@@ -10,4 +13,3 @@
 jdk.naming.dns
 jdk.scripting.nashorn
 jdk.zipfs
-jdk.accessbridge
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Wed Jul 05 20:20:43 2017 +0200
@@ -31,7 +31,6 @@
 import sun.invoke.util.VerifyAccess;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodTypeForm.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import java.lang.ref.WeakReference;
@@ -693,4 +692,10 @@
             }
         }
     }
+
+    @Override
+    void customize() {
+        assert(form.customized == null);
+        // No need to customize DMHs.
+    }
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Wed Jul 05 20:20:43 2017 +0200
@@ -285,6 +285,7 @@
         // Forward the SAM method
         MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, samMethodName,
                                           samMethodType.toMethodDescriptorString(), null, null);
+        mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
         new ForwardingMethodGenerator(mv).generate(samMethodType);
 
         // Forward the bridges
@@ -292,6 +293,7 @@
             for (MethodType mt : additionalBridges) {
                 mv = cw.visitMethod(ACC_PUBLIC|ACC_BRIDGE, samMethodName,
                                     mt.toMethodDescriptorString(), null, null);
+                mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
                 new ForwardingMethodGenerator(mv).generate(mt);
             }
         }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Jul 05 20:20:43 2017 +0200
@@ -56,9 +56,11 @@
     private static final String OBJ     = "java/lang/Object";
     private static final String OBJARY  = "[Ljava/lang/Object;";
 
+    private static final String MH_SIG  = "L" + MH + ";";
     private static final String LF_SIG  = "L" + LF + ";";
     private static final String LFN_SIG = "L" + LFN + ";";
     private static final String LL_SIG  = "(L" + OBJ + ";)L" + OBJ + ";";
+    private static final String LLV_SIG = "(L" + OBJ + ";L" + OBJ + ";)V";
     private static final String CLL_SIG = "(L" + CLS + ";L" + OBJ + ";)L" + OBJ + ";";
 
     /** Name of its super class*/
@@ -616,6 +618,15 @@
         return g.loadMethod(g.generateCustomizedCodeBytes());
     }
 
+    /** Generates code to check that actual receiver and LambdaForm matches */
+    private boolean checkActualReceiver() {
+        // Expects MethodHandle on the stack and actual receiver MethodHandle in slot #0
+        mv.visitInsn(Opcodes.DUP);
+        mv.visitVarInsn(Opcodes.ALOAD, localsMap[0]);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, MHI, "assertSame", LLV_SIG, false);
+        return true;
+    }
+
     /**
      * Generate an invoker method for the passed {@link LambdaForm}.
      */
@@ -635,6 +646,16 @@
             mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
         }
 
+        if (lambdaForm.customized != null) {
+            // Since LambdaForm is customized for a particular MethodHandle, it's safe to substitute
+            // receiver MethodHandle (at slot #0) with an embedded constant and use it instead.
+            // It enables more efficient code generation in some situations, since embedded constants
+            // are compile-time constants for JIT compiler.
+            mv.visitLdcInsn(constantPlaceholder(lambdaForm.customized));
+            mv.visitTypeInsn(Opcodes.CHECKCAST, MH);
+            assert(checkActualReceiver()); // expects MethodHandle on top of the stack
+            mv.visitVarInsn(Opcodes.ASTORE, localsMap[0]);
+        }
 
         // iterate over the form's names, generating bytecode instructions for each
         // start iterating at the first name following the arguments
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Wed Jul 05 20:20:43 2017 +0200
@@ -247,6 +247,7 @@
         int nameCursor = OUTARG_LIMIT;
         final int MTYPE_ARG    = customized ? -1 : nameCursor++;  // might be last in-argument
         final int CHECK_TYPE   = nameCursor++;
+        final int CHECK_CUSTOM = (CUSTOMIZE_THRESHOLD >= 0) ? nameCursor++ : -1;
         final int LINKER_CALL  = nameCursor++;
         MethodType invokerFormType = mtype.invokerType();
         if (isLinker) {
@@ -279,6 +280,9 @@
             // mh.invokeGeneric(a*):R => checkGenericType(mh, TYPEOF(a*:R)).invokeBasic(a*)
             outArgs[0] = names[CHECK_TYPE];
         }
+        if (CHECK_CUSTOM != -1) {
+            names[CHECK_CUSTOM] = new Name(NF_checkCustomized, names[CALL_MH]);
+        }
         names[LINKER_CALL] = new Name(outCallType, outArgs);
         lform = new LambdaForm(debugName, INARG_LIMIT, names);
         if (isLinker)
@@ -386,11 +390,32 @@
         return ((CallSite)site).getTarget();
     }
 
+    /*non-public*/ static
+    @ForceInline
+    void checkCustomized(Object o) {
+        MethodHandle mh = (MethodHandle)o;
+        if (mh.form.customized == null) {
+            maybeCustomize(mh);
+        }
+    }
+
+    /*non-public*/ static
+    @DontInline
+    void maybeCustomize(MethodHandle mh) {
+        byte count = mh.customizationCount;
+        if (count >= CUSTOMIZE_THRESHOLD) {
+            mh.customize();
+        } else {
+            mh.customizationCount = (byte)(count+1);
+        }
+    }
+
     // Local constant functions:
     private static final NamedFunction
         NF_checkExactType,
         NF_checkGenericType,
-        NF_getCallSiteTarget;
+        NF_getCallSiteTarget,
+        NF_checkCustomized;
     static {
         try {
             NamedFunction nfs[] = {
@@ -399,7 +424,9 @@
                 NF_checkGenericType = new NamedFunction(Invokers.class
                         .getDeclaredMethod("checkGenericType", Object.class, Object.class)),
                 NF_getCallSiteTarget = new NamedFunction(Invokers.class
-                        .getDeclaredMethod("getCallSiteTarget", Object.class))
+                        .getDeclaredMethod("getCallSiteTarget", Object.class)),
+                NF_checkCustomized = new NamedFunction(Invokers.class
+                        .getDeclaredMethod("checkCustomized", Object.class))
             };
             for (NamedFunction nf : nfs) {
                 // Each nf must be statically invocable or we get tied up in our bootstraps.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Wed Jul 05 20:20:43 2017 +0200
@@ -120,12 +120,14 @@
     final int arity;
     final int result;
     final boolean forceInline;
+    final MethodHandle customized;
     @Stable final Name[] names;
     final String debugName;
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
 
-    volatile Object transformCache;  // managed by LambdaFormEditor
+    // Either a LambdaForm cache (managed by LambdaFormEditor) or a link to uncustomized version (for customized LF)
+    volatile Object transformCache;
 
     public static final int VOID_RESULT = -1, LAST_RESULT = -2;
 
@@ -244,16 +246,17 @@
 
     LambdaForm(String debugName,
                int arity, Name[] names, int result) {
-        this(debugName, arity, names, result, true);
+        this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null);
     }
     LambdaForm(String debugName,
-               int arity, Name[] names, int result, boolean forceInline) {
+               int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
         assert(namesOK(arity, names));
         this.arity = arity;
         this.result = fixResult(result, names);
         this.names = names.clone();
         this.debugName = fixDebugName(debugName);
         this.forceInline = forceInline;
+        this.customized = customized;
         int maxOutArity = normalize();
         if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
             // Cannot use LF interpreter on very high arity expressions.
@@ -263,21 +266,21 @@
     }
     LambdaForm(String debugName,
                int arity, Name[] names) {
-        this(debugName, arity, names, LAST_RESULT, true);
+        this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
     }
     LambdaForm(String debugName,
                int arity, Name[] names, boolean forceInline) {
-        this(debugName, arity, names, LAST_RESULT, forceInline);
+        this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null);
     }
     LambdaForm(String debugName,
                Name[] formals, Name[] temps, Name result) {
         this(debugName,
-             formals.length, buildNames(formals, temps, result), LAST_RESULT, true);
+             formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
     }
     LambdaForm(String debugName,
                Name[] formals, Name[] temps, Name result, boolean forceInline) {
         this(debugName,
-             formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline);
+             formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*customized=*/null);
     }
 
     private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
@@ -291,10 +294,6 @@
     }
 
     private LambdaForm(String sig) {
-        this(sig, true);
-    }
-
-    private LambdaForm(String sig, boolean forceInline) {
         // Make a blank lambda form, which returns a constant zero or null.
         // It is used as a template for managing the invocation of similar forms that are non-empty.
         // Called only from getPreparedForm.
@@ -303,7 +302,8 @@
         this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
         this.names = buildEmptyNames(arity, sig);
         this.debugName = "LF.zero";
-        this.forceInline = forceInline;
+        this.forceInline = true;
+        this.customized = null;
         assert(nameRefsAreLegal());
         assert(isEmpty());
         assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
@@ -375,6 +375,31 @@
         return true;
     }
 
+    /** Customize LambdaForm for a particular MethodHandle */
+    LambdaForm customize(MethodHandle mh) {
+        LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh);
+        if (COMPILE_THRESHOLD > 0 && isCompiled) {
+            // If shared LambdaForm has been compiled, compile customized version as well.
+            customForm.compileToBytecode();
+        }
+        customForm.transformCache = this; // LambdaFormEditor should always use uncustomized form.
+        return customForm;
+    }
+
+    /** Get uncustomized flavor of the LambdaForm */
+    LambdaForm uncustomize() {
+        if (customized == null) {
+            return this;
+        }
+        assert(transformCache != null); // Customized LambdaForm should always has a link to uncustomized version.
+        LambdaForm uncustomizedForm = (LambdaForm)transformCache;
+        if (COMPILE_THRESHOLD > 0 && isCompiled) {
+            // If customized LambdaForm has been compiled, compile uncustomized version as well.
+            uncustomizedForm.compileToBytecode();
+        }
+        return uncustomizedForm;
+    }
+
     /** Renumber and/or replace params so that they are interned and canonically numbered.
      *  @return maximum argument list length among the names (since we have to pass over them anyway)
      */
@@ -417,8 +442,8 @@
             for (int i = arity; i < names.length; i++) {
                 names[i].internArguments();
             }
-            assert(nameRefsAreLegal());
         }
+        assert(nameRefsAreLegal());
         return maxOutArity;
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Wed Jul 05 20:20:43 2017 +0200
@@ -51,7 +51,10 @@
     static LambdaFormEditor lambdaFormEditor(LambdaForm lambdaForm) {
         // TO DO:  Consider placing intern logic here, to cut down on duplication.
         // lambdaForm = findPreexistingEquivalent(lambdaForm)
-        return new LambdaFormEditor(lambdaForm);
+
+        // Always use uncustomized version for editing.
+        // It helps caching and customized LambdaForms reuse transformCache field to keep a link to uncustomized version.
+        return new LambdaFormEditor(lambdaForm.uncustomize());
     }
 
     /** A description of a cached transform, possibly associated with the result of the transform.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Wed Jul 05 20:20:43 2017 +0200
@@ -434,6 +434,8 @@
     // form is not private so that invokers can easily fetch it
     /*private*/ MethodHandle asTypeCache;
     // asTypeCache is not private so that invokers can easily fetch it
+    /*non-public*/ byte customizationCount;
+    // customizationCount should be accessible from invokers
 
     /**
      * Reports the type of this method handle.
@@ -454,9 +456,9 @@
         type.getClass();  // explicit NPE
         form.getClass();  // explicit NPE
         this.type = type;
-        this.form = form;
+        this.form = form.uncustomize();
 
-        form.prepare();  // TO DO:  Try to delay this step until just before invocation.
+        this.form.prepare();  // TO DO:  Try to delay this step until just before invocation.
     }
 
     /**
@@ -1425,12 +1427,24 @@
      */
     /*non-public*/
     void updateForm(LambdaForm newForm) {
+        assert(newForm.customized == null || newForm.customized == this);
         if (form == newForm)  return;
         newForm.prepare();  // as in MethodHandle.<init>
         UNSAFE.putObject(this, FORM_OFFSET, newForm);
         UNSAFE.fullFence();
     }
 
+    /** Craft a LambdaForm customized for this particular MethodHandle */
+    /*non-public*/
+    void customize() {
+        if (form.customized == null) {
+            LambdaForm newForm = form.customize(this);
+            updateForm(newForm);
+        } else {
+            assert(form.customized == this);
+        }
+    }
+
     private static final long FORM_OFFSET;
     static {
         try {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Jul 05 20:20:43 2017 +0200
@@ -597,6 +597,7 @@
         static final NamedFunction NF_checkSpreadArgument;
         static final NamedFunction NF_guardWithCatch;
         static final NamedFunction NF_throwException;
+        static final NamedFunction NF_profileBoolean;
 
         static final MethodHandle MH_castReference;
         static final MethodHandle MH_selectAlternative;
@@ -614,10 +615,12 @@
                 NF_guardWithCatch      = new NamedFunction(MHI.getDeclaredMethod("guardWithCatch", MethodHandle.class, Class.class,
                                                                                  MethodHandle.class, Object[].class));
                 NF_throwException      = new NamedFunction(MHI.getDeclaredMethod("throwException", Throwable.class));
+                NF_profileBoolean      = new NamedFunction(MHI.getDeclaredMethod("profileBoolean", boolean.class, int[].class));
 
                 NF_checkSpreadArgument.resolve();
                 NF_guardWithCatch.resolve();
                 NF_throwException.resolve();
+                NF_profileBoolean.resolve();
 
                 MH_castReference        = IMPL_LOOKUP.findStatic(MHI, "castReference",
                                             MethodType.methodType(Object.class, Class.class, Object.class));
@@ -697,7 +700,26 @@
     @LambdaForm.Hidden
     static
     MethodHandle selectAlternative(boolean testResult, MethodHandle target, MethodHandle fallback) {
-        return testResult ? target : fallback;
+        if (testResult) {
+            return target;
+        } else {
+            return fallback;
+        }
+    }
+
+    // Intrinsified by C2. Counters are used during parsing to calculate branch frequencies.
+    @LambdaForm.Hidden
+    static
+    boolean profileBoolean(boolean result, int[] counters) {
+        // Profile is int[2] where [0] and [1] correspond to false and true occurrences respectively.
+        int idx = result ? 1 : 0;
+        try {
+            counters[idx] = Math.addExact(counters[idx], 1);
+        } catch (ArithmeticException e) {
+            // Avoid continuous overflow by halving the problematic count.
+            counters[idx] = counters[idx] / 2;
+        }
+        return result;
     }
 
     static
@@ -708,13 +730,18 @@
         assert(test.type().equals(type.changeReturnType(boolean.class)) && fallback.type().equals(type));
         MethodType basicType = type.basicType();
         LambdaForm form = makeGuardWithTestForm(basicType);
-        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
         BoundMethodHandle mh;
-
         try {
-            mh = (BoundMethodHandle)
-                    data.constructor().invokeBasic(type, form,
-                        (Object) test, (Object) profile(target), (Object) profile(fallback));
+            if (PROFILE_GWT) {
+                int[] counts = new int[2];
+                mh = (BoundMethodHandle)
+                        BoundMethodHandle.speciesData_LLLL().constructor().invokeBasic(type, form,
+                                (Object) test, (Object) profile(target), (Object) profile(fallback), counts);
+            } else {
+                mh = (BoundMethodHandle)
+                        BoundMethodHandle.speciesData_LLL().constructor().invokeBasic(type, form,
+                                (Object) test, (Object) profile(target), (Object) profile(fallback));
+            }
         } catch (Throwable ex) {
             throw uncaughtException(ex);
         }
@@ -726,7 +753,7 @@
     static
     MethodHandle profile(MethodHandle target) {
         if (DONT_INLINE_THRESHOLD >= 0) {
-            return makeBlockInlningWrapper(target);
+            return makeBlockInliningWrapper(target);
         } else {
             return target;
         }
@@ -737,8 +764,13 @@
      * Corresponding LambdaForm has @DontInline when compiled into bytecode.
      */
     static
-    MethodHandle makeBlockInlningWrapper(MethodHandle target) {
-        LambdaForm lform = PRODUCE_BLOCK_INLINING_FORM.apply(target);
+    MethodHandle makeBlockInliningWrapper(MethodHandle target) {
+        LambdaForm lform;
+        if (DONT_INLINE_THRESHOLD > 0) {
+            lform = PRODUCE_BLOCK_INLINING_FORM.apply(target);
+        } else {
+            lform = PRODUCE_REINVOKER_FORM.apply(target);
+        }
         return new CountingWrapper(target, lform,
                 PRODUCE_BLOCK_INLINING_FORM, PRODUCE_REINVOKER_FORM,
                                    DONT_INLINE_THRESHOLD);
@@ -800,7 +832,7 @@
             MethodHandle wrapper;
             if (isCounting) {
                 LambdaForm lform;
-                lform = countingFormProducer.apply(target);
+                lform = countingFormProducer.apply(newTarget);
                 wrapper = new CountingWrapper(newTarget, lform, countingFormProducer, nonCountingFormProducer, DONT_INLINE_THRESHOLD);
             } else {
                 wrapper = newTarget; // no need for a counting wrapper anymore
@@ -809,7 +841,8 @@
         }
 
         boolean countDown() {
-            if (count <= 0) {
+            int c = count;
+            if (c <= 1) {
                 // Try to limit number of updates. MethodHandle.updateForm() doesn't guarantee LF update visibility.
                 if (isCounting) {
                     isCounting = false;
@@ -818,7 +851,7 @@
                     return false;
                 }
             } else {
-                --count;
+                count = c - 1;
                 return false;
             }
         }
@@ -856,7 +889,10 @@
         final int GET_TEST     = nameCursor++;
         final int GET_TARGET   = nameCursor++;
         final int GET_FALLBACK = nameCursor++;
+        final int GET_COUNTERS = PROFILE_GWT ? nameCursor++ : -1;
         final int CALL_TEST    = nameCursor++;
+        final int PROFILE      = (GET_COUNTERS != -1) ? nameCursor++ : -1;
+        final int TEST         = nameCursor-1; // previous statement: either PROFILE or CALL_TEST
         final int SELECT_ALT   = nameCursor++;
         final int CALL_TARGET  = nameCursor++;
         assert(CALL_TARGET == SELECT_ALT+1);  // must be true to trigger IBG.emitSelectAlternative
@@ -864,12 +900,16 @@
         MethodType lambdaType = basicType.invokerType();
         Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
 
-        BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
+        BoundMethodHandle.SpeciesData data =
+                (GET_COUNTERS != -1) ? BoundMethodHandle.speciesData_LLLL()
+                                     : BoundMethodHandle.speciesData_LLL();
         names[THIS_MH] = names[THIS_MH].withConstraint(data);
         names[GET_TEST]     = new Name(data.getterFunction(0), names[THIS_MH]);
         names[GET_TARGET]   = new Name(data.getterFunction(1), names[THIS_MH]);
         names[GET_FALLBACK] = new Name(data.getterFunction(2), names[THIS_MH]);
-
+        if (GET_COUNTERS != -1) {
+            names[GET_COUNTERS] = new Name(data.getterFunction(3), names[THIS_MH]);
+        }
         Object[] invokeArgs = Arrays.copyOfRange(names, 0, ARG_LIMIT, Object[].class);
 
         // call test
@@ -877,15 +917,18 @@
         invokeArgs[0] = names[GET_TEST];
         names[CALL_TEST] = new Name(testType, invokeArgs);
 
+        // profile branch
+        if (PROFILE != -1) {
+            names[PROFILE] = new Name(Lazy.NF_profileBoolean, names[CALL_TEST], names[GET_COUNTERS]);
+        }
         // call selectAlternative
-        names[SELECT_ALT] = new Name(Lazy.MH_selectAlternative, names[CALL_TEST],
-                                     names[GET_TARGET], names[GET_FALLBACK]);
+        names[SELECT_ALT] = new Name(Lazy.MH_selectAlternative, names[TEST], names[GET_TARGET], names[GET_FALLBACK]);
 
         // call target or fallback
         invokeArgs[0] = names[SELECT_ALT];
         names[CALL_TARGET] = new Name(basicType, invokeArgs);
 
-        lform = new LambdaForm("guard", lambdaType.parameterCount(), names);
+        lform = new LambdaForm("guard", lambdaType.parameterCount(), names, /*forceInline=*/true);
 
         return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
     }
@@ -1629,4 +1672,13 @@
         assert(elemType.isPrimitive());
         return Lazy.MH_copyAsPrimitiveArray.bindTo(Wrapper.forPrimitiveType(elemType));
     }
+
+    /*non-public*/ static void assertSame(Object mh1, Object mh2) {
+        if (mh1 != mh2) {
+            String msg = String.format("mh1 != mh2: mh1 = %s (form: %s); mh2 = %s (form: %s)",
+                    mh1, ((MethodHandle)mh1).form,
+                    mh2, ((MethodHandle)mh2).form);
+            throw newInternalError(msg);
+        }
+    }
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java	Wed Jul 05 20:20:43 2017 +0200
@@ -48,9 +48,11 @@
     static final int COMPILE_THRESHOLD;
     static final int DONT_INLINE_THRESHOLD;
     static final int PROFILE_LEVEL;
+    static final boolean PROFILE_GWT;
+    static final int CUSTOMIZE_THRESHOLD;
 
     static {
-        final Object[] values = new Object[7];
+        final Object[] values = new Object[9];
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
@@ -60,6 +62,8 @@
                     values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0);
                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
+                    values[7] = Boolean.parseBoolean(System.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));
+                    values[8] = Integer.getInteger("java.lang.invoke.MethodHandle.CUSTOMIZE_THRESHOLD", 127);
                     return null;
                 }
             });
@@ -70,6 +74,12 @@
         COMPILE_THRESHOLD         = (Integer) values[4];
         DONT_INLINE_THRESHOLD     = (Integer) values[5];
         PROFILE_LEVEL             = (Integer) values[6];
+        PROFILE_GWT               = (Boolean) values[7];
+        CUSTOMIZE_THRESHOLD       = (Integer) values[8];
+
+        if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
+            throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
+        }
     }
 
     /** Tell if any of the debugging switches are turned on.
--- a/jdk/src/java.base/share/classes/java/nio/channels/Pipe.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/channels/Pipe.java	Wed Jul 05 20:20:43 2017 +0200
@@ -35,7 +35,7 @@
  * <p> A pipe consists of a pair of channels: A writable {@link
  * Pipe.SinkChannel sink} channel and a readable {@link Pipe.SourceChannel source}
  * channel.  Once some bytes are written to the sink channel they can be read
- * from source channel in exactlyAthe order in which they were written.
+ * from the source channel in exactly the order in which they were written.
  *
  * <p> Whether or not a thread writing bytes to a pipe will block until another
  * thread reads those bytes, or some previously-written bytes, from the pipe is
--- a/jdk/src/java.base/share/classes/java/security/AccessControlContext.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/AccessControlContext.java	Wed Jul 05 20:20:43 2017 +0200
@@ -172,9 +172,24 @@
     public AccessControlContext(AccessControlContext acc,
                                 DomainCombiner combiner) {
 
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
+        this(acc, combiner, false);
+    }
+
+    /**
+     * package private to allow calls from ProtectionDomain without performing
+     * the security check for {@linkplain SecurityConstants.CREATE_ACC_PERMISSION}
+     * permission
+     */
+    AccessControlContext(AccessControlContext acc,
+                        DomainCombiner combiner,
+                        boolean preauthorized) {
+        if (!preauthorized) {
+            SecurityManager sm = System.getSecurityManager();
+            if (sm != null) {
+                sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
+                this.isAuthorized = true;
+            }
+        } else {
             this.isAuthorized = true;
         }
 
--- a/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
@@ -60,35 +59,44 @@
  */
 
 public class ProtectionDomain {
+    private static class JavaSecurityAccessImpl implements JavaSecurityAccess {
+
+        private JavaSecurityAccessImpl() {
+        }
+
+        @Override
+        public <T> T doIntersectionPrivilege(
+                PrivilegedAction<T> action,
+                final AccessControlContext stack,
+                final AccessControlContext context) {
+            if (action == null) {
+                throw new NullPointerException();
+            }
+
+            return AccessController.doPrivileged(
+                action,
+                getCombinedACC(context, stack)
+            );
+        }
+
+        @Override
+        public <T> T doIntersectionPrivilege(
+                PrivilegedAction<T> action,
+                AccessControlContext context) {
+            return doIntersectionPrivilege(action,
+                AccessController.getContext(), context);
+        }
+
+        private static AccessControlContext getCombinedACC(AccessControlContext context, AccessControlContext stack) {
+            AccessControlContext acc = new AccessControlContext(context, stack.getCombiner(), true);
+
+            return new AccessControlContext(stack.getContext(), acc).optimize();
+        }
+    }
 
     static {
         // Set up JavaSecurityAccess in SharedSecrets
-        SharedSecrets.setJavaSecurityAccess(
-            new JavaSecurityAccess() {
-                public <T> T doIntersectionPrivilege(
-                    PrivilegedAction<T> action,
-                    final AccessControlContext stack,
-                    final AccessControlContext context)
-                {
-                    if (action == null) {
-                        throw new NullPointerException();
-                    }
-                    return AccessController.doPrivileged(
-                        action,
-                        new AccessControlContext(
-                            stack.getContext(), context).optimize()
-                    );
-                }
-
-                public <T> T doIntersectionPrivilege(
-                    PrivilegedAction<T> action,
-                    AccessControlContext context)
-                {
-                    return doIntersectionPrivilege(action,
-                        AccessController.getContext(), context);
-                }
-            }
-       );
+        SharedSecrets.setJavaSecurityAccess(new JavaSecurityAccessImpl());
     }
 
     /* CodeSource */
--- a/jdk/src/java.base/share/classes/java/util/ComparableTimSort.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/ComparableTimSort.java	Wed Jul 05 20:20:43 2017 +0200
@@ -144,6 +144,10 @@
          * large) stack lengths for smaller arrays.  The "magic numbers" in the
          * computation below must be changed if MIN_MERGE is decreased.  See
          * the MIN_MERGE declaration above for more information.
+         * The maximum value of 49 allows for an array up to length
+         * Integer.MAX_VALUE-4, if array is filled by the worst case stack size
+         * increasing scenario. More explanations are given in section 4 of:
+         * http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
          */
         int stackLen = (len <    120  ?  5 :
                         len <   1542  ? 10 :
--- a/jdk/src/java.base/share/classes/java/util/Formattable.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Formattable.java	Wed Jul 05 20:20:43 2017 +0200
@@ -36,14 +36,14 @@
  * For example, the following class prints out different representations of a
  * stock's name depending on the flags and length constraints:
  *
- * {@code
+ * <pre> {@code
  *   import java.nio.CharBuffer;
  *   import java.util.Formatter;
  *   import java.util.Formattable;
  *   import java.util.Locale;
  *   import static java.util.FormattableFlags.*;
  *
- *  ...
+ *   ...
  *
  *   public class StockName implements Formattable {
  *       private String symbol, companyName, frenchCompanyName;
@@ -89,12 +89,12 @@
  *           return String.format("%s - %s", symbol, companyName);
  *       }
  *   }
- * }
+ * }</pre>
  *
  * <p> When used in conjunction with the {@link java.util.Formatter}, the above
  * class produces the following output for various format strings.
  *
- * {@code
+ * <pre> {@code
  *   Formatter fmt = new Formatter();
  *   StockName sn = new StockName("HUGE", "Huge Fruit, Inc.",
  *                                "Fruit Titanesque, Inc.");
@@ -104,7 +104,7 @@
  *   fmt.format("%-10.8s", sn);              //   -> "HUGE      "
  *   fmt.format("%.12s", sn);                //   -> "Huge Fruit,*"
  *   fmt.format(Locale.FRANCE, "%25s", sn);  //   -> "   Fruit Titanesque, Inc."
- * }
+ * }</pre>
  *
  * <p> Formattables are not necessarily safe for multithreaded access.  Thread
  * safety is optional and may be enforced by classes that extend and implement
--- a/jdk/src/java.base/share/classes/java/util/Optional.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/Optional.java	Wed Jul 05 20:20:43 2017 +0200
@@ -38,8 +38,8 @@
  * <p>Additional methods that depend on the presence or absence of a contained
  * value are provided, such as {@link #orElse(java.lang.Object) orElse()}
  * (return a default value if value not present) and
- * {@link #ifPresent(java.util.function.Consumer) ifPresent()} (execute a block
- * of code if the value is present).
+ * {@link #ifPresent(java.util.function.Consumer) ifPresent()} (perform an
+ * action if the value is present).
  *
  * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
  * class; use of identity-sensitive operations (including reference equality
@@ -148,16 +148,35 @@
     }
 
     /**
-     * If a value is present, invoke the specified consumer with the value,
+     * If a value is present, perform the given action with the value,
      * otherwise do nothing.
      *
-     * @param consumer block to be executed if a value is present
-     * @throws NullPointerException if value is present and {@code consumer} is
+     * @param action the action to be performed if a value is present
+     * @throws NullPointerException if a value is present and {@code action} is
      * null
      */
-    public void ifPresent(Consumer<? super T> consumer) {
+    public void ifPresent(Consumer<? super T> action) {
         if (value != null) {
-            consumer.accept(value);
+            action.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present, perform the given action with the value,
+     * otherwise perform the given empty-based action.
+     *
+     * @param action the action to be performed if a value is present
+     * @param emptyAction the empty-based action to be performed if a value is
+     * not present
+     * @throws NullPointerException if a value is present and {@code action} is
+     * null, or a value is not present and {@code emptyAction} is null.
+     * @since 1.9
+     */
+    public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) {
+        if (value != null) {
+            action.accept(value);
+        } else {
+            emptyAction.run();
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/util/OptionalDouble.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalDouble.java	Wed Jul 05 20:20:43 2017 +0200
@@ -37,8 +37,8 @@
  * <p>Additional methods that depend on the presence or absence of a contained
  * value are provided, such as {@link #orElse(double) orElse()}
  * (return a default value if value not present) and
- * {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (execute a block
- * of code if the value is present).
+ * {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (perform an
+ * action if the value is present).
  *
  * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
  * class; use of identity-sensitive operations (including reference equality
@@ -131,16 +131,35 @@
     }
 
     /**
-     * Have the specified consumer accept the value if a value is present,
+     * If a value is present, perform the given action with the value,
      * otherwise do nothing.
      *
-     * @param consumer block to be executed if a value is present
-     * @throws NullPointerException if value is present and {@code consumer} is
+     * @param action the action to be performed if a value is present
+     * @throws NullPointerException if a value is present and {@code action} is
      * null
      */
-    public void ifPresent(DoubleConsumer consumer) {
+    public void ifPresent(DoubleConsumer action) {
         if (isPresent) {
-            consumer.accept(value);
+            action.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present, perform the given action with the value,
+     * otherwise perform the given empty-based action.
+     *
+     * @param action the action to be performed if a value is present
+     * @param emptyAction the empty-based action to be performed if a value is
+     * not present
+     * @throws NullPointerException if a value is present and {@code action} is
+     * null, or a value is not present and {@code emptyAction} is null.
+     * @since 1.9
+     */
+    public void ifPresentOrElse(DoubleConsumer action, Runnable emptyAction) {
+        if (isPresent) {
+            action.accept(value);
+        } else {
+            emptyAction.run();
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/util/OptionalInt.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalInt.java	Wed Jul 05 20:20:43 2017 +0200
@@ -37,8 +37,8 @@
  * <p>Additional methods that depend on the presence or absence of a contained
  * value are provided, such as {@link #orElse(int) orElse()}
  * (return a default value if value not present) and
- * {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (execute a block
- * of code if the value is present).
+ * {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (perform an
+ * action if the value is present).
  *
  * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
  * class; use of identity-sensitive operations (including reference equality
@@ -131,16 +131,35 @@
     }
 
     /**
-     * Have the specified consumer accept the value if a value is present,
+     * If a value is present, perform the given action with the value,
      * otherwise do nothing.
      *
-     * @param consumer block to be executed if a value is present
-     * @throws NullPointerException if value is present and {@code consumer} is
+     * @param action the action to be performed if a value is present
+     * @throws NullPointerException if value is present and {@code action} is
      * null
      */
-    public void ifPresent(IntConsumer consumer) {
+    public void ifPresent(IntConsumer action) {
         if (isPresent) {
-            consumer.accept(value);
+            action.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present, perform the given action with the value,
+     * otherwise perform the given empty-based action.
+     *
+     * @param action the action to be performed if a value is present
+     * @param emptyAction the empty-based action to be performed if a value is
+     * not present
+     * @throws NullPointerException if a value is present and {@code action} is
+     * null, or a value is not present and {@code emptyAction} is null.
+     * @since 1.9
+     */
+    public void ifPresentOrElse(IntConsumer action, Runnable emptyAction) {
+        if (isPresent) {
+            action.accept(value);
+        } else {
+            emptyAction.run();
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/util/OptionalLong.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/OptionalLong.java	Wed Jul 05 20:20:43 2017 +0200
@@ -37,8 +37,8 @@
  * <p>Additional methods that depend on the presence or absence of a contained
  * value are provided, such as {@link #orElse(long) orElse()}
  * (return a default value if value not present) and
- * {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (execute a block
- * of code if the value is present).
+ * {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (perform an
+ * action if the value is present).
  *
  * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
  * class; use of identity-sensitive operations (including reference equality
@@ -131,16 +131,35 @@
     }
 
     /**
-     * Have the specified consumer accept the value if a value is present,
+     * If a value is present, perform the given action with the value,
      * otherwise do nothing.
      *
-     * @param consumer block to be executed if a value is present
-     * @throws NullPointerException if value is present and {@code consumer} is
+     * @param action the action to be performed if a value is present
+     * @throws NullPointerException if a value is present and {@code action} is
      * null
      */
-    public void ifPresent(LongConsumer consumer) {
+    public void ifPresent(LongConsumer action) {
         if (isPresent) {
-            consumer.accept(value);
+            action.accept(value);
+        }
+    }
+
+    /**
+     * If a value is present, perform the given action with the value,
+     * otherwise perform the given empty-based action.
+     *
+     * @param action the action to be performed if a value is present
+     * @param emptyAction the empty-based action to be performed if a value is
+     * not present
+     * @throws NullPointerException if a value is present and {@code action} is
+     * null, or a value is not present and {@code emptyAction} is null.
+     * @since 1.9
+     */
+    public void ifPresentOrElse(LongConsumer action, Runnable emptyAction) {
+        if (isPresent) {
+            action.accept(value);
+        } else {
+            emptyAction.run();
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/util/TimSort.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/TimSort.java	Wed Jul 05 20:20:43 2017 +0200
@@ -174,6 +174,10 @@
          * large) stack lengths for smaller arrays.  The "magic numbers" in the
          * computation below must be changed if MIN_MERGE is decreased.  See
          * the MIN_MERGE declaration above for more information.
+         * The maximum value of 49 allows for an array up to length
+         * Integer.MAX_VALUE-4, if array is filled by the worst case stack size
+         * increasing scenario. More explanations are given in section 4 of:
+         * http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
          */
         int stackLen = (len <    120  ?  5 :
                         len <   1542  ? 10 :
--- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java	Wed Jul 05 20:20:43 2017 +0200
@@ -5819,6 +5819,10 @@
 
             MatcherIterator() {
                 this.matcher = matcher(input);
+                // If the input is an empty string then the result can only be a
+                // stream of the input.  Induce that by setting the empty
+                // element count to 1
+                this.emptyElementCount = input.length() == 0 ? 1 : 0;
             }
 
             public String next() {
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Wed Jul 05 20:20:43 2017 +0200
@@ -25,8 +25,8 @@
 
 package sun.misc;
 
-import java.security.*;
-import java.lang.reflect.*;
+import java.lang.reflect.Field;
+import java.security.ProtectionDomain;
 
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
@@ -189,205 +189,39 @@
      * If the reference <code>o</code> is non-null, car marks or
      * other store barriers for that object (if the VM requires them)
      * are updated.
-     * @see #putInt(Object, int, int)
+     * @see #putInt(Object, long, int)
      */
     public native void putObject(Object o, long offset, Object x);
 
     /** @see #getInt(Object, long) */
     public native boolean getBoolean(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putBoolean(Object o, long offset, boolean x);
     /** @see #getInt(Object, long) */
     public native byte    getByte(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putByte(Object o, long offset, byte x);
     /** @see #getInt(Object, long) */
     public native short   getShort(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putShort(Object o, long offset, short x);
     /** @see #getInt(Object, long) */
     public native char    getChar(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putChar(Object o, long offset, char x);
     /** @see #getInt(Object, long) */
     public native long    getLong(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putLong(Object o, long offset, long x);
     /** @see #getInt(Object, long) */
     public native float   getFloat(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putFloat(Object o, long offset, float x);
     /** @see #getInt(Object, long) */
     public native double  getDouble(Object o, long offset);
-    /** @see #putInt(Object, int, int) */
+    /** @see #putInt(Object, long, int) */
     public native void    putDouble(Object o, long offset, double x);
 
-    /**
-     * This method, like all others with 32-bit offsets, was native
-     * in a previous release but is now a wrapper which simply casts
-     * the offset to a long value.  It provides backward compatibility
-     * with bytecodes compiled against 1.4.
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public int getInt(Object o, int offset) {
-        return getInt(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putInt(Object o, int offset, int x) {
-        putInt(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public Object getObject(Object o, int offset) {
-        return getObject(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putObject(Object o, int offset, Object x) {
-        putObject(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public boolean getBoolean(Object o, int offset) {
-        return getBoolean(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putBoolean(Object o, int offset, boolean x) {
-        putBoolean(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public byte getByte(Object o, int offset) {
-        return getByte(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putByte(Object o, int offset, byte x) {
-        putByte(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public short getShort(Object o, int offset) {
-        return getShort(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putShort(Object o, int offset, short x) {
-        putShort(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public char getChar(Object o, int offset) {
-        return getChar(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putChar(Object o, int offset, char x) {
-        putChar(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public long getLong(Object o, int offset) {
-        return getLong(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putLong(Object o, int offset, long x) {
-        putLong(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public float getFloat(Object o, int offset) {
-        return getFloat(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putFloat(Object o, int offset, float x) {
-        putFloat(o, (long)offset, x);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public double getDouble(Object o, int offset) {
-        return getDouble(o, (long)offset);
-    }
-
-    /**
-     * @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
-     * See {@link #staticFieldOffset}.
-     */
-    @Deprecated
-    public void putDouble(Object o, int offset, double x) {
-        putDouble(o, (long)offset, x);
-    }
-
     // These work on values in the C heap.
 
     /**
@@ -579,58 +413,6 @@
     public static final int INVALID_FIELD_OFFSET   = -1;
 
     /**
-     * Returns the offset of a field, truncated to 32 bits.
-     * This method is implemented as follows:
-     * <blockquote><pre>
-     * public int fieldOffset(Field f) {
-     *     if (Modifier.isStatic(f.getModifiers()))
-     *         return (int) staticFieldOffset(f);
-     *     else
-     *         return (int) objectFieldOffset(f);
-     * }
-     * </pre></blockquote>
-     * @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static
-     * fields and {@link #objectFieldOffset} for non-static fields.
-     */
-    @Deprecated
-    public int fieldOffset(Field f) {
-        if (Modifier.isStatic(f.getModifiers()))
-            return (int) staticFieldOffset(f);
-        else
-            return (int) objectFieldOffset(f);
-    }
-
-    /**
-     * Returns the base address for accessing some static field
-     * in the given class.  This method is implemented as follows:
-     * <blockquote><pre>
-     * public Object staticFieldBase(Class c) {
-     *     Field[] fields = c.getDeclaredFields();
-     *     for (int i = 0; i < fields.length; i++) {
-     *         if (Modifier.isStatic(fields[i].getModifiers())) {
-     *             return staticFieldBase(fields[i]);
-     *         }
-     *     }
-     *     return null;
-     * }
-     * </pre></blockquote>
-     * @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)}
-     * to obtain the base pertaining to a specific {@link Field}.
-     * This method works only for JVMs which store all statics
-     * for a given class in one place.
-     */
-    @Deprecated
-    public Object staticFieldBase(Class<?> c) {
-        Field[] fields = c.getDeclaredFields();
-        for (int i = 0; i < fields.length; i++) {
-            if (Modifier.isStatic(fields[i].getModifiers())) {
-                return staticFieldBase(fields[i]);
-            }
-        }
-        return null;
-    }
-
-    /**
      * Report the location of a given field in the storage allocation of its
      * class.  Do not expect to perform any sort of arithmetic on this offset;
      * it is just a cookie which is passed to the unsafe heap memory accessors.
@@ -648,7 +430,7 @@
      * must preserve all bits of static field offsets.
      * @see #getInt(Object, long)
      */
-    public native long staticFieldOffset(Field f);
+    public native long objectFieldOffset(Field f);
 
     /**
      * Report the location of a given static field, in conjunction with {@link
@@ -667,7 +449,7 @@
      * this method reports its result as a long value.
      * @see #getInt(Object, long)
      */
-    public native long objectFieldOffset(Field f);
+    public native long staticFieldOffset(Field f);
 
     /**
      * Report the location of a given static field, in conjunction with {@link
@@ -748,7 +530,7 @@
      * Report the scale factor for addressing elements in the storage
      * allocation of a given array class.  However, arrays of "narrow" types
      * will generally not work properly with accessors like {@link
-     * #getByte(Object, int)}, so the scale factor for such classes is reported
+     * #getByte(Object, long)}, so the scale factor for such classes is reported
      * as zero.
      *
      * @see #arrayBaseOffset
@@ -1136,11 +918,11 @@
     public native void fullFence();
 
     /**
-     * Throws IllegalAccessError; for use by the VM.
+     * Throws IllegalAccessError; for use by the VM for access control
+     * error support.
      * @since 1.8
      */
     private static void throwIllegalAccessError() {
-       throw new IllegalAccessError();
+        throw new IllegalAccessError();
     }
-
 }
--- a/jdk/src/java.base/share/classes/sun/nio/cs/AbstractCharsetProvider.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/AbstractCharsetProvider.java	Wed Jul 05 20:20:43 2017 +0200
@@ -111,6 +111,12 @@
         }
     }
 
+    protected boolean hasCharset(String name) {
+        synchronized (this) {
+            return classMap.containsKey(name);
+        }
+    }
+
     /* Late initialization hook, needed by some providers
      */
     protected void init() { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/DelegatableDecoder.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.cs;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CoderResult;
+
+/**
+ * A decoder that can be delegated to by another decoder
+ * when normal inheritance cannot be used.
+ * Used by autodecting decoders.
+ */
+public interface DelegatableDecoder {
+    CoderResult decodeLoop(ByteBuffer src, CharBuffer dst);
+    void implReset();
+    CoderResult implFlush(CharBuffer out);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/DoubleByte.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,929 @@
+/*
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.cs;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import java.util.Arrays;
+import sun.nio.cs.Surrogate;
+import sun.nio.cs.ArrayDecoder;
+import sun.nio.cs.ArrayEncoder;
+import static sun.nio.cs.CharsetMapping.*;
+
+/*
+ * Four types of "DoubleByte" charsets are implemented in this class
+ * (1)DoubleByte
+ *    The "mostly widely used" multibyte charset, a combination of
+ *    a singlebyte character set (usually the ASCII charset) and a
+ *    doublebyte character set. The codepoint values of singlebyte
+ *    and doublebyte don't overlap. Microsoft's multibyte charsets
+ *    and IBM's "DBCS_ASCII" charsets, such as IBM1381, 942, 943,
+ *    948, 949 and 950 are such charsets.
+ *
+ * (2)DoubleByte_EBCDIC
+ *    IBM EBCDIC Mix multibyte charset. Use SO and SI to shift (switch)
+ *    in and out between the singlebyte character set and doublebyte
+ *    character set.
+ *
+ * (3)DoubleByte_SIMPLE_EUC
+ *    It's a "simple" form of EUC encoding scheme, only have the
+ *    singlebyte character set G0 and one doublebyte character set
+ *    G1 are defined, G2 (with SS2) and G3 (with SS3) are not used.
+ *    So it is actually the same as the "typical" type (1) mentioned
+ *    above, except it return "malformed" for the SS2 and SS3 when
+ *    decoding.
+ *
+ * (4)DoubleByte ONLY
+ *    A "pure" doublebyte only character set. From implementation
+ *    point of view, this is the type (1) with "decodeSingle" always
+ *    returns unmappable.
+ *
+ * For simplicity, all implementations share the same decoding and
+ * encoding data structure.
+ *
+ * Decoding:
+ *
+ *    char[][] b2c;
+ *    char[] b2cSB;
+ *    int b2Min, b2Max
+ *
+ *    public char decodeSingle(int b) {
+ *        return b2cSB.[b];
+ *    }
+ *
+ *    public char decodeDouble(int b1, int b2) {
+ *        if (b2 < b2Min || b2 > b2Max)
+ *            return UNMAPPABLE_DECODING;
+ *         return b2c[b1][b2 - b2Min];
+ *    }
+ *
+ *    (1)b2Min, b2Max are the corresponding min and max value of the
+ *       low-half of the double-byte.
+ *    (2)The high 8-bit/b1 of the double-byte are used to indexed into
+ *       b2c array.
+ *
+ * Encoding:
+ *
+ *    char[] c2b;
+ *    char[] c2bIndex;
+ *
+ *    public int encodeChar(char ch) {
+ *        return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
+ *    }
+ *
+ */
+
+public class DoubleByte {
+
+    public final static char[] B2C_UNMAPPABLE;
+    static {
+        B2C_UNMAPPABLE = new char[0x100];
+        Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING);
+    }
+
+    public static class Decoder extends CharsetDecoder
+                                implements DelegatableDecoder, ArrayDecoder
+    {
+        final char[][] b2c;
+        final char[] b2cSB;
+        final int b2Min;
+        final int b2Max;
+
+        // for SimpleEUC override
+        protected CoderResult crMalformedOrUnderFlow(int b) {
+            return CoderResult.UNDERFLOW;
+        }
+
+        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
+            if (b2c[b1] == B2C_UNMAPPABLE ||                // isNotLeadingByte(b1)
+                b2c[b2] != B2C_UNMAPPABLE ||                // isLeadingByte(b2)
+                decodeSingle(b2) != UNMAPPABLE_DECODING) {  // isSingle(b2)
+                return CoderResult.malformedForLength(1);
+            }
+            return CoderResult.unmappableForLength(2);
+        }
+
+        public Decoder(Charset cs, float avgcpb, float maxcpb,
+                       char[][] b2c, char[] b2cSB,
+                       int b2Min, int b2Max) {
+            super(cs, avgcpb, maxcpb);
+            this.b2c = b2c;
+            this.b2cSB = b2cSB;
+            this.b2Min = b2Min;
+            this.b2Max = b2Max;
+        }
+
+        public Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
+            this(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
+        }
+
+        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
+            byte[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+
+            char[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                while (sp < sl && dp < dl) {
+                    // inline the decodeSingle/Double() for better performance
+                    int inSize = 1;
+                    int b1 = sa[sp] & 0xff;
+                    char c = b2cSB[b1];
+                    if (c == UNMAPPABLE_DECODING) {
+                        if (sl - sp < 2)
+                            return crMalformedOrUnderFlow(b1);
+                        int b2 = sa[sp + 1] & 0xff;
+                        if (b2 < b2Min || b2 > b2Max ||
+                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                            return crMalformedOrUnmappable(b1, b2);
+                        }
+                        inSize++;
+                    }
+                    da[dp++] = c;
+                    sp += inSize;
+                }
+                return (sp >= sl) ? CoderResult.UNDERFLOW
+                                  : CoderResult.OVERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
+            int mark = src.position();
+            try {
+
+                while (src.hasRemaining() && dst.hasRemaining()) {
+                    int b1 = src.get() & 0xff;
+                    char c = b2cSB[b1];
+                    int inSize = 1;
+                    if (c == UNMAPPABLE_DECODING) {
+                        if (src.remaining() < 1)
+                            return crMalformedOrUnderFlow(b1);
+                        int b2 = src.get() & 0xff;
+                        if (b2 < b2Min || b2 > b2Max ||
+                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING)
+                            return crMalformedOrUnmappable(b1, b2);
+                        inSize++;
+                    }
+                    dst.put(c);
+                    mark += inSize;
+                }
+                return src.hasRemaining()? CoderResult.OVERFLOW
+                                         : CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        // Make some protected methods public for use by JISAutoDetect
+        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
+            if (src.hasArray() && dst.hasArray())
+                return decodeArrayLoop(src, dst);
+            else
+                return decodeBufferLoop(src, dst);
+        }
+
+        public int decode(byte[] src, int sp, int len, char[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            char repl = replacement().charAt(0);
+            while (sp < sl) {
+                int b1 = src[sp++] & 0xff;
+                char c = b2cSB[b1];
+                if (c == UNMAPPABLE_DECODING) {
+                    if (sp < sl) {
+                        int b2 = src[sp++] & 0xff;
+                        if (b2 < b2Min || b2 > b2Max ||
+                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                            if (b2c[b1] == B2C_UNMAPPABLE ||  // isNotLeadingByte
+                                b2c[b2] != B2C_UNMAPPABLE ||  // isLeadingByte
+                                decodeSingle(b2) != UNMAPPABLE_DECODING) {
+                                sp--;
+                            }
+                        }
+                    }
+                    if (c == UNMAPPABLE_DECODING) {
+                        c = repl;
+                    }
+                }
+                dst[dp++] = c;
+            }
+            return dp;
+        }
+
+        public void implReset() {
+            super.implReset();
+        }
+
+        public CoderResult implFlush(CharBuffer out) {
+            return super.implFlush(out);
+        }
+
+        // decode loops are not using decodeSingle/Double() for performance
+        // reason.
+        public char decodeSingle(int b) {
+            return b2cSB[b];
+        }
+
+        public char decodeDouble(int b1, int b2) {
+            if (b1 < 0 || b1 > b2c.length ||
+                b2 < b2Min || b2 > b2Max)
+                return UNMAPPABLE_DECODING;
+            return  b2c[b1][b2 - b2Min];
+        }
+    }
+
+    // IBM_EBCDIC_DBCS
+    public static class Decoder_EBCDIC extends Decoder {
+        private static final int SBCS = 0;
+        private static final int DBCS = 1;
+        private static final int SO = 0x0e;
+        private static final int SI = 0x0f;
+        private int  currentState;
+
+        public Decoder_EBCDIC(Charset cs,
+                       char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
+            super(cs, b2c, b2cSB, b2Min, b2Max);
+        }
+
+        public void implReset() {
+            currentState = SBCS;
+        }
+
+        // Check validity of dbcs ebcdic byte pair values
+        //
+        // First byte : 0x41 -- 0xFE
+        // Second byte: 0x41 -- 0xFE
+        // Doublebyte blank: 0x4040
+        //
+        // The validation implementation in "old" DBCS_IBM_EBCDIC and sun.io
+        // as
+        //            if ((b1 != 0x40 || b2 != 0x40) &&
+        //                (b2 < 0x41 || b2 > 0xfe)) {...}
+        // is not correct/complete (range check for b1)
+        //
+        private static boolean isDoubleByte(int b1, int b2) {
+            return (0x41 <= b1 && b1 <= 0xfe && 0x41 <= b2 && b2 <= 0xfe)
+                   || (b1 == 0x40 && b2 == 0x40); // DBCS-HOST SPACE
+        }
+
+        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
+            byte[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+            char[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                // don't check dp/dl together here, it's possible to
+                // decdoe a SO/SI without space in output buffer.
+                while (sp < sl) {
+                    int b1 = sa[sp] & 0xff;
+                    int inSize = 1;
+                    if (b1 == SO) {  // Shift out
+                        if (currentState != SBCS)
+                            return CoderResult.malformedForLength(1);
+                        else
+                            currentState = DBCS;
+                    } else if (b1 == SI) {
+                        if (currentState != DBCS)
+                            return CoderResult.malformedForLength(1);
+                        else
+                            currentState = SBCS;
+                    } else {
+                        char c =  UNMAPPABLE_DECODING;
+                        if (currentState == SBCS) {
+                            c = b2cSB[b1];
+                            if (c == UNMAPPABLE_DECODING)
+                                return CoderResult.unmappableForLength(1);
+                        } else {
+                            if (sl - sp < 2)
+                                return CoderResult.UNDERFLOW;
+                            int b2 = sa[sp + 1] & 0xff;
+                            if (b2 < b2Min || b2 > b2Max ||
+                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                                if (!isDoubleByte(b1, b2))
+                                    return CoderResult.malformedForLength(2);
+                                return CoderResult.unmappableForLength(2);
+                            }
+                            inSize++;
+                        }
+                        if (dl - dp < 1)
+                            return CoderResult.OVERFLOW;
+
+                        da[dp++] = c;
+                    }
+                    sp += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
+            int mark = src.position();
+            try {
+                while (src.hasRemaining()) {
+                    int b1 = src.get() & 0xff;
+                    int inSize = 1;
+                    if (b1 == SO) {  // Shift out
+                        if (currentState != SBCS)
+                            return CoderResult.malformedForLength(1);
+                        else
+                            currentState = DBCS;
+                    } else if (b1 == SI) {
+                        if (currentState != DBCS)
+                            return CoderResult.malformedForLength(1);
+                        else
+                            currentState = SBCS;
+                    } else {
+                        char c = UNMAPPABLE_DECODING;
+                        if (currentState == SBCS) {
+                            c = b2cSB[b1];
+                            if (c == UNMAPPABLE_DECODING)
+                                return CoderResult.unmappableForLength(1);
+                        } else {
+                            if (src.remaining() < 1)
+                                return CoderResult.UNDERFLOW;
+                            int b2 = src.get()&0xff;
+                            if (b2 < b2Min || b2 > b2Max ||
+                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                                if (!isDoubleByte(b1, b2))
+                                    return CoderResult.malformedForLength(2);
+                                return CoderResult.unmappableForLength(2);
+                            }
+                            inSize++;
+                        }
+
+                        if (dst.remaining() < 1)
+                            return CoderResult.OVERFLOW;
+
+                        dst.put(c);
+                    }
+                    mark += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        public int decode(byte[] src, int sp, int len, char[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            currentState = SBCS;
+            char repl = replacement().charAt(0);
+            while (sp < sl) {
+                int b1 = src[sp++] & 0xff;
+                if (b1 == SO) {  // Shift out
+                    if (currentState != SBCS)
+                        dst[dp++] = repl;
+                    else
+                        currentState = DBCS;
+                } else if (b1 == SI) {
+                    if (currentState != DBCS)
+                        dst[dp++] = repl;
+                    else
+                        currentState = SBCS;
+                } else {
+                    char c =  UNMAPPABLE_DECODING;
+                    if (currentState == SBCS) {
+                        c = b2cSB[b1];
+                        if (c == UNMAPPABLE_DECODING)
+                            c = repl;
+                    } else {
+                        if (sl == sp) {
+                            c = repl;
+                        } else {
+                            int b2 = src[sp++] & 0xff;
+                            if (b2 < b2Min || b2 > b2Max ||
+                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                                c = repl;
+                            }
+                        }
+                    }
+                    dst[dp++] = c;
+                }
+            }
+            return dp;
+        }
+    }
+
+    // DBCS_ONLY
+    public static class Decoder_DBCSONLY extends Decoder {
+        static final char[] b2cSB_UNMAPPABLE;
+        static {
+            b2cSB_UNMAPPABLE = new char[0x100];
+            Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
+        }
+        public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
+            super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max);
+        }
+    }
+
+    // EUC_SIMPLE
+    // The only thing we need to "override" is to check SS2/SS3 and
+    // return "malformed" if found
+    public static class Decoder_EUC_SIM extends Decoder {
+        private final int SS2 =  0x8E;
+        private final int SS3 =  0x8F;
+
+        public Decoder_EUC_SIM(Charset cs,
+                        char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
+            super(cs, b2c, b2cSB, b2Min, b2Max);
+        }
+
+        // No support provided for G2/G3 for SimpleEUC
+        protected CoderResult crMalformedOrUnderFlow(int b) {
+            if (b == SS2 || b == SS3 )
+                return CoderResult.malformedForLength(1);
+            return CoderResult.UNDERFLOW;
+        }
+
+        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
+            if (b1 == SS2 || b1 == SS3 )
+                return CoderResult.malformedForLength(1);
+            return CoderResult.unmappableForLength(2);
+        }
+
+        public int decode(byte[] src, int sp, int len, char[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            char repl = replacement().charAt(0);
+            while (sp < sl) {
+                int b1 = src[sp++] & 0xff;
+                char c = b2cSB[b1];
+                if (c == UNMAPPABLE_DECODING) {
+                    if (sp < sl) {
+                        int b2 = src[sp++] & 0xff;
+                        if (b2 < b2Min || b2 > b2Max ||
+                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                            if (b1 == SS2 || b1 == SS3) {
+                                sp--;
+                            }
+                            c = repl;
+                        }
+                    } else {
+                        c = repl;
+                    }
+                }
+                dst[dp++] = c;
+            }
+            return dp;
+        }
+    }
+
+    public static class Encoder extends CharsetEncoder
+                                implements ArrayEncoder
+    {
+        protected final int MAX_SINGLEBYTE = 0xff;
+        private final char[] c2b;
+        private final char[] c2bIndex;
+        protected Surrogate.Parser sgp;
+
+        public Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
+            super(cs, 2.0f, 2.0f);
+            this.c2b = c2b;
+            this.c2bIndex = c2bIndex;
+        }
+
+        public Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
+            super(cs, avg, max, repl);
+            this.c2b = c2b;
+            this.c2bIndex = c2bIndex;
+        }
+
+        public boolean canEncode(char c) {
+            return encodeChar(c) != UNMAPPABLE_ENCODING;
+        }
+
+        protected Surrogate.Parser sgp() {
+            if (sgp == null)
+                sgp = new Surrogate.Parser();
+            return sgp;
+        }
+
+        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
+            char[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+
+            byte[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                while (sp < sl) {
+                    char c = sa[sp];
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            if (sgp().parse(c, sa, sp, sl) < 0)
+                                return sgp.error();
+                            return sgp.unmappableResult();
+                        }
+                        return CoderResult.unmappableForLength(1);
+                    }
+
+                    if (bb > MAX_SINGLEBYTE) {    // DoubleByte
+                        if (dl - dp < 2)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)(bb >> 8);
+                        da[dp++] = (byte)bb;
+                    } else {                      // SingleByte
+                        if (dl - dp < 1)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)bb;
+                    }
+
+                    sp++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
+            int mark = src.position();
+            try {
+                while (src.hasRemaining()) {
+                    char c = src.get();
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            if (sgp().parse(c, src) < 0)
+                                return sgp.error();
+                            return sgp.unmappableResult();
+                        }
+                        return CoderResult.unmappableForLength(1);
+                    }
+                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
+                        if (dst.remaining() < 2)
+                            return CoderResult.OVERFLOW;
+                        dst.put((byte)(bb >> 8));
+                        dst.put((byte)(bb));
+                    } else {
+                        if (dst.remaining() < 1)
+                        return CoderResult.OVERFLOW;
+                        dst.put((byte)bb);
+                    }
+                    mark++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
+            if (src.hasArray() && dst.hasArray())
+                return encodeArrayLoop(src, dst);
+            else
+                return encodeBufferLoop(src, dst);
+        }
+
+        protected byte[] repl = replacement();
+        protected void implReplaceWith(byte[] newReplacement) {
+            repl = newReplacement;
+        }
+
+        public int encode(char[] src, int sp, int len, byte[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            int dl = dst.length;
+            while (sp < sl) {
+                char c = src[sp++];
+                int bb = encodeChar(c);
+                if (bb == UNMAPPABLE_ENCODING) {
+                    if (Character.isHighSurrogate(c) && sp < sl &&
+                        Character.isLowSurrogate(src[sp])) {
+                        sp++;
+                    }
+                    dst[dp++] = repl[0];
+                    if (repl.length > 1)
+                        dst[dp++] = repl[1];
+                    continue;
+                } //else
+                if (bb > MAX_SINGLEBYTE) { // DoubleByte
+                    dst[dp++] = (byte)(bb >> 8);
+                    dst[dp++] = (byte)bb;
+                } else {                          // SingleByte
+                    dst[dp++] = (byte)bb;
+                }
+
+            }
+            return dp;
+        }
+
+        public int encodeChar(char ch) {
+            return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
+        }
+
+        // init the c2b and c2bIndex tables from b2c.
+        public static void initC2B(String[] b2c, String b2cSB, String b2cNR,  String c2bNR,
+                            int b2Min, int b2Max,
+                            char[] c2b, char[] c2bIndex)
+        {
+            Arrays.fill(c2b, (char)UNMAPPABLE_ENCODING);
+            int off = 0x100;
+
+            char[][] b2c_ca = new char[b2c.length][];
+            char[] b2cSB_ca = null;
+            if (b2cSB != null)
+                b2cSB_ca = b2cSB.toCharArray();
+
+            for (int i = 0; i < b2c.length; i++) {
+                if (b2c[i] == null)
+                    continue;
+                b2c_ca[i] = b2c[i].toCharArray();
+            }
+
+            if (b2cNR != null) {
+                int j = 0;
+                while (j < b2cNR.length()) {
+                    char b  = b2cNR.charAt(j++);
+                    char c  = b2cNR.charAt(j++);
+                    if (b < 0x100 && b2cSB_ca != null) {
+                        if (b2cSB_ca[b] == c)
+                            b2cSB_ca[b] = UNMAPPABLE_DECODING;
+                    } else {
+                        if (b2c_ca[b >> 8][(b & 0xff) - b2Min] == c)
+                            b2c_ca[b >> 8][(b & 0xff) - b2Min] = UNMAPPABLE_DECODING;
+                    }
+                }
+            }
+
+            if (b2cSB_ca != null) {      // SingleByte
+                for (int b = 0; b < b2cSB_ca.length; b++) {
+                    char c = b2cSB_ca[b];
+                    if (c == UNMAPPABLE_DECODING)
+                        continue;
+                    int index = c2bIndex[c >> 8];
+                    if (index == 0) {
+                        index = off;
+                        off += 0x100;
+                        c2bIndex[c >> 8] = (char)index;
+                    }
+                    c2b[index + (c & 0xff)] = (char)b;
+                }
+            }
+
+            for (int b1 = 0; b1 < b2c.length; b1++) {  // DoubleByte
+                char[] db = b2c_ca[b1];
+                if (db == null)
+                    continue;
+                for (int b2 = b2Min; b2 <= b2Max; b2++) {
+                    char c = db[b2 - b2Min];
+                    if (c == UNMAPPABLE_DECODING)
+                        continue;
+                    int index = c2bIndex[c >> 8];
+                    if (index == 0) {
+                        index = off;
+                        off += 0x100;
+                        c2bIndex[c >> 8] = (char)index;
+                    }
+                    c2b[index + (c & 0xff)] = (char)((b1 << 8) | b2);
+                }
+            }
+
+            if (c2bNR != null) {
+                // add c->b only nr entries
+                for (int i = 0; i < c2bNR.length(); i += 2) {
+                    char b = c2bNR.charAt(i);
+                    char c = c2bNR.charAt(i + 1);
+                    int index = (c >> 8);
+                    if (c2bIndex[index] == 0) {
+                        c2bIndex[index] = (char)off;
+                        off += 0x100;
+                    }
+                    index = c2bIndex[index] + (c & 0xff);
+                    c2b[index] = b;
+                }
+            }
+        }
+    }
+
+    public static class Encoder_DBCSONLY extends Encoder {
+        public Encoder_DBCSONLY(Charset cs, byte[] repl,
+                         char[] c2b, char[] c2bIndex) {
+            super(cs, 2.0f, 2.0f, repl, c2b, c2bIndex);
+        }
+
+        public int encodeChar(char ch) {
+            int bb = super.encodeChar(ch);
+            if (bb <= MAX_SINGLEBYTE)
+                return UNMAPPABLE_ENCODING;
+            return bb;
+        }
+    }
+
+
+
+    public static class Encoder_EBCDIC extends Encoder {
+        static final int SBCS = 0;
+        static final int DBCS = 1;
+        static final byte SO = 0x0e;
+        static final byte SI = 0x0f;
+
+        protected int  currentState = SBCS;
+
+        public Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
+            super(cs, 4.0f, 5.0f, new byte[] {(byte)0x6f}, c2b, c2bIndex);
+        }
+
+        protected void implReset() {
+            currentState = SBCS;
+        }
+
+        protected CoderResult implFlush(ByteBuffer out) {
+            if (currentState == DBCS) {
+                if (out.remaining() < 1)
+                    return CoderResult.OVERFLOW;
+                out.put(SI);
+            }
+            implReset();
+            return CoderResult.UNDERFLOW;
+        }
+
+        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
+            char[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+            byte[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                while (sp < sl) {
+                    char c = sa[sp];
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            if (sgp().parse(c, sa, sp, sl) < 0)
+                                return sgp.error();
+                            return sgp.unmappableResult();
+                        }
+                        return CoderResult.unmappableForLength(1);
+                    }
+                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
+                        if (currentState == SBCS) {
+                            if (dl - dp < 1)
+                                return CoderResult.OVERFLOW;
+                            currentState = DBCS;
+                            da[dp++] = SO;
+                        }
+                        if (dl - dp < 2)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)(bb >> 8);
+                        da[dp++] = (byte)bb;
+                    } else {                    // SingleByte
+                        if (currentState == DBCS) {
+                            if (dl - dp < 1)
+                                return CoderResult.OVERFLOW;
+                            currentState = SBCS;
+                            da[dp++] = SI;
+                        }
+                        if (dl - dp < 1)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)bb;
+
+                    }
+                    sp++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
+            int mark = src.position();
+            try {
+                while (src.hasRemaining()) {
+                    char c = src.get();
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            if (sgp().parse(c, src) < 0)
+                                return sgp.error();
+                            return sgp.unmappableResult();
+                        }
+                        return CoderResult.unmappableForLength(1);
+                    }
+                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
+                        if (currentState == SBCS) {
+                            if (dst.remaining() < 1)
+                                return CoderResult.OVERFLOW;
+                            currentState = DBCS;
+                            dst.put(SO);
+                        }
+                        if (dst.remaining() < 2)
+                            return CoderResult.OVERFLOW;
+                        dst.put((byte)(bb >> 8));
+                        dst.put((byte)(bb));
+                    } else {                  // Single-byte
+                        if (currentState == DBCS) {
+                            if (dst.remaining() < 1)
+                                return CoderResult.OVERFLOW;
+                            currentState = SBCS;
+                            dst.put(SI);
+                        }
+                        if (dst.remaining() < 1)
+                            return CoderResult.OVERFLOW;
+                        dst.put((byte)bb);
+                    }
+                    mark++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        public int encode(char[] src, int sp, int len, byte[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            while (sp < sl) {
+                char c = src[sp++];
+                int bb = encodeChar(c);
+
+                if (bb == UNMAPPABLE_ENCODING) {
+                    if (Character.isHighSurrogate(c) && sp < sl &&
+                        Character.isLowSurrogate(src[sp])) {
+                        sp++;
+                    }
+                    dst[dp++] = repl[0];
+                    if (repl.length > 1)
+                        dst[dp++] = repl[1];
+                    continue;
+                } //else
+                if (bb > MAX_SINGLEBYTE) {           // DoubleByte
+                    if (currentState == SBCS) {
+                        currentState = DBCS;
+                        dst[dp++] = SO;
+                    }
+                    dst[dp++] = (byte)(bb >> 8);
+                    dst[dp++] = (byte)bb;
+                } else {                             // SingleByte
+                    if (currentState == DBCS) {
+                         currentState = SBCS;
+                         dst[dp++] = SI;
+                    }
+                    dst[dp++] = (byte)bb;
+                }
+            }
+
+            if (currentState == DBCS) {
+                 currentState = SBCS;
+                 dst[dp++] = SI;
+            }
+            return dp;
+        }
+    }
+
+    // EUC_SIMPLE
+    public static class Encoder_EUC_SIM extends Encoder {
+        public Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
+            super(cs, c2b, c2bIndex);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/HKSCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.nio.cs;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import java.util.Arrays;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.Surrogate;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class HKSCS {
+
+    public static class Decoder extends DoubleByte.Decoder {
+        static int b2Min = 0x40;
+        static int b2Max = 0xfe;
+
+        private char[][] b2cBmp;
+        private char[][] b2cSupp;
+        private DoubleByte.Decoder big5Dec;
+
+        protected Decoder(Charset cs,
+                          DoubleByte.Decoder big5Dec,
+                          char[][] b2cBmp, char[][] b2cSupp)
+        {
+            // super(cs, 0.5f, 1.0f);
+            // need to extends DoubleByte.Decoder so the
+            // sun.io can use it. this implementation
+            super(cs, 0.5f, 1.0f, null, null, 0, 0);
+            this.big5Dec = big5Dec;
+            this.b2cBmp = b2cBmp;
+            this.b2cSupp = b2cSupp;
+        }
+
+        public char decodeSingle(int b) {
+            return big5Dec.decodeSingle(b);
+        }
+
+        public char decodeBig5(int b1, int b2) {
+            return big5Dec.decodeDouble(b1, b2);
+        }
+
+        public char decodeDouble(int b1, int b2) {
+            return b2cBmp[b1][b2 - b2Min];
+        }
+
+        public char decodeDoubleEx(int b1, int b2) {
+            /* if the b2cSupp is null, the subclass need
+               to override the methold
+            if (b2cSupp == null)
+                return UNMAPPABLE_DECODING;
+             */
+            return b2cSupp[b1][b2 - b2Min];
+        }
+
+        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
+            byte[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+
+            char[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                while (sp < sl) {
+                    int b1 = sa[sp] & 0xff;
+                    char c = decodeSingle(b1);
+                    int inSize = 1, outSize = 1;
+                    char[] cc = null;
+                    if (c == UNMAPPABLE_DECODING) {
+                        if (sl - sp < 2)
+                            return CoderResult.UNDERFLOW;
+                        int b2 = sa[sp + 1] & 0xff;
+                        inSize++;
+                        if (b2 < b2Min || b2 > b2Max)
+                            return CoderResult.unmappableForLength(2);
+                        c = decodeDouble(b1, b2);           //bmp
+                        if (c == UNMAPPABLE_DECODING) {
+                            c = decodeDoubleEx(b1, b2);     //supp
+                            if (c == UNMAPPABLE_DECODING) {
+                                c = decodeBig5(b1, b2);     //big5
+                                if (c == UNMAPPABLE_DECODING)
+                                    return CoderResult.unmappableForLength(2);
+                            } else {
+                                // supplementary character in u+2xxxx area
+                                outSize = 2;
+                            }
+                        }
+                    }
+                    if (dl - dp < outSize)
+                        return CoderResult.OVERFLOW;
+                    if (outSize == 2) {
+                        // supplementary characters
+                        da[dp++] = Surrogate.high(0x20000 + c);
+                        da[dp++] = Surrogate.low(0x20000 + c);
+                    } else {
+                        da[dp++] = c;
+                    }
+                    sp += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
+            int mark = src.position();
+            try {
+                while (src.hasRemaining()) {
+                    char[] cc = null;
+                    int b1 = src.get() & 0xff;
+                    int inSize = 1, outSize = 1;
+                    char c = decodeSingle(b1);
+                    if (c == UNMAPPABLE_DECODING) {
+                        if (src.remaining() < 1)
+                            return CoderResult.UNDERFLOW;
+                        int b2 = src.get() & 0xff;
+                        inSize++;
+                        if (b2 < b2Min || b2 > b2Max)
+                            return CoderResult.unmappableForLength(2);
+                        c = decodeDouble(b1, b2);           //bmp
+                        if (c == UNMAPPABLE_DECODING) {
+                            c = decodeDoubleEx(b1, b2);     //supp
+                            if (c == UNMAPPABLE_DECODING) {
+                                c = decodeBig5(b1, b2);     //big5
+                                if (c == UNMAPPABLE_DECODING)
+                                    return CoderResult.unmappableForLength(2);
+                            } else {
+                                outSize = 2;
+                            }
+                        }
+                    }
+                    if (dst.remaining() < outSize)
+                        return CoderResult.OVERFLOW;
+                    if (outSize == 2) {
+                        dst.put(Surrogate.high(0x20000 + c));
+                        dst.put(Surrogate.low(0x20000 + c));
+                    } else {
+                        dst.put(c);
+                    }
+                    mark += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        public int decode(byte[] src, int sp, int len, char[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            char repl = replacement().charAt(0);
+            while (sp < sl) {
+                int b1 = src[sp++] & 0xff;
+                char c = decodeSingle(b1);
+                if (c == UNMAPPABLE_DECODING) {
+                    if (sl == sp) {
+                        c = repl;
+                    } else {
+                        int b2 = src[sp++] & 0xff;
+                        if (b2 < b2Min || b2 > b2Max) {
+                            c = repl;
+                        } else if ((c = decodeDouble(b1, b2)) == UNMAPPABLE_DECODING) {
+                            c = decodeDoubleEx(b1, b2);     //supp
+                            if (c == UNMAPPABLE_DECODING) {
+                                c = decodeBig5(b1, b2);     //big5
+                                if (c == UNMAPPABLE_DECODING)
+                                    c = repl;
+                            } else {
+                                // supplementary character in u+2xxxx area
+                                dst[dp++] = Surrogate.high(0x20000 + c);
+                                dst[dp++] = Surrogate.low(0x20000 + c);
+                                continue;
+                            }
+                        }
+                    }
+                }
+                dst[dp++] = c;
+            }
+            return dp;
+        }
+
+        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
+            if (src.hasArray() && dst.hasArray())
+                return decodeArrayLoop(src, dst);
+            else
+                return decodeBufferLoop(src, dst);
+        }
+
+        public static void initb2c(char[][]b2c, String[] b2cStr)
+        {
+            for (int i = 0; i < b2cStr.length; i++) {
+                if (b2cStr[i] == null)
+                    b2c[i] = DoubleByte.B2C_UNMAPPABLE;
+                else
+                    b2c[i] = b2cStr[i].toCharArray();
+            }
+        }
+
+    }
+
+    public static class Encoder extends DoubleByte.Encoder {
+        private DoubleByte.Encoder big5Enc;
+        private char[][] c2bBmp;
+        private char[][] c2bSupp;
+
+        protected Encoder(Charset cs,
+                          DoubleByte.Encoder big5Enc,
+                          char[][] c2bBmp,
+                          char[][] c2bSupp)
+        {
+            super(cs, null, null);
+            this.big5Enc = big5Enc;
+            this.c2bBmp = c2bBmp;
+            this.c2bSupp = c2bSupp;
+        }
+
+        public int encodeBig5(char ch) {
+            return big5Enc.encodeChar(ch);
+        }
+
+        public int encodeChar(char ch) {
+            int bb = c2bBmp[ch >> 8][ch & 0xff];
+            if (bb == UNMAPPABLE_ENCODING)
+                return encodeBig5(ch);
+            return bb;
+        }
+
+        public int encodeSupp(int cp) {
+            if ((cp & 0xf0000) != 0x20000)
+                return UNMAPPABLE_ENCODING;
+            return c2bSupp[(cp >> 8) & 0xff][cp & 0xff];
+        }
+
+        public boolean canEncode(char c) {
+            return encodeChar(c) != UNMAPPABLE_ENCODING;
+        }
+
+        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
+            char[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+
+            byte[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+
+            try {
+                while (sp < sl) {
+                    char c = sa[sp];
+                    int inSize = 1;
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            int cp;
+                            if ((cp = sgp().parse(c, sa, sp, sl)) < 0)
+                                return sgp.error();
+                            bb = encodeSupp(cp);
+                            if (bb == UNMAPPABLE_ENCODING)
+                                return CoderResult.unmappableForLength(2);
+                            inSize = 2;
+                        } else {
+                            return CoderResult.unmappableForLength(1);
+                        }
+                    }
+                    if (bb > MAX_SINGLEBYTE) {    // DoubleByte
+                        if (dl - dp < 2)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)(bb >> 8);
+                        da[dp++] = (byte)bb;
+                    } else {                      // SingleByte
+                        if (dl - dp < 1)
+                            return CoderResult.OVERFLOW;
+                        da[dp++] = (byte)bb;
+                    }
+                    sp += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
+            int mark = src.position();
+            try {
+                while (src.hasRemaining()) {
+                    int inSize = 1;
+                    char c = src.get();
+                    int bb = encodeChar(c);
+                    if (bb == UNMAPPABLE_ENCODING) {
+                        if (Character.isSurrogate(c)) {
+                            int cp;
+                            if ((cp = sgp().parse(c, src)) < 0)
+                                return sgp.error();
+                            bb = encodeSupp(cp);
+                            if (bb == UNMAPPABLE_ENCODING)
+                                return CoderResult.unmappableForLength(2);
+                            inSize = 2;
+                        } else {
+                            return CoderResult.unmappableForLength(1);
+                        }
+                    }
+                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
+                        if (dst.remaining() < 2)
+                            return CoderResult.OVERFLOW;
+                        dst.put((byte)(bb >> 8));
+                        dst.put((byte)(bb));
+                    } else {
+                        if (dst.remaining() < 1)
+                        return CoderResult.OVERFLOW;
+                        dst.put((byte)bb);
+                    }
+                    mark += inSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
+            if (src.hasArray() && dst.hasArray())
+                return encodeArrayLoop(src, dst);
+            else
+                return encodeBufferLoop(src, dst);
+        }
+
+        private byte[] repl = replacement();
+        protected void implReplaceWith(byte[] newReplacement) {
+            repl = newReplacement;
+        }
+
+        public int encode(char[] src, int sp, int len, byte[] dst) {
+            int dp = 0;
+            int sl = sp + len;
+            while (sp < sl) {
+                char c = src[sp++];
+                int bb = encodeChar(c);
+                if (bb == UNMAPPABLE_ENCODING) {
+                    if (!Character.isHighSurrogate(c) || sp == sl ||
+                        !Character.isLowSurrogate(src[sp]) ||
+                        (bb = encodeSupp(Character.toCodePoint(c, src[sp++])))
+                        == UNMAPPABLE_ENCODING) {
+                        dst[dp++] = repl[0];
+                        if (repl.length > 1)
+                            dst[dp++] = repl[1];
+                        continue;
+                    }
+                    sp++;
+                }
+                if (bb > MAX_SINGLEBYTE) {        // DoubleByte
+                    dst[dp++] = (byte)(bb >> 8);
+                    dst[dp++] = (byte)bb;
+                } else {                          // SingleByte
+                    dst[dp++] = (byte)bb;
+                }
+            }
+            return dp;
+        }
+
+
+        static char[] C2B_UNMAPPABLE = new char[0x100];
+        static {
+            Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
+        }
+
+        public static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
+            // init c2b/c2bSupp from b2cStr and supp
+            int b2Min = 0x40;
+            Arrays.fill(c2b, C2B_UNMAPPABLE);
+            for (int b1 = 0; b1 < 0x100; b1++) {
+                String s = b2cStr[b1];
+                if (s == null)
+                    continue;
+                for (int i = 0; i < s.length(); i++) {
+                    char c = s.charAt(i);
+                    int hi = c >> 8;
+                    if (c2b[hi] == C2B_UNMAPPABLE) {
+                        c2b[hi] = new char[0x100];
+                        Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
+                    }
+                    c2b[hi][c & 0xff] = (char)((b1 << 8) | (i + b2Min));
+                }
+            }
+            if (pua != null) {        // add the compatibility pua entries
+                char c = '\ue000';    //first pua character
+                for (int i = 0; i < pua.length(); i++) {
+                    char bb = pua.charAt(i);
+                    if (bb != UNMAPPABLE_DECODING) {
+                        int hi = c >> 8;
+                        if (c2b[hi] == C2B_UNMAPPABLE) {
+                            c2b[hi] = new char[0x100];
+                            Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
+                        }
+                        c2b[hi][c & 0xff] = bb;
+                    }
+                    c++;
+                }
+            }
+        }
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,20 +29,188 @@
 
 package sun.nio.cs;
 
-import java.nio.charset.*;
-
+import java.nio.charset.Charset;
+import java.nio.charset.spi.CharsetProvider;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
-public class StandardCharsets
-    extends FastCharsetProvider
-{
+public class StandardCharsets extends CharsetProvider {
 
     _INCLUDE_ALIASES_TABLES_
     _INCLUDE_ALIASES_MAP_
     _INCLUDE_CLASSES_MAP_
     _INCLUDE_CACHE_MAP_
 
+    // Maps canonical names to class names
+    private Map<String,String> classMap;
+    // Maps alias names to canonical names
+    private Map<String,String> aliasMap;
+    // Maps canonical names to cached instances
+    private Map<String,Charset> cache;
+
+    private String packagePrefix = "sun.nio.cs";
+
     public StandardCharsets() {
-        super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
+        this.aliasMap = new Aliases();
+        this.classMap = new Classes();
+        this.cache = new Cache();
+    }
+
+    private String canonicalize(String csn) {
+        String acn = aliasMap.get(csn);
+        return (acn != null) ? acn : csn;
+    }
+
+    // Private ASCII-only version, optimized for interpretation during startup
+    //
+    private static String toLower(String s) {
+        int n = s.length();
+        boolean allLower = true;
+        for (int i = 0; i < n; i++) {
+            int c = s.charAt(i);
+            if (((c - 'A') | ('Z' - c)) >= 0) {
+                allLower = false;
+                break;
+            }
+        }
+        if (allLower)
+            return s;
+        char[] ca = new char[n];
+        for (int i = 0; i < n; i++) {
+            int c = s.charAt(i);
+            if (((c - 'A') | ('Z' - c)) >= 0)
+                ca[i] = (char)(c + 0x20);
+            else
+                ca[i] = (char)c;
+        }
+        return new String(ca);
+    }
+
+    private Charset lookup(String charsetName) {
+        init();
+        String csn = canonicalize(toLower(charsetName));
+
+        // Check cache first
+        Charset cs = cache.get(csn);
+        if (cs != null)
+            return cs;
+
+        // Do we even support this charset?
+        String cln = classMap.get(csn);
+        if (cln == null)
+            return null;
+
+        if (cln.equals("US_ASCII")) {
+            cs = new US_ASCII();
+            cache.put(csn, cs);
+            return cs;
+        }
+
+        // Instantiate the charset and cache it
+        try {
+            Class<?> c = Class.forName(packagePrefix + "." + cln,
+                                    true,
+                                    this.getClass().getClassLoader());
+            cs = (Charset)c.newInstance();
+            cache.put(csn, cs);
+            return cs;
+        } catch (ClassNotFoundException |
+                 IllegalAccessException |
+                 InstantiationException x) {
+            return null;
+        }
     }
 
+    public final Charset charsetForName(String charsetName) {
+        synchronized (this) {
+            return lookup(canonicalize(charsetName));
+        }
+    }
+
+    public final Iterator<Charset> charsets() {
+        synchronized (this) {
+            init();
+        }
+        return new Iterator<Charset>() {
+
+                Iterator<String> i = classMap.keySet().iterator();
+
+                public boolean hasNext() {
+                    return i.hasNext();
+                }
+
+                public Charset next() {
+                    String csn = i.next();
+                    return lookup(csn);
+                }
+
+                public void remove() {
+                    throw new UnsupportedOperationException();
+                }
+
+            };
+    }
+
+    private boolean initialized = false;
+
+    /*   provider the sun.nio.cs.map property fir sjis/ms932 mapping hack 
+     */
+    private void init() {
+        if (initialized)
+            return;
+        if (!sun.misc.VM.isBooted())
+            return;
+        initialized = true;
+
+        String map = getProperty("sun.nio.cs.map");
+        if (map != null) {
+            String[] maps = map.split(",");
+            for (int i = 0; i < maps.length; i++) {
+                if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
+                    // if we dont have both sjis and ms932, do nothing
+                    if (classMap.get("shift_jis") == null ||
+                        classMap.get("windows-31j") == null) {
+                        break;
+                    }
+                    aliases_MS932 = new String[] {
+                        "MS932",        // JDK historical
+                        "windows-932",
+                        "csWindows31J",
+                        "shift-jis",
+                        "ms_kanji",
+                        "x-sjis",
+                        "csShiftJIS",
+                        // This alias takes precedence over the actual
+                        // Shift_JIS charset itself since aliases are always
+                        // resolved first, before looking up canonical names.
+                        "shift_jis"
+                    };
+                    aliases_SJIS = new String[] { "sjis" };
+
+                    for (String alias : aliases_MS932) {
+                        aliasMap.put(toLower(alias), "windows-31j");
+                    }
+                    cache.put("shift_jis", null);
+                    break;
+                }
+            }
+        }
+    }
+
+    private static String getProperty(String key) {
+        // this method may be called during initialization of
+        // system class loader and thus not using lambda
+        return AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty(key);
+                }
+            });
+    }
+
+
 }
--- a/jdk/src/java.base/share/classes/sun/security/provider/DSA.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/DSA.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,11 @@
 import java.security.*;
 import java.security.SecureRandom;
 import java.security.interfaces.*;
-import java.security.spec.DSAParameterSpec;
-import java.security.spec.InvalidParameterSpecException;
 
 import sun.security.util.Debug;
 import sun.security.util.DerValue;
 import sun.security.util.DerInputStream;
 import sun.security.util.DerOutputStream;
-import sun.security.x509.AlgIdDSA;
 import sun.security.jca.JCAUtil;
 
 /**
@@ -85,13 +82,28 @@
     /* The message digest object used */
     private final MessageDigest md;
 
+    /* The format. true for the IEEE P1363 format. false (default) for ASN.1 */
+    private final boolean p1363Format;
+
     /**
      * Construct a blank DSA object. It must be
      * initialized before being usable for signing or verifying.
      */
     DSA(MessageDigest md) {
+        this(md, false);
+    }
+
+    /**
+     * Construct a blank DSA object that will use the specified
+     * signature format. {@code p1363Format} should be {@code true} to
+     * use the IEEE P1363 format. If {@code p1363Format} is {@code false},
+     * the DER-encoded ASN.1 format will used. The DSA object must be
+     * initialized before being usable for signing or verifying.
+     */
+    DSA(MessageDigest md, boolean p1363Format) {
         super();
         this.md = md;
+        this.p1363Format = p1363Format;
     }
 
     /**
@@ -178,12 +190,16 @@
 
 
     /**
-     * Sign all the data thus far updated. The signature is formatted
+     * Sign all the data thus far updated. The signature format is
+     * determined by {@code p1363Format}. If {@code p1363Format} is
+     * {@code false} (the default), then the signature is formatted
      * according to the Canonical Encoding Rules, returned as a DER
-     * sequence of Integer, r and s.
+     * sequence of Integers, r and s. If {@code p1363Format} is
+     * {@code false}, the signature is returned in the IEEE P1363
+     * format, which is the concatenation or r and s.
      *
-     * @return a signature block formatted according to the Canonical
-     * Encoding Rules.
+     * @return a signature block formatted according to the format
+     * indicated by {@code p1363Format}
      *
      * @exception SignatureException if the signature object was not
      * properly initialized, or if another exception occurs.
@@ -196,24 +212,48 @@
         BigInteger r = generateR(presetP, presetQ, presetG, k);
         BigInteger s = generateS(presetX, presetQ, r, k);
 
-        try {
-            DerOutputStream outseq = new DerOutputStream(100);
-            outseq.putInteger(r);
-            outseq.putInteger(s);
-            DerValue result = new DerValue(DerValue.tag_Sequence,
-                                           outseq.toByteArray());
+        if (p1363Format) {
+            // Return the concatenation of r and s
+            byte[] rBytes = r.toByteArray();
+            byte[] sBytes = s.toByteArray();
+
+            int size = presetQ.bitLength() / 8;
+            byte[] outseq = new byte[size * 2];
+
+            int rLength = rBytes.length;
+            int sLength = sBytes.length;
+            int i;
+            for (i = rLength; i > 0 && rBytes[rLength - i] == 0; i--);
+
+            int j;
+            for (j = sLength;
+                    j > 0 && sBytes[sLength - j] == 0; j--);
 
-            return result.toByteArray();
+            System.arraycopy(rBytes, rLength - i, outseq, size - i, i);
+            System.arraycopy(sBytes, sLength - j, outseq, size * 2 - j, j);
 
-        } catch (IOException e) {
-            throw new SignatureException("error encoding signature");
+            return outseq;
+        } else {
+            // Return the DER-encoded ASN.1 form
+            try {
+                DerOutputStream outseq = new DerOutputStream(100);
+                outseq.putInteger(r);
+                outseq.putInteger(s);
+                DerValue result = new DerValue(DerValue.tag_Sequence,
+                        outseq.toByteArray());
+
+                return result.toByteArray();
+
+            } catch (IOException e) {
+                throw new SignatureException("error encoding signature");
+            }
         }
     }
 
     /**
      * Verify all the data thus far updated.
      *
-     * @param signature the alledged signature, encoded using the
+     * @param signature the alleged signature, encoded using the
      * Canonical Encoding Rules, as a sequence of integers, r and s.
      *
      * @exception SignatureException if the signature object was not
@@ -230,8 +270,13 @@
     /**
      * Verify all the data thus far updated.
      *
-     * @param signature the alledged signature, encoded using the
-     * Canonical Encoding Rules, as a sequence of integers, r and s.
+     * @param signature the alleged signature, encoded using the
+     * format indicated by {@code p1363Format}. If {@code p1363Format}
+     * is {@code false} (the default), then the signature is formatted
+     * according to the Canonical Encoding Rules, as a DER sequence of
+     * Integers, r and s. If {@code p1363Format} is {@code false},
+     * the signature is in the IEEE P1363 format, which is the
+     * concatenation or r and s.
      *
      * @param offset the offset to start from in the array of bytes.
      *
@@ -248,16 +293,28 @@
 
         BigInteger r = null;
         BigInteger s = null;
-        // first decode the signature.
-        try {
-            DerInputStream in = new DerInputStream(signature, offset, length);
-            DerValue[] values = in.getSequence(2);
 
-            r = values[0].getBigInteger();
-            s = values[1].getBigInteger();
+        if (p1363Format) {
+            if ((length & 1) == 1) {
+                // length of signature byte array should be even
+                throw new SignatureException("invalid signature format");
+            }
+            int mid = length/2;
+            r = new BigInteger(Arrays.copyOfRange(signature, 0, mid));
+            s = new BigInteger(Arrays.copyOfRange(signature, mid, length));
+        } else {
+            // first decode the signature.
+            try {
+                DerInputStream in = new DerInputStream(signature, offset,
+                                                       length);
+                DerValue[] values = in.getSequence(2);
 
-        } catch (IOException e) {
-            throw new SignatureException("invalid encoding for signature");
+                r = values[0].getBigInteger();
+                s = values[1].getBigInteger();
+
+            } catch (IOException e) {
+                throw new SignatureException("invalid encoding for signature");
+            }
         }
 
         // some implementations do not correctly encode values in the ASN.1
@@ -421,6 +478,15 @@
     }
 
     /**
+     * SHA224withDSA implementation that uses the IEEE P1363 format.
+     */
+    public static final class SHA224withDSAinP1363Format extends DSA {
+        public SHA224withDSAinP1363Format() throws NoSuchAlgorithmException {
+            super(MessageDigest.getInstance("SHA-224"), true);
+        }
+    }
+
+    /**
      * Standard SHA256withDSA implementation as defined in FIPS186-3.
      */
     public static final class SHA256withDSA extends DSA {
@@ -429,6 +495,15 @@
         }
     }
 
+    /**
+     * SHA256withDSA implementation that uses the IEEE P1363 format.
+     */
+    public static final class SHA256withDSAinP1363Format extends DSA {
+        public SHA256withDSAinP1363Format() throws NoSuchAlgorithmException {
+            super(MessageDigest.getInstance("SHA-256"), true);
+        }
+    }
+
     static class LegacyDSA extends DSA {
         /* The random seed used to generate k */
         private int[] kSeed;
@@ -441,7 +516,12 @@
         private int[] kSeedLast;
 
         public LegacyDSA(MessageDigest md) throws NoSuchAlgorithmException {
-            super(md);
+            this(md, false);
+        }
+
+        private LegacyDSA(MessageDigest md, boolean p1363Format)
+                throws NoSuchAlgorithmException {
+            super(md, p1363Format);
         }
 
         @Deprecated
@@ -636,6 +716,9 @@
         }
     }
 
+    /**
+     * Standard SHA1withDSA implementation.
+     */
     public static final class SHA1withDSA extends LegacyDSA {
         public SHA1withDSA() throws NoSuchAlgorithmException {
             super(MessageDigest.getInstance("SHA-1"));
@@ -643,13 +726,22 @@
     }
 
     /**
-     * RawDSA implementation.
+     * SHA1withDSA implementation that uses the IEEE P1363 format.
+     */
+    public static final class SHA1withDSAinP1363Format extends LegacyDSA {
+        public SHA1withDSAinP1363Format() throws NoSuchAlgorithmException {
+            super(MessageDigest.getInstance("SHA-1"), true);
+        }
+    }
+
+    /**
+     * Raw DSA.
      *
-     * RawDSA requires the data to be exactly 20 bytes long. If it is
+     * Raw DSA requires the data to be exactly 20 bytes long. If it is
      * not, a SignatureException is thrown when sign()/verify() is called
      * per JCA spec.
      */
-    public static final class RawDSA extends LegacyDSA {
+    static class Raw extends LegacyDSA {
         // Internal special-purpose MessageDigest impl for RawDSA
         // Only override whatever methods used
         // NOTE: no clone support
@@ -719,8 +811,27 @@
             }
         }
 
+        private Raw(boolean p1363Format) throws NoSuchAlgorithmException {
+            super(new NullDigest20(), p1363Format);
+        }
+
+    }
+
+    /**
+     * Standard Raw DSA implementation.
+     */
+    public static final class RawDSA extends Raw {
         public RawDSA() throws NoSuchAlgorithmException {
-            super(new NullDigest20());
+            super(false);
+        }
+    }
+
+    /**
+     * Raw DSA implementation that uses the IEEE P1363 format.
+     */
+    public static final class RawDSAinP1363Format extends Raw {
+        public RawDSAinP1363Format() throws NoSuchAlgorithmException {
+            super(true);
         }
     }
 }
--- a/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -130,6 +130,15 @@
         map.put("Signature.SHA256withDSA",
                 "sun.security.provider.DSA$SHA256withDSA");
 
+        map.put("Signature.SHA1withDSAinP1363Format",
+                "sun.security.provider.DSA$SHA1withDSAinP1363Format");
+        map.put("Signature.NONEwithDSAinP1363Format",
+                "sun.security.provider.DSA$RawDSAinP1363Format");
+        map.put("Signature.SHA224withDSAinP1363Format",
+                "sun.security.provider.DSA$SHA224withDSAinP1363Format");
+        map.put("Signature.SHA256withDSAinP1363Format",
+                "sun.security.provider.DSA$SHA256withDSAinP1363Format");
+
         String dsaKeyClasses = "java.security.interfaces.DSAPublicKey" +
                 "|java.security.interfaces.DSAPrivateKey";
         map.put("Signature.SHA1withDSA SupportedKeyClasses", dsaKeyClasses);
--- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,8 +171,9 @@
             // OAEPWith<digest>And<mgf>Padding
             // <digest>with<encryption>
             // <digest>with<encryption>and<mgf>
+            // <digest>with<encryption>in<format>
             Pattern pattern =
-                    Pattern.compile("with|and", Pattern.CASE_INSENSITIVE);
+                    Pattern.compile("with|and|in", Pattern.CASE_INSENSITIVE);
             String[] tokens = pattern.split(transTocken);
 
             for (String token : tokens) {
--- a/jdk/src/java.base/share/conf/security/java.policy	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/share/conf/security/java.policy	Wed Jul 05 20:20:43 2017 +0200
@@ -1,4 +1,8 @@
 // permissions required by each component
+grant codeBase "jrt:/java.corba" {
+        permission java.security.AllPermission;
+};
+
 grant codeBase "jrt:/jdk.zipfs" {
         permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
         permission java.lang.RuntimePermission "fileSystemProvider";
--- a/jdk/src/java.base/windows/native/libjli/java_md.c	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c	Wed Jul 05 20:20:43 2017 +0200
@@ -265,26 +265,17 @@
          * assumed to be present in the "JRE path" directory.  If it is not found
          * there (or "JRE path" fails to resolve), skip the explicit load and let
          * nature take its course, which is likely to be a failure to execute.
-         * This is clearly completely specific to the exact compiler version
-         * which isn't very nice, but its hardly the only place.
-         * No attempt to look for compiler versions in between 2003 and 2010
-         * as we aren't supporting building with those.
+         * The makefiles will provide the correct lib contained in quotes in the
+         * macro MSVCR_DLL_NAME.
          */
-#ifdef _MSC_VER
-#if _MSC_VER < 1400
-#define CRT_DLL "msvcr71.dll"
-#endif
-#if _MSC_VER >= 1600
-#define CRT_DLL "msvcr100.dll"
-#endif
-#ifdef CRT_DLL
+#ifdef MSVCR_DLL_NAME
         if (GetJREPath(crtpath, MAXPATHLEN)) {
             if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
-                    JLI_StrLen(CRT_DLL) >= MAXPATHLEN) {
+                    JLI_StrLen(MSVCR_DLL_NAME) >= MAXPATHLEN) {
                 JLI_ReportErrorMessage(JRE_ERROR11);
                 return JNI_FALSE;
             }
-            (void)JLI_StrCat(crtpath, "\\bin\\" CRT_DLL);   /* Add crt dll */
+            (void)JLI_StrCat(crtpath, "\\bin\\" MSVCR_DLL_NAME);   /* Add crt dll */
             JLI_TraceLauncher("CRT path is %s\n", crtpath);
             if (_access(crtpath, 0) == 0) {
                 if (LoadLibrary(crtpath) == 0) {
@@ -293,8 +284,24 @@
                 }
             }
         }
-#endif /* CRT_DLL */
-#endif /* _MSC_VER */
+#endif /* MSVCR_DLL_NAME */
+#ifdef MSVCP_DLL_NAME
+        if (GetJREPath(crtpath, MAXPATHLEN)) {
+            if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
+                    JLI_StrLen(MSVCP_DLL_NAME) >= MAXPATHLEN) {
+                JLI_ReportErrorMessage(JRE_ERROR11);
+                return JNI_FALSE;
+            }
+            (void)JLI_StrCat(crtpath, "\\bin\\" MSVCP_DLL_NAME);   /* Add prt dll */
+            JLI_TraceLauncher("PRT path is %s\n", crtpath);
+            if (_access(crtpath, 0) == 0) {
+                if (LoadLibrary(crtpath) == 0) {
+                    JLI_ReportErrorMessage(DLL_ERROR4, crtpath);
+                    return JNI_FALSE;
+                }
+            }
+        }
+#endif /* MSVCP_DLL_NAME */
         loaded = 1;
     }
     return JNI_TRUE;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/macosx/classes/sun/datatransfer/resources/flavormap.properties	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,76 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific,
+# default mappings between common Mac OS X selection atoms and platform-independent
+# MIME type strings, which will be converted into 
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by 
+# default. The reason is that many native applications prefer this format over 
+# other native text formats, but are unable to decode the textual data in this 
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment 
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
+TIFF=image/x-java-image;class=java.awt.Image
+RICH_TEXT=text/rtf
+HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL,\
+    text/uri-list;eoln="\r\n";terminators=1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Clipboard.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 1996, 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 java.awt.datatransfer;
+
+import sun.datatransfer.DataFlavorUtil;
+
+import java.util.Objects;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+import java.io.IOException;
+
+/**
+ * A class that implements a mechanism to transfer data using
+ * cut/copy/paste operations.
+ * <p>
+ * {@link FlavorListener}s may be registered on an instance of the
+ * Clipboard class to be notified about changes to the set of
+ * {@link DataFlavor}s available on this clipboard (see
+ * {@link #addFlavorListener}).
+ *
+ * @see java.awt.Toolkit#getSystemClipboard
+ * @see java.awt.Toolkit#getSystemSelection
+ *
+ * @author      Amy Fowler
+ * @author      Alexander Gerasimov
+ */
+public class Clipboard {
+
+    String name;
+
+    /**
+     * The owner of the clipboard.
+     */
+    protected ClipboardOwner owner;
+    /**
+     * Contents of the clipboard.
+     */
+    protected Transferable contents;
+
+    /**
+     * An aggregate of flavor listeners registered on this local clipboard.
+     *
+     * @since 1.5
+     */
+    private Set<FlavorListener> flavorListeners;
+
+    /**
+     * A set of <code>DataFlavor</code>s that is available on
+     * this local clipboard. It is used for tracking changes
+     * of <code>DataFlavor</code>s available on this clipboard.
+     *
+     * @since 1.5
+     */
+    private Set<DataFlavor> currentDataFlavors;
+
+    /**
+     * Creates a clipboard object.
+     * @param name for the clipboard
+     * @see java.awt.Toolkit#getSystemClipboard
+     */
+    public Clipboard(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of this clipboard object.
+     * @return the name of this clipboard object
+     *
+     * @see java.awt.Toolkit#getSystemClipboard
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the current contents of the clipboard to the specified
+     * transferable object and registers the specified clipboard owner
+     * as the owner of the new contents.
+     * <p>
+     * If there is an existing owner different from the argument
+     * <code>owner</code>, that owner is notified that it no longer
+     * holds ownership of the clipboard contents via an invocation
+     * of <code>ClipboardOwner.lostOwnership()</code> on that owner.
+     * An implementation of <code>setContents()</code> is free not
+     * to invoke <code>lostOwnership()</code> directly from this method.
+     * For example, <code>lostOwnership()</code> may be invoked later on
+     * a different thread. The same applies to <code>FlavorListener</code>s
+     * registered on this clipboard.
+     * <p>
+     * The method throws <code>IllegalStateException</code> if the clipboard
+     * is currently unavailable. For example, on some platforms, the system
+     * clipboard is unavailable while it is accessed by another application.
+     *
+     * @param contents the transferable object representing the
+     *                 clipboard content
+     * @param owner the object which owns the clipboard content
+     * @throws IllegalStateException if the clipboard is currently unavailable
+     * @see java.awt.Toolkit#getSystemClipboard
+     */
+    public synchronized void setContents(Transferable contents, ClipboardOwner owner) {
+        final ClipboardOwner oldOwner = this.owner;
+        final Transferable oldContents = this.contents;
+
+        this.owner = owner;
+        this.contents = contents;
+
+        if (oldOwner != null && oldOwner != owner) {
+            DataFlavorUtil.getDesktopService().invokeOnEventThread(() ->
+                    oldOwner.lostOwnership(Clipboard.this, oldContents));
+        }
+        fireFlavorsChanged();
+    }
+
+    /**
+     * Returns a transferable object representing the current contents
+     * of the clipboard.  If the clipboard currently has no contents,
+     * it returns <code>null</code>. The parameter Object requestor is
+     * not currently used.  The method throws
+     * <code>IllegalStateException</code> if the clipboard is currently
+     * unavailable.  For example, on some platforms, the system clipboard is
+     * unavailable while it is accessed by another application.
+     *
+     * @param requestor the object requesting the clip data  (not used)
+     * @return the current transferable object on the clipboard
+     * @throws IllegalStateException if the clipboard is currently unavailable
+     * @see java.awt.Toolkit#getSystemClipboard
+     */
+    public synchronized Transferable getContents(Object requestor) {
+        return contents;
+    }
+
+
+    /**
+     * Returns an array of <code>DataFlavor</code>s in which the current
+     * contents of this clipboard can be provided. If there are no
+     * <code>DataFlavor</code>s available, this method returns a zero-length
+     * array.
+     *
+     * @return an array of <code>DataFlavor</code>s in which the current
+     *         contents of this clipboard can be provided
+     *
+     * @throws IllegalStateException if this clipboard is currently unavailable
+     *
+     * @since 1.5
+     */
+    public DataFlavor[] getAvailableDataFlavors() {
+        Transferable cntnts = getContents(null);
+        if (cntnts == null) {
+            return new DataFlavor[0];
+        }
+        return cntnts.getTransferDataFlavors();
+    }
+
+    /**
+     * Returns whether or not the current contents of this clipboard can be
+     * provided in the specified <code>DataFlavor</code>.
+     *
+     * @param flavor the requested <code>DataFlavor</code> for the contents
+     *
+     * @return <code>true</code> if the current contents of this clipboard
+     *         can be provided in the specified <code>DataFlavor</code>;
+     *         <code>false</code> otherwise
+     *
+     * @throws NullPointerException if <code>flavor</code> is <code>null</code>
+     * @throws IllegalStateException if this clipboard is currently unavailable
+     *
+     * @since 1.5
+     */
+    public boolean isDataFlavorAvailable(DataFlavor flavor) {
+        if (flavor == null) {
+            throw new NullPointerException("flavor");
+        }
+
+        Transferable cntnts = getContents(null);
+        if (cntnts == null) {
+            return false;
+        }
+        return cntnts.isDataFlavorSupported(flavor);
+    }
+
+    /**
+     * Returns an object representing the current contents of this clipboard
+     * in the specified <code>DataFlavor</code>.
+     * The class of the object returned is defined by the representation
+     * class of <code>flavor</code>.
+     *
+     * @param flavor the requested <code>DataFlavor</code> for the contents
+     *
+     * @return an object representing the current contents of this clipboard
+     *         in the specified <code>DataFlavor</code>
+     *
+     * @throws NullPointerException if <code>flavor</code> is <code>null</code>
+     * @throws IllegalStateException if this clipboard is currently unavailable
+     * @throws UnsupportedFlavorException if the requested <code>DataFlavor</code>
+     *         is not available
+     * @throws IOException if the data in the requested <code>DataFlavor</code>
+     *         can not be retrieved
+     *
+     * @see DataFlavor#getRepresentationClass
+     *
+     * @since 1.5
+     */
+    public Object getData(DataFlavor flavor)
+        throws UnsupportedFlavorException, IOException {
+        if (flavor == null) {
+            throw new NullPointerException("flavor");
+        }
+
+        Transferable cntnts = getContents(null);
+        if (cntnts == null) {
+            throw new UnsupportedFlavorException(flavor);
+        }
+        return cntnts.getTransferData(flavor);
+    }
+
+
+    /**
+     * Registers the specified <code>FlavorListener</code> to receive
+     * <code>FlavorEvent</code>s from this clipboard.
+     * If <code>listener</code> is <code>null</code>, no exception
+     * is thrown and no action is performed.
+     *
+     * @param listener the listener to be added
+     *
+     * @see #removeFlavorListener
+     * @see #getFlavorListeners
+     * @see FlavorListener
+     * @see FlavorEvent
+     * @since 1.5
+     */
+    public synchronized void addFlavorListener(FlavorListener listener) {
+        if (listener == null) {
+            return;
+        }
+
+        if (flavorListeners == null) {
+            flavorListeners = new HashSet<>();
+            currentDataFlavors = getAvailableDataFlavorSet();
+        }
+
+        flavorListeners.add(listener);
+    }
+
+    /**
+     * Removes the specified <code>FlavorListener</code> so that it no longer
+     * receives <code>FlavorEvent</code>s from this <code>Clipboard</code>.
+     * This method performs no function, nor does it throw an exception, if
+     * the listener specified by the argument was not previously added to this
+     * <code>Clipboard</code>.
+     * If <code>listener</code> is <code>null</code>, no exception
+     * is thrown and no action is performed.
+     *
+     * @param listener the listener to be removed
+     *
+     * @see #addFlavorListener
+     * @see #getFlavorListeners
+     * @see FlavorListener
+     * @see FlavorEvent
+     * @since 1.5
+     */
+    public synchronized void removeFlavorListener(FlavorListener listener) {
+        if (listener == null || flavorListeners == null) {
+            return;
+        }
+        flavorListeners.remove(listener);
+    }
+
+    /**
+     * Returns an array of all the <code>FlavorListener</code>s currently
+     * registered on this <code>Clipboard</code>.
+     *
+     * @return all of this clipboard's <code>FlavorListener</code>s or an empty
+     *         array if no listeners are currently registered
+     * @see #addFlavorListener
+     * @see #removeFlavorListener
+     * @see FlavorListener
+     * @see FlavorEvent
+     * @since 1.5
+     */
+    public synchronized FlavorListener[] getFlavorListeners() {
+        return flavorListeners == null ? new FlavorListener[0] :
+            flavorListeners.toArray(new FlavorListener[flavorListeners.size()]);
+    }
+
+    /**
+     * Checks change of the <code>DataFlavor</code>s and, if necessary,
+     * notifies all listeners that have registered interest for notification
+     * on <code>FlavorEvent</code>s.
+     *
+     * @since 1.5
+     */
+    private void fireFlavorsChanged() {
+        if (flavorListeners == null) {
+            return;
+        }
+
+        Set<DataFlavor> prevDataFlavors = currentDataFlavors;
+        currentDataFlavors = getAvailableDataFlavorSet();
+        if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
+            return;
+        }
+        flavorListeners.forEach(listener ->
+                DataFlavorUtil.getDesktopService().invokeOnEventThread(() ->
+                        listener.flavorsChanged(new FlavorEvent(Clipboard.this))));
+    }
+
+    /**
+     * Returns a set of <code>DataFlavor</code>s currently available
+     * on this clipboard.
+     *
+     * @return a set of <code>DataFlavor</code>s currently available
+     *         on this clipboard
+     *
+     * @since 1.5
+     */
+    private Set<DataFlavor> getAvailableDataFlavorSet() {
+        Set<DataFlavor> set = new HashSet<>();
+        Transferable contents = getContents(null);
+        if (contents != null) {
+            DataFlavor[] flavors = contents.getTransferDataFlavors();
+            if (flavors != null) {
+                set.addAll(Arrays.asList(flavors));
+            }
+        }
+        return set;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/ClipboardOwner.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+/**
+ * Defines the interface for classes that will provide data to
+ * a clipboard. An instance of this interface becomes the owner
+ * of the contents of a clipboard (clipboard owner) if it is
+ * passed as an argument to
+ * {@link java.awt.datatransfer.Clipboard#setContents} method of
+ * the clipboard and this method returns successfully.
+ * The instance remains the clipboard owner until another application
+ * or another object within this application asserts ownership
+ * of this clipboard.
+ *
+ * @see java.awt.datatransfer.Clipboard
+ *
+ * @author      Amy Fowler
+ */
+
+public interface ClipboardOwner {
+
+    /**
+     * Notifies this object that it is no longer the clipboard owner.
+     * This method will be called when another application or another
+     * object within this application asserts ownership of the clipboard.
+     *
+     * @param clipboard the clipboard that is no longer owned
+     * @param contents the contents which this owner had placed on the clipboard
+     */
+    public void lostOwnership(Clipboard clipboard, Transferable contents);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,1431 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import sun.datatransfer.DataFlavorUtil;
+import sun.reflect.misc.ReflectUtil;
+
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.OptionalDataException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Objects;
+
+/**
+ * A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
+ * is typically used to access data on the clipboard, or during
+ * a drag and drop operation.
+ * <p>
+ * An instance of {@code DataFlavor} encapsulates a content type as
+ * defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
+ * and <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>.
+ * A content type is typically referred to as a MIME type.
+ * <p>
+ * A content type consists of a media type (referred
+ * to as the primary type), a subtype, and optional parameters. See
+ * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
+ * for details on the syntax of a MIME type.
+ * <p>
+ * The JRE data transfer implementation interprets the parameter &quot;class&quot;
+ * of a MIME type as <B>a representation class</b>.
+ * The representation class reflects the class of the object being
+ * transferred. In other words, the representation class is the type of
+ * object returned by {@link Transferable#getTransferData}.
+ * For example, the MIME type of {@link #imageFlavor} is
+ * {@code "image/x-java-image;class=java.awt.Image"},
+ * the primary type is {@code image}, the subtype is
+ * {@code x-java-image}, and the representation class is
+ * {@code java.awt.Image}. When {@code getTransferData} is invoked
+ * with a {@code DataFlavor} of {@code imageFlavor}, an instance of
+ * {@code java.awt.Image} is returned.
+ * It's important to note that {@code DataFlavor} does no error checking
+ * against the representation class. It is up to consumers of
+ * {@code DataFlavor}, such as {@code Transferable}, to honor the representation
+ * class.
+ * <br>
+ * Note, if you do not specify a representation class when
+ * creating a {@code DataFlavor}, the default
+ * representation class is used. See appropriate documentation for
+ * {@code DataFlavor}'s constructors.
+ * <p>
+ * Also, {@code DataFlavor} instances with the &quot;text&quot; primary
+ * MIME type may have a &quot;charset&quot; parameter. Refer to
+ * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a> and
+ * {@link #selectBestTextFlavor} for details on &quot;text&quot; MIME types
+ * and the &quot;charset&quot; parameter.
+ * <p>
+ * Equality of {@code DataFlavors} is determined by the primary type,
+ * subtype, and representation class. Refer to {@link #equals(DataFlavor)} for
+ * details. When determining equality, any optional parameters are ignored.
+ * For example, the following produces two {@code DataFlavors} that
+ * are considered identical:
+ * <pre>
+ *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
+ *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
+ *   // The following returns true.
+ *   flavor1.equals(flavor2);
+ * </pre>
+ * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
+ * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
+ * the same results.
+ * <p>
+ * For more information on using data transfer with Swing see
+ * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
+ * How to Use Drag and Drop and Data Transfer</a>,
+ * section in <em>Java Tutorial</em>.
+ *
+ * @author      Blake Sullivan
+ * @author      Laurence P. G. Cable
+ * @author      Jeff Dunn
+ */
+public class DataFlavor implements Externalizable, Cloneable {
+
+    private static final long serialVersionUID = 8367026044764648243L;
+    private static final Class<InputStream> ioInputStreamClass = InputStream.class;
+
+    /**
+     * Tries to load a class from: the bootstrap loader, the system loader,
+     * the context loader (if one is present) and finally the loader specified.
+     *
+     * @param className the name of the class to be loaded
+     * @param fallback the fallback loader
+     * @return the class loaded
+     * @exception ClassNotFoundException if class is not found
+     */
+    protected final static Class<?> tryToLoadClass(String className,
+                                                   ClassLoader fallback)
+        throws ClassNotFoundException
+    {
+        ReflectUtil.checkPackageAccess(className);
+        try {
+            SecurityManager sm = System.getSecurityManager();
+            if (sm != null) {
+                sm.checkPermission(new RuntimePermission("getClassLoader"));
+            }
+            ClassLoader loader = ClassLoader.getSystemClassLoader();
+            try {
+                // bootstrap class loader and system class loader if present
+                return Class.forName(className, true, loader);
+            }
+            catch (ClassNotFoundException exception) {
+                // thread context class loader if and only if present
+                loader = Thread.currentThread().getContextClassLoader();
+                if (loader != null) {
+                    try {
+                        return Class.forName(className, true, loader);
+                    }
+                    catch (ClassNotFoundException e) {
+                        // fallback to user's class loader
+                    }
+                }
+            }
+        } catch (SecurityException exception) {
+            // ignore secured class loaders
+        }
+        return Class.forName(className, true, fallback);
+    }
+
+    /*
+     * private initializer
+     */
+    static private DataFlavor createConstant(Class<?> rc, String prn) {
+        try {
+            return new DataFlavor(rc, prn);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /*
+     * private initializer
+     */
+    static private DataFlavor createConstant(String mt, String prn) {
+        try {
+            return new DataFlavor(mt, prn);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /*
+     * private initializer
+     */
+    static private DataFlavor initHtmlDataFlavor(String htmlFlavorType) {
+        try {
+            return new DataFlavor ("text/html; class=java.lang.String;document=" +
+                                       htmlFlavorType + ";charset=Unicode");
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /**
+     * The <code>DataFlavor</code> representing a Java Unicode String class,
+     * where:
+     * <pre>
+     *     representationClass = java.lang.String
+     *     mimeType           = "application/x-java-serialized-object"
+     * </pre>
+     */
+    public static final DataFlavor stringFlavor = createConstant(java.lang.String.class, "Unicode String");
+
+    /**
+     * The <code>DataFlavor</code> representing a Java Image class,
+     * where:
+     * <pre>
+     *     representationClass = java.awt.Image
+     *     mimeType            = "image/x-java-image"
+     * </pre>
+     */
+    public static final DataFlavor imageFlavor = createConstant("image/x-java-image; class=java.awt.Image", "Image");
+
+    /**
+     * The <code>DataFlavor</code> representing plain text with Unicode
+     * encoding, where:
+     * <pre>
+     *     representationClass = InputStream
+     *     mimeType            = "text/plain; charset=unicode"
+     * </pre>
+     * This <code>DataFlavor</code> has been <b>deprecated</b> because
+     * (1) Its representation is an InputStream, an 8-bit based representation,
+     * while Unicode is a 16-bit character set; and (2) The charset "unicode"
+     * is not well-defined. "unicode" implies a particular platform's
+     * implementation of Unicode, not a cross-platform implementation.
+     *
+     * @deprecated as of 1.3. Use <code>DataFlavor.getReaderForText(Transferable)</code>
+     *             instead of <code>Transferable.getTransferData(DataFlavor.plainTextFlavor)</code>.
+     */
+    @Deprecated
+    public static final DataFlavor plainTextFlavor = createConstant("text/plain; charset=unicode; class=java.io.InputStream", "Plain Text");
+
+    /**
+     * A MIME Content-Type of application/x-java-serialized-object represents
+     * a graph of Java object(s) that have been made persistent.
+     *
+     * The representation class associated with this <code>DataFlavor</code>
+     * identifies the Java type of an object returned as a reference
+     * from an invocation <code>java.awt.datatransfer.getTransferData</code>.
+     */
+    public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object";
+
+    /**
+     * To transfer a list of files to/from Java (and the underlying
+     * platform) a <code>DataFlavor</code> of this type/subtype and
+     * representation class of <code>java.util.List</code> is used.
+     * Each element of the list is required/guaranteed to be of type
+     * <code>java.io.File</code>.
+     */
+    public static final DataFlavor javaFileListFlavor = createConstant("application/x-java-file-list;class=java.util.List", null);
+
+    /**
+     * To transfer a reference to an arbitrary Java object reference that
+     * has no associated MIME Content-type, across a <code>Transferable</code>
+     * interface WITHIN THE SAME JVM, a <code>DataFlavor</code>
+     * with this type/subtype is used, with a <code>representationClass</code>
+     * equal to the type of the class/interface being passed across the
+     * <code>Transferable</code>.
+     * <p>
+     * The object reference returned from
+     * <code>Transferable.getTransferData</code> for a <code>DataFlavor</code>
+     * with this MIME Content-Type is required to be
+     * an instance of the representation Class of the <code>DataFlavor</code>.
+     */
+    public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref";
+
+    /**
+     * In order to pass a live link to a Remote object via a Drag and Drop
+     * <code>ACTION_LINK</code> operation a Mime Content Type of
+     * application/x-java-remote-object should be used,
+     * where the representation class of the <code>DataFlavor</code>
+     * represents the type of the <code>Remote</code> interface to be
+     * transferred.
+     */
+    public static final String javaRemoteObjectMimeType = "application/x-java-remote-object";
+
+    /**
+     * Represents a piece of an HTML markup. The markup consists of the part
+     * selected on the source side. Therefore some tags in the markup may be
+     * unpaired. If the flavor is used to represent the data in
+     * a {@link Transferable} instance, no additional changes will be made.
+     * This DataFlavor instance represents the same HTML markup as DataFlavor
+     * instances which content MIME type does not contain document parameter
+     * and representation class is the String class.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static DataFlavor selectionHtmlFlavor = initHtmlDataFlavor("selection");
+
+    /**
+     * Represents a piece of an HTML markup. If possible, the markup received
+     * from a native system is supplemented with pair tags to be
+     * a well-formed HTML markup. If the flavor is used to represent the data in
+     * a {@link Transferable} instance, no additional changes will be made.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static DataFlavor fragmentHtmlFlavor = initHtmlDataFlavor("fragment");
+
+    /**
+     * Represents a piece of an HTML markup. If possible, the markup
+     * received from a native system is supplemented with additional
+     * tags to make up a well-formed HTML document. If the flavor is used to
+     * represent the data in a {@link Transferable} instance,
+     * no additional changes will be made.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static  DataFlavor allHtmlFlavor = initHtmlDataFlavor("all");
+
+    /**
+     * Constructs a new <code>DataFlavor</code>.  This constructor is
+     * provided only for the purpose of supporting the
+     * <code>Externalizable</code> interface.  It is not
+     * intended for public (client) use.
+     *
+     * @since 1.2
+     */
+    public DataFlavor() {
+        super();
+    }
+
+    /**
+     * Constructs a fully specified <code>DataFlavor</code>.
+     *
+     * @exception NullPointerException if either <code>primaryType</code>,
+     *            <code>subType</code> or <code>representationClass</code> is null
+     */
+    private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class<?> representationClass, String humanPresentableName) {
+        super();
+        if (primaryType == null) {
+            throw new NullPointerException("primaryType");
+        }
+        if (subType == null) {
+            throw new NullPointerException("subType");
+        }
+        if (representationClass == null) {
+            throw new NullPointerException("representationClass");
+        }
+
+        if (params == null) params = new MimeTypeParameterList();
+
+        params.set("class", representationClass.getName());
+
+        if (humanPresentableName == null) {
+            humanPresentableName = params.get("humanPresentableName");
+
+            if (humanPresentableName == null)
+                humanPresentableName = primaryType + "/" + subType;
+        }
+
+        try {
+            mimeType = new MimeType(primaryType, subType, params);
+        } catch (MimeTypeParseException mtpe) {
+            throw new IllegalArgumentException("MimeType Parse Exception: " + mtpe.getMessage());
+        }
+
+        this.representationClass  = representationClass;
+        this.humanPresentableName = humanPresentableName;
+
+        mimeType.removeParameter("humanPresentableName");
+    }
+
+    /**
+     * Constructs a <code>DataFlavor</code> that represents a Java class.
+     * <p>
+     * The returned <code>DataFlavor</code> will have the following
+     * characteristics:
+     * <pre>
+     *    representationClass = representationClass
+     *    mimeType            = application/x-java-serialized-object
+     * </pre>
+     * @param representationClass the class used to transfer data in this flavor
+     * @param humanPresentableName the human-readable string used to identify
+     *                 this flavor; if this parameter is <code>null</code>
+     *                 then the value of the MIME Content Type is used
+     * @exception NullPointerException if <code>representationClass</code> is null
+     */
+    public DataFlavor(Class<?> representationClass, String humanPresentableName) {
+        this("application", "x-java-serialized-object", null, representationClass, humanPresentableName);
+        if (representationClass == null) {
+            throw new NullPointerException("representationClass");
+        }
+    }
+
+    /**
+     * Constructs a <code>DataFlavor</code> that represents a
+     * <code>MimeType</code>.
+     * <p>
+     * The returned <code>DataFlavor</code> will have the following
+     * characteristics:
+     * <p>
+     * If the <code>mimeType</code> is
+     * "application/x-java-serialized-object; class=&lt;representation class&gt;",
+     * the result is the same as calling
+     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
+     * <p>
+     * Otherwise:
+     * <pre>
+     *     representationClass = InputStream
+     *     mimeType            = mimeType
+     * </pre>
+     * @param mimeType the string used to identify the MIME type for this flavor;
+     *                 if the <code>mimeType</code> does not specify a
+     *                 "class=" parameter, or if the class is not successfully
+     *                 loaded, then an <code>IllegalArgumentException</code>
+     *                 is thrown
+     * @param humanPresentableName the human-readable string used to identify
+     *                 this flavor; if this parameter is <code>null</code>
+     *                 then the value of the MIME Content Type is used
+     * @exception IllegalArgumentException if <code>mimeType</code> is
+     *                 invalid or if the class is not successfully loaded
+     * @exception NullPointerException if <code>mimeType</code> is null
+     */
+    public DataFlavor(String mimeType, String humanPresentableName) {
+        super();
+        if (mimeType == null) {
+            throw new NullPointerException("mimeType");
+        }
+        try {
+            initialize(mimeType, humanPresentableName, this.getClass().getClassLoader());
+        } catch (MimeTypeParseException mtpe) {
+            throw new IllegalArgumentException("failed to parse:" + mimeType);
+        } catch (ClassNotFoundException cnfe) {
+            throw new IllegalArgumentException("can't find specified class: " + cnfe.getMessage());
+        }
+    }
+
+    /**
+     * Constructs a <code>DataFlavor</code> that represents a
+     * <code>MimeType</code>.
+     * <p>
+     * The returned <code>DataFlavor</code> will have the following
+     * characteristics:
+     * <p>
+     * If the mimeType is
+     * "application/x-java-serialized-object; class=&lt;representation class&gt;",
+     * the result is the same as calling
+     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
+     * <p>
+     * Otherwise:
+     * <pre>
+     *     representationClass = InputStream
+     *     mimeType            = mimeType
+     * </pre>
+     * @param mimeType the string used to identify the MIME type for this flavor
+     * @param humanPresentableName the human-readable string used to
+     *          identify this flavor
+     * @param classLoader the class loader to use
+     * @exception ClassNotFoundException if the class is not loaded
+     * @exception IllegalArgumentException if <code>mimeType</code> is
+     *                 invalid
+     * @exception NullPointerException if <code>mimeType</code> is null
+     */
+    public DataFlavor(String mimeType, String humanPresentableName, ClassLoader classLoader) throws ClassNotFoundException {
+        super();
+        if (mimeType == null) {
+            throw new NullPointerException("mimeType");
+        }
+        try {
+            initialize(mimeType, humanPresentableName, classLoader);
+        } catch (MimeTypeParseException mtpe) {
+            throw new IllegalArgumentException("failed to parse:" + mimeType);
+        }
+    }
+
+    /**
+     * Constructs a <code>DataFlavor</code> from a <code>mimeType</code> string.
+     * The string can specify a "class=&lt;fully specified Java class name&gt;"
+     * parameter to create a <code>DataFlavor</code> with the desired
+     * representation class. If the string does not contain "class=" parameter,
+     * <code>java.io.InputStream</code> is used as default.
+     *
+     * @param mimeType the string used to identify the MIME type for this flavor;
+     *                 if the class specified by "class=" parameter is not
+     *                 successfully loaded, then an
+     *                 <code>ClassNotFoundException</code> is thrown
+     * @exception ClassNotFoundException if the class is not loaded
+     * @exception IllegalArgumentException if <code>mimeType</code> is
+     *                 invalid
+     * @exception NullPointerException if <code>mimeType</code> is null
+     */
+    public DataFlavor(String mimeType) throws ClassNotFoundException {
+        super();
+        if (mimeType == null) {
+            throw new NullPointerException("mimeType");
+        }
+        try {
+            initialize(mimeType, null, this.getClass().getClassLoader());
+        } catch (MimeTypeParseException mtpe) {
+            throw new IllegalArgumentException("failed to parse:" + mimeType);
+        }
+    }
+
+   /**
+    * Common initialization code called from various constructors.
+    *
+    * @param mimeType the MIME Content Type (must have a class= param)
+    * @param humanPresentableName the human Presentable Name or
+    *                 <code>null</code>
+    * @param classLoader the fallback class loader to resolve against
+    *
+    * @throws MimeTypeParseException
+    * @throws ClassNotFoundException
+    * @throws  NullPointerException if <code>mimeType</code> is null
+    *
+    * @see #tryToLoadClass
+    */
+    private void initialize(String mimeType, String humanPresentableName, ClassLoader classLoader) throws MimeTypeParseException, ClassNotFoundException {
+        if (mimeType == null) {
+            throw new NullPointerException("mimeType");
+        }
+
+        this.mimeType = new MimeType(mimeType); // throws
+
+        String rcn = getParameter("class");
+
+        if (rcn == null) {
+            if ("application/x-java-serialized-object".equals(this.mimeType.getBaseType()))
+
+                throw new IllegalArgumentException("no representation class specified for:" + mimeType);
+            else
+                representationClass = java.io.InputStream.class; // default
+        } else { // got a class name
+            representationClass = DataFlavor.tryToLoadClass(rcn, classLoader);
+        }
+
+        this.mimeType.setParameter("class", representationClass.getName());
+
+        if (humanPresentableName == null) {
+            humanPresentableName = this.mimeType.getParameter("humanPresentableName");
+            if (humanPresentableName == null)
+                humanPresentableName = this.mimeType.getPrimaryType() + "/" + this.mimeType.getSubType();
+        }
+
+        this.humanPresentableName = humanPresentableName; // set it.
+
+        this.mimeType.removeParameter("humanPresentableName"); // just in case
+    }
+
+    /**
+     * String representation of this <code>DataFlavor</code> and its
+     * parameters. The resulting <code>String</code> contains the name of
+     * the <code>DataFlavor</code> class, this flavor's MIME type, and its
+     * representation class. If this flavor has a primary MIME type of "text",
+     * supports the charset parameter, and has an encoded representation, the
+     * flavor's charset is also included. See <code>selectBestTextFlavor</code>
+     * for a list of text flavors which support the charset parameter.
+     *
+     * @return  string representation of this <code>DataFlavor</code>
+     * @see #selectBestTextFlavor
+     */
+    public String toString() {
+        String string = getClass().getName();
+        string += "["+paramString()+"]";
+        return string;
+    }
+
+    private String paramString() {
+        String params = "";
+        params += "mimetype=";
+        if (mimeType == null) {
+            params += "null";
+        } else {
+            params += mimeType.getBaseType();
+        }
+        params += ";representationclass=";
+        if (representationClass == null) {
+           params += "null";
+        } else {
+           params += representationClass.getName();
+        }
+        if (DataFlavorUtil.isFlavorCharsetTextType(this) &&
+            (isRepresentationClassInputStream() ||
+             isRepresentationClassByteBuffer() ||
+             byte[].class.equals(representationClass)))
+        {
+            params += ";charset=" + DataFlavorUtil.getTextCharset(this);
+        }
+        return params;
+    }
+
+    /**
+     * Returns a <code>DataFlavor</code> representing plain text with Unicode
+     * encoding, where:
+     * <pre>
+     *     representationClass = java.io.InputStream
+     *     mimeType            = "text/plain;
+     *                            charset=&lt;platform default Unicode encoding&gt;"
+     * </pre>
+     * Sun's implementation for Microsoft Windows uses the encoding <code>utf-16le</code>.
+     * Sun's implementation for Solaris and Linux uses the encoding
+     * <code>iso-10646-ucs-2</code>.
+     *
+     * @return a <code>DataFlavor</code> representing plain text
+     *    with Unicode encoding
+     * @since 1.3
+     */
+    public static final DataFlavor getTextPlainUnicodeFlavor() {
+        return new DataFlavor(
+            "text/plain;charset=" + DataFlavorUtil.getDesktopService().getDefaultUnicodeEncoding()
+            +";class=java.io.InputStream", "Plain Text");
+    }
+
+    /**
+     * Selects the best text <code>DataFlavor</code> from an array of <code>
+     * DataFlavor</code>s. Only <code>DataFlavor.stringFlavor</code>, and
+     * equivalent flavors, and flavors that have a primary MIME type of "text",
+     * are considered for selection.
+     * <p>
+     * Flavors are first sorted by their MIME types in the following order:
+     * <ul>
+     * <li>"text/sgml"
+     * <li>"text/xml"
+     * <li>"text/html"
+     * <li>"text/rtf"
+     * <li>"text/enriched"
+     * <li>"text/richtext"
+     * <li>"text/uri-list"
+     * <li>"text/tab-separated-values"
+     * <li>"text/t140"
+     * <li>"text/rfc822-headers"
+     * <li>"text/parityfec"
+     * <li>"text/directory"
+     * <li>"text/css"
+     * <li>"text/calendar"
+     * <li>"application/x-java-serialized-object"
+     * <li>"text/plain"
+     * <li>"text/&lt;other&gt;"
+     * </ul>
+     * <p>For example, "text/sgml" will be selected over
+     * "text/html", and <code>DataFlavor.stringFlavor</code> will be chosen
+     * over <code>DataFlavor.plainTextFlavor</code>.
+     * <p>
+     * If two or more flavors share the best MIME type in the array, then that
+     * MIME type will be checked to see if it supports the charset parameter.
+     * <p>
+     * The following MIME types support, or are treated as though they support,
+     * the charset parameter:
+     * <ul>
+     * <li>"text/sgml"
+     * <li>"text/xml"
+     * <li>"text/html"
+     * <li>"text/enriched"
+     * <li>"text/richtext"
+     * <li>"text/uri-list"
+     * <li>"text/directory"
+     * <li>"text/css"
+     * <li>"text/calendar"
+     * <li>"application/x-java-serialized-object"
+     * <li>"text/plain"
+     * </ul>
+     * The following MIME types do not support, or are treated as though they
+     * do not support, the charset parameter:
+     * <ul>
+     * <li>"text/rtf"
+     * <li>"text/tab-separated-values"
+     * <li>"text/t140"
+     * <li>"text/rfc822-headers"
+     * <li>"text/parityfec"
+     * </ul>
+     * For "text/&lt;other&gt;" MIME types, the first time the JRE needs to
+     * determine whether the MIME type supports the charset parameter, it will
+     * check whether the parameter is explicitly listed in an arbitrarily
+     * chosen <code>DataFlavor</code> which uses that MIME type. If so, the JRE
+     * will assume from that point on that the MIME type supports the charset
+     * parameter and will not check again. If the parameter is not explicitly
+     * listed, the JRE will assume from that point on that the MIME type does
+     * not support the charset parameter and will not check again. Because
+     * this check is performed on an arbitrarily chosen
+     * <code>DataFlavor</code>, developers must ensure that all
+     * <code>DataFlavor</code>s with a "text/&lt;other&gt;" MIME type specify
+     * the charset parameter if it is supported by that MIME type. Developers
+     * should never rely on the JRE to substitute the platform's default
+     * charset for a "text/&lt;other&gt;" DataFlavor. Failure to adhere to this
+     * restriction will lead to undefined behavior.
+     * <p>
+     * If the best MIME type in the array does not support the charset
+     * parameter, the flavors which share that MIME type will then be sorted by
+     * their representation classes in the following order:
+     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
+     * <code>[B</code>, &lt;all others&gt;.
+     * <p>
+     * If two or more flavors share the best representation class, or if no
+     * flavor has one of the three specified representations, then one of those
+     * flavors will be chosen non-deterministically.
+     * <p>
+     * If the best MIME type in the array does support the charset parameter,
+     * the flavors which share that MIME type will then be sorted by their
+     * representation classes in the following order:
+     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
+     * <code>java.nio.CharBuffer</code>, <code>[C</code>, &lt;all others&gt;.
+     * <p>
+     * If two or more flavors share the best representation class, and that
+     * representation is one of the four explicitly listed, then one of those
+     * flavors will be chosen non-deterministically. If, however, no flavor has
+     * one of the four specified representations, the flavors will then be
+     * sorted by their charsets. Unicode charsets, such as "UTF-16", "UTF-8",
+     * "UTF-16BE", "UTF-16LE", and their aliases, are considered best. After
+     * them, the platform default charset and its aliases are selected.
+     * "US-ASCII" and its aliases are worst. All other charsets are chosen in
+     * alphabetical order, but only charsets supported by this implementation
+     * of the Java platform will be considered.
+     * <p>
+     * If two or more flavors share the best charset, the flavors will then
+     * again be sorted by their representation classes in the following order:
+     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
+     * <code>[B</code>, &lt;all others&gt;.
+     * <p>
+     * If two or more flavors share the best representation class, or if no
+     * flavor has one of the three specified representations, then one of those
+     * flavors will be chosen non-deterministically.
+     *
+     * @param availableFlavors an array of available <code>DataFlavor</code>s
+     * @return the best (highest fidelity) flavor according to the rules
+     *         specified above, or <code>null</code>,
+     *         if <code>availableFlavors</code> is <code>null</code>,
+     *         has zero length, or contains no text flavors
+     * @since 1.3
+     */
+    public static final DataFlavor selectBestTextFlavor(
+                                       DataFlavor[] availableFlavors) {
+        if (availableFlavors == null || availableFlavors.length == 0) {
+            return null;
+        }
+
+        DataFlavor bestFlavor = Collections.max(Arrays.asList(availableFlavors),
+                                                DataFlavorUtil.getTextFlavorComparator());
+
+        if (!bestFlavor.isFlavorTextType()) {
+            return null;
+        }
+
+        return bestFlavor;
+    }
+
+    /**
+     * Gets a Reader for a text flavor, decoded, if necessary, for the expected
+     * charset (encoding). The supported representation classes are
+     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
+     * <code>java.nio.CharBuffer</code>, <code>[C</code>,
+     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
+     * and <code>[B</code>.
+     * <p>
+     * Because text flavors which do not support the charset parameter are
+     * encoded in a non-standard format, this method should not be called for
+     * such flavors. However, in order to maintain backward-compatibility,
+     * if this method is called for such a flavor, this method will treat the
+     * flavor as though it supports the charset parameter and attempt to
+     * decode it accordingly. See <code>selectBestTextFlavor</code> for a list
+     * of text flavors which do not support the charset parameter.
+     *
+     * @param transferable the <code>Transferable</code> whose data will be
+     *        requested in this flavor
+     *
+     * @return a <code>Reader</code> to read the <code>Transferable</code>'s
+     *         data
+     *
+     * @exception IllegalArgumentException if the representation class
+     *            is not one of the seven listed above
+     * @exception IllegalArgumentException if the <code>Transferable</code>
+     *            has <code>null</code> data
+     * @exception NullPointerException if the <code>Transferable</code> is
+     *            <code>null</code>
+     * @exception UnsupportedEncodingException if this flavor's representation
+     *            is <code>java.io.InputStream</code>,
+     *            <code>java.nio.ByteBuffer</code>, or <code>[B</code> and
+     *            this flavor's encoding is not supported by this
+     *            implementation of the Java platform
+     * @exception UnsupportedFlavorException if the <code>Transferable</code>
+     *            does not support this flavor
+     * @exception IOException if the data cannot be read because of an
+     *            I/O error
+     * @see #selectBestTextFlavor
+     * @since 1.3
+     */
+    public Reader getReaderForText(Transferable transferable)
+        throws UnsupportedFlavorException, IOException
+    {
+        Object transferObject = transferable.getTransferData(this);
+        if (transferObject == null) {
+            throw new IllegalArgumentException
+                ("getTransferData() returned null");
+        }
+
+        if (transferObject instanceof Reader) {
+            return (Reader)transferObject;
+        } else if (transferObject instanceof String) {
+            return new StringReader((String)transferObject);
+        } else if (transferObject instanceof CharBuffer) {
+            CharBuffer buffer = (CharBuffer)transferObject;
+            int size = buffer.remaining();
+            char[] chars = new char[size];
+            buffer.get(chars, 0, size);
+            return new CharArrayReader(chars);
+        } else if (transferObject instanceof char[]) {
+            return new CharArrayReader((char[])transferObject);
+        }
+
+        InputStream stream = null;
+
+        if (transferObject instanceof InputStream) {
+            stream = (InputStream)transferObject;
+        } else if (transferObject instanceof ByteBuffer) {
+            ByteBuffer buffer = (ByteBuffer)transferObject;
+            int size = buffer.remaining();
+            byte[] bytes = new byte[size];
+            buffer.get(bytes, 0, size);
+            stream = new ByteArrayInputStream(bytes);
+        } else if (transferObject instanceof byte[]) {
+            stream = new ByteArrayInputStream((byte[])transferObject);
+        }
+
+        if (stream == null) {
+            throw new IllegalArgumentException("transfer data is not Reader, String, CharBuffer, char array, InputStream, ByteBuffer, or byte array");
+        }
+
+        String encoding = getParameter("charset");
+        return (encoding == null)
+            ? new InputStreamReader(stream)
+            : new InputStreamReader(stream, encoding);
+    }
+
+    /**
+     * Returns the MIME type string for this <code>DataFlavor</code>.
+     * @return the MIME type string for this flavor
+     */
+    public String getMimeType() {
+        return (mimeType != null) ? mimeType.toString() : null;
+    }
+
+    /**
+     * Returns the <code>Class</code> which objects supporting this
+     * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
+     * is requested.
+     * @return the <code>Class</code> which objects supporting this
+     * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
+     * is requested
+     */
+    public Class<?> getRepresentationClass() {
+        return representationClass;
+    }
+
+    /**
+     * Returns the human presentable name for the data format that this
+     * <code>DataFlavor</code> represents.  This name would be localized
+     * for different countries.
+     * @return the human presentable name for the data format that this
+     *    <code>DataFlavor</code> represents
+     */
+    public String getHumanPresentableName() {
+        return humanPresentableName;
+    }
+
+    /**
+     * Returns the primary MIME type for this <code>DataFlavor</code>.
+     * @return the primary MIME type of this <code>DataFlavor</code>
+     */
+    public String getPrimaryType() {
+        return (mimeType != null) ? mimeType.getPrimaryType() : null;
+    }
+
+    /**
+     * Returns the sub MIME type of this <code>DataFlavor</code>.
+     * @return the Sub MIME type of this <code>DataFlavor</code>
+     */
+    public String getSubType() {
+        return (mimeType != null) ? mimeType.getSubType() : null;
+    }
+
+    /**
+     * Returns the human presentable name for this <code>DataFlavor</code>
+     * if <code>paramName</code> equals "humanPresentableName".  Otherwise
+     * returns the MIME type value associated with <code>paramName</code>.
+     *
+     * @param paramName the parameter name requested
+     * @return the value of the name parameter, or <code>null</code>
+     *  if there is no associated value
+     */
+    public String getParameter(String paramName) {
+        if (paramName.equals("humanPresentableName")) {
+            return humanPresentableName;
+        } else {
+            return (mimeType != null)
+                ? mimeType.getParameter(paramName) : null;
+        }
+    }
+
+    /**
+     * Sets the human presentable name for the data format that this
+     * <code>DataFlavor</code> represents. This name would be localized
+     * for different countries.
+     * @param humanPresentableName the new human presentable name
+     */
+    public void setHumanPresentableName(String humanPresentableName) {
+        this.humanPresentableName = humanPresentableName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The equals comparison for the {@code DataFlavor} class is implemented
+     * as follows: Two <code>DataFlavor</code>s are considered equal if and
+     * only if their MIME primary type and subtype and representation class are
+     * equal. Additionally, if the primary type is "text", the subtype denotes
+     * a text flavor which supports the charset parameter, and the
+     * representation class is not <code>java.io.Reader</code>,
+     * <code>java.lang.String</code>, <code>java.nio.CharBuffer</code>, or
+     * <code>[C</code>, the <code>charset</code> parameter must also be equal.
+     * If a charset is not explicitly specified for one or both
+     * <code>DataFlavor</code>s, the platform default encoding is assumed. See
+     * <code>selectBestTextFlavor</code> for a list of text flavors which
+     * support the charset parameter.
+     *
+     * @param o the <code>Object</code> to compare with <code>this</code>
+     * @return <code>true</code> if <code>that</code> is equivalent to this
+     *         <code>DataFlavor</code>; <code>false</code> otherwise
+     * @see #selectBestTextFlavor
+     */
+    public boolean equals(Object o) {
+        return ((o instanceof DataFlavor) && equals((DataFlavor)o));
+    }
+
+    /**
+     * This method has the same behavior as {@link #equals(Object)}.
+     * The only difference being that it takes a {@code DataFlavor} instance
+     * as a parameter.
+     *
+     * @param that the <code>DataFlavor</code> to compare with
+     *        <code>this</code>
+     * @return <code>true</code> if <code>that</code> is equivalent to this
+     *         <code>DataFlavor</code>; <code>false</code> otherwise
+     * @see #selectBestTextFlavor
+     */
+    public boolean equals(DataFlavor that) {
+        if (that == null) {
+            return false;
+        }
+        if (this == that) {
+            return true;
+        }
+
+        if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) {
+            return false;
+        }
+
+        if (mimeType == null) {
+            if (that.mimeType != null) {
+                return false;
+            }
+        } else {
+            if (!mimeType.match(that.mimeType)) {
+                return false;
+            }
+
+            if ("text".equals(getPrimaryType())) {
+                if (DataFlavorUtil.doesSubtypeSupportCharset(this)
+                        && representationClass != null
+                        && !isStandardTextRepresentationClass()) {
+                    String thisCharset =
+                            DataFlavorUtil.canonicalName(this.getParameter("charset"));
+                    String thatCharset =
+                            DataFlavorUtil.canonicalName(that.getParameter("charset"));
+                    if (!Objects.equals(thisCharset, thatCharset)) {
+                        return false;
+                    }
+                }
+
+                if ("html".equals(getSubType())) {
+                    String thisDocument = this.getParameter("document");
+                    String thatDocument = that.getParameter("document");
+                    if (!Objects.equals(thisDocument, thatDocument)) {
+                        return false;
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Compares only the <code>mimeType</code> against the passed in
+     * <code>String</code> and <code>representationClass</code> is
+     * not considered in the comparison.
+     *
+     * If <code>representationClass</code> needs to be compared, then
+     * <code>equals(new DataFlavor(s))</code> may be used.
+     * @deprecated As inconsistent with <code>hashCode()</code> contract,
+     *             use <code>isMimeTypeEqual(String)</code> instead.
+     * @param s the {@code mimeType} to compare.
+     * @return true if the String (MimeType) is equal; false otherwise or if
+     *         {@code s} is {@code null}
+     */
+    @Deprecated
+    public boolean equals(String s) {
+        if (s == null || mimeType == null)
+            return false;
+        return isMimeTypeEqual(s);
+    }
+
+    /**
+     * Returns hash code for this <code>DataFlavor</code>.
+     * For two equal <code>DataFlavor</code>s, hash codes are equal.
+     * For the <code>String</code>
+     * that matches <code>DataFlavor.equals(String)</code>, it is not
+     * guaranteed that <code>DataFlavor</code>'s hash code is equal
+     * to the hash code of the <code>String</code>.
+     *
+     * @return a hash code for this <code>DataFlavor</code>
+     */
+    public int hashCode() {
+        int total = 0;
+
+        if (representationClass != null) {
+            total += representationClass.hashCode();
+        }
+
+        if (mimeType != null) {
+            String primaryType = mimeType.getPrimaryType();
+            if (primaryType != null) {
+                total += primaryType.hashCode();
+            }
+
+            // Do not add subType.hashCode() to the total. equals uses
+            // MimeType.match which reports a match if one or both of the
+            // subTypes is '*', regardless of the other subType.
+
+            if ("text".equals(primaryType)) {
+                if (DataFlavorUtil.doesSubtypeSupportCharset(this)
+                        && representationClass != null
+                        && !isStandardTextRepresentationClass()) {
+                    String charset = DataFlavorUtil.canonicalName(getParameter("charset"));
+                    if (charset != null) {
+                        total += charset.hashCode();
+                    }
+                }
+
+                if ("html".equals(getSubType())) {
+                    String document = this.getParameter("document");
+                    if (document != null) {
+                        total += document.hashCode();
+                    }
+                }
+            }
+        }
+
+        return total;
+    }
+
+    /**
+     * Identical to {@link #equals(DataFlavor)}.
+     *
+     * @param that the <code>DataFlavor</code> to compare with
+     *        <code>this</code>
+     * @return <code>true</code> if <code>that</code> is equivalent to this
+     *         <code>DataFlavor</code>; <code>false</code> otherwise
+     * @see #selectBestTextFlavor
+     * @since 1.3
+     */
+    public boolean match(DataFlavor that) {
+        return equals(that);
+    }
+
+    /**
+     * Returns whether the string representation of the MIME type passed in
+     * is equivalent to the MIME type of this <code>DataFlavor</code>.
+     * Parameters are not included in the comparison.
+     *
+     * @param mimeType the string representation of the MIME type
+     * @return true if the string representation of the MIME type passed in is
+     *         equivalent to the MIME type of this <code>DataFlavor</code>;
+     *         false otherwise
+     * @throws NullPointerException if mimeType is <code>null</code>
+     */
+    public boolean isMimeTypeEqual(String mimeType) {
+        // JCK Test DataFlavor0117: if 'mimeType' is null, throw NPE
+        if (mimeType == null) {
+            throw new NullPointerException("mimeType");
+        }
+        if (this.mimeType == null) {
+            return false;
+        }
+        try {
+            return this.mimeType.match(new MimeType(mimeType));
+        } catch (MimeTypeParseException mtpe) {
+            return false;
+        }
+    }
+
+    /**
+     * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
+     * objects. No parameters are considered.
+     *
+     * @param dataFlavor the <code>DataFlavor</code> to be compared
+     * @return true if the <code>MimeType</code>s are equal,
+     *  otherwise false
+     */
+
+    public final boolean isMimeTypeEqual(DataFlavor dataFlavor) {
+        return isMimeTypeEqual(dataFlavor.mimeType);
+    }
+
+    /**
+     * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
+     * objects.  No parameters are considered.
+     *
+     * @return true if the <code>MimeType</code>s are equal,
+     *  otherwise false
+     */
+
+    private boolean isMimeTypeEqual(MimeType mtype) {
+        if (this.mimeType == null) {
+            return (mtype == null);
+        }
+        return mimeType.match(mtype);
+    }
+
+    /**
+     * Checks if the representation class is one of the standard text
+     * representation classes.
+     *
+     * @return true if the representation class is one of the standard text
+     *              representation classes, otherwise false
+     */
+    private boolean isStandardTextRepresentationClass() {
+        return isRepresentationClassReader()
+                || String.class.equals(representationClass)
+                || isRepresentationClassCharBuffer()
+                || char[].class.equals(representationClass);
+    }
+
+   /**
+    * Does the <code>DataFlavor</code> represent a serialized object?
+    * @return whether or not a serialized object is represented
+    */
+    public boolean isMimeTypeSerializedObject() {
+        return isMimeTypeEqual(javaSerializedObjectMimeType);
+    }
+
+    /**
+     * Returns the default representation class.
+     * @return the default representation class
+     */
+    public final Class<?> getDefaultRepresentationClass() {
+        return ioInputStreamClass;
+    }
+
+    /**
+     * Returns the name of the default representation class.
+     * @return the name of the default representation class
+     */
+    public final String getDefaultRepresentationClassAsString() {
+        return getDefaultRepresentationClass().getName();
+    }
+
+   /**
+    * Does the <code>DataFlavor</code> represent a
+    * <code>java.io.InputStream</code>?
+    * @return whether or not this {@code DataFlavor} represent a
+    * {@code java.io.InputStream}
+    */
+    public boolean isRepresentationClassInputStream() {
+        return ioInputStreamClass.isAssignableFrom(representationClass);
+    }
+
+    /**
+     * Returns whether the representation class for this
+     * <code>DataFlavor</code> is <code>java.io.Reader</code> or a subclass
+     * thereof.
+     * @return whether or not the representation class for this
+     * {@code DataFlavor} is {@code java.io.Reader} or a subclass
+     * thereof
+     *
+     * @since 1.4
+     */
+    public boolean isRepresentationClassReader() {
+        return java.io.Reader.class.isAssignableFrom(representationClass);
+    }
+
+    /**
+     * Returns whether the representation class for this
+     * <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a
+     * subclass thereof.
+     * @return whether or not the representation class for this
+     * {@code DataFlavor} is {@code java.nio.CharBuffer} or a subclass
+     * thereof
+     *
+     * @since 1.4
+     */
+    public boolean isRepresentationClassCharBuffer() {
+        return java.nio.CharBuffer.class.isAssignableFrom(representationClass);
+    }
+
+    /**
+     * Returns whether the representation class for this
+     * <code>DataFlavor</code> is <code>java.nio.ByteBuffer</code> or a
+     * subclass thereof.
+     * @return whether or not the representation class for this
+     * {@code DataFlavor} is {@code java.nio.ByteBuffer} or a subclass
+     * thereof
+     *
+     * @since 1.4
+     */
+    public boolean isRepresentationClassByteBuffer() {
+        return java.nio.ByteBuffer.class.isAssignableFrom(representationClass);
+    }
+
+   /**
+    * Returns true if the representation class can be serialized.
+    * @return true if the representation class can be serialized
+    */
+
+    public boolean isRepresentationClassSerializable() {
+        return java.io.Serializable.class.isAssignableFrom(representationClass);
+    }
+
+   /**
+    * Returns true if the representation class is <code>Remote</code>.
+    * @return true if the representation class is <code>Remote</code>
+    */
+    public boolean isRepresentationClassRemote() {
+        return DataFlavorUtil.RMI.isRemote(representationClass);
+    }
+
+   /**
+    * Returns true if the <code>DataFlavor</code> specified represents
+    * a serialized object.
+    * @return true if the <code>DataFlavor</code> specified represents
+    *   a Serialized Object
+    */
+
+    public boolean isFlavorSerializedObjectType() {
+        return isRepresentationClassSerializable() && isMimeTypeEqual(javaSerializedObjectMimeType);
+    }
+
+    /**
+     * Returns true if the <code>DataFlavor</code> specified represents
+     * a remote object.
+     * @return true if the <code>DataFlavor</code> specified represents
+     *  a Remote Object
+     */
+
+    public boolean isFlavorRemoteObjectType() {
+        return isRepresentationClassRemote()
+            && isRepresentationClassSerializable()
+            && isMimeTypeEqual(javaRemoteObjectMimeType);
+    }
+
+
+   /**
+    * Returns true if the <code>DataFlavor</code> specified represents
+    * a list of file objects.
+    * @return true if the <code>DataFlavor</code> specified represents
+    *   a List of File objects
+    */
+
+   public boolean isFlavorJavaFileListType() {
+        if (mimeType == null || representationClass == null)
+            return false;
+        return java.util.List.class.isAssignableFrom(representationClass) &&
+               mimeType.match(javaFileListFlavor.mimeType);
+
+   }
+
+    /**
+     * Returns whether this <code>DataFlavor</code> is a valid text flavor for
+     * this implementation of the Java platform. Only flavors equivalent to
+     * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
+     * a primary MIME type of "text" can be valid text flavors.
+     * <p>
+     * If this flavor supports the charset parameter, it must be equivalent to
+     * <code>DataFlavor.stringFlavor</code>, or its representation must be
+     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
+     * <code>java.nio.CharBuffer</code>, <code>[C</code>,
+     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
+     * <code>[B</code>. If the representation is
+     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
+     * <code>[B</code>, then this flavor's <code>charset</code> parameter must
+     * be supported by this implementation of the Java platform. If a charset
+     * is not specified, then the platform default charset, which is always
+     * supported, is assumed.
+     * <p>
+     * If this flavor does not support the charset parameter, its
+     * representation must be <code>java.io.InputStream</code>,
+     * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
+     * <p>
+     * See <code>selectBestTextFlavor</code> for a list of text flavors which
+     * support the charset parameter.
+     *
+     * @return <code>true</code> if this <code>DataFlavor</code> is a valid
+     *         text flavor as described above; <code>false</code> otherwise
+     * @see #selectBestTextFlavor
+     * @since 1.4
+     */
+    public boolean isFlavorTextType() {
+        return (DataFlavorUtil.isFlavorCharsetTextType(this) ||
+                DataFlavorUtil.isFlavorNoncharsetTextType(this));
+    }
+
+   /**
+    * Serializes this <code>DataFlavor</code>.
+    */
+
+   public synchronized void writeExternal(ObjectOutput os) throws IOException {
+       if (mimeType != null) {
+           mimeType.setParameter("humanPresentableName", humanPresentableName);
+           os.writeObject(mimeType);
+           mimeType.removeParameter("humanPresentableName");
+       } else {
+           os.writeObject(null);
+       }
+
+       os.writeObject(representationClass);
+   }
+
+   /**
+    * Restores this <code>DataFlavor</code> from a Serialized state.
+    */
+
+   public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException {
+       String rcn = null;
+        mimeType = (MimeType)is.readObject();
+
+        if (mimeType != null) {
+            humanPresentableName =
+                mimeType.getParameter("humanPresentableName");
+            mimeType.removeParameter("humanPresentableName");
+            rcn = mimeType.getParameter("class");
+            if (rcn == null) {
+                throw new IOException("no class parameter specified in: " +
+                                      mimeType);
+            }
+        }
+
+        try {
+            representationClass = (Class)is.readObject();
+        } catch (OptionalDataException ode) {
+            if (!ode.eof || ode.length != 0) {
+                throw ode;
+            }
+            // Ensure backward compatibility.
+            // Old versions didn't write the representation class to the stream.
+            if (rcn != null) {
+                representationClass =
+                    DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader());
+            }
+        }
+   }
+
+   /**
+    * Returns a clone of this <code>DataFlavor</code>.
+    * @return a clone of this <code>DataFlavor</code>
+    */
+
+    public Object clone() throws CloneNotSupportedException {
+        Object newObj = super.clone();
+        if (mimeType != null) {
+            ((DataFlavor)newObj).mimeType = (MimeType)mimeType.clone();
+        }
+        return newObj;
+    } // clone()
+
+   /**
+    * Called on <code>DataFlavor</code> for every MIME Type parameter
+    * to allow <code>DataFlavor</code> subclasses to handle special
+    * parameters like the text/plain <code>charset</code>
+    * parameters, whose values are case insensitive.  (MIME type parameter
+    * values are supposed to be case sensitive.
+    * <p>
+    * This method is called for each parameter name/value pair and should
+    * return the normalized representation of the <code>parameterValue</code>.
+    *
+    * This method is never invoked by this implementation from 1.1 onwards.
+    *
+    * @param parameterName the parameter name
+    * @param parameterValue the parameter value
+    * @return the parameter value
+    * @deprecated
+    */
+    @Deprecated
+    protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) {
+        return parameterValue;
+    }
+
+   /**
+    * Called for each MIME type string to give <code>DataFlavor</code> subtypes
+    * the opportunity to change how the normalization of MIME types is
+    * accomplished.  One possible use would be to add default
+    * parameter/value pairs in cases where none are present in the MIME
+    * type string passed in.
+    *
+    * This method is never invoked by this implementation from 1.1 onwards.
+    *
+    * @param mimeType the mime type
+    * @return the mime type
+    * @deprecated
+    */
+    @Deprecated
+    protected String normalizeMimeType(String mimeType) {
+        return mimeType;
+    }
+
+    /*
+     * fields
+     */
+
+    /* placeholder for caching any platform-specific data for flavor */
+
+    transient int       atom;
+
+    /* Mime Type of DataFlavor */
+
+    MimeType            mimeType;
+
+    private String      humanPresentableName;
+
+    /** Java class of objects this DataFlavor represents **/
+
+    private Class<?>       representationClass;
+
+} // class DataFlavor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorEvent.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2003, 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 java.awt.datatransfer;
+
+import java.util.EventObject;
+
+
+/**
+ * <code>FlavorEvent</code> is used to notify interested parties
+ * that available {@link DataFlavor}s have changed in the
+ * {@link Clipboard} (the event source).
+ *
+ * @see FlavorListener
+ *
+ * @author Alexander Gerasimov
+ * @since 1.5
+ */
+public class FlavorEvent extends EventObject {
+    private static final long serialVersionUID = -5842664112252414548L;
+
+    /**
+     * Constructs a <code>FlavorEvent</code> object.
+     *
+     * @param source  the <code>Clipboard</code> that is the source of the event
+     *
+     * @throws IllegalArgumentException if the {@code source} is {@code null}
+     */
+    public FlavorEvent(Clipboard source) {
+        super(source);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorListener.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.awt.datatransfer;
+
+import java.util.EventListener;
+
+
+/**
+ * Defines an object which listens for {@link FlavorEvent}s.
+ *
+ * @author Alexander Gerasimov
+ * @since 1.5
+ */
+public interface FlavorListener extends EventListener {
+    /**
+     * Invoked when the target {@link Clipboard} of the listener
+     * has changed its available {@link DataFlavor}s.
+     * <p>
+     * Some notifications may be redundant &#8212; they are not
+     * caused by a change of the set of DataFlavors available
+     * on the clipboard.
+     * For example, if the clipboard subsystem supposes that
+     * the system clipboard's contents has been changed but it
+     * can't ascertain whether its DataFlavors have been changed
+     * because of some exceptional condition when accessing the
+     * clipboard, the notification is sent to ensure from omitting
+     * a significant notification. Ordinarily, those redundant
+     * notifications should be occasional.
+     *
+     * @param e  a <code>FlavorEvent</code> object
+     */
+    void flavorsChanged(FlavorEvent e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorMap.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import java.util.Map;
+
+
+/**
+ * A two-way Map between "natives" (Strings), which correspond to platform-
+ * specific data formats, and "flavors" (DataFlavors), which correspond to
+ * platform-independent MIME types. FlavorMaps need not be symmetric, but
+ * typically are.
+ *
+ *
+ * @since 1.2
+ */
+public interface FlavorMap {
+
+    /**
+     * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
+     * their corresponding <code>String</code> native. The returned
+     * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
+     * internal data. Client code is free to modify the <code>Map</code>
+     * without affecting this object.
+     *
+     * @param flavors an array of <code>DataFlavor</code>s which will be the
+     *        key set of the returned <code>Map</code>. If <code>null</code> is
+     *        specified, a mapping of all <code>DataFlavor</code>s currently
+     *        known to this <code>FlavorMap</code> to their corresponding
+     *        <code>String</code> natives will be returned.
+     * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
+     *         <code>String</code> natives
+     */
+    Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors);
+
+    /**
+     * Returns a <code>Map</code> of the specified <code>String</code> natives
+     * to their corresponding <code>DataFlavor</code>. The returned
+     * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
+     * internal data. Client code is free to modify the <code>Map</code>
+     * without affecting this object.
+     *
+     * @param natives an array of <code>String</code>s which will be the
+     *        key set of the returned <code>Map</code>. If <code>null</code> is
+     *        specified, a mapping of all <code>String</code> natives currently
+     *        known to this <code>FlavorMap</code> to their corresponding
+     *        <code>DataFlavor</code>s will be returned.
+     * @return a <code>java.util.Map</code> of <code>String</code> natives to
+     *         <code>DataFlavor</code>s
+     */
+    Map<String,DataFlavor> getFlavorsForNatives(String[] natives);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorTable.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import java.util.List;
+
+
+/**
+ * A FlavorMap which relaxes the traditional 1-to-1 restriction of a Map. A
+ * flavor is permitted to map to any number of natives, and likewise a native
+ * is permitted to map to any number of flavors. FlavorTables need not be
+ * symmetric, but typically are.
+ *
+ * @author David Mendenhall
+ *
+ * @since 1.4
+ */
+public interface FlavorTable extends FlavorMap {
+
+    /**
+     * Returns a <code>List</code> of <code>String</code> natives to which the
+     * specified <code>DataFlavor</code> corresponds. The <code>List</code>
+     * will be sorted from best native to worst. That is, the first native will
+     * best reflect data in the specified flavor to the underlying native
+     * platform. The returned <code>List</code> is a modifiable copy of this
+     * <code>FlavorTable</code>'s internal data. Client code is free to modify
+     * the <code>List</code> without affecting this object.
+     *
+     * @param flav the <code>DataFlavor</code> whose corresponding natives
+     *        should be returned. If <code>null</code> is specified, all
+     *        natives currently known to this <code>FlavorTable</code> are
+     *        returned in a non-deterministic order.
+     * @return a <code>java.util.List</code> of <code>java.lang.String</code>
+     *         objects which are platform-specific representations of platform-
+     *         specific data formats
+     */
+    List<String> getNativesForFlavor(DataFlavor flav);
+
+    /**
+     * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
+     * specified <code>String</code> corresponds. The <code>List</code> will be
+     * sorted from best <code>DataFlavor</code> to worst. That is, the first
+     * <code>DataFlavor</code> will best reflect data in the specified
+     * native to a Java application. The returned <code>List</code> is a
+     * modifiable copy of this <code>FlavorTable</code>'s internal data.
+     * Client code is free to modify the <code>List</code> without affecting
+     * this object.
+     *
+     * @param nat the native whose corresponding <code>DataFlavor</code>s
+     *        should be returned. If <code>null</code> is specified, all
+     *        <code>DataFlavor</code>s currently known to this
+     *        <code>FlavorTable</code> are returned in a non-deterministic
+     *        order.
+     * @return a <code>java.util.List</code> of <code>DataFlavor</code>
+     *         objects into which platform-specific data in the specified,
+     *         platform-specific native can be translated
+     */
+    List<DataFlavor> getFlavorsForNative(String nat);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,394 @@
+/*
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import java.io.Externalizable;
+import java.io.ObjectOutput;
+import java.io.ObjectInput;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Locale;
+
+
+/**
+ * A Multipurpose Internet Mail Extension (MIME) type, as defined
+ * in RFC 2045 and 2046.
+ *
+ * THIS IS *NOT* - REPEAT *NOT* - A PUBLIC CLASS! DataFlavor IS
+ * THE PUBLIC INTERFACE, AND THIS IS PROVIDED AS A ***PRIVATE***
+ * (THAT IS AS IN *NOT* PUBLIC) HELPER CLASS!
+ */
+class MimeType implements Externalizable, Cloneable {
+
+    /*
+     * serialization support
+     */
+
+    static final long serialVersionUID = -6568722458793895906L;
+
+    /**
+     * Constructor for externalization; this constructor should not be
+     * called directly by an application, since the result will be an
+     * uninitialized, immutable <code>MimeType</code> object.
+     */
+    public MimeType() {
+    }
+
+    /**
+     * Builds a <code>MimeType</code> from a <code>String</code>.
+     *
+     * @param rawdata text used to initialize the <code>MimeType</code>
+     * @throws NullPointerException if <code>rawdata</code> is null
+     */
+    public MimeType(String rawdata) throws MimeTypeParseException {
+        parse(rawdata);
+    }
+
+    /**
+     * Builds a <code>MimeType</code> with the given primary and sub
+     * type but has an empty parameter list.
+     *
+     * @param primary the primary type of this <code>MimeType</code>
+     * @param sub the subtype of this <code>MimeType</code>
+     * @throws NullPointerException if either <code>primary</code> or
+     *         <code>sub</code> is null
+     */
+    public MimeType(String primary, String sub) throws MimeTypeParseException {
+        this(primary, sub, new MimeTypeParameterList());
+    }
+
+    /**
+     * Builds a <code>MimeType</code> with a pre-defined
+     * and valid (or empty) parameter list.
+     *
+     * @param primary the primary type of this <code>MimeType</code>
+     * @param sub the subtype of this <code>MimeType</code>
+     * @param mtpl the requested parameter list
+     * @throws NullPointerException if either <code>primary</code>,
+     *         <code>sub</code> or <code>mtpl</code> is null
+     */
+    public MimeType(String primary, String sub, MimeTypeParameterList mtpl) throws
+MimeTypeParseException {
+        //    check to see if primary is valid
+        if(isValidToken(primary)) {
+            primaryType = primary.toLowerCase(Locale.ENGLISH);
+        } else {
+            throw new MimeTypeParseException("Primary type is invalid.");
+        }
+
+        //    check to see if sub is valid
+        if(isValidToken(sub)) {
+            subType = sub.toLowerCase(Locale.ENGLISH);
+        } else {
+            throw new MimeTypeParseException("Sub type is invalid.");
+        }
+
+        parameters = (MimeTypeParameterList)mtpl.clone();
+    }
+
+    public int hashCode() {
+
+        // We sum up the hash codes for all of the strings. This
+        // way, the order of the strings is irrelevant
+        int code = 0;
+        code += primaryType.hashCode();
+        code += subType.hashCode();
+        code += parameters.hashCode();
+        return code;
+    } // hashCode()
+
+    /**
+     * <code>MimeType</code>s are equal if their primary types,
+     * subtypes, and  parameters are all equal. No default values
+     * are taken into account.
+     * @param thatObject the object to be evaluated as a
+     *    <code>MimeType</code>
+     * @return <code>true</code> if <code>thatObject</code> is
+     *    a <code>MimeType</code>; otherwise returns <code>false</code>
+     */
+    public boolean equals(Object thatObject) {
+        if (!(thatObject instanceof MimeType)) {
+            return false;
+        }
+        MimeType that = (MimeType)thatObject;
+        boolean isIt =
+            ((this.primaryType.equals(that.primaryType)) &&
+             (this.subType.equals(that.subType)) &&
+             (this.parameters.equals(that.parameters)));
+        return isIt;
+    } // equals()
+
+    /**
+     * A routine for parsing the MIME type out of a String.
+     *
+     * @throws NullPointerException if <code>rawdata</code> is null
+     */
+    private void parse(String rawdata) throws MimeTypeParseException {
+        int slashIndex = rawdata.indexOf('/');
+        int semIndex = rawdata.indexOf(';');
+        if((slashIndex < 0) && (semIndex < 0)) {
+            //    neither character is present, so treat it
+            //    as an error
+            throw new MimeTypeParseException("Unable to find a sub type.");
+        } else if((slashIndex < 0) && (semIndex >= 0)) {
+            //    we have a ';' (and therefore a parameter list),
+            //    but no '/' indicating a sub type is present
+            throw new MimeTypeParseException("Unable to find a sub type.");
+        } else if((slashIndex >= 0) && (semIndex < 0)) {
+            //    we have a primary and sub type but no parameter list
+            primaryType = rawdata.substring(0,slashIndex).
+                trim().toLowerCase(Locale.ENGLISH);
+            subType = rawdata.substring(slashIndex + 1).
+                trim().toLowerCase(Locale.ENGLISH);
+            parameters = new MimeTypeParameterList();
+        } else if (slashIndex < semIndex) {
+            //    we have all three items in the proper sequence
+            primaryType = rawdata.substring(0, slashIndex).
+                trim().toLowerCase(Locale.ENGLISH);
+            subType = rawdata.substring(slashIndex + 1,
+                semIndex).trim().toLowerCase(Locale.ENGLISH);
+            parameters = new
+MimeTypeParameterList(rawdata.substring(semIndex));
+        } else {
+            //    we have a ';' lexically before a '/' which means we have a primary type
+            //    & a parameter list but no sub type
+            throw new MimeTypeParseException("Unable to find a sub type.");
+        }
+
+        //    now validate the primary and sub types
+
+        //    check to see if primary is valid
+        if(!isValidToken(primaryType)) {
+            throw new MimeTypeParseException("Primary type is invalid.");
+        }
+
+        //    check to see if sub is valid
+        if(!isValidToken(subType)) {
+            throw new MimeTypeParseException("Sub type is invalid.");
+        }
+    }
+
+    /**
+     * Retrieve the primary type of this object.
+     */
+    public String getPrimaryType() {
+        return primaryType;
+    }
+
+    /**
+     * Retrieve the sub type of this object.
+     */
+    public String getSubType() {
+        return subType;
+    }
+
+    /**
+     * Retrieve a copy of this object's parameter list.
+     */
+    public MimeTypeParameterList getParameters() {
+        return (MimeTypeParameterList)parameters.clone();
+    }
+
+    /**
+     * Retrieve the value associated with the given name, or null if there
+     * is no current association.
+     */
+    public String getParameter(String name) {
+        return parameters.get(name);
+    }
+
+    /**
+     * Set the value to be associated with the given name, replacing
+     * any previous association.
+     *
+     * @throw IllegalArgumentException if parameter or value is illegal
+     */
+    public void setParameter(String name, String value) {
+        parameters.set(name, value);
+    }
+
+    /**
+     * Remove any value associated with the given name.
+     *
+     * @throw IllegalArgumentException if parameter may not be deleted
+     */
+    public void removeParameter(String name) {
+        parameters.remove(name);
+    }
+
+    /**
+     * Return the String representation of this object.
+     */
+    public String toString() {
+        return getBaseType() + parameters.toString();
+    }
+
+    /**
+     * Return a String representation of this object
+     * without the parameter list.
+     */
+    public String getBaseType() {
+        return primaryType + "/" + subType;
+    }
+
+    /**
+     * Returns <code>true</code> if the primary type and the
+     * subtype of this object are the same as the specified
+     * <code>type</code>; otherwise returns <code>false</code>.
+     *
+     * @param type the type to compare to <code>this</code>'s type
+     * @return <code>true</code> if the primary type and the
+     *    subtype of this object are the same as the
+     *    specified <code>type</code>; otherwise returns
+     *    <code>false</code>
+     */
+    public boolean match(MimeType type) {
+        if (type == null)
+            return false;
+        return primaryType.equals(type.getPrimaryType())
+                    && (subType.equals("*")
+                            || type.getSubType().equals("*")
+                            || (subType.equals(type.getSubType())));
+    }
+
+    /**
+     * Returns <code>true</code> if the primary type and the
+     * subtype of this object are the same as the content type
+     * described in <code>rawdata</code>; otherwise returns
+     * <code>false</code>.
+     *
+     * @param rawdata the raw data to be examined
+     * @return <code>true</code> if the primary type and the
+     *    subtype of this object are the same as the content type
+     *    described in <code>rawdata</code>; otherwise returns
+     *    <code>false</code>; if <code>rawdata</code> is
+     *    <code>null</code>, returns <code>false</code>
+     */
+    public boolean match(String rawdata) throws MimeTypeParseException {
+        if (rawdata == null)
+            return false;
+        return match(new MimeType(rawdata));
+    }
+
+    /**
+     * The object implements the writeExternal method to save its contents
+     * by calling the methods of DataOutput for its primitive values or
+     * calling the writeObject method of ObjectOutput for objects, strings
+     * and arrays.
+     * @exception IOException Includes any I/O exceptions that may occur
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        String s = toString(); // contains ASCII chars only
+        // one-to-one correspondence between ASCII char and byte in UTF string
+        if (s.length() <= 65535) { // 65535 is max length of UTF string
+            out.writeUTF(s);
+        } else {
+            out.writeByte(0);
+            out.writeByte(0);
+            out.writeInt(s.length());
+            out.write(s.getBytes());
+        }
+    }
+
+    /**
+     * The object implements the readExternal method to restore its
+     * contents by calling the methods of DataInput for primitive
+     * types and readObject for objects, strings and arrays.  The
+     * readExternal method must read the values in the same sequence
+     * and with the same types as were written by writeExternal.
+     * @exception ClassNotFoundException If the class for an object being
+     *              restored cannot be found.
+     */
+    public void readExternal(ObjectInput in) throws IOException,
+ClassNotFoundException {
+        String s = in.readUTF();
+        if (s == null || s.length() == 0) { // long mime type
+            byte[] ba = new byte[in.readInt()];
+            in.readFully(ba);
+            s = new String(ba);
+        }
+        try {
+            parse(s);
+        } catch(MimeTypeParseException e) {
+            throw new IOException(e.toString());
+        }
+    }
+
+    /**
+     * Returns a clone of this object.
+     * @return a clone of this object
+     */
+
+    public Object clone() {
+        MimeType newObj = null;
+        try {
+            newObj = (MimeType)super.clone();
+        } catch (CloneNotSupportedException cannotHappen) {
+        }
+        newObj.parameters = (MimeTypeParameterList)parameters.clone();
+        return newObj;
+    }
+
+    private String    primaryType;
+    private String    subType;
+    private MimeTypeParameterList parameters;
+
+    //    below here be scary parsing related things
+
+    /**
+     * Determines whether or not a given character belongs to a legal token.
+     */
+    private static boolean isTokenChar(char c) {
+        return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
+    }
+
+    /**
+     * Determines whether or not a given string is a legal token.
+     *
+     * @throws NullPointerException if <code>s</code> is null
+     */
+    private boolean isValidToken(String s) {
+        int len = s.length();
+        if(len > 0) {
+            for (int i = 0; i < len; ++i) {
+                char c = s.charAt(i);
+                if (!isTokenChar(c)) {
+                    return false;
+                }
+            }
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * A string that holds all the special chars.
+     */
+
+    private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
+
+} // class MimeType
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * An object that encapsulates the parameter list of a MimeType
+ * as defined in RFC 2045 and 2046.
+ *
+ * @author jeff.dunn@eng.sun.com
+ */
+class MimeTypeParameterList implements Cloneable {
+
+    /**
+     * Default constructor.
+     */
+    public MimeTypeParameterList() {
+        parameters = new Hashtable<>();
+    }
+
+    public MimeTypeParameterList(String rawdata)
+        throws MimeTypeParseException
+    {
+        parameters = new Hashtable<>();
+
+        //    now parse rawdata
+        parse(rawdata);
+    }
+
+    public int hashCode() {
+        int code = Integer.MAX_VALUE/45; // "random" value for empty lists
+        String paramName = null;
+        Enumeration<String> enum_ = this.getNames();
+
+        while (enum_.hasMoreElements()) {
+            paramName = enum_.nextElement();
+            code += paramName.hashCode();
+            code += this.get(paramName).hashCode();
+        }
+
+        return code;
+    } // hashCode()
+
+    /**
+     * Two parameter lists are considered equal if they have exactly
+     * the same set of parameter names and associated values. The
+     * order of the parameters is not considered.
+     */
+    public boolean equals(Object thatObject) {
+        //System.out.println("MimeTypeParameterList.equals("+this+","+thatObject+")");
+        if (!(thatObject instanceof MimeTypeParameterList)) {
+            return false;
+        }
+        MimeTypeParameterList that = (MimeTypeParameterList)thatObject;
+        if (this.size() != that.size()) {
+            return false;
+        }
+        String name = null;
+        String thisValue = null;
+        String thatValue = null;
+        Set<Map.Entry<String, String>> entries = parameters.entrySet();
+        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
+        Map.Entry<String, String> entry = null;
+        while (iterator.hasNext()) {
+            entry = iterator.next();
+            name = entry.getKey();
+            thisValue = entry.getValue();
+            thatValue = that.parameters.get(name);
+            if ((thisValue == null) || (thatValue == null)) {
+                // both null -> equal, only one null -> not equal
+                if (thisValue != thatValue) {
+                    return false;
+                }
+            } else if (!thisValue.equals(thatValue)) {
+                return false;
+            }
+        } // while iterator
+
+        return true;
+    } // equals()
+
+    /**
+     * A routine for parsing the parameter list out of a String.
+     */
+    protected void parse(String rawdata) throws MimeTypeParseException {
+        int length = rawdata.length();
+        if(length > 0) {
+            int currentIndex = skipWhiteSpace(rawdata, 0);
+            int lastIndex = 0;
+
+            if(currentIndex < length) {
+                char currentChar = rawdata.charAt(currentIndex);
+                while ((currentIndex < length) && (currentChar == ';')) {
+                    String name;
+                    String value;
+                    boolean foundit;
+
+                    //    eat the ';'
+                    ++currentIndex;
+
+                    //    now parse the parameter name
+
+                    //    skip whitespace
+                    currentIndex = skipWhiteSpace(rawdata, currentIndex);
+
+                    if(currentIndex < length) {
+                        //    find the end of the token char run
+                        lastIndex = currentIndex;
+                        currentChar = rawdata.charAt(currentIndex);
+                        while((currentIndex < length) && isTokenChar(currentChar)) {
+                            ++currentIndex;
+                            currentChar = rawdata.charAt(currentIndex);
+                        }
+                        name = rawdata.substring(lastIndex, currentIndex).toLowerCase();
+
+                        //    now parse the '=' that separates the name from the value
+
+                        //    skip whitespace
+                        currentIndex = skipWhiteSpace(rawdata, currentIndex);
+
+                        if((currentIndex < length) && (rawdata.charAt(currentIndex) == '='))  {
+                            //    eat it and parse the parameter value
+                            ++currentIndex;
+
+                            //    skip whitespace
+                            currentIndex = skipWhiteSpace(rawdata, currentIndex);
+
+                            if(currentIndex < length) {
+                                //    now find out whether or not we have a quoted value
+                                currentChar = rawdata.charAt(currentIndex);
+                                if(currentChar == '"') {
+                                    //    yup it's quoted so eat it and capture the quoted string
+                                    ++currentIndex;
+                                    lastIndex = currentIndex;
+
+                                    if(currentIndex < length) {
+                                        //    find the next unescaped quote
+                                        foundit = false;
+                                        while((currentIndex < length) && !foundit) {
+                                            currentChar = rawdata.charAt(currentIndex);
+                                            if(currentChar == '\\') {
+                                                //    found an escape sequence so pass this and the next character
+                                                currentIndex += 2;
+                                            } else if(currentChar == '"') {
+                                                //    found it!
+                                                foundit = true;
+                                            } else {
+                                                ++currentIndex;
+                                            }
+                                        }
+                                        if(currentChar == '"') {
+                                            value = unquote(rawdata.substring(lastIndex, currentIndex));
+                                            //    eat the quote
+                                            ++currentIndex;
+                                        } else {
+                                            throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
+                                        }
+                                    } else {
+                                        throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
+                                    }
+                                } else if(isTokenChar(currentChar)) {
+                                    //    nope it's an ordinary token so it ends with a non-token char
+                                    lastIndex = currentIndex;
+                                    foundit = false;
+                                    while((currentIndex < length) && !foundit) {
+                                        currentChar = rawdata.charAt(currentIndex);
+
+                                        if(isTokenChar(currentChar)) {
+                                            ++currentIndex;
+                                        } else {
+                                            foundit = true;
+                                        }
+                                    }
+                                    value = rawdata.substring(lastIndex, currentIndex);
+                                } else {
+                                    //    it ain't a value
+                                    throw new MimeTypeParseException("Unexpected character encountered at index " + currentIndex);
+                                }
+
+                                //    now put the data into the hashtable
+                                parameters.put(name, value);
+                            } else {
+                                throw new MimeTypeParseException("Couldn't find a value for parameter named " + name);
+                            }
+                        } else {
+                            throw new MimeTypeParseException("Couldn't find the '=' that separates a parameter name from its value.");
+                        }
+                    } else {
+                        throw new MimeTypeParseException("Couldn't find parameter name");
+                    }
+
+                    //    setup the next iteration
+                    currentIndex = skipWhiteSpace(rawdata, currentIndex);
+                    if(currentIndex < length) {
+                        currentChar = rawdata.charAt(currentIndex);
+                    }
+                }
+                if(currentIndex < length) {
+                    throw new MimeTypeParseException("More characters encountered in input than expected.");
+                }
+            }
+        }
+    }
+
+    /**
+     * return the number of name-value pairs in this list.
+     */
+    public int size() {
+        return parameters.size();
+    }
+
+    /**
+     * Determine whether or not this list is empty.
+     */
+    public boolean isEmpty() {
+        return parameters.isEmpty();
+    }
+
+    /**
+     * Retrieve the value associated with the given name, or null if there
+     * is no current association.
+     */
+    public String get(String name) {
+        return parameters.get(name.trim().toLowerCase());
+    }
+
+    /**
+     * Set the value to be associated with the given name, replacing
+     * any previous association.
+     */
+    public void set(String name, String value) {
+        parameters.put(name.trim().toLowerCase(), value);
+    }
+
+    /**
+     * Remove any value associated with the given name.
+     */
+    public void remove(String name) {
+        parameters.remove(name.trim().toLowerCase());
+    }
+
+    /**
+     * Retrieve an enumeration of all the names in this list.
+     */
+    public Enumeration<String> getNames() {
+        return parameters.keys();
+    }
+
+    public String toString() {
+        // Heuristic: 8 characters per field
+        StringBuilder buffer = new StringBuilder(parameters.size() * 16);
+
+        Enumeration<String> keys = parameters.keys();
+        while(keys.hasMoreElements())
+        {
+            buffer.append("; ");
+
+            String key = keys.nextElement();
+            buffer.append(key);
+            buffer.append('=');
+               buffer.append(quote(parameters.get(key)));
+        }
+
+        return buffer.toString();
+    }
+
+    /**
+     * @return a clone of this object
+     */
+    @SuppressWarnings("unchecked") // Cast from clone
+     public Object clone() {
+         MimeTypeParameterList newObj = null;
+         try {
+             newObj = (MimeTypeParameterList)super.clone();
+         } catch (CloneNotSupportedException cannotHappen) {
+         }
+         newObj.parameters = (Hashtable<String, String>)parameters.clone();
+         return newObj;
+     }
+
+    private Hashtable<String, String> parameters;
+
+    //    below here be scary parsing related things
+
+    /**
+     * Determine whether or not a given character belongs to a legal token.
+     */
+    private static boolean isTokenChar(char c) {
+        return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
+    }
+
+    /**
+     * return the index of the first non white space character in
+     * rawdata at or after index i.
+     */
+    private static int skipWhiteSpace(String rawdata, int i) {
+        int length = rawdata.length();
+        if (i < length) {
+            char c =  rawdata.charAt(i);
+            while ((i < length) && Character.isWhitespace(c)) {
+                ++i;
+                c = rawdata.charAt(i);
+            }
+        }
+
+        return i;
+    }
+
+    /**
+     * A routine that knows how and when to quote and escape the given value.
+     */
+    private static String quote(String value) {
+        boolean needsQuotes = false;
+
+        //    check to see if we actually have to quote this thing
+        int length = value.length();
+        for(int i = 0; (i < length) && !needsQuotes; ++i) {
+            needsQuotes = !isTokenChar(value.charAt(i));
+        }
+
+        if(needsQuotes) {
+            StringBuilder buffer = new StringBuilder((int)(length * 1.5));
+
+            //    add the initial quote
+            buffer.append('"');
+
+            //    add the properly escaped text
+            for(int i = 0; i < length; ++i) {
+                char c = value.charAt(i);
+                if((c == '\\') || (c == '"')) {
+                    buffer.append('\\');
+                }
+                buffer.append(c);
+            }
+
+            //    add the closing quote
+            buffer.append('"');
+
+            return buffer.toString();
+        }
+        else
+        {
+            return value;
+        }
+    }
+
+    /**
+     * A routine that knows how to strip the quotes and escape sequences from the given value.
+     */
+    private static String unquote(String value) {
+        int valueLength = value.length();
+        StringBuilder buffer = new StringBuilder(valueLength);
+
+        boolean escaped = false;
+        for(int i = 0; i < valueLength; ++i) {
+            char currentChar = value.charAt(i);
+            if(!escaped && (currentChar != '\\')) {
+                buffer.append(currentChar);
+            } else if(escaped) {
+                buffer.append(currentChar);
+                escaped = false;
+            } else {
+                escaped = true;
+            }
+        }
+
+        return buffer.toString();
+    }
+
+    /**
+     * A string that holds all the special chars.
+     */
+    private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParseException.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+
+/**
+ *    A class to encapsulate MimeType parsing related exceptions
+ *
+ * @serial exclude
+ * @since 1.3
+ */
+public class MimeTypeParseException extends Exception {
+
+    // use serialVersionUID from JDK 1.2.2 for interoperability
+    private static final long serialVersionUID = -5604407764691570741L;
+
+    /**
+     * Constructs a MimeTypeParseException with no specified detail message.
+     */
+    public MimeTypeParseException() {
+        super();
+    }
+
+    /**
+     * Constructs a MimeTypeParseException with the specified detail message.
+     *
+     * @param   s   the detail message.
+     */
+    public MimeTypeParseException(String s) {
+        super(s);
+    }
+} // class MimeTypeParseException
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/StringSelection.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1996, 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 java.awt.datatransfer;
+
+import java.io.*;
+
+
+/**
+ * A <code>Transferable</code> which implements the capability required
+ * to transfer a <code>String</code>.
+ *
+ * This <code>Transferable</code> properly supports
+ * <code>DataFlavor.stringFlavor</code>
+ * and all equivalent flavors. Support for
+ * <code>DataFlavor.plainTextFlavor</code>
+ * and all equivalent flavors is <b>deprecated</b>. No other
+ * <code>DataFlavor</code>s are supported.
+ *
+ * @see java.awt.datatransfer.DataFlavor#stringFlavor
+ * @see java.awt.datatransfer.DataFlavor#plainTextFlavor
+ */
+public class StringSelection implements Transferable, ClipboardOwner {
+
+    private static final int STRING = 0;
+    private static final int PLAIN_TEXT = 1;
+
+    @SuppressWarnings("deprecation")
+    private static final DataFlavor[] flavors = {
+        DataFlavor.stringFlavor,
+        DataFlavor.plainTextFlavor // deprecated
+    };
+
+    private String data;
+
+    /**
+     * Creates a <code>Transferable</code> capable of transferring
+     * the specified <code>String</code>.
+     * @param data the string to be transferred
+     */
+    public StringSelection(String data) {
+        this.data = data;
+    }
+
+    /**
+     * Returns an array of flavors in which this <code>Transferable</code>
+     * can provide the data. <code>DataFlavor.stringFlavor</code>
+     * is properly supported.
+     * Support for <code>DataFlavor.plainTextFlavor</code> is
+     * <b>deprecated</b>.
+     *
+     * @return an array of length two, whose elements are <code>DataFlavor.
+     *         stringFlavor</code> and <code>DataFlavor.plainTextFlavor</code>
+     */
+    public DataFlavor[] getTransferDataFlavors() {
+        // returning flavors itself would allow client code to modify
+        // our internal behavior
+        return flavors.clone();
+    }
+
+    /**
+     * Returns whether the requested flavor is supported by this
+     * <code>Transferable</code>.
+     *
+     * @param flavor the requested flavor for the data
+     * @return true if <code>flavor</code> is equal to
+     *   <code>DataFlavor.stringFlavor</code> or
+     *   <code>DataFlavor.plainTextFlavor</code>; false if <code>flavor</code>
+     *   is not one of the above flavors
+     * @throws NullPointerException if flavor is <code>null</code>
+     */
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        // JCK Test StringSelection0003: if 'flavor' is null, throw NPE
+        for (int i = 0; i < flavors.length; i++) {
+            if (flavor.equals(flavors[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns the <code>Transferable</code>'s data in the requested
+     * <code>DataFlavor</code> if possible. If the desired flavor is
+     * <code>DataFlavor.stringFlavor</code>, or an equivalent flavor,
+     * the <code>String</code> representing the selection is
+     * returned. If the desired flavor is
+     * <code>DataFlavor.plainTextFlavor</code>,
+     * or an equivalent flavor, a <code>Reader</code> is returned.
+     * <b>Note:</b> The behavior of this method for
+     * <code>DataFlavor.plainTextFlavor</code>
+     * and equivalent <code>DataFlavor</code>s is inconsistent with the
+     * definition of <code>DataFlavor.plainTextFlavor</code>.
+     *
+     * @param flavor the requested flavor for the data
+     * @return the data in the requested flavor, as outlined above
+     * @throws UnsupportedFlavorException if the requested data flavor is
+     *         not equivalent to either <code>DataFlavor.stringFlavor</code>
+     *         or <code>DataFlavor.plainTextFlavor</code>
+     * @throws IOException if an IOException occurs while retrieving the data.
+     *         By default, StringSelection never throws this exception, but a
+     *         subclass may.
+     * @throws NullPointerException if flavor is <code>null</code>
+     * @see java.io.Reader
+     */
+    public Object getTransferData(DataFlavor flavor)
+        throws UnsupportedFlavorException, IOException
+    {
+        // JCK Test StringSelection0007: if 'flavor' is null, throw NPE
+        if (flavor.equals(flavors[STRING])) {
+            return (Object)data;
+        } else if (flavor.equals(flavors[PLAIN_TEXT])) {
+            return new StringReader(data == null ? "" : data);
+        } else {
+            throw new UnsupportedFlavorException(flavor);
+        }
+    }
+
+    public void lostOwnership(Clipboard clipboard, Transferable contents) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,1094 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+import sun.datatransfer.DataFlavorUtil;
+import sun.datatransfer.DesktopDatatransferService;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * The SystemFlavorMap is a configurable map between "natives" (Strings), which
+ * correspond to platform-specific data formats, and "flavors" (DataFlavors),
+ * which correspond to platform-independent MIME types. This mapping is used
+ * by the data transfer subsystem to transfer data between Java and native
+ * applications, and between Java applications in separate VMs.
+ *
+ * @since 1.2
+ */
+public final class SystemFlavorMap implements FlavorMap, FlavorTable {
+
+    /**
+     * Constant prefix used to tag Java types converted to native platform
+     * type.
+     */
+    private static String JavaMIME = "JAVA_DATAFLAVOR:";
+
+    private static final Object FLAVOR_MAP_KEY = new Object();
+
+    /**
+     * The list of valid, decoded text flavor representation classes, in order
+     * from best to worst.
+     */
+    private static final String[] UNICODE_TEXT_CLASSES = {
+        "java.io.Reader", "java.lang.String", "java.nio.CharBuffer", "\"[C\""
+    };
+
+    /**
+     * The list of valid, encoded text flavor representation classes, in order
+     * from best to worst.
+     */
+    private static final String[] ENCODED_TEXT_CLASSES = {
+        "java.io.InputStream", "java.nio.ByteBuffer", "\"[B\""
+    };
+
+    /**
+     * A String representing text/plain MIME type.
+     */
+    private static final String TEXT_PLAIN_BASE_TYPE = "text/plain";
+
+    /**
+     * A String representing text/html MIME type.
+     */
+    private static final String HTML_TEXT_BASE_TYPE = "text/html";
+
+    /**
+     * Maps native Strings to Lists of DataFlavors (or base type Strings for
+     * text DataFlavors).
+     * Do not use the field directly, use getNativeToFlavor() instead.
+     */
+    private final Map<String, LinkedHashSet<DataFlavor>> nativeToFlavor = new HashMap<>();
+
+    /**
+     * Accessor to nativeToFlavor map.  Since we use lazy initialization we must
+     * use this accessor instead of direct access to the field which may not be
+     * initialized yet.  This method will initialize the field if needed.
+     *
+     * @return nativeToFlavor
+     */
+    private Map<String, LinkedHashSet<DataFlavor>> getNativeToFlavor() {
+        if (!isMapInitialized) {
+            initSystemFlavorMap();
+        }
+        return nativeToFlavor;
+    }
+
+    /**
+     * Maps DataFlavors (or base type Strings for text DataFlavors) to Lists of
+     * native Strings.
+     * Do not use the field directly, use getFlavorToNative() instead.
+     */
+    private final Map<DataFlavor, LinkedHashSet<String>> flavorToNative = new HashMap<>();
+
+    /**
+     * Accessor to flavorToNative map.  Since we use lazy initialization we must
+     * use this accessor instead of direct access to the field which may not be
+     * initialized yet.  This method will initialize the field if needed.
+     *
+     * @return flavorToNative
+     */
+    private synchronized Map<DataFlavor, LinkedHashSet<String>> getFlavorToNative() {
+        if (!isMapInitialized) {
+            initSystemFlavorMap();
+        }
+        return flavorToNative;
+    }
+
+    /**
+     * Maps a text DataFlavor primary mime-type to the native. Used only to store
+     * standard mappings registered in the flavormap.properties
+     * Do not use this field directly, use getTextTypeToNative() instead.
+     */
+    private Map<String, LinkedHashSet<String>> textTypeToNative = new HashMap<>();
+
+    /**
+     * Shows if the object has been initialized.
+     */
+    private boolean isMapInitialized = false;
+
+    /**
+     * An accessor to textTypeToNative map.  Since we use lazy initialization we
+     * must use this accessor instead of direct access to the field which may not
+     * be initialized yet. This method will initialize the field if needed.
+     *
+     * @return textTypeToNative
+     */
+    private synchronized Map<String, LinkedHashSet<String>> getTextTypeToNative() {
+        if (!isMapInitialized) {
+            initSystemFlavorMap();
+            // From this point the map should not be modified
+            textTypeToNative = Collections.unmodifiableMap(textTypeToNative);
+        }
+        return textTypeToNative;
+    }
+
+    /**
+     * Caches the result of getNativesForFlavor(). Maps DataFlavors to
+     * SoftReferences which reference LinkedHashSet of String natives.
+     */
+    private final SoftCache<DataFlavor, String> nativesForFlavorCache = new SoftCache<>();
+
+    /**
+     * Caches the result getFlavorsForNative(). Maps String natives to
+     * SoftReferences which reference LinkedHashSet of DataFlavors.
+     */
+    private final SoftCache<String, DataFlavor> flavorsForNativeCache = new SoftCache<>();
+
+    /**
+     * Dynamic mapping generation used for text mappings should not be applied
+     * to the DataFlavors and String natives for which the mappings have been
+     * explicitly specified with setFlavorsForNative() or
+     * setNativesForFlavor(). This keeps all such keys.
+     */
+    private Set<Object> disabledMappingGenerationKeys = new HashSet<>();
+
+    /**
+     * Returns the default FlavorMap for this thread's ClassLoader.
+     *
+     * @return the default FlavorMap for this thread's ClassLoader
+     */
+    public static FlavorMap getDefaultFlavorMap() {
+        return DataFlavorUtil.getDesktopService().getFlavorMap(SystemFlavorMap::new);
+    }
+
+    private SystemFlavorMap() {
+    }
+
+    /**
+     * Initializes a SystemFlavorMap by reading flavormap.properties
+     * For thread-safety must be called under lock on this.
+     */
+    private void initSystemFlavorMap() {
+        if (isMapInitialized) {
+            return;
+        }
+        isMapInitialized = true;
+
+        InputStream is = SystemFlavorMap.class.getResourceAsStream("/sun/datatransfer/resources/flavormap.properties");
+        if (is == null) {
+            throw new InternalError("Default flavor mapping not found");
+        }
+
+        try (InputStreamReader isr = new InputStreamReader(is);
+             BufferedReader reader = new BufferedReader(isr)) {
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("#") || line.isEmpty()) continue;
+                while (line.endsWith("\\")) {
+                    line = line.substring(0, line.length() - 1) + reader.readLine().trim();
+                }
+                int delimiterPosition = line.indexOf('=');
+                String key = line.substring(0, delimiterPosition).replace("\\ ", " ");
+                String[] values = line.substring(delimiterPosition + 1, line.length()).split(",");
+                for (String value : values) {
+                    try {
+                        value = loadConvert(value);
+                        MimeType mime = new MimeType(value);
+                        if ("text".equals(mime.getPrimaryType())) {
+                            String charset = mime.getParameter("charset");
+                            if (DataFlavorUtil.doesSubtypeSupportCharset(mime.getSubType(), charset))
+                            {
+                                // We need to store the charset and eoln
+                                // parameters, if any, so that the
+                                // DataTransferer will have this information
+                                // for conversion into the native format.
+                                DesktopDatatransferService desktopService =
+                                        DataFlavorUtil.getDesktopService();
+                                if (desktopService.isDesktopPresent()) {
+                                    desktopService.registerTextFlavorProperties(
+                                            key, charset,
+                                            mime.getParameter("eoln"),
+                                            mime.getParameter("terminators"));
+                                }
+                            }
+
+                            // But don't store any of these parameters in the
+                            // DataFlavor itself for any text natives (even
+                            // non-charset ones). The SystemFlavorMap will
+                            // synthesize the appropriate mappings later.
+                            mime.removeParameter("charset");
+                            mime.removeParameter("class");
+                            mime.removeParameter("eoln");
+                            mime.removeParameter("terminators");
+                            value = mime.toString();
+                        }
+                    } catch (MimeTypeParseException e) {
+                        e.printStackTrace();
+                        continue;
+                    }
+
+                    DataFlavor flavor;
+                    try {
+                        flavor = new DataFlavor(value);
+                    } catch (Exception e) {
+                        try {
+                            flavor = new DataFlavor(value, null);
+                        } catch (Exception ee) {
+                            ee.printStackTrace();
+                            continue;
+                        }
+                    }
+
+                    final LinkedHashSet<DataFlavor> dfs = new LinkedHashSet<>();
+                    dfs.add(flavor);
+
+                    if ("text".equals(flavor.getPrimaryType())) {
+                        dfs.addAll(convertMimeTypeToDataFlavors(value));
+                        store(flavor.mimeType.getBaseType(), key, getTextTypeToNative());
+                    }
+
+                    for (DataFlavor df : dfs) {
+                        store(df, key, getFlavorToNative());
+                        store(key, df, getNativeToFlavor());
+                    }
+                }
+            }
+        } catch (IOException e) {
+            throw new InternalError("Error reading default flavor mapping", e);
+        }
+    }
+
+    // Copied from java.util.Properties
+    private static String loadConvert(String theString) {
+        char aChar;
+        int len = theString.length();
+        StringBuilder outBuffer = new StringBuilder(len);
+
+        for (int x = 0; x < len; ) {
+            aChar = theString.charAt(x++);
+            if (aChar == '\\') {
+                aChar = theString.charAt(x++);
+                if (aChar == 'u') {
+                    // Read the xxxx
+                    int value = 0;
+                    for (int i = 0; i < 4; i++) {
+                        aChar = theString.charAt(x++);
+                        switch (aChar) {
+                            case '0': case '1': case '2': case '3': case '4':
+                            case '5': case '6': case '7': case '8': case '9': {
+                                value = (value << 4) + aChar - '0';
+                                break;
+                            }
+                            case 'a': case 'b': case 'c':
+                            case 'd': case 'e': case 'f': {
+                                value = (value << 4) + 10 + aChar - 'a';
+                                break;
+                            }
+                            case 'A': case 'B': case 'C':
+                            case 'D': case 'E': case 'F': {
+                                value = (value << 4) + 10 + aChar - 'A';
+                                break;
+                            }
+                            default: {
+                                throw new IllegalArgumentException(
+                                        "Malformed \\uxxxx encoding.");
+                            }
+                        }
+                    }
+                    outBuffer.append((char)value);
+                } else {
+                    if (aChar == 't') {
+                        aChar = '\t';
+                    } else if (aChar == 'r') {
+                        aChar = '\r';
+                    } else if (aChar == 'n') {
+                        aChar = '\n';
+                    } else if (aChar == 'f') {
+                        aChar = '\f';
+                    }
+                    outBuffer.append(aChar);
+                }
+            } else {
+                outBuffer.append(aChar);
+            }
+        }
+        return outBuffer.toString();
+    }
+
+    /**
+     * Stores the listed object under the specified hash key in map. Unlike a
+     * standard map, the listed object will not replace any object already at
+     * the appropriate Map location, but rather will be appended to a List
+     * stored in that location.
+     */
+    private <H, L> void store(H hashed, L listed, Map<H, LinkedHashSet<L>> map) {
+        LinkedHashSet<L> list = map.get(hashed);
+        if (list == null) {
+            list = new LinkedHashSet<>(1);
+            map.put(hashed, list);
+        }
+        if (!list.contains(listed)) {
+            list.add(listed);
+        }
+    }
+
+    /**
+     * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
+     * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
+     * case, a new DataFlavor is synthesized, stored, and returned, if and
+     * only if the specified native is encoded as a Java MIME type.
+     */
+    private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
+
+        if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
+            DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
+            if (desktopService.isDesktopPresent()) {
+                LinkedHashSet<DataFlavor> platformFlavors =
+                        desktopService.getPlatformMappingsForNative(nat);
+                if (!platformFlavors.isEmpty()) {
+                    if (flavors != null) {
+                        // Prepending the platform-specific mappings ensures
+                        // that the flavors added with
+                        // addFlavorForUnencodedNative() are at the end of
+                        // list.
+                        platformFlavors.addAll(flavors);
+                    }
+                    flavors = platformFlavors;
+                }
+            }
+        }
+
+        if (flavors == null && isJavaMIMEType(nat)) {
+            String decoded = decodeJavaMIMEType(nat);
+            DataFlavor flavor = null;
+
+            try {
+                flavor = new DataFlavor(decoded);
+            } catch (Exception e) {
+                System.err.println("Exception \"" + e.getClass().getName() +
+                                   ": " + e.getMessage()  +
+                                   "\"while constructing DataFlavor for: " +
+                                   decoded);
+            }
+
+            if (flavor != null) {
+                flavors = new LinkedHashSet<>(1);
+                getNativeToFlavor().put(nat, flavors);
+                flavors.add(flavor);
+                flavorsForNativeCache.remove(nat);
+
+                LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
+                if (natives == null) {
+                    natives = new LinkedHashSet<>(1);
+                    getFlavorToNative().put(flavor, natives);
+                }
+                natives.add(nat);
+                nativesForFlavorCache.remove(flavor);
+            }
+        }
+
+        return (flavors != null) ? flavors : new LinkedHashSet<>(0);
+    }
+
+    /**
+     * Semantically equivalent to 'flavorToNative.get(flav)'. This method
+     * handles the case where 'flav' is not found in 'flavorToNative' depending
+     * on the value of passes 'synthesize' parameter. If 'synthesize' is
+     * SYNTHESIZE_IF_NOT_FOUND a native is synthesized, stored, and returned by
+     * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
+     * and 'flavorToNative' remains unaffected.
+     */
+    private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
+                                                       final boolean synthesize) {
+
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
+
+        if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
+            DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
+            if (desktopService.isDesktopPresent()) {
+                LinkedHashSet<String> platformNatives =
+                        desktopService.getPlatformMappingsForFlavor(flav);
+                if (!platformNatives.isEmpty()) {
+                    if (natives != null) {
+                        // Prepend the platform-specific mappings to ensure
+                        // that the natives added with
+                        // addUnencodedNativeForFlavor() are at the end of
+                        // list.
+                        platformNatives.addAll(natives);
+                    }
+                    natives = platformNatives;
+                }
+            }
+        }
+
+        if (natives == null) {
+            if (synthesize) {
+                String encoded = encodeDataFlavor(flav);
+                natives = new LinkedHashSet<>(1);
+                getFlavorToNative().put(flav, natives);
+                natives.add(encoded);
+
+                LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
+                if (flavors == null) {
+                    flavors = new LinkedHashSet<>(1);
+                    getNativeToFlavor().put(encoded, flavors);
+                }
+                flavors.add(flav);
+
+                nativesForFlavorCache.remove(flav);
+                flavorsForNativeCache.remove(encoded);
+            } else {
+                natives = new LinkedHashSet<>(0);
+            }
+        }
+
+        return new LinkedHashSet<>(natives);
+    }
+
+    /**
+     * Returns a <code>List</code> of <code>String</code> natives to which the
+     * specified <code>DataFlavor</code> can be translated by the data transfer
+     * subsystem. The <code>List</code> will be sorted from best native to
+     * worst. That is, the first native will best reflect data in the specified
+     * flavor to the underlying native platform.
+     * <p>
+     * If the specified <code>DataFlavor</code> is previously unknown to the
+     * data transfer subsystem and the data transfer subsystem is unable to
+     * translate this <code>DataFlavor</code> to any existing native, then
+     * invoking this method will establish a
+     * mapping in both directions between the specified <code>DataFlavor</code>
+     * and an encoded version of its MIME type as its native.
+     *
+     * @param flav the <code>DataFlavor</code> whose corresponding natives
+     *        should be returned. If <code>null</code> is specified, all
+     *        natives currently known to the data transfer subsystem are
+     *        returned in a non-deterministic order.
+     * @return a <code>java.util.List</code> of <code>java.lang.String</code>
+     *         objects which are platform-specific representations of platform-
+     *         specific data formats
+     *
+     * @see #encodeDataFlavor
+     * @since 1.4
+     */
+    @Override
+    public synchronized List<String> getNativesForFlavor(DataFlavor flav) {
+        LinkedHashSet<String> retval = nativesForFlavorCache.check(flav);
+        if (retval != null) {
+            return new ArrayList<>(retval);
+        }
+
+        if (flav == null) {
+            retval = new LinkedHashSet<>(getNativeToFlavor().keySet());
+        } else if (disabledMappingGenerationKeys.contains(flav)) {
+            // In this case we shouldn't synthesize a native for this flavor,
+            // since its mappings were explicitly specified.
+            retval = flavorToNativeLookup(flav, false);
+        } else if (DataFlavorUtil.isFlavorCharsetTextType(flav)) {
+            retval = new LinkedHashSet<>(0);
+
+            // For text/* flavors, flavor-to-native mappings specified in
+            // flavormap.properties are stored per flavor's base type.
+            if ("text".equals(flav.getPrimaryType())) {
+                LinkedHashSet<String> textTypeNatives =
+                        getTextTypeToNative().get(flav.mimeType.getBaseType());
+                if (textTypeNatives != null) {
+                    retval.addAll(textTypeNatives);
+                }
+            }
+
+            // Also include text/plain natives, but don't duplicate Strings
+            LinkedHashSet<String> textTypeNatives =
+                    getTextTypeToNative().get(TEXT_PLAIN_BASE_TYPE);
+            if (textTypeNatives != null) {
+                retval.addAll(textTypeNatives);
+            }
+
+            if (retval.isEmpty()) {
+                retval = flavorToNativeLookup(flav, true);
+            } else {
+                // In this branch it is guaranteed that natives explicitly
+                // listed for flav's MIME type were added with
+                // addUnencodedNativeForFlavor(), so they have lower priority.
+                retval.addAll(flavorToNativeLookup(flav, false));
+            }
+        } else if (DataFlavorUtil.isFlavorNoncharsetTextType(flav)) {
+            retval = getTextTypeToNative().get(flav.mimeType.getBaseType());
+
+            if (retval == null || retval.isEmpty()) {
+                retval = flavorToNativeLookup(flav, true);
+            } else {
+                // In this branch it is guaranteed that natives explicitly
+                // listed for flav's MIME type were added with
+                // addUnencodedNativeForFlavor(), so they have lower priority.
+                retval.addAll(flavorToNativeLookup(flav, false));
+            }
+        } else {
+            retval = flavorToNativeLookup(flav, true);
+        }
+
+        nativesForFlavorCache.put(flav, retval);
+        // Create a copy, because client code can modify the returned list.
+        return new ArrayList<>(retval);
+    }
+
+    /**
+     * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
+     * specified <code>String</code> native can be translated by the data
+     * transfer subsystem. The <code>List</code> will be sorted from best
+     * <code>DataFlavor</code> to worst. That is, the first
+     * <code>DataFlavor</code> will best reflect data in the specified
+     * native to a Java application.
+     * <p>
+     * If the specified native is previously unknown to the data transfer
+     * subsystem, and that native has been properly encoded, then invoking this
+     * method will establish a mapping in both directions between the specified
+     * native and a <code>DataFlavor</code> whose MIME type is a decoded
+     * version of the native.
+     * <p>
+     * If the specified native is not a properly encoded native and the
+     * mappings for this native have not been altered with
+     * <code>setFlavorsForNative</code>, then the contents of the
+     * <code>List</code> is platform dependent, but <code>null</code>
+     * cannot be returned.
+     *
+     * @param nat the native whose corresponding <code>DataFlavor</code>s
+     *        should be returned. If <code>null</code> is specified, all
+     *        <code>DataFlavor</code>s currently known to the data transfer
+     *        subsystem are returned in a non-deterministic order.
+     * @return a <code>java.util.List</code> of <code>DataFlavor</code>
+     *         objects into which platform-specific data in the specified,
+     *         platform-specific native can be translated
+     *
+     * @see #encodeJavaMIMEType
+     * @since 1.4
+     */
+    @Override
+    public synchronized List<DataFlavor> getFlavorsForNative(String nat) {
+        LinkedHashSet<DataFlavor> returnValue = flavorsForNativeCache.check(nat);
+        if (returnValue != null) {
+            return new ArrayList<>(returnValue);
+        } else {
+            returnValue = new LinkedHashSet<>();
+        }
+
+        if (nat == null) {
+            for (String n : getNativesForFlavor(null)) {
+                returnValue.addAll(getFlavorsForNative(n));
+            }
+        } else {
+            final LinkedHashSet<DataFlavor> flavors = nativeToFlavorLookup(nat);
+            if (disabledMappingGenerationKeys.contains(nat)) {
+                return new ArrayList<>(flavors);
+            }
+
+            final LinkedHashSet<DataFlavor> flavorsWithSynthesized =
+                    nativeToFlavorLookup(nat);
+
+            for (DataFlavor df : flavorsWithSynthesized) {
+                returnValue.add(df);
+                if ("text".equals(df.getPrimaryType())) {
+                    String baseType = df.mimeType.getBaseType();
+                    returnValue.addAll(convertMimeTypeToDataFlavors(baseType));
+                }
+            }
+        }
+        flavorsForNativeCache.put(nat, returnValue);
+        return new ArrayList<>(returnValue);
+    }
+
+    @SuppressWarnings("deprecation")
+    private static Set<DataFlavor> convertMimeTypeToDataFlavors(
+        final String baseType) {
+
+        final Set<DataFlavor> returnValue = new LinkedHashSet<>();
+
+        String subType = null;
+
+        try {
+            final MimeType mimeType = new MimeType(baseType);
+            subType = mimeType.getSubType();
+        } catch (MimeTypeParseException mtpe) {
+            // Cannot happen, since we checked all mappings
+            // on load from flavormap.properties.
+        }
+
+        if (DataFlavorUtil.doesSubtypeSupportCharset(subType, null)) {
+            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
+            {
+                returnValue.add(DataFlavor.stringFlavor);
+            }
+
+            for (String unicodeClassName : UNICODE_TEXT_CLASSES) {
+                final String mimeType = baseType + ";charset=Unicode;class=" +
+                                            unicodeClassName;
+
+                final LinkedHashSet<String> mimeTypes =
+                    handleHtmlMimeTypes(baseType, mimeType);
+                for (String mt : mimeTypes) {
+                    DataFlavor toAdd = null;
+                    try {
+                        toAdd = new DataFlavor(mt);
+                    } catch (ClassNotFoundException cannotHappen) {
+                    }
+                    returnValue.add(toAdd);
+                }
+            }
+
+            for (String charset : DataFlavorUtil.standardEncodings()) {
+
+                for (String encodedTextClass : ENCODED_TEXT_CLASSES) {
+                    final String mimeType =
+                            baseType + ";charset=" + charset +
+                            ";class=" + encodedTextClass;
+
+                    final LinkedHashSet<String> mimeTypes =
+                        handleHtmlMimeTypes(baseType, mimeType);
+
+                    for (String mt : mimeTypes) {
+
+                        DataFlavor df = null;
+
+                        try {
+                            df = new DataFlavor(mt);
+                            // Check for equality to plainTextFlavor so
+                            // that we can ensure that the exact charset of
+                            // plainTextFlavor, not the canonical charset
+                            // or another equivalent charset with a
+                            // different name, is used.
+                            if (df.equals(DataFlavor.plainTextFlavor)) {
+                                df = DataFlavor.plainTextFlavor;
+                            }
+                        } catch (ClassNotFoundException cannotHappen) {
+                        }
+
+                        returnValue.add(df);
+                    }
+                }
+            }
+
+            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
+            {
+                returnValue.add(DataFlavor.plainTextFlavor);
+            }
+        } else {
+            // Non-charset text natives should be treated as
+            // opaque, 8-bit data in any of its various
+            // representations.
+            for (String encodedTextClassName : ENCODED_TEXT_CLASSES) {
+                DataFlavor toAdd = null;
+                try {
+                    toAdd = new DataFlavor(baseType +
+                         ";class=" + encodedTextClassName);
+                } catch (ClassNotFoundException cannotHappen) {
+                }
+                returnValue.add(toAdd);
+            }
+        }
+        return returnValue;
+    }
+
+    private static final String [] htmlDocumentTypes =
+            new String [] {"all", "selection", "fragment"};
+
+    private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
+                                                             String mimeType) {
+
+        LinkedHashSet<String> returnValues = new LinkedHashSet<>();
+
+        if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
+            for (String documentType : htmlDocumentTypes) {
+                returnValues.add(mimeType + ";document=" + documentType);
+            }
+        } else {
+            returnValues.add(mimeType);
+        }
+
+        return returnValues;
+    }
+
+    /**
+     * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
+     * their most preferred <code>String</code> native. Each native value will
+     * be the same as the first native in the List returned by
+     * <code>getNativesForFlavor</code> for the specified flavor.
+     * <p>
+     * If a specified <code>DataFlavor</code> is previously unknown to the
+     * data transfer subsystem, then invoking this method will establish a
+     * mapping in both directions between the specified <code>DataFlavor</code>
+     * and an encoded version of its MIME type as its native.
+     *
+     * @param flavors an array of <code>DataFlavor</code>s which will be the
+     *        key set of the returned <code>Map</code>. If <code>null</code> is
+     *        specified, a mapping of all <code>DataFlavor</code>s known to the
+     *        data transfer subsystem to their most preferred
+     *        <code>String</code> natives will be returned.
+     * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
+     *         <code>String</code> natives
+     *
+     * @see #getNativesForFlavor
+     * @see #encodeDataFlavor
+     */
+    @Override
+    public synchronized Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors)
+    {
+        // Use getNativesForFlavor to generate extra natives for text flavors
+        // and stringFlavor
+
+        if (flavors == null) {
+            List<DataFlavor> flavor_list = getFlavorsForNative(null);
+            flavors = new DataFlavor[flavor_list.size()];
+            flavor_list.toArray(flavors);
+        }
+
+        Map<DataFlavor, String> retval = new HashMap<>(flavors.length, 1.0f);
+        for (DataFlavor flavor : flavors) {
+            List<String> natives = getNativesForFlavor(flavor);
+            String nat = (natives.isEmpty()) ? null : natives.get(0);
+            retval.put(flavor, nat);
+        }
+
+        return retval;
+    }
+
+    /**
+     * Returns a <code>Map</code> of the specified <code>String</code> natives
+     * to their most preferred <code>DataFlavor</code>. Each
+     * <code>DataFlavor</code> value will be the same as the first
+     * <code>DataFlavor</code> in the List returned by
+     * <code>getFlavorsForNative</code> for the specified native.
+     * <p>
+     * If a specified native is previously unknown to the data transfer
+     * subsystem, and that native has been properly encoded, then invoking this
+     * method will establish a mapping in both directions between the specified
+     * native and a <code>DataFlavor</code> whose MIME type is a decoded
+     * version of the native.
+     *
+     * @param natives an array of <code>String</code>s which will be the
+     *        key set of the returned <code>Map</code>. If <code>null</code> is
+     *        specified, a mapping of all supported <code>String</code> natives
+     *        to their most preferred <code>DataFlavor</code>s will be
+     *        returned.
+     * @return a <code>java.util.Map</code> of <code>String</code> natives to
+     *         <code>DataFlavor</code>s
+     *
+     * @see #getFlavorsForNative
+     * @see #encodeJavaMIMEType
+     */
+    @Override
+    public synchronized Map<String,DataFlavor> getFlavorsForNatives(String[] natives)
+    {
+        // Use getFlavorsForNative to generate extra flavors for text natives
+        if (natives == null) {
+            List<String> nativesList = getNativesForFlavor(null);
+            natives = new String[nativesList.size()];
+            nativesList.toArray(natives);
+        }
+
+        Map<String, DataFlavor> retval = new HashMap<>(natives.length, 1.0f);
+        for (String aNative : natives) {
+            List<DataFlavor> flavors = getFlavorsForNative(aNative);
+            DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0);
+            retval.put(aNative, flav);
+        }
+        return retval;
+    }
+
+    /**
+     * Adds a mapping from the specified <code>DataFlavor</code> (and all
+     * <code>DataFlavor</code>s equal to the specified <code>DataFlavor</code>)
+     * to the specified <code>String</code> native.
+     * Unlike <code>getNativesForFlavor</code>, the mapping will only be
+     * established in one direction, and the native will not be encoded. To
+     * establish a two-way mapping, call
+     * <code>addFlavorForUnencodedNative</code> as well. The new mapping will
+     * be of lower priority than any existing mapping.
+     * This method has no effect if a mapping from the specified or equal
+     * <code>DataFlavor</code> to the specified <code>String</code> native
+     * already exists.
+     *
+     * @param flav the <code>DataFlavor</code> key for the mapping
+     * @param nat the <code>String</code> native value for the mapping
+     * @throws NullPointerException if flav or nat is <code>null</code>
+     *
+     * @see #addFlavorForUnencodedNative
+     * @since 1.4
+     */
+    public synchronized void addUnencodedNativeForFlavor(DataFlavor flav,
+                                                         String nat) {
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
+
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
+        if (natives == null) {
+            natives = new LinkedHashSet<>(1);
+            getFlavorToNative().put(flav, natives);
+        }
+        natives.add(nat);
+        nativesForFlavorCache.remove(flav);
+    }
+
+    /**
+     * Discards the current mappings for the specified <code>DataFlavor</code>
+     * and all <code>DataFlavor</code>s equal to the specified
+     * <code>DataFlavor</code>, and creates new mappings to the
+     * specified <code>String</code> natives.
+     * Unlike <code>getNativesForFlavor</code>, the mappings will only be
+     * established in one direction, and the natives will not be encoded. To
+     * establish two-way mappings, call <code>setFlavorsForNative</code>
+     * as well. The first native in the array will represent the highest
+     * priority mapping. Subsequent natives will represent mappings of
+     * decreasing priority.
+     * <p>
+     * If the array contains several elements that reference equal
+     * <code>String</code> natives, this method will establish new mappings
+     * for the first of those elements and ignore the rest of them.
+     * <p>
+     * It is recommended that client code not reset mappings established by the
+     * data transfer subsystem. This method should only be used for
+     * application-level mappings.
+     *
+     * @param flav the <code>DataFlavor</code> key for the mappings
+     * @param natives the <code>String</code> native values for the mappings
+     * @throws NullPointerException if flav or natives is <code>null</code>
+     *         or if natives contains <code>null</code> elements
+     *
+     * @see #setFlavorsForNative
+     * @since 1.4
+     */
+    public synchronized void setNativesForFlavor(DataFlavor flav,
+                                                 String[] natives) {
+        Objects.requireNonNull(natives, "Null natives not permitted");
+        Objects.requireNonNull(flav, "Null flavors not permitted");
+
+        getFlavorToNative().remove(flav);
+        for (String aNative : natives) {
+            addUnencodedNativeForFlavor(flav, aNative);
+        }
+        disabledMappingGenerationKeys.add(flav);
+        nativesForFlavorCache.remove(flav);
+    }
+
+    /**
+     * Adds a mapping from a single <code>String</code> native to a single
+     * <code>DataFlavor</code>. Unlike <code>getFlavorsForNative</code>, the
+     * mapping will only be established in one direction, and the native will
+     * not be encoded. To establish a two-way mapping, call
+     * <code>addUnencodedNativeForFlavor</code> as well. The new mapping will
+     * be of lower priority than any existing mapping.
+     * This method has no effect if a mapping from the specified
+     * <code>String</code> native to the specified or equal
+     * <code>DataFlavor</code> already exists.
+     *
+     * @param nat the <code>String</code> native key for the mapping
+     * @param flav the <code>DataFlavor</code> value for the mapping
+     * @throws NullPointerException if nat or flav is <code>null</code>
+     *
+     * @see #addUnencodedNativeForFlavor
+     * @since 1.4
+     */
+    public synchronized void addFlavorForUnencodedNative(String nat,
+                                                         DataFlavor flav) {
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
+
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
+        if (flavors == null) {
+            flavors = new LinkedHashSet<>(1);
+            getNativeToFlavor().put(nat, flavors);
+        }
+        flavors.add(flav);
+        flavorsForNativeCache.remove(nat);
+    }
+
+    /**
+     * Discards the current mappings for the specified <code>String</code>
+     * native, and creates new mappings to the specified
+     * <code>DataFlavor</code>s. Unlike <code>getFlavorsForNative</code>, the
+     * mappings will only be established in one direction, and the natives need
+     * not be encoded. To establish two-way mappings, call
+     * <code>setNativesForFlavor</code> as well. The first
+     * <code>DataFlavor</code> in the array will represent the highest priority
+     * mapping. Subsequent <code>DataFlavor</code>s will represent mappings of
+     * decreasing priority.
+     * <p>
+     * If the array contains several elements that reference equal
+     * <code>DataFlavor</code>s, this method will establish new mappings
+     * for the first of those elements and ignore the rest of them.
+     * <p>
+     * It is recommended that client code not reset mappings established by the
+     * data transfer subsystem. This method should only be used for
+     * application-level mappings.
+     *
+     * @param nat the <code>String</code> native key for the mappings
+     * @param flavors the <code>DataFlavor</code> values for the mappings
+     * @throws NullPointerException if nat or flavors is <code>null</code>
+     *         or if flavors contains <code>null</code> elements
+     *
+     * @see #setNativesForFlavor
+     * @since 1.4
+     */
+    public synchronized void setFlavorsForNative(String nat,
+                                                 DataFlavor[] flavors) {
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flavors, "Null flavors not permitted");
+
+        getNativeToFlavor().remove(nat);
+        for (DataFlavor flavor : flavors) {
+            addFlavorForUnencodedNative(nat, flavor);
+        }
+        disabledMappingGenerationKeys.add(nat);
+        flavorsForNativeCache.remove(nat);
+    }
+
+    /**
+     * Encodes a MIME type for use as a <code>String</code> native. The format
+     * of an encoded representation of a MIME type is implementation-dependent.
+     * The only restrictions are:
+     * <ul>
+     * <li>The encoded representation is <code>null</code> if and only if the
+     * MIME type <code>String</code> is <code>null</code>.</li>
+     * <li>The encoded representations for two non-<code>null</code> MIME type
+     * <code>String</code>s are equal if and only if these <code>String</code>s
+     * are equal according to <code>String.equals(Object)</code>.</li>
+     * </ul>
+     * <p>
+     * The reference implementation of this method returns the specified MIME
+     * type <code>String</code> prefixed with <code>JAVA_DATAFLAVOR:</code>.
+     *
+     * @param mimeType the MIME type to encode
+     * @return the encoded <code>String</code>, or <code>null</code> if
+     *         mimeType is <code>null</code>
+     */
+    public static String encodeJavaMIMEType(String mimeType) {
+        return (mimeType != null)
+            ? JavaMIME + mimeType
+            : null;
+    }
+
+    /**
+     * Encodes a <code>DataFlavor</code> for use as a <code>String</code>
+     * native. The format of an encoded <code>DataFlavor</code> is
+     * implementation-dependent. The only restrictions are:
+     * <ul>
+     * <li>The encoded representation is <code>null</code> if and only if the
+     * specified <code>DataFlavor</code> is <code>null</code> or its MIME type
+     * <code>String</code> is <code>null</code>.</li>
+     * <li>The encoded representations for two non-<code>null</code>
+     * <code>DataFlavor</code>s with non-<code>null</code> MIME type
+     * <code>String</code>s are equal if and only if the MIME type
+     * <code>String</code>s of these <code>DataFlavor</code>s are equal
+     * according to <code>String.equals(Object)</code>.</li>
+     * </ul>
+     * <p>
+     * The reference implementation of this method returns the MIME type
+     * <code>String</code> of the specified <code>DataFlavor</code> prefixed
+     * with <code>JAVA_DATAFLAVOR:</code>.
+     *
+     * @param flav the <code>DataFlavor</code> to encode
+     * @return the encoded <code>String</code>, or <code>null</code> if
+     *         flav is <code>null</code> or has a <code>null</code> MIME type
+     */
+    public static String encodeDataFlavor(DataFlavor flav) {
+        return (flav != null)
+            ? SystemFlavorMap.encodeJavaMIMEType(flav.getMimeType())
+            : null;
+    }
+
+    /**
+     * Returns whether the specified <code>String</code> is an encoded Java
+     * MIME type.
+     *
+     * @param str the <code>String</code> to test
+     * @return <code>true</code> if the <code>String</code> is encoded;
+     *         <code>false</code> otherwise
+     */
+    public static boolean isJavaMIMEType(String str) {
+        return (str != null && str.startsWith(JavaMIME, 0));
+    }
+
+    /**
+     * Decodes a <code>String</code> native for use as a Java MIME type.
+     *
+     * @param nat the <code>String</code> to decode
+     * @return the decoded Java MIME type, or <code>null</code> if nat is not
+     *         an encoded <code>String</code> native
+     */
+    public static String decodeJavaMIMEType(String nat) {
+        return (isJavaMIMEType(nat))
+            ? nat.substring(JavaMIME.length(), nat.length()).trim()
+            : null;
+    }
+
+    /**
+     * Decodes a <code>String</code> native for use as a
+     * <code>DataFlavor</code>.
+     *
+     * @param nat the <code>String</code> to decode
+     * @return the decoded <code>DataFlavor</code>, or <code>null</code> if
+     *         nat is not an encoded <code>String</code> native
+     * @throws ClassNotFoundException if the class of the data flavor
+     * is not loaded
+     */
+    public static DataFlavor decodeDataFlavor(String nat)
+        throws ClassNotFoundException
+    {
+        String retval_str = SystemFlavorMap.decodeJavaMIMEType(nat);
+        return (retval_str != null)
+            ? new DataFlavor(retval_str)
+            : null;
+    }
+
+    private static final class SoftCache<K, V> {
+        Map<K, SoftReference<LinkedHashSet<V>>> cache;
+
+        public void put(K key, LinkedHashSet<V> value) {
+            if (cache == null) {
+                cache = new HashMap<>(1);
+            }
+            cache.put(key, new SoftReference<>(value));
+        }
+
+        public void remove(K key) {
+            if (cache == null) return;
+            cache.remove(null);
+            cache.remove(key);
+        }
+
+        public LinkedHashSet<V> check(K key) {
+            if (cache == null) return null;
+            SoftReference<LinkedHashSet<V>> ref = cache.get(key);
+            if (ref != null) {
+                return ref.get();
+            }
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Transferable.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1996, 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 java.awt.datatransfer;
+
+import java.io.IOException;
+
+/**
+ * Defines the interface for classes that can be used to provide data
+ * for a transfer operation.
+ * <p>
+ * For information on using data transfer with Swing, see
+ * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
+ * How to Use Drag and Drop and Data Transfer</a>,
+ * a section in <em>The Java Tutorial</em>, for more information.
+ *
+ * @author      Amy Fowler
+ */
+
+public interface Transferable {
+
+    /**
+     * Returns an array of DataFlavor objects indicating the flavors the data
+     * can be provided in.  The array should be ordered according to preference
+     * for providing the data (from most richly descriptive to least descriptive).
+     * @return an array of data flavors in which this data can be transferred
+     */
+    public DataFlavor[] getTransferDataFlavors();
+
+    /**
+     * Returns whether or not the specified data flavor is supported for
+     * this object.
+     * @param flavor the requested flavor for the data
+     * @return boolean indicating whether or not the data flavor is supported
+     */
+    public boolean isDataFlavorSupported(DataFlavor flavor);
+
+    /**
+     * Returns an object which represents the data to be transferred.  The class
+     * of the object returned is defined by the representation class of the flavor.
+     *
+     * @param flavor the requested flavor for the data
+     * @return an object which represents the data to be transferred
+     * @see DataFlavor#getRepresentationClass
+     * @exception IOException                if the data is no longer available
+     *              in the requested flavor.
+     * @exception UnsupportedFlavorException if the requested data flavor is
+     *              not supported.
+     */
+    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.datatransfer;
+
+/**
+ * Signals that the requested data is not supported in this flavor.
+ * @see Transferable#getTransferData
+ *
+ * @author      Amy Fowler
+ */
+public class UnsupportedFlavorException extends Exception {
+
+    /*
+     * JDK 1.1 serialVersionUID
+     */
+    private static final long serialVersionUID = 5383814944251665601L;
+
+    /**
+     * Constructs an UnsupportedFlavorException.
+     *
+     * @param flavor the flavor object which caused the exception. May
+     *        be <code>null</code>.
+     */
+    public UnsupportedFlavorException(DataFlavor flavor) {
+        super((flavor != null) ? flavor.getHumanPresentableName() : null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/package.html	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,64 @@
+<!--
+ Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.  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.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head><title></title></head>
+<body bgcolor="white">
+
+Provides interfaces and classes for transferring data
+between and within applications.  It defines the notion of a
+"transferable" object, which is an object capable of being
+transferred between or within applications. An object identifies
+itself as being transferable by implementing the Transferable
+interface.
+<p>
+It also provides a clipboard mechanism, which is an object that
+temporarily holds a transferable object that can be transferred
+between or within an application. The clipboard is typically used
+for copy and paste operations. Although it is possible to create
+a clipboard to use within an application, most applications will
+use the system clipboard to ensure the data can be transferred
+across applications running on the platform.
+
+<!--
+<h2>Package Specification</h2>
+
+##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
+<ul>
+  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
+</ul>
+-->
+
+@since 1.1
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,841 @@
+/*
+ * 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 sun.datatransfer;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.FlavorMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.StandardCharsets;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.function.Supplier;
+
+
+/**
+ * Utility class with different datatransfer helper functions
+ *
+ * @see 1.9
+ */
+public class DataFlavorUtil {
+
+    private DataFlavorUtil() {
+        // Avoid instantiation
+    }
+
+    private static Comparator<String> getCharsetComparator() {
+       return CharsetComparator.INSTANCE;
+    }
+
+    public static Comparator<DataFlavor> getDataFlavorComparator() {
+       return DataFlavorComparator.INSTANCE;
+    }
+
+    public static Comparator<Long> getIndexOrderComparator(Map<Long, Integer> indexMap) {
+        return new IndexOrderComparator(indexMap);
+    }
+
+    public static Comparator<DataFlavor> getTextFlavorComparator() {
+        return TextFlavorComparator.INSTANCE;
+    }
+
+    /**
+     * Tracks whether a particular text/* MIME type supports the charset
+     * parameter. The Map is initialized with all of the standard MIME types
+     * listed in the DataFlavor.selectBestTextFlavor method comment. Additional
+     * entries may be added during the life of the JRE for text/<other> types.
+     */
+    private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
+
+    static {
+        Map<String, Boolean> tempMap = new HashMap<>(17);
+        tempMap.put("sgml", Boolean.TRUE);
+        tempMap.put("xml", Boolean.TRUE);
+        tempMap.put("html", Boolean.TRUE);
+        tempMap.put("enriched", Boolean.TRUE);
+        tempMap.put("richtext", Boolean.TRUE);
+        tempMap.put("uri-list", Boolean.TRUE);
+        tempMap.put("directory", Boolean.TRUE);
+        tempMap.put("css", Boolean.TRUE);
+        tempMap.put("calendar", Boolean.TRUE);
+        tempMap.put("plain", Boolean.TRUE);
+        tempMap.put("rtf", Boolean.FALSE);
+        tempMap.put("tab-separated-values", Boolean.FALSE);
+        tempMap.put("t140", Boolean.FALSE);
+        tempMap.put("rfc822-headers", Boolean.FALSE);
+        tempMap.put("parityfec", Boolean.FALSE);
+        textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
+    }
+
+    /**
+     * Lazy initialization of Standard Encodings.
+     */
+    private static class StandardEncodingsHolder {
+        private static final SortedSet<String> standardEncodings = load();
+
+        private static SortedSet<String> load() {
+            final SortedSet<String> tempSet = new TreeSet<>(getCharsetComparator().reversed());
+            tempSet.add("US-ASCII");
+            tempSet.add("ISO-8859-1");
+            tempSet.add("UTF-8");
+            tempSet.add("UTF-16BE");
+            tempSet.add("UTF-16LE");
+            tempSet.add("UTF-16");
+            tempSet.add(Charset.defaultCharset().name());
+            return Collections.unmodifiableSortedSet(tempSet);
+        }
+    }
+
+    /**
+     * Returns a {@code SortedSet} of Strings which are a total order of the standard
+     * character sets supported by the JRE. The ordering follows the same principles as
+     * {@link java.awt.datatransfer.DataFlavor#selectBestTextFlavor(java.awt.datatransfer.DataFlavor[])}.
+     * So as to avoid loading all available character converters, optional, non-standard,
+     * character sets are not included.
+     */
+    public static Set<String> standardEncodings() {
+        return StandardEncodingsHolder.standardEncodings;
+    }
+
+    /**
+     * Converts an arbitrary text encoding to its canonical name.
+     */
+    public static String canonicalName(String encoding) {
+        if (encoding == null) {
+            return null;
+        }
+        try {
+            return Charset.forName(encoding).name();
+        } catch (IllegalCharsetNameException icne) {
+            return encoding;
+        } catch (UnsupportedCharsetException uce) {
+            return encoding;
+        }
+    }
+
+    /**
+     * Tests only whether the flavor's MIME type supports the charset
+     * parameter. Must only be called for flavors with a primary type of
+     * "text".
+     */
+    public static boolean doesSubtypeSupportCharset(DataFlavor flavor) {
+        String subType = flavor.getSubType();
+        if (subType == null) {
+            return false;
+        }
+
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
+
+        if (support != null) {
+            return support;
+        }
+
+        boolean ret_val = (flavor.getParameter("charset") != null);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
+        return ret_val;
+    }
+    public static boolean doesSubtypeSupportCharset(String subType,
+                                                    String charset)
+    {
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
+
+        if (support != null) {
+            return support;
+        }
+
+        boolean ret_val = (charset != null);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
+        return ret_val;
+    }
+
+
+    /**
+     * Returns whether this flavor is a text type which supports the
+     * 'charset' parameter.
+     */
+    public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
+        // Although stringFlavor doesn't actually support the charset
+        // parameter (because its primary MIME type is not "text"), it should
+        // be treated as though it does. stringFlavor is semantically
+        // equivalent to "text/plain" data.
+        if (DataFlavor.stringFlavor.equals(flavor)) {
+            return true;
+        }
+
+        if (!"text".equals(flavor.getPrimaryType()) ||
+                !doesSubtypeSupportCharset(flavor))
+        {
+            return false;
+        }
+
+        Class<?> rep_class = flavor.getRepresentationClass();
+
+        if (flavor.isRepresentationClassReader() ||
+                String.class.equals(rep_class) ||
+                flavor.isRepresentationClassCharBuffer() ||
+                char[].class.equals(rep_class))
+        {
+            return true;
+        }
+
+        if (!(flavor.isRepresentationClassInputStream() ||
+                flavor.isRepresentationClassByteBuffer() ||
+                byte[].class.equals(rep_class))) {
+            return false;
+        }
+
+        String charset = flavor.getParameter("charset");
+
+        // null equals default encoding which is always supported
+        return (charset == null) || isEncodingSupported(charset);
+    }
+
+    /**
+     * Returns whether this flavor is a text type which does not support the
+     * 'charset' parameter.
+     */
+    public static boolean isFlavorNoncharsetTextType(DataFlavor flavor) {
+        if (!"text".equals(flavor.getPrimaryType()) || doesSubtypeSupportCharset(flavor)) {
+            return false;
+        }
+
+        return (flavor.isRepresentationClassInputStream() ||
+                flavor.isRepresentationClassByteBuffer() ||
+                byte[].class.equals(flavor.getRepresentationClass()));
+    }
+
+    /**
+     * If the specified flavor is a text flavor which supports the "charset"
+     * parameter, then this method returns that parameter, or the default
+     * charset if no such parameter was specified at construction. For non-
+     * text DataFlavors, and for non-charset text flavors, this method returns
+     * null.
+     */
+    public static String getTextCharset(DataFlavor flavor) {
+        if (!isFlavorCharsetTextType(flavor)) {
+            return null;
+        }
+
+        String encoding = flavor.getParameter("charset");
+
+        return (encoding != null) ? encoding : Charset.defaultCharset().name();
+    }
+
+    /**
+     * Determines whether this JRE can both encode and decode text in the
+     * specified encoding.
+     */
+    private static boolean isEncodingSupported(String encoding) {
+        if (encoding == null) {
+            return false;
+        }
+        try {
+            return Charset.isSupported(encoding);
+        } catch (IllegalCharsetNameException icne) {
+            return false;
+        }
+    }
+
+    /**
+     * Helper method to compare two objects by their Integer indices in the
+     * given map. If the map doesn't contain an entry for either of the
+     * objects, the fallback index will be used for the object instead.
+     *
+     * @param indexMap the map which maps objects into Integer indexes.
+     * @param obj1 the first object to be compared.
+     * @param obj2 the second object to be compared.
+     * @param fallbackIndex the Integer to be used as a fallback index.
+     * @return a negative integer, zero, or a positive integer as the
+     *             first object is mapped to a less, equal to, or greater
+     *             index than the second.
+     */
+    static <T> int compareIndices(Map<T, Integer> indexMap,
+                                  T obj1, T obj2,
+                                  Integer fallbackIndex) {
+        Integer index1 = indexMap.getOrDefault(obj1, fallbackIndex);
+        Integer index2 = indexMap.getOrDefault(obj2, fallbackIndex);
+        return index1.compareTo(index2);
+    }
+
+    /**
+     * An IndexedComparator which compares two String charsets. The comparison
+     * follows the rules outlined in DataFlavor.selectBestTextFlavor. In order
+     * to ensure that non-Unicode, non-ASCII, non-default charsets are sorted
+     * in alphabetical order, charsets are not automatically converted to their
+     * canonical forms.
+     */
+    private static class CharsetComparator implements Comparator<String> {
+        static final CharsetComparator INSTANCE = new CharsetComparator();
+
+        private static final Map<String, Integer> charsets;
+
+        private static final Integer DEFAULT_CHARSET_INDEX = 2;
+        private static final Integer OTHER_CHARSET_INDEX = 1;
+        private static final Integer WORST_CHARSET_INDEX = 0;
+        private static final Integer UNSUPPORTED_CHARSET_INDEX = Integer.MIN_VALUE;
+
+        private static final String UNSUPPORTED_CHARSET = "UNSUPPORTED";
+
+        static {
+            Map<String, Integer> charsetsMap = new HashMap<>(8, 1.0f);
+
+            // we prefer Unicode charsets
+            charsetsMap.put(canonicalName("UTF-16LE"), 4);
+            charsetsMap.put(canonicalName("UTF-16BE"), 5);
+            charsetsMap.put(canonicalName("UTF-8"), 6);
+            charsetsMap.put(canonicalName("UTF-16"), 7);
+
+            // US-ASCII is the worst charset supported
+            charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
+
+            charsetsMap.putIfAbsent(Charset.defaultCharset().name(), DEFAULT_CHARSET_INDEX);
+
+            charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
+
+            charsets = Collections.unmodifiableMap(charsetsMap);
+        }
+
+        /**
+         * Compares charsets. Returns a negative integer, zero, or a positive
+         * integer as the first charset is worse than, equal to, or better than
+         * the second.
+         * <p>
+         * Charsets are ordered according to the following rules:
+         * <ul>
+         * <li>All unsupported charsets are equal.
+         * <li>Any unsupported charset is worse than any supported charset.
+         * <li>Unicode charsets, such as "UTF-16", "UTF-8", "UTF-16BE" and
+         *     "UTF-16LE", are considered best.
+         * <li>After them, platform default charset is selected.
+         * <li>"US-ASCII" is the worst of supported charsets.
+         * <li>For all other supported charsets, the lexicographically less
+         *     one is considered the better.
+         * </ul>
+         *
+         * @param charset1 the first charset to be compared
+         * @param charset2 the second charset to be compared.
+         * @return a negative integer, zero, or a positive integer as the
+         *             first argument is worse, equal to, or better than the
+         *             second.
+         */
+        public int compare(String charset1, String charset2) {
+            charset1 = getEncoding(charset1);
+            charset2 = getEncoding(charset2);
+
+            int comp = compareIndices(charsets, charset1, charset2, OTHER_CHARSET_INDEX);
+
+            if (comp == 0) {
+                return charset2.compareTo(charset1);
+            }
+
+            return comp;
+        }
+
+        /**
+         * Returns encoding for the specified charset according to the
+         * following rules:
+         * <ul>
+         * <li>If the charset is <code>null</code>, then <code>null</code> will
+         *     be returned.
+         * <li>Iff the charset specifies an encoding unsupported by this JRE,
+         *     <code>UNSUPPORTED_CHARSET</code> will be returned.
+         * <li>If the charset specifies an alias name, the corresponding
+         *     canonical name will be returned iff the charset is a known
+         *     Unicode, ASCII, or default charset.
+         * </ul>
+         *
+         * @param charset the charset.
+         * @return an encoding for this charset.
+         */
+        static String getEncoding(String charset) {
+            if (charset == null) {
+                return null;
+            } else if (!isEncodingSupported(charset)) {
+                return UNSUPPORTED_CHARSET;
+            } else {
+                // Only convert to canonical form if the charset is one
+                // of the charsets explicitly listed in the known charsets
+                // map. This will happen only for Unicode, ASCII, or default
+                // charsets.
+                String canonicalName = canonicalName(charset);
+                return (charsets.containsKey(canonicalName))
+                        ? canonicalName
+                        : charset;
+            }
+        }
+    }
+
+    /**
+     * An IndexedComparator which compares two DataFlavors. For text flavors,
+     * the comparison follows the rules outlined in
+     * DataFlavor.selectBestTextFlavor. For non-text flavors, unknown
+     * application MIME types are preferred, followed by known
+     * application/x-java-* MIME types. Unknown application types are preferred
+     * because if the user provides his own data flavor, it will likely be the
+     * most descriptive one. For flavors which are otherwise equal, the
+     * flavors' string representation are compared in the alphabetical order.
+     */
+    private static class DataFlavorComparator implements Comparator<DataFlavor> {
+
+        static final DataFlavorComparator INSTANCE = new DataFlavorComparator();
+
+        private static final Map<String, Integer> exactTypes;
+        private static final Map<String, Integer> primaryTypes;
+        private static final Map<Class<?>, Integer> nonTextRepresentations;
+        private static final Map<String, Integer> textTypes;
+        private static final Map<Class<?>, Integer> decodedTextRepresentations;
+        private static final Map<Class<?>, Integer> encodedTextRepresentations;
+
+        private static final Integer UNKNOWN_OBJECT_LOSES = Integer.MIN_VALUE;
+        private static final Integer UNKNOWN_OBJECT_WINS = Integer.MAX_VALUE;
+
+        static {
+            {
+                Map<String, Integer> exactTypesMap = new HashMap<>(4, 1.0f);
+
+                // application/x-java-* MIME types
+                exactTypesMap.put("application/x-java-file-list", 0);
+                exactTypesMap.put("application/x-java-serialized-object", 1);
+                exactTypesMap.put("application/x-java-jvm-local-objectref", 2);
+                exactTypesMap.put("application/x-java-remote-object", 3);
+
+                exactTypes = Collections.unmodifiableMap(exactTypesMap);
+            }
+
+            {
+                Map<String, Integer> primaryTypesMap = new HashMap<>(1, 1.0f);
+
+                primaryTypesMap.put("application", 0);
+
+                primaryTypes = Collections.unmodifiableMap(primaryTypesMap);
+            }
+
+            {
+                Map<Class<?>, Integer> nonTextRepresentationsMap = new HashMap<>(3, 1.0f);
+
+                nonTextRepresentationsMap.put(java.io.InputStream.class, 0);
+                nonTextRepresentationsMap.put(java.io.Serializable.class, 1);
+
+                nonTextRepresentationsMap.put(RMI.remoteClass(), 2);
+
+                nonTextRepresentations = Collections.unmodifiableMap(nonTextRepresentationsMap);
+            }
+
+            {
+                Map<String, Integer> textTypesMap = new HashMap<>(16, 1.0f);
+
+                // plain text
+                textTypesMap.put("text/plain", 0);
+
+                // stringFlavor
+                textTypesMap.put("application/x-java-serialized-object", 1);
+
+                // misc
+                textTypesMap.put("text/calendar", 2);
+                textTypesMap.put("text/css", 3);
+                textTypesMap.put("text/directory", 4);
+                textTypesMap.put("text/parityfec", 5);
+                textTypesMap.put("text/rfc822-headers", 6);
+                textTypesMap.put("text/t140", 7);
+                textTypesMap.put("text/tab-separated-values", 8);
+                textTypesMap.put("text/uri-list", 9);
+
+                // enriched
+                textTypesMap.put("text/richtext", 10);
+                textTypesMap.put("text/enriched", 11);
+                textTypesMap.put("text/rtf", 12);
+
+                // markup
+                textTypesMap.put("text/html", 13);
+                textTypesMap.put("text/xml", 14);
+                textTypesMap.put("text/sgml", 15);
+
+                textTypes = Collections.unmodifiableMap(textTypesMap);
+            }
+
+            {
+                Map<Class<?>, Integer> decodedTextRepresentationsMap = new HashMap<>(4, 1.0f);
+
+                decodedTextRepresentationsMap.put(char[].class, 0);
+                decodedTextRepresentationsMap.put(CharBuffer.class, 1);
+                decodedTextRepresentationsMap.put(String.class, 2);
+                decodedTextRepresentationsMap.put(Reader.class, 3);
+
+                decodedTextRepresentations =
+                        Collections.unmodifiableMap(decodedTextRepresentationsMap);
+            }
+
+            {
+                Map<Class<?>, Integer> encodedTextRepresentationsMap = new HashMap<>(3, 1.0f);
+
+                encodedTextRepresentationsMap.put(byte[].class, 0);
+                encodedTextRepresentationsMap.put(ByteBuffer.class, 1);
+                encodedTextRepresentationsMap.put(InputStream.class, 2);
+
+                encodedTextRepresentations =
+                        Collections.unmodifiableMap(encodedTextRepresentationsMap);
+            }
+        }
+
+
+        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
+            if (flavor1.equals(flavor2)) {
+                return 0;
+            }
+
+            int comp;
+
+            String primaryType1 = flavor1.getPrimaryType();
+            String subType1 = flavor1.getSubType();
+            String mimeType1 = primaryType1 + "/" + subType1;
+            Class<?> class1 = flavor1.getRepresentationClass();
+
+            String primaryType2 = flavor2.getPrimaryType();
+            String subType2 = flavor2.getSubType();
+            String mimeType2 = primaryType2 + "/" + subType2;
+            Class<?> class2 = flavor2.getRepresentationClass();
+
+            if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
+                // First, compare MIME types
+                comp = compareIndices(textTypes, mimeType1, mimeType2, UNKNOWN_OBJECT_LOSES);
+                if (comp != 0) {
+                    return comp;
+                }
+
+                // Only need to test one flavor because they both have the
+                // same MIME type. Also don't need to worry about accidentally
+                // passing stringFlavor because either
+                //   1. Both flavors are stringFlavor, in which case the
+                //      equality test at the top of the function succeeded.
+                //   2. Only one flavor is stringFlavor, in which case the MIME
+                //      type comparison returned a non-zero value.
+                if (doesSubtypeSupportCharset(flavor1)) {
+                    // Next, prefer the decoded text representations of Reader,
+                    // String, CharBuffer, and [C, in that order.
+                    comp = compareIndices(decodedTextRepresentations, class1,
+                            class2, UNKNOWN_OBJECT_LOSES);
+                    if (comp != 0) {
+                        return comp;
+                    }
+
+                    // Next, compare charsets
+                    comp = CharsetComparator.INSTANCE.compare(getTextCharset(flavor1),
+                            getTextCharset(flavor2));
+                    if (comp != 0) {
+                        return comp;
+                    }
+                }
+
+                // Finally, prefer the encoded text representations of
+                // InputStream, ByteBuffer, and [B, in that order.
+                comp = compareIndices(encodedTextRepresentations, class1,
+                        class2, UNKNOWN_OBJECT_LOSES);
+                if (comp != 0) {
+                    return comp;
+                }
+            } else {
+                // First, prefer application types.
+                comp = compareIndices(primaryTypes, primaryType1, primaryType2,
+                        UNKNOWN_OBJECT_LOSES);
+                if (comp != 0) {
+                    return comp;
+                }
+
+                // Next prefer text types
+                if (flavor1.isFlavorTextType()) {
+                    return 1;
+                }
+
+                if (flavor2.isFlavorTextType()) {
+                    return -1;
+                }
+
+                // Next, look for application/x-java-* types. Prefer unknown
+                // MIME types because if the user provides his own data flavor,
+                // it will likely be the most descriptive one.
+                comp = compareIndices(exactTypes, mimeType1, mimeType2,
+                        UNKNOWN_OBJECT_WINS);
+                if (comp != 0) {
+                    return comp;
+                }
+
+                // Finally, prefer the representation classes of Remote,
+                // Serializable, and InputStream, in that order.
+                comp = compareIndices(nonTextRepresentations, class1, class2,
+                        UNKNOWN_OBJECT_LOSES);
+                if (comp != 0) {
+                    return comp;
+                }
+            }
+
+            // The flavours are not equal but still not distinguishable.
+            // Compare String representations in alphabetical order
+            return flavor1.getMimeType().compareTo(flavor2.getMimeType());
+        }
+    }
+
+    /*
+     * Given the Map that maps objects to Integer indices and a boolean value,
+     * this Comparator imposes a direct or reverse order on set of objects.
+     * <p>
+     * If the specified boolean value is SELECT_BEST, the Comparator imposes the
+     * direct index-based order: an object A is greater than an object B if and
+     * only if the index of A is greater than the index of B. An object that
+     * doesn't have an associated index is less or equal than any other object.
+     * <p>
+     * If the specified boolean value is SELECT_WORST, the Comparator imposes the
+     * reverse index-based order: an object A is greater than an object B if and
+     * only if A is less than B with the direct index-based order.
+     */
+    private static class IndexOrderComparator implements Comparator<Long> {
+        private final Map<Long, Integer> indexMap;
+        private static final Integer FALLBACK_INDEX = Integer.MIN_VALUE;
+
+        public IndexOrderComparator(Map<Long, Integer> indexMap) {
+            this.indexMap = indexMap;
+        }
+
+        public int compare(Long obj1, Long obj2) {
+            return compareIndices(indexMap, obj1, obj2, FALLBACK_INDEX);
+        }
+    }
+
+    private static class TextFlavorComparator extends DataFlavorComparator {
+
+        static final TextFlavorComparator INSTANCE = new TextFlavorComparator();
+        /**
+         * Compares two <code>DataFlavor</code> objects. Returns a negative
+         * integer, zero, or a positive integer as the first
+         * <code>DataFlavor</code> is worse than, equal to, or better than the
+         * second.
+         * <p>
+         * <code>DataFlavor</code>s are ordered according to the rules outlined
+         * for <code>selectBestTextFlavor</code>.
+         *
+         * @param flavor1 the first <code>DataFlavor</code> to be compared
+         * @param flavor2 the second <code>DataFlavor</code> to be compared
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is worse, equal to, or better than the second
+         * @throws ClassCastException if either of the arguments is not an
+         *         instance of <code>DataFlavor</code>
+         * @throws NullPointerException if either of the arguments is
+         *         <code>null</code>
+         *
+         * @see java.awt.datatransfer.DataFlavor#selectBestTextFlavor
+         */
+        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
+            if (flavor1.isFlavorTextType()) {
+                if (flavor2.isFlavorTextType()) {
+                    return super.compare(flavor1, flavor2);
+                } else {
+                    return 1;
+                }
+            } else if (flavor2.isFlavorTextType()) {
+                return -1;
+            } else {
+                return 0;
+            }
+        }
+    }
+
+    /**
+     * A fallback implementation of {@link sun.datatransfer.DesktopDatatransferService}
+     * used if there is no desktop.
+     */
+    private static final class DefaultDesktopDatatransferService implements DesktopDatatransferService {
+        static final DesktopDatatransferService INSTANCE = getDesktopService();
+
+        private static DesktopDatatransferService getDesktopService() {
+            ServiceLoader<DesktopDatatransferService> loader =
+                    ServiceLoader.load(DesktopDatatransferService.class, null);
+            Iterator<DesktopDatatransferService> iterator = loader.iterator();
+            if (iterator.hasNext()) {
+                return iterator.next();
+            } else {
+                return new DefaultDesktopDatatransferService();
+            }
+        }
+
+        /**
+         * System singleton FlavorTable.
+         * Only used if there is no desktop
+         * to provide an appropriate FlavorMap.
+         */
+        private volatile FlavorMap flavorMap;
+
+        @Override
+        public void invokeOnEventThread(Runnable r) {
+            r.run();
+        }
+
+        @Override
+        public String getDefaultUnicodeEncoding() {
+            return StandardCharsets.UTF_8.name();
+        }
+
+        @Override
+        public FlavorMap getFlavorMap(Supplier<FlavorMap> supplier) {
+            FlavorMap map = flavorMap;
+            if (map == null) {
+                synchronized (this) {
+                    map = flavorMap;
+                    if (map == null) {
+                        flavorMap = map = supplier.get();
+                    }
+                }
+            }
+            return map;
+        }
+
+        @Override
+        public boolean isDesktopPresent() {
+            return false;
+        }
+
+        @Override
+        public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
+            return new LinkedHashSet<>();
+        }
+
+        @Override
+        public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
+            return new LinkedHashSet<>();
+        }
+
+        @Override
+        public void registerTextFlavorProperties(String nat, String charset,
+                                                 String eoln, String terminators) {
+            // Not needed if desktop module is absent
+        }
+    }
+
+    public static DesktopDatatransferService getDesktopService() {
+        return DefaultDesktopDatatransferService.INSTANCE;
+    }
+
+    /**
+     * A class that provides access to java.rmi.Remote and java.rmi.MarshalledObject
+     * without creating a static dependency.
+     */
+    public static class RMI {
+        private static final Class<?> remoteClass = getClass("java.rmi.Remote");
+        private static final Class<?> marshallObjectClass = getClass("java.rmi.MarshalledObject");
+        private static final Constructor<?> marshallCtor = getConstructor(marshallObjectClass, Object.class);
+        private static final Method marshallGet = getMethod(marshallObjectClass, "get");
+
+        private static Class<?> getClass(String name) {
+            try {
+                return Class.forName(name, true, null);
+            } catch (ClassNotFoundException e) {
+                return null;
+            }
+        }
+
+        private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
+            try {
+                return (c == null) ? null : c.getDeclaredConstructor(types);
+            } catch (NoSuchMethodException x) {
+                throw new AssertionError(x);
+            }
+        }
+
+        private static Method getMethod(Class<?> c, String name, Class<?>... types) {
+            try {
+                return (c == null) ? null : c.getMethod(name, types);
+            } catch (NoSuchMethodException e) {
+                throw new AssertionError(e);
+            }
+        }
+
+        /**
+         * Returns java.rmi.Remote.class if RMI is present; otherwise {@code null}.
+         */
+        static Class<?> remoteClass() {
+            return remoteClass;
+        }
+
+        /**
+         * Returns {@code true} if the given class is java.rmi.Remote.
+         */
+        public static boolean isRemote(Class<?> c) {
+            return (remoteClass != null) && remoteClass.isAssignableFrom(c);
+        }
+
+        /**
+         * Returns a new MarshalledObject containing the serialized representation
+         * of the given object.
+         */
+        public static Object newMarshalledObject(Object obj) throws IOException {
+            try {
+                return marshallCtor == null ? null : marshallCtor.newInstance(obj);
+            } catch (InstantiationException | IllegalAccessException x) {
+                throw new AssertionError(x);
+            } catch (InvocationTargetException x) {
+                Throwable cause = x.getCause();
+                if (cause instanceof IOException)
+                    throw (IOException) cause;
+                throw new AssertionError(x);
+            }
+        }
+
+        /**
+         * Returns a new copy of the contained marshalled object.
+         */
+        public static Object getMarshalledObject(Object obj)
+                throws IOException, ClassNotFoundException {
+            try {
+                return marshallGet == null ? null : marshallGet.invoke(obj);
+            } catch (IllegalAccessException x) {
+                throw new AssertionError(x);
+            } catch (InvocationTargetException x) {
+                Throwable cause = x.getCause();
+                if (cause instanceof IOException)
+                    throw (IOException) cause;
+                if (cause instanceof ClassNotFoundException)
+                    throw (ClassNotFoundException) cause;
+                throw new AssertionError(x);
+            }
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * 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 sun.datatransfer;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.FlavorMap;
+import java.util.LinkedHashSet;
+import java.util.function.Supplier;
+
+/**
+ * Contains services which desktop provides to the datatransfer system
+ * to enrich it's functionality
+ *
+ * @author Petr Pchelko
+ * @since 1.9
+ */
+public interface DesktopDatatransferService {
+
+    /**
+     * If desktop is present - invokes a {@code Runnable} on
+     * the event dispatch thread. Otherwise invokes a {@code run()}
+     * method directly.
+     *
+     * @param r a {@code Runnable} to invoke
+     */
+    void invokeOnEventThread(Runnable r);
+
+    /**
+     * Get a platform-dependent default unicode encoding to use in
+     * datatransfer system.
+     *
+     * @return default unicode encoding
+     */
+    String getDefaultUnicodeEncoding();
+
+    /**
+     * Takes an appropriate {@code FlavorMap} from the desktop.
+     * If no appropriate table is found - uses a provided supplier to
+     * instantiate a table. If the desktop is absent - creates and returns
+     * a system singleton.
+     *
+     * @param supplier a constructor that should be used to create a new instance of
+     *                 the {@code FlavorMap}
+     * @return a {@code FlavorMap}
+     */
+    FlavorMap getFlavorMap(Supplier<FlavorMap> supplier);
+
+    /**
+     * Checks if desktop is present
+     *
+     * @return {@code true} is the desktop is present
+     */
+    boolean isDesktopPresent();
+
+    /**
+     * Returns platform-specific mappings for the specified native format.
+     * If there are no platform-specific mappings for this native, the method
+     * returns an empty {@code Set}
+     *
+     * @param nat a native format to return flavors for
+     * @return set of platform-specific mappings for a native format
+     */
+    LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat);
+
+    /**
+     * Returns platform-specific mappings for the specified flavor.
+     * If there are no platform-specific mappings for this flavor, the method
+     * returns an empty {@code Set}
+     *
+     * @param df {@code DataFlavor} to return mappings for
+     * @return set of platform-specific mappings for a {@code DataFlavor}
+     */
+    LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df);
+
+    /**
+     * This method is called for text flavor mappings established while parsing
+     * the default flavor mappings file. It stores the "eoln" and "terminators"
+     * parameters which are not officially part of the MIME type. They are
+     * MIME parameters specific to the flavormap.properties file format.
+     */
+    void registerTextFlavorProperties(String nat, String charset,
+                                      String eoln, String terminators);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/unix/classes/sun/datatransfer/resources/flavormap.properties	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,71 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific,
+# default mappings between common X11 selection atoms and platform-independent
+# MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by 
+# default. The reason is that many native applications prefer this format over 
+# other native text formats, but are unable to decode the textual data in this 
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment 
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.datatransfer/windows/classes/sun/datatransfer/resources/flavormap.properties	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,69 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the Win32 platform-
+# specific, default mappings between common Win32 Clipboard atoms and platform-
+# independent MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UNICODE\ TEXT=text/plain;charset=utf-16le;eoln="\r\n";terminators=2
+TEXT=text/plain;eoln="\r\n";terminators=1
+HTML\ Format=text/html;charset=utf-8;eoln="\r\n";terminators=1
+Rich\ Text\ Format=text/rtf
+HDROP=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
+DIB=image/x-java-image;class=java.awt.Image
+ENHMETAFILE=image/x-java-image;class=java.awt.Image
+METAFILEPICT=image/x-java-image;class=java.awt.Image
+LOCALE=application/x-java-text-encoding;class="[B"
+UniformResourceLocator=application/x-java-url;class=java.net.URL,\
+                       text/uri-list;eoln="\r\n";terminators=1,\
+                       text/plain;eoln="\r\n";terminators=1
+FileGroupDescriptorW=application/x-java-file-list;class=java.util.List
+FileGroupDescriptor=application/x-java-file-list;class=java.util.List
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaBorder.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaBorder.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,8 +68,9 @@
         painter.state.set(size);
     }
 
+    @Override
     public Insets getBorderInsets(final Component c) {
-        return sizeVariant.margins;
+        return (Insets) sizeVariant.margins.clone();
     }
 
     protected AquaBorder deriveBorderForSize(final Size size) {
@@ -130,8 +131,10 @@
         return (focusable != null && focusable instanceof JComponent && ((JComponent)focusable).hasFocus());
     }
 
+    @Override
     public boolean isBorderOpaque() { return false; }
 
+    @Override
     public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
         painter.paint(g, c, x, y, w, h);
     }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -275,7 +275,7 @@
 
         actionMap.put("aquaSelectNext", highlightNextAction);
         actionMap.put("aquaSelectPrevious", highlightPreviousAction);
-        actionMap.put("aquaEnterPressed", triggerSelectionAction);
+        actionMap.put("enterPressed", triggerSelectionAction);
         actionMap.put("aquaSpacePressed", toggleSelectionAction);
 
         actionMap.put("aquaSelectHome", highlightFirstAction);
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1098,8 +1098,15 @@
             super(f);
         }
 
-        public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
-            super.getTableCellRendererComponent(list, value, isSelected, false, index, col); // No focus border, thanks
+        public Component getTableCellRendererComponent(final JTable list,
+                                                       final Object value,
+                                                       final boolean isSelected,
+                                                       final boolean cellHasFocus,
+                                                       final int index,
+                                                       final int col) {
+            super.getTableCellRendererComponent(list, value, isSelected, false,
+                                                index,
+                                                col); // No focus border, thanks
             final File file = (File)value;
             final JFileChooser fc = getFileChooser();
             setText(fc.getName(file));
@@ -1115,8 +1122,14 @@
             super(f);
         }
 
-        public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
-            super.getTableCellRendererComponent(list, value, isSelected, false, index, col);
+        public Component getTableCellRendererComponent(final JTable list,
+                                                       final Object value,
+                                                       final boolean isSelected,
+                                                       final boolean cellHasFocus,
+                                                       final int index,
+                                                       final int col) {
+            super.getTableCellRendererComponent(list, value, isSelected, false,
+                                                index, col);
             final File file = (File)fFileList.getValueAt(index, 0);
             setEnabled(isSelectableInList(file));
             final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT);
@@ -1132,14 +1145,17 @@
         }
     }
 
+    @Override
     public Dimension getPreferredSize(final JComponent c) {
-        return PREF_SIZE;
+        return new Dimension(PREF_WIDTH, PREF_HEIGHT);
     }
 
+    @Override
     public Dimension getMinimumSize(final JComponent c) {
-        return MIN_SIZE;
+        return new Dimension(MIN_WIDTH, MIN_HEIGHT);
     }
 
+    @Override
     public Dimension getMaximumSize(final JComponent c) {
         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
@@ -1819,12 +1835,8 @@
 
     private static final int PREF_WIDTH = 550;
     private static final int PREF_HEIGHT = 400;
-    private static final Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
-
     private static final int MIN_WIDTH = 400;
     private static final int MIN_HEIGHT = 250;
-    private static final Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
-
     private static final int LIST_MIN_WIDTH = 400;
     private static final int LIST_MIN_HEIGHT = 100;
     private static final Dimension LIST_MIN_SIZE = new Dimension(LIST_MIN_WIDTH, LIST_MIN_HEIGHT);
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java	Wed Jul 05 20:20:43 2017 +0200
@@ -214,7 +214,7 @@
             "PAGE_DOWN", "aquaSelectPageDown",
             "HOME", "aquaSelectHome",
             "END", "aquaSelectEnd",
-            "ENTER", "aquaEnterPressed",
+            "ENTER", "enterPressed",
             "UP", "aquaSelectPrevious",
             "KP_UP", "aquaSelectPrevious",
             "DOWN", "aquaSelectNext",
--- a/jdk/src/java.desktop/macosx/classes/sun/datatransfer/resources/flavormap.properties	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific,
-# default mappings between common Mac OS X selection atoms and platform-independent
-# MIME type strings, which will be converted into 
-# java.awt.datatransfer.DataFlavors.
-#
-# The standard format is:
-#
-# <native>=<MIME type>,<MIME type>, ...
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate DataFlavor values and set multiple values for a single native by
-# separating them with ",". If a mapping contains a duplicate key or value,
-# earlier mappings which included this key or value will be preferred.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-
-# The COMPOUND_TEXT support for inter-client text transfer is disabled by 
-# default. The reason is that many native applications prefer this format over 
-# other native text formats, but are unable to decode the textual data in this 
-# format properly. This results in java-to-native text transfer failures.
-# To enable the COMPOUND_TEXT support for this JRE installation uncomment 
-# the line below.
-
-# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
-
-TEXT=text/plain;eoln="\n";terminators=0
-STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-FILE_NAME=application/x-java-file-list;class=java.util.List
-text/uri-list=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
-TIFF=image/x-java-image;class=java.awt.Image
-RICH_TEXT=text/rtf
-HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
-URL=application/x-java-url;class=java.net.URL,\
-    text/uri-list;eoln="\r\n";terminators=1
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java	Wed Jul 05 20:20:43 2017 +0200
@@ -77,14 +77,72 @@
     }
 
     private static native long createNativeFont(final String nativeFontName,
-                                                final int style,
-                                                final boolean isFakeItalic);
+                                                final int style);
     private static native void disposeNativeFont(final long nativeFontPtr);
 
     private boolean isFakeItalic;
     private String nativeFontName;
     private long nativeFontPtr;
 
+    private native float getWidthNative(final long nativeFontPtr);
+    private native float getWeightNative(final long nativeFontPtr);
+
+    private int fontWidth = -1;
+    private int fontWeight = -1;
+
+    @Override
+    public int getWidth() {
+        if (fontWidth == -1) {
+            // Apple use a range of -1 -> +1, where 0.0 is normal
+            // OpenType uses a % range from 50% -> 200% where 100% is normal
+            // and maps these onto the integer values 1->9.
+            // Since that is what Font2D.getWidth() expects, remap to that.
+            float fw = getWidthNative(getNativeFontPtr());
+            if (fw == 0.0) { // short cut the common case
+                fontWidth = Font2D.FWIDTH_NORMAL;
+                return fontWidth;
+            }
+            fw += 1.0; fw *= 100.0;
+            if (fw <= 50.0) {
+                fontWidth = 1;
+            } else if (fw <= 62.5) {
+                fontWidth = 2;
+            } else if (fw <= 75.0) {
+                fontWidth = 3;
+            } else if (fw <= 87.5) {
+                fontWidth = 4;
+            } else if (fw <= 100.0) {
+                fontWidth = 5;
+            } else if (fw <= 112.5) {
+                fontWidth = 6;
+            } else if (fw <= 125.0) {
+                fontWidth = 7;
+            } else if (fw <= 150.0) {
+                fontWidth = 8;
+            } else {
+                fontWidth = 9;
+            }
+        }
+        return fontWidth;
+   }
+
+    @Override
+    public int getWeight() {
+        if (fontWeight == -1) {
+            // Apple use a range of -1 -> +1, where 0 is medium/regular
+            // Map this on to the OpenType range of 100->900 where
+            // 500 is medium/regular.
+            // We'll actually map to 0->1000 but that's close enough.
+            float fw = getWeightNative(getNativeFontPtr());
+            if (fw == 0) {
+               return Font2D.FWEIGHT_NORMAL;
+            }
+            fw += 1.0; fw *= 500;
+            fontWeight = (int)fw;
+          }
+          return fontWeight;
+    }
+
     // this constructor is called from CFontWrapper.m
     public CFont(String name) {
         this(name, name);
@@ -94,10 +152,11 @@
         handle = new Font2DHandle(this);
         fullName = name;
         familyName = inFamilyName;
-        nativeFontName = inFamilyName;
+        nativeFontName = fullName;
         setStyle();
     }
 
+    /* Called from CFontManager too */
     public CFont(CFont other, String logicalFamilyName) {
         handle = new Font2DHandle(this);
         fullName = logicalFamilyName;
@@ -109,6 +168,7 @@
 
     public CFont createItalicVariant() {
         CFont font = new CFont(this, familyName);
+        font.nativeFontName = fullName;
         font.fullName =
             fullName + (style == Font.BOLD ? "" : "-") + "Italic-Derived";
         font.style |= Font.ITALIC;
@@ -118,7 +178,7 @@
 
     protected synchronized long getNativeFontPtr() {
         if (nativeFontPtr == 0L) {
-            nativeFontPtr = createNativeFont(nativeFontName, style, isFakeItalic);
+            nativeFontPtr = createNativeFont(nativeFontName, style);
 }
         return nativeFontPtr;
     }
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Wed Jul 05 20:20:43 2017 +0200
@@ -252,13 +252,42 @@
         final CFont font = new CFont(fontName, fontFamilyName);
 
         registerGenericFont(font);
+    }
 
-        if ((font.getStyle() & Font.ITALIC) == 0) {
-            registerGenericFont(font.createItalicVariant(), true);
+    void registerItalicDerived() {
+        FontFamily[] famArr = FontFamily.getAllFontFamilies();
+        for (int i=0; i<famArr.length; i++) {
+            FontFamily family = famArr[i];
+
+            Font2D f2dPlain = family.getFont(Font.PLAIN);
+            if (f2dPlain != null && !(f2dPlain instanceof CFont)) continue;
+            Font2D f2dBold = family.getFont(Font.BOLD);
+            if (f2dBold != null && !(f2dBold instanceof CFont)) continue;
+            Font2D f2dItalic = family.getFont(Font.ITALIC);
+            if (f2dItalic != null && !(f2dItalic instanceof CFont)) continue;
+            Font2D f2dBoldItalic = family.getFont(Font.BOLD|Font.ITALIC);
+            if (f2dBoldItalic != null && !(f2dBoldItalic instanceof CFont)) continue;
+
+            CFont plain = (CFont)f2dPlain;
+            CFont bold = (CFont)f2dBold;
+            CFont italic = (CFont)f2dItalic;
+            CFont boldItalic = (CFont)f2dBoldItalic;
+
+            if (bold == null) bold = plain;
+            if (plain == null && bold == null) continue;
+            if (italic != null && boldItalic != null) continue;
+            if (plain != null && italic == null) {
+               registerGenericFont(plain.createItalicVariant(), true);
+            }
+            if (bold != null && boldItalic == null) {
+               registerGenericFont(bold.createItalicVariant(), true);
+            }
         }
     }
 
     Object waitForFontsToBeLoaded  = new Object();
+    private boolean loadedAllFonts = false;
+
     public void loadFonts()
     {
         synchronized(waitForFontsToBeLoaded)
@@ -267,7 +296,11 @@
             java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<Object>() {
                     public Object run() {
-                        loadNativeFonts();
+                        if (!loadedAllFonts) {
+                           loadNativeFonts();
+                           registerItalicDerived();
+                           loadedAllFonts = true;
+                        }
                         return null;
                     }
                 }
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Wed Jul 05 20:20:43 2017 +0200
@@ -890,9 +890,9 @@
     // text, or 'text in progress'.  We also need to send the event if we get an insert text out of the blue!
     // (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex
     // Unicode value.
-    NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+    NSUInteger utf16Length = [aString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
 
-    if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) {
+    if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {
         JNIEnv *env = [ThreadUtilities getJNIEnv];
 
         static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m	Wed Jul 05 20:20:43 2017 +0200
@@ -35,15 +35,11 @@
 #import "AWTStrike.h"
 #import "CoreTextSupport.h"
 
-
-#define DEBUG
-
 @implementation AWTFont
 
-- (id) initWithFont:(NSFont *)font isFakeItalic:(BOOL)isFakeItalic {
+- (id) initWithFont:(NSFont *)font {
     self = [super init];
     if (self) {
-        fIsFakeItalic = isFakeItalic;
         fFont = [font retain];
         fNativeCGFont = CTFontCopyGraphicsFont((CTFontRef)font, NULL);
     }
@@ -72,7 +68,6 @@
 
 + (AWTFont *) awtFontForName:(NSString *)name
                        style:(int)style
-                isFakeItalic:(BOOL)isFakeItalic
 {
     // create font with family & size
     NSFont *nsFont = [NSFont fontWithName:name size:1.0];
@@ -95,7 +90,7 @@
         nsFont = [[NSFontManager sharedFontManager] convertFont:nsFont toHaveTrait:NSBoldFontMask];
     }
 
-    return [[[AWTFont alloc] initWithFont:nsFont isFakeItalic:isFakeItalic] autorelease];
+    return [[[AWTFont alloc] initWithFont:nsFont] autorelease];
 }
 
 + (NSFont *) nsFontForJavaFont:(jobject)javaFont env:(JNIEnv *)env {
@@ -354,7 +349,7 @@
 JNIEXPORT jlong JNICALL
 Java_sun_font_CFont_createNativeFont
     (JNIEnv *env, jclass clazz,
-     jstring nativeFontName, jint style, jboolean isFakeItalic)
+     jstring nativeFontName, jint style)
 {
     AWTFont *awtFont = nil;
 
@@ -362,8 +357,7 @@
 
     awtFont =
         [AWTFont awtFontForName:JNFJavaToNSString(env, nativeFontName)
-         style:style
-         isFakeItalic:isFakeItalic]; // autoreleased
+         style:style]; // autoreleased
 
     if (awtFont) {
         CFRetain(awtFont); // GC
@@ -376,6 +370,52 @@
 
 /*
  * Class:     sun_font_CFont
+ * Method:    getWidthNative
+ * Signature: (J)F
+ */
+JNIEXPORT jfloat JNICALL
+Java_sun_font_CFont_getWidthNative
+    (JNIEnv *env, jobject cfont, jlong awtFontPtr)
+{
+    float widthVal;
+JNF_COCOA_ENTER(env);
+
+    AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
+    NSFont* nsFont = awtFont->fFont;
+    NSFontDescriptor *fontDescriptor = nsFont.fontDescriptor;
+    NSDictionary *fontTraits = [fontDescriptor objectForKey : NSFontTraitsAttribute];
+    NSNumber *width = [fontTraits objectForKey : NSFontWidthTrait];
+    widthVal = (float)[width floatValue];
+
+JNF_COCOA_EXIT(env);
+   return (jfloat)widthVal;
+}
+
+/*
+ * Class:     sun_font_CFont
+ * Method:    getWeightNative
+ * Signature: (J)F
+ */
+JNIEXPORT jfloat JNICALL
+Java_sun_font_CFont_getWeightNative
+    (JNIEnv *env, jobject cfont, jlong awtFontPtr)
+{
+    float weightVal;
+JNF_COCOA_ENTER(env);
+
+    AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
+    NSFont* nsFont = awtFont->fFont;
+    NSFontDescriptor *fontDescriptor = nsFont.fontDescriptor;
+    NSDictionary *fontTraits = [fontDescriptor objectForKey : NSFontTraitsAttribute];
+    NSNumber *weight = [fontTraits objectForKey : NSFontWeightTrait];
+    weightVal = (float)[weight floatValue];
+
+JNF_COCOA_EXIT(env);
+   return (jfloat)weightVal;
+}
+
+/*
+ * Class:     sun_font_CFont
  * Method:    disposeNativeFont
  * Signature: (J)V
  */
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,6 @@
 
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
-import java.awt.image.SampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.image.ColorModel;
 import java.awt.image.IndexColorModel;
@@ -1048,7 +1046,13 @@
 
         // Call the writer, who will call back for every scanline
 
-        processImageStarted(currentImage);
+        clearAbortRequest();
+        cbLock.lock();
+        try {
+            processImageStarted(currentImage);
+        } finally {
+            cbLock.unlock();
+        }
 
         boolean aborted = false;
 
@@ -1225,6 +1229,23 @@
         }
     }
 
+    @Override
+    protected synchronized void clearAbortRequest() {
+        setThreadLock();
+        try {
+            cbLock.check();
+            if (abortRequested()) {
+                super.clearAbortRequest();
+                // reset C structures
+                resetWriter(structPointer);
+                // reset the native destination
+                setDest(structPointer);
+            }
+        } finally {
+            clearThreadLock();
+        }
+    }
+
     private void resetInternalState() {
         // reset C structures
         resetWriter(structPointer);
@@ -1652,7 +1673,7 @@
         int vsamp0 = specs[0].VsamplingFactor;
         for (int i = 1; i < specs.length; i++) {
             if ((specs[i].HsamplingFactor != hsamp0) ||
-                (specs[i].HsamplingFactor != hsamp0))
+                (specs[i].VsamplingFactor != vsamp0))
                 return true;
         }
         return false;
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -100,7 +100,8 @@
     private static Dimension prefListSize = new Dimension(75, 150);
 
     private static Dimension PREF_SIZE = new Dimension(435, 360);
-    private static Dimension MIN_SIZE = new Dimension(200, 300);
+    private static final int MIN_WIDTH = 200;
+    private static final int MIN_HEIGHT = 300;
 
     private static Dimension ZERO_ACC_SIZE = new Dimension(1, 1);
 
@@ -1052,6 +1053,7 @@
         }
     }
 
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         Dimension prefSize = new Dimension(PREF_SIZE);
         JComponent accessory = getFileChooser().getAccessory();
@@ -1067,10 +1069,12 @@
         }
     }
 
-    public Dimension getMinimumSize(JComponent x)  {
-        return new Dimension(MIN_SIZE);
+    @Override
+    public Dimension getMinimumSize(JComponent x) {
+        return new Dimension(MIN_WIDTH, MIN_HEIGHT);
     }
 
+    @Override
     public Dimension getMaximumSize(JComponent x) {
         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,8 @@
 
     private static Dimension WITH_ACCELERATOR_PREF_SIZE = new Dimension(650, 450);
     private static Dimension PREF_SIZE = new Dimension(350, 450);
-    private static Dimension MIN_SIZE = new Dimension(200, 300);
-
+    private static final int MIN_WIDTH = 200;
+    private static final int MIN_HEIGHT = 300;
     private static Dimension PREF_ACC_SIZE = new Dimension(10, 10);
     private static Dimension ZERO_ACC_SIZE = new Dimension(1, 1);
 
@@ -628,6 +628,7 @@
         return scrollpane;
     }
 
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         Dimension prefSize =
             (getFileChooser().getAccessory() != null) ? WITH_ACCELERATOR_PREF_SIZE : PREF_SIZE;
@@ -640,10 +641,12 @@
         }
     }
 
-    public Dimension getMinimumSize(JComponent x)  {
-        return MIN_SIZE;
+    @Override
+    public Dimension getMinimumSize(JComponent x) {
+        return new Dimension(MIN_WIDTH, MIN_HEIGHT);
     }
 
+    @Override
     public Dimension getMaximumSize(JComponent x) {
         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -93,7 +93,6 @@
 
     private static int MIN_WIDTH = 425;
     private static int MIN_HEIGHT = 245;
-    private static Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
 
     private static int LIST_PREF_WIDTH = 444;
     private static int LIST_PREF_HEIGHT = 138;
@@ -642,6 +641,7 @@
      * @return   a <code>Dimension</code> specifying the preferred
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         int prefWidth = PREF_SIZE.width;
         Dimension d = c.getLayout().preferredLayoutSize(c);
@@ -660,8 +660,9 @@
      * @return   a <code>Dimension</code> specifying the minimum
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
-        return MIN_SIZE;
+        return new Dimension(MIN_WIDTH, MIN_HEIGHT);
     }
 
     /**
@@ -671,6 +672,7 @@
      * @return   a <code>Dimension</code> specifying the maximum
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getMaximumSize(JComponent c) {
         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1690,15 +1690,6 @@
         /* do nothing */
     }
 
-    /*
-     * Delete references from LightweightDispatcher of a heavyweight parent
-     */
-    void clearLightweightDispatcherOnRemove(Component removedComponent) {
-        if (parent != null) {
-            parent.clearLightweightDispatcherOnRemove(removedComponent);
-        }
-    }
-
     /**
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setVisible(boolean)</code>.
@@ -6242,7 +6233,7 @@
     /**
      * Indicates whether a class or its superclasses override coalesceEvents.
      * Must be called with lock on coalesceMap and privileged.
-     * @see checkCoalsecing
+     * @see checkCoalescing
      */
     private static boolean isCoalesceEventsOverriden(Class<?> clazz) {
         assert Thread.holdsLock(coalesceMap);
@@ -7083,8 +7074,6 @@
         }
 
         synchronized (getTreeLock()) {
-            clearLightweightDispatcherOnRemove(this);
-
             if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) {
                 transferFocus(true);
             }
--- a/jdk/src/java.desktop/share/classes/java/awt/Container.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 import java.io.PrintStream;
 import java.io.PrintWriter;
 
+import java.lang.ref.WeakReference;
 import java.security.AccessController;
 
 import java.util.EventListener;
@@ -3321,16 +3322,6 @@
         }
     }
 
-    @Override
-    void clearLightweightDispatcherOnRemove(Component removedComponent) {
-        if (dispatcher != null) {
-            dispatcher.removeReferences(removedComponent);
-        } else {
-            //It is a Lightweight Container, should clear parent`s Dispatcher
-            super.clearLightweightDispatcherOnRemove(removedComponent);
-        }
-    }
-
     final Container getTraversalRoot() {
         if (isFocusCycleRoot()) {
             return findTraversalRoot();
@@ -4431,7 +4422,9 @@
 
     LightweightDispatcher(Container nativeContainer) {
         this.nativeContainer = nativeContainer;
-        mouseEventTarget = null;
+        mouseEventTarget = new WeakReference<>(null);
+        targetLastEntered = new WeakReference<>(null);
+        targetLastEnteredDT = new WeakReference<>(null);
         eventMask = 0;
     }
 
@@ -4442,9 +4435,9 @@
     void dispose() {
         //System.out.println("Disposing lw dispatcher");
         stopListeningForOtherDrags();
-        mouseEventTarget = null;
-        targetLastEntered = null;
-        targetLastEnteredDT = null;
+        mouseEventTarget.clear();
+        targetLastEntered.clear();
+        targetLastEnteredDT.clear();
     }
 
     /**
@@ -4531,65 +4524,62 @@
 
         trackMouseEnterExit(mouseOver, e);
 
-    // 4508327 : MOUSE_CLICKED should only go to the recipient of
-    // the accompanying MOUSE_PRESSED, so don't reset mouseEventTarget on a
-    // MOUSE_CLICKED.
-    if (!isMouseGrab(e) && id != MouseEvent.MOUSE_CLICKED) {
-            mouseEventTarget = (mouseOver != nativeContainer) ? mouseOver: null;
-            isCleaned = false;
+        Component met = mouseEventTarget.get();
+        // 4508327 : MOUSE_CLICKED should only go to the recipient of
+        // the accompanying MOUSE_PRESSED, so don't reset mouseEventTarget on a
+        // MOUSE_CLICKED.
+        if (!isMouseGrab(e) && id != MouseEvent.MOUSE_CLICKED) {
+            met = (mouseOver != nativeContainer) ? mouseOver : null;
+            mouseEventTarget = new WeakReference<>(met);
         }
 
-        if (mouseEventTarget != null) {
+        if (met != null) {
             switch (id) {
-            case MouseEvent.MOUSE_ENTERED:
-            case MouseEvent.MOUSE_EXITED:
-                break;
-            case MouseEvent.MOUSE_PRESSED:
-                retargetMouseEvent(mouseEventTarget, id, e);
-                break;
-        case MouseEvent.MOUSE_RELEASED:
-            retargetMouseEvent(mouseEventTarget, id, e);
-        break;
-        case MouseEvent.MOUSE_CLICKED:
-        // 4508327: MOUSE_CLICKED should never be dispatched to a Component
-        // other than that which received the MOUSE_PRESSED event.  If the
-        // mouse is now over a different Component, don't dispatch the event.
-        // The previous fix for a similar problem was associated with bug
-        // 4155217.
-        if (mouseOver == mouseEventTarget) {
-            retargetMouseEvent(mouseOver, id, e);
-        }
-        break;
-            case MouseEvent.MOUSE_MOVED:
-                retargetMouseEvent(mouseEventTarget, id, e);
-                break;
-        case MouseEvent.MOUSE_DRAGGED:
-            if (isMouseGrab(e)) {
-                retargetMouseEvent(mouseEventTarget, id, e);
-            }
-                break;
-        case MouseEvent.MOUSE_WHEEL:
-            // This may send it somewhere that doesn't have MouseWheelEvents
-            // enabled.  In this case, Component.dispatchEventImpl() will
-            // retarget the event to a parent that DOES have the events enabled.
-            if (eventLog.isLoggable(PlatformLogger.Level.FINEST) && (mouseOver != null)) {
-                eventLog.finest("retargeting mouse wheel to " +
+                case MouseEvent.MOUSE_ENTERED:
+                case MouseEvent.MOUSE_EXITED:
+                    break;
+                case MouseEvent.MOUSE_PRESSED:
+                    retargetMouseEvent(met, id, e);
+                    break;
+                case MouseEvent.MOUSE_RELEASED:
+                    retargetMouseEvent(met, id, e);
+                    break;
+                case MouseEvent.MOUSE_CLICKED:
+                    // 4508327: MOUSE_CLICKED should never be dispatched to a Component
+                    // other than that which received the MOUSE_PRESSED event.  If the
+                    // mouse is now over a different Component, don't dispatch the event.
+                    // The previous fix for a similar problem was associated with bug
+                    // 4155217.
+                    if (mouseOver == met) {
+                        retargetMouseEvent(mouseOver, id, e);
+                    }
+                    break;
+                case MouseEvent.MOUSE_MOVED:
+                    retargetMouseEvent(met, id, e);
+                    break;
+                case MouseEvent.MOUSE_DRAGGED:
+                    if (isMouseGrab(e)) {
+                        retargetMouseEvent(met, id, e);
+                    }
+                    break;
+                case MouseEvent.MOUSE_WHEEL:
+                    // This may send it somewhere that doesn't have MouseWheelEvents
+                    // enabled.  In this case, Component.dispatchEventImpl() will
+                    // retarget the event to a parent that DOES have the events enabled.
+                    if (eventLog.isLoggable(PlatformLogger.Level.FINEST) && (mouseOver != null)) {
+                        eventLog.finest("retargeting mouse wheel to " +
                                 mouseOver.getName() + ", " +
                                 mouseOver.getClass());
-            }
-            retargetMouseEvent(mouseOver, id, e);
-        break;
+                    }
+                    retargetMouseEvent(mouseOver, id, e);
+                    break;
             }
-        //Consuming of wheel events is implemented in "retargetMouseEvent".
-        if (id != MouseEvent.MOUSE_WHEEL) {
-            e.consume();
+            //Consuming of wheel events is implemented in "retargetMouseEvent".
+            if (id != MouseEvent.MOUSE_WHEEL) {
+                e.consume();
+            }
         }
-    } else if (isCleaned && id != MouseEvent.MOUSE_WHEEL) {
-        //After mouseEventTarget was removed and cleaned should consume all events
-        //until new mouseEventTarget is found
-        e.consume();
-    }
-    return e.isConsumed();
+        return e.isConsumed();
     }
 
     private boolean processDropTargetEvent(SunDropTargetEvent e) {
@@ -4646,15 +4636,16 @@
             // drag has an associated drop target. MOUSE_ENTERED comes when the
             // mouse is in the native container already. To propagate this event
             // properly we should null out targetLastEntered.
-            targetLastEnteredDT = null;
+            targetLastEnteredDT.clear();
         } else if (id == MouseEvent.MOUSE_ENTERED) {
             isMouseDTInNativeContainer = true;
         } else if (id == MouseEvent.MOUSE_EXITED) {
             isMouseDTInNativeContainer = false;
         }
-        targetLastEnteredDT = retargetMouseEnterExit(targetOver, e,
-                                                     targetLastEnteredDT,
+        Component tle = retargetMouseEnterExit(targetOver, e,
+                                                     targetLastEnteredDT.get(),
                                                      isMouseDTInNativeContainer);
+        targetLastEnteredDT = new WeakReference<>(tle);
     }
 
     /*
@@ -4680,9 +4671,10 @@
             isMouseInNativeContainer = false;
             stopListeningForOtherDrags();
         }
-        targetLastEntered = retargetMouseEnterExit(targetOver, e,
-                                                   targetLastEntered,
+        Component tle = retargetMouseEnterExit(targetOver, e,
+                                                   targetLastEntered.get(),
                                                    isMouseInNativeContainer);
+        targetLastEntered = new WeakReference<>(tle);
     }
 
     private Component retargetMouseEnterExit(Component targetOver, MouseEvent e,
@@ -4944,22 +4936,17 @@
      * is null, there are currently no events being forwarded to
      * a subcomponent.
      */
-    private transient Component mouseEventTarget;
+    private transient WeakReference<Component> mouseEventTarget;
 
     /**
      * The last component entered by the {@code MouseEvent}.
      */
-    private transient Component targetLastEntered;
+    private transient  WeakReference<Component> targetLastEntered;
 
     /**
      * The last component entered by the {@code SunDropTargetEvent}.
      */
-    private transient Component targetLastEnteredDT;
-
-    /**
-     * Indicates whether {@code mouseEventTarget} was removed and nulled
-     */
-    private transient boolean isCleaned;
+    private transient  WeakReference<Component> targetLastEnteredDT;
 
     /**
      * Is the mouse over the native container.
@@ -5000,17 +4987,4 @@
         AWTEvent.MOUSE_EVENT_MASK |
         AWTEvent.MOUSE_MOTION_EVENT_MASK |
         AWTEvent.MOUSE_WHEEL_EVENT_MASK;
-
-    void removeReferences(Component removedComponent) {
-        if (mouseEventTarget == removedComponent) {
-            isCleaned = true;
-            mouseEventTarget = null;
-        }
-        if (targetLastEntered == removedComponent) {
-            targetLastEntered = null;
-        }
-        if (targetLastEnteredDT == removedComponent) {
-            targetLastEnteredDT = null;
-        }
-    }
 }
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Wed Jul 05 20:20:43 2017 +0200
@@ -182,7 +182,14 @@
 
     private FwDispatcher fwDispatcher;
 
-    private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
+    private static volatile PlatformLogger eventLog;
+
+    private static final PlatformLogger getEventLog() {
+        if(eventLog == null) {
+            eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
+        }
+        return eventLog;
+    }
 
     static {
         AWTAccessor.setEventQueueAccessor(
@@ -762,8 +769,8 @@
                 dispatchThread.stopDispatching();
             }
         } else {
-            if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
-                eventLog.fine("Unable to dispatch event: " + event);
+            if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
+                getEventLog().fine("Unable to dispatch event: " + event);
             }
         }
     }
@@ -860,8 +867,8 @@
      * @since           1.2
      */
     public void push(EventQueue newEventQueue) {
-        if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
-            eventLog.fine("EventQueue.push(" + newEventQueue + ")");
+        if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
+            getEventLog().fine("EventQueue.push(" + newEventQueue + ")");
         }
 
         pushPopLock.lock();
@@ -886,8 +893,8 @@
                     // Use getNextEventPrivate() as it doesn't call flushPendingEvents()
                     newEventQueue.postEventPrivate(topQueue.getNextEventPrivate());
                 } catch (InterruptedException ie) {
-                    if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
-                        eventLog.fine("Interrupted push", ie);
+                    if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
+                        getEventLog().fine("Interrupted push", ie);
                     }
                 }
             }
@@ -925,8 +932,8 @@
      * @since           1.2
      */
     protected void pop() throws EmptyStackException {
-        if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
-            eventLog.fine("EventQueue.pop(" + this + ")");
+        if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
+            getEventLog().fine("EventQueue.pop(" + this + ")");
         }
 
         pushPopLock.lock();
@@ -948,8 +955,8 @@
                 try {
                     prevQueue.postEventPrivate(topQueue.getNextEventPrivate());
                 } catch (InterruptedException ie) {
-                    if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
-                        eventLog.fine("Interrupted pop", ie);
+                    if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
+                        getEventLog().fine("Interrupted pop", ie);
                     }
                 }
             }
--- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -181,7 +181,7 @@
      * removed from the menu bar, and replaced with the specified menu.
      * @param m    the menu to be set as the help menu
      */
-    public void setHelpMenu(Menu m) {
+    public void setHelpMenu(final Menu m) {
         synchronized (getTreeLock()) {
             if (helpMenu == m) {
                 return;
@@ -189,11 +189,11 @@
             if (helpMenu != null) {
                 remove(helpMenu);
             }
-            if (m.parent != this) {
-                add(m);
-            }
             helpMenu = m;
             if (m != null) {
+                if (m.parent != this) {
+                    add(m);
+                }
                 m.isHelpMenu = true;
                 m.parent = this;
                 MenuBarPeer peer = (MenuBarPeer)this.peer;
@@ -242,7 +242,7 @@
      * @param        index   the position of the menu to be removed.
      * @see          java.awt.MenuBar#add(java.awt.Menu)
      */
-    public void remove(int index) {
+    public void remove(final int index) {
         synchronized (getTreeLock()) {
             Menu m = getMenu(index);
             menus.removeElementAt(index);
@@ -252,6 +252,10 @@
                 m.parent = null;
                 peer.delMenu(index);
             }
+            if (helpMenu == m) {
+                helpMenu = null;
+                m.isHelpMenu = false;
+            }
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/Clipboard.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 1996, 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 java.awt.datatransfer;
-
-import sun.datatransfer.DataFlavorUtil;
-
-import java.util.Objects;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Arrays;
-
-import java.io.IOException;
-
-/**
- * A class that implements a mechanism to transfer data using
- * cut/copy/paste operations.
- * <p>
- * {@link FlavorListener}s may be registered on an instance of the
- * Clipboard class to be notified about changes to the set of
- * {@link DataFlavor}s available on this clipboard (see
- * {@link #addFlavorListener}).
- *
- * @see java.awt.Toolkit#getSystemClipboard
- * @see java.awt.Toolkit#getSystemSelection
- *
- * @author      Amy Fowler
- * @author      Alexander Gerasimov
- */
-public class Clipboard {
-
-    String name;
-
-    /**
-     * The owner of the clipboard.
-     */
-    protected ClipboardOwner owner;
-    /**
-     * Contents of the clipboard.
-     */
-    protected Transferable contents;
-
-    /**
-     * An aggregate of flavor listeners registered on this local clipboard.
-     *
-     * @since 1.5
-     */
-    private Set<FlavorListener> flavorListeners;
-
-    /**
-     * A set of <code>DataFlavor</code>s that is available on
-     * this local clipboard. It is used for tracking changes
-     * of <code>DataFlavor</code>s available on this clipboard.
-     *
-     * @since 1.5
-     */
-    private Set<DataFlavor> currentDataFlavors;
-
-    /**
-     * Creates a clipboard object.
-     * @param name for the clipboard
-     * @see java.awt.Toolkit#getSystemClipboard
-     */
-    public Clipboard(String name) {
-        this.name = name;
-    }
-
-    /**
-     * Returns the name of this clipboard object.
-     * @return the name of this clipboard object
-     *
-     * @see java.awt.Toolkit#getSystemClipboard
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the current contents of the clipboard to the specified
-     * transferable object and registers the specified clipboard owner
-     * as the owner of the new contents.
-     * <p>
-     * If there is an existing owner different from the argument
-     * <code>owner</code>, that owner is notified that it no longer
-     * holds ownership of the clipboard contents via an invocation
-     * of <code>ClipboardOwner.lostOwnership()</code> on that owner.
-     * An implementation of <code>setContents()</code> is free not
-     * to invoke <code>lostOwnership()</code> directly from this method.
-     * For example, <code>lostOwnership()</code> may be invoked later on
-     * a different thread. The same applies to <code>FlavorListener</code>s
-     * registered on this clipboard.
-     * <p>
-     * The method throws <code>IllegalStateException</code> if the clipboard
-     * is currently unavailable. For example, on some platforms, the system
-     * clipboard is unavailable while it is accessed by another application.
-     *
-     * @param contents the transferable object representing the
-     *                 clipboard content
-     * @param owner the object which owns the clipboard content
-     * @throws IllegalStateException if the clipboard is currently unavailable
-     * @see java.awt.Toolkit#getSystemClipboard
-     */
-    public synchronized void setContents(Transferable contents, ClipboardOwner owner) {
-        final ClipboardOwner oldOwner = this.owner;
-        final Transferable oldContents = this.contents;
-
-        this.owner = owner;
-        this.contents = contents;
-
-        if (oldOwner != null && oldOwner != owner) {
-            DataFlavorUtil.getDesktopService().invokeOnEventThread(() ->
-                    oldOwner.lostOwnership(Clipboard.this, oldContents));
-        }
-        fireFlavorsChanged();
-    }
-
-    /**
-     * Returns a transferable object representing the current contents
-     * of the clipboard.  If the clipboard currently has no contents,
-     * it returns <code>null</code>. The parameter Object requestor is
-     * not currently used.  The method throws
-     * <code>IllegalStateException</code> if the clipboard is currently
-     * unavailable.  For example, on some platforms, the system clipboard is
-     * unavailable while it is accessed by another application.
-     *
-     * @param requestor the object requesting the clip data  (not used)
-     * @return the current transferable object on the clipboard
-     * @throws IllegalStateException if the clipboard is currently unavailable
-     * @see java.awt.Toolkit#getSystemClipboard
-     */
-    public synchronized Transferable getContents(Object requestor) {
-        return contents;
-    }
-
-
-    /**
-     * Returns an array of <code>DataFlavor</code>s in which the current
-     * contents of this clipboard can be provided. If there are no
-     * <code>DataFlavor</code>s available, this method returns a zero-length
-     * array.
-     *
-     * @return an array of <code>DataFlavor</code>s in which the current
-     *         contents of this clipboard can be provided
-     *
-     * @throws IllegalStateException if this clipboard is currently unavailable
-     *
-     * @since 1.5
-     */
-    public DataFlavor[] getAvailableDataFlavors() {
-        Transferable cntnts = getContents(null);
-        if (cntnts == null) {
-            return new DataFlavor[0];
-        }
-        return cntnts.getTransferDataFlavors();
-    }
-
-    /**
-     * Returns whether or not the current contents of this clipboard can be
-     * provided in the specified <code>DataFlavor</code>.
-     *
-     * @param flavor the requested <code>DataFlavor</code> for the contents
-     *
-     * @return <code>true</code> if the current contents of this clipboard
-     *         can be provided in the specified <code>DataFlavor</code>;
-     *         <code>false</code> otherwise
-     *
-     * @throws NullPointerException if <code>flavor</code> is <code>null</code>
-     * @throws IllegalStateException if this clipboard is currently unavailable
-     *
-     * @since 1.5
-     */
-    public boolean isDataFlavorAvailable(DataFlavor flavor) {
-        if (flavor == null) {
-            throw new NullPointerException("flavor");
-        }
-
-        Transferable cntnts = getContents(null);
-        if (cntnts == null) {
-            return false;
-        }
-        return cntnts.isDataFlavorSupported(flavor);
-    }
-
-    /**
-     * Returns an object representing the current contents of this clipboard
-     * in the specified <code>DataFlavor</code>.
-     * The class of the object returned is defined by the representation
-     * class of <code>flavor</code>.
-     *
-     * @param flavor the requested <code>DataFlavor</code> for the contents
-     *
-     * @return an object representing the current contents of this clipboard
-     *         in the specified <code>DataFlavor</code>
-     *
-     * @throws NullPointerException if <code>flavor</code> is <code>null</code>
-     * @throws IllegalStateException if this clipboard is currently unavailable
-     * @throws UnsupportedFlavorException if the requested <code>DataFlavor</code>
-     *         is not available
-     * @throws IOException if the data in the requested <code>DataFlavor</code>
-     *         can not be retrieved
-     *
-     * @see DataFlavor#getRepresentationClass
-     *
-     * @since 1.5
-     */
-    public Object getData(DataFlavor flavor)
-        throws UnsupportedFlavorException, IOException {
-        if (flavor == null) {
-            throw new NullPointerException("flavor");
-        }
-
-        Transferable cntnts = getContents(null);
-        if (cntnts == null) {
-            throw new UnsupportedFlavorException(flavor);
-        }
-        return cntnts.getTransferData(flavor);
-    }
-
-
-    /**
-     * Registers the specified <code>FlavorListener</code> to receive
-     * <code>FlavorEvent</code>s from this clipboard.
-     * If <code>listener</code> is <code>null</code>, no exception
-     * is thrown and no action is performed.
-     *
-     * @param listener the listener to be added
-     *
-     * @see #removeFlavorListener
-     * @see #getFlavorListeners
-     * @see FlavorListener
-     * @see FlavorEvent
-     * @since 1.5
-     */
-    public synchronized void addFlavorListener(FlavorListener listener) {
-        if (listener == null) {
-            return;
-        }
-
-        if (flavorListeners == null) {
-            flavorListeners = new HashSet<>();
-            currentDataFlavors = getAvailableDataFlavorSet();
-        }
-
-        flavorListeners.add(listener);
-    }
-
-    /**
-     * Removes the specified <code>FlavorListener</code> so that it no longer
-     * receives <code>FlavorEvent</code>s from this <code>Clipboard</code>.
-     * This method performs no function, nor does it throw an exception, if
-     * the listener specified by the argument was not previously added to this
-     * <code>Clipboard</code>.
-     * If <code>listener</code> is <code>null</code>, no exception
-     * is thrown and no action is performed.
-     *
-     * @param listener the listener to be removed
-     *
-     * @see #addFlavorListener
-     * @see #getFlavorListeners
-     * @see FlavorListener
-     * @see FlavorEvent
-     * @since 1.5
-     */
-    public synchronized void removeFlavorListener(FlavorListener listener) {
-        if (listener == null || flavorListeners == null) {
-            return;
-        }
-        flavorListeners.remove(listener);
-    }
-
-    /**
-     * Returns an array of all the <code>FlavorListener</code>s currently
-     * registered on this <code>Clipboard</code>.
-     *
-     * @return all of this clipboard's <code>FlavorListener</code>s or an empty
-     *         array if no listeners are currently registered
-     * @see #addFlavorListener
-     * @see #removeFlavorListener
-     * @see FlavorListener
-     * @see FlavorEvent
-     * @since 1.5
-     */
-    public synchronized FlavorListener[] getFlavorListeners() {
-        return flavorListeners == null ? new FlavorListener[0] :
-            flavorListeners.toArray(new FlavorListener[flavorListeners.size()]);
-    }
-
-    /**
-     * Checks change of the <code>DataFlavor</code>s and, if necessary,
-     * notifies all listeners that have registered interest for notification
-     * on <code>FlavorEvent</code>s.
-     *
-     * @since 1.5
-     */
-    private void fireFlavorsChanged() {
-        if (flavorListeners == null) {
-            return;
-        }
-
-        Set<DataFlavor> prevDataFlavors = currentDataFlavors;
-        currentDataFlavors = getAvailableDataFlavorSet();
-        if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
-            return;
-        }
-        flavorListeners.forEach(listener ->
-                DataFlavorUtil.getDesktopService().invokeOnEventThread(() ->
-                        listener.flavorsChanged(new FlavorEvent(Clipboard.this))));
-    }
-
-    /**
-     * Returns a set of <code>DataFlavor</code>s currently available
-     * on this clipboard.
-     *
-     * @return a set of <code>DataFlavor</code>s currently available
-     *         on this clipboard
-     *
-     * @since 1.5
-     */
-    private Set<DataFlavor> getAvailableDataFlavorSet() {
-        Set<DataFlavor> set = new HashSet<>();
-        Transferable contents = getContents(null);
-        if (contents != null) {
-            DataFlavor[] flavors = contents.getTransferDataFlavors();
-            if (flavors != null) {
-                set.addAll(Arrays.asList(flavors));
-            }
-        }
-        return set;
-    }
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/ClipboardOwner.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-/**
- * Defines the interface for classes that will provide data to
- * a clipboard. An instance of this interface becomes the owner
- * of the contents of a clipboard (clipboard owner) if it is
- * passed as an argument to
- * {@link java.awt.datatransfer.Clipboard#setContents} method of
- * the clipboard and this method returns successfully.
- * The instance remains the clipboard owner until another application
- * or another object within this application asserts ownership
- * of this clipboard.
- *
- * @see java.awt.datatransfer.Clipboard
- *
- * @author      Amy Fowler
- */
-
-public interface ClipboardOwner {
-
-    /**
-     * Notifies this object that it is no longer the clipboard owner.
-     * This method will be called when another application or another
-     * object within this application asserts ownership of the clipboard.
-     *
-     * @param clipboard the clipboard that is no longer owned
-     * @param contents the contents which this owner had placed on the clipboard
-     */
-    public void lostOwnership(Clipboard clipboard, Transferable contents);
-
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/DataFlavor.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1433 +0,0 @@
-/*
- * Copyright (c) 1996, 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 java.awt.datatransfer;
-
-import sun.datatransfer.DataFlavorUtil;
-import sun.reflect.misc.ReflectUtil;
-
-import java.io.ByteArrayInputStream;
-import java.io.CharArrayReader;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.OptionalDataException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Objects;
-
-import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
-
-/**
- * A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
- * is typically used to access data on the clipboard, or during
- * a drag and drop operation.
- * <p>
- * An instance of {@code DataFlavor} encapsulates a content type as
- * defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
- * and <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>.
- * A content type is typically referred to as a MIME type.
- * <p>
- * A content type consists of a media type (referred
- * to as the primary type), a subtype, and optional parameters. See
- * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
- * for details on the syntax of a MIME type.
- * <p>
- * The JRE data transfer implementation interprets the parameter &quot;class&quot;
- * of a MIME type as <B>a representation class</b>.
- * The representation class reflects the class of the object being
- * transferred. In other words, the representation class is the type of
- * object returned by {@link Transferable#getTransferData}.
- * For example, the MIME type of {@link #imageFlavor} is
- * {@code "image/x-java-image;class=java.awt.Image"},
- * the primary type is {@code image}, the subtype is
- * {@code x-java-image}, and the representation class is
- * {@code java.awt.Image}. When {@code getTransferData} is invoked
- * with a {@code DataFlavor} of {@code imageFlavor}, an instance of
- * {@code java.awt.Image} is returned.
- * It's important to note that {@code DataFlavor} does no error checking
- * against the representation class. It is up to consumers of
- * {@code DataFlavor}, such as {@code Transferable}, to honor the representation
- * class.
- * <br>
- * Note, if you do not specify a representation class when
- * creating a {@code DataFlavor}, the default
- * representation class is used. See appropriate documentation for
- * {@code DataFlavor}'s constructors.
- * <p>
- * Also, {@code DataFlavor} instances with the &quot;text&quot; primary
- * MIME type may have a &quot;charset&quot; parameter. Refer to
- * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a> and
- * {@link #selectBestTextFlavor} for details on &quot;text&quot; MIME types
- * and the &quot;charset&quot; parameter.
- * <p>
- * Equality of {@code DataFlavors} is determined by the primary type,
- * subtype, and representation class. Refer to {@link #equals(DataFlavor)} for
- * details. When determining equality, any optional parameters are ignored.
- * For example, the following produces two {@code DataFlavors} that
- * are considered identical:
- * <pre>
- *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
- *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
- *   // The following returns true.
- *   flavor1.equals(flavor2);
- * </pre>
- * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
- * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
- * the same results.
- * <p>
- * For more information on using data transfer with Swing see
- * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
- * How to Use Drag and Drop and Data Transfer</a>,
- * section in <em>Java Tutorial</em>.
- *
- * @author      Blake Sullivan
- * @author      Laurence P. G. Cable
- * @author      Jeff Dunn
- */
-public class DataFlavor implements Externalizable, Cloneable {
-
-    private static final long serialVersionUID = 8367026044764648243L;
-    private static final Class<InputStream> ioInputStreamClass = InputStream.class;
-
-    /**
-     * Tries to load a class from: the bootstrap loader, the system loader,
-     * the context loader (if one is present) and finally the loader specified.
-     *
-     * @param className the name of the class to be loaded
-     * @param fallback the fallback loader
-     * @return the class loaded
-     * @exception ClassNotFoundException if class is not found
-     */
-    protected final static Class<?> tryToLoadClass(String className,
-                                                   ClassLoader fallback)
-        throws ClassNotFoundException
-    {
-        ReflectUtil.checkPackageAccess(className);
-        try {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(GET_CLASSLOADER_PERMISSION);
-            }
-            ClassLoader loader = ClassLoader.getSystemClassLoader();
-            try {
-                // bootstrap class loader and system class loader if present
-                return Class.forName(className, true, loader);
-            }
-            catch (ClassNotFoundException exception) {
-                // thread context class loader if and only if present
-                loader = Thread.currentThread().getContextClassLoader();
-                if (loader != null) {
-                    try {
-                        return Class.forName(className, true, loader);
-                    }
-                    catch (ClassNotFoundException e) {
-                        // fallback to user's class loader
-                    }
-                }
-            }
-        } catch (SecurityException exception) {
-            // ignore secured class loaders
-        }
-        return Class.forName(className, true, fallback);
-    }
-
-    /*
-     * private initializer
-     */
-    static private DataFlavor createConstant(Class<?> rc, String prn) {
-        try {
-            return new DataFlavor(rc, prn);
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-    /*
-     * private initializer
-     */
-    static private DataFlavor createConstant(String mt, String prn) {
-        try {
-            return new DataFlavor(mt, prn);
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-    /*
-     * private initializer
-     */
-    static private DataFlavor initHtmlDataFlavor(String htmlFlavorType) {
-        try {
-            return new DataFlavor ("text/html; class=java.lang.String;document=" +
-                                       htmlFlavorType + ";charset=Unicode");
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-    /**
-     * The <code>DataFlavor</code> representing a Java Unicode String class,
-     * where:
-     * <pre>
-     *     representationClass = java.lang.String
-     *     mimeType           = "application/x-java-serialized-object"
-     * </pre>
-     */
-    public static final DataFlavor stringFlavor = createConstant(java.lang.String.class, "Unicode String");
-
-    /**
-     * The <code>DataFlavor</code> representing a Java Image class,
-     * where:
-     * <pre>
-     *     representationClass = java.awt.Image
-     *     mimeType            = "image/x-java-image"
-     * </pre>
-     */
-    public static final DataFlavor imageFlavor = createConstant("image/x-java-image; class=java.awt.Image", "Image");
-
-    /**
-     * The <code>DataFlavor</code> representing plain text with Unicode
-     * encoding, where:
-     * <pre>
-     *     representationClass = InputStream
-     *     mimeType            = "text/plain; charset=unicode"
-     * </pre>
-     * This <code>DataFlavor</code> has been <b>deprecated</b> because
-     * (1) Its representation is an InputStream, an 8-bit based representation,
-     * while Unicode is a 16-bit character set; and (2) The charset "unicode"
-     * is not well-defined. "unicode" implies a particular platform's
-     * implementation of Unicode, not a cross-platform implementation.
-     *
-     * @deprecated as of 1.3. Use <code>DataFlavor.getReaderForText(Transferable)</code>
-     *             instead of <code>Transferable.getTransferData(DataFlavor.plainTextFlavor)</code>.
-     */
-    @Deprecated
-    public static final DataFlavor plainTextFlavor = createConstant("text/plain; charset=unicode; class=java.io.InputStream", "Plain Text");
-
-    /**
-     * A MIME Content-Type of application/x-java-serialized-object represents
-     * a graph of Java object(s) that have been made persistent.
-     *
-     * The representation class associated with this <code>DataFlavor</code>
-     * identifies the Java type of an object returned as a reference
-     * from an invocation <code>java.awt.datatransfer.getTransferData</code>.
-     */
-    public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object";
-
-    /**
-     * To transfer a list of files to/from Java (and the underlying
-     * platform) a <code>DataFlavor</code> of this type/subtype and
-     * representation class of <code>java.util.List</code> is used.
-     * Each element of the list is required/guaranteed to be of type
-     * <code>java.io.File</code>.
-     */
-    public static final DataFlavor javaFileListFlavor = createConstant("application/x-java-file-list;class=java.util.List", null);
-
-    /**
-     * To transfer a reference to an arbitrary Java object reference that
-     * has no associated MIME Content-type, across a <code>Transferable</code>
-     * interface WITHIN THE SAME JVM, a <code>DataFlavor</code>
-     * with this type/subtype is used, with a <code>representationClass</code>
-     * equal to the type of the class/interface being passed across the
-     * <code>Transferable</code>.
-     * <p>
-     * The object reference returned from
-     * <code>Transferable.getTransferData</code> for a <code>DataFlavor</code>
-     * with this MIME Content-Type is required to be
-     * an instance of the representation Class of the <code>DataFlavor</code>.
-     */
-    public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref";
-
-    /**
-     * In order to pass a live link to a Remote object via a Drag and Drop
-     * <code>ACTION_LINK</code> operation a Mime Content Type of
-     * application/x-java-remote-object should be used,
-     * where the representation class of the <code>DataFlavor</code>
-     * represents the type of the <code>Remote</code> interface to be
-     * transferred.
-     */
-    public static final String javaRemoteObjectMimeType = "application/x-java-remote-object";
-
-    /**
-     * Represents a piece of an HTML markup. The markup consists of the part
-     * selected on the source side. Therefore some tags in the markup may be
-     * unpaired. If the flavor is used to represent the data in
-     * a {@link Transferable} instance, no additional changes will be made.
-     * This DataFlavor instance represents the same HTML markup as DataFlavor
-     * instances which content MIME type does not contain document parameter
-     * and representation class is the String class.
-     * <pre>
-     *     representationClass = String
-     *     mimeType           = "text/html"
-     * </pre>
-     */
-    public static DataFlavor selectionHtmlFlavor = initHtmlDataFlavor("selection");
-
-    /**
-     * Represents a piece of an HTML markup. If possible, the markup received
-     * from a native system is supplemented with pair tags to be
-     * a well-formed HTML markup. If the flavor is used to represent the data in
-     * a {@link Transferable} instance, no additional changes will be made.
-     * <pre>
-     *     representationClass = String
-     *     mimeType           = "text/html"
-     * </pre>
-     */
-    public static DataFlavor fragmentHtmlFlavor = initHtmlDataFlavor("fragment");
-
-    /**
-     * Represents a piece of an HTML markup. If possible, the markup
-     * received from a native system is supplemented with additional
-     * tags to make up a well-formed HTML document. If the flavor is used to
-     * represent the data in a {@link Transferable} instance,
-     * no additional changes will be made.
-     * <pre>
-     *     representationClass = String
-     *     mimeType           = "text/html"
-     * </pre>
-     */
-    public static  DataFlavor allHtmlFlavor = initHtmlDataFlavor("all");
-
-    /**
-     * Constructs a new <code>DataFlavor</code>.  This constructor is
-     * provided only for the purpose of supporting the
-     * <code>Externalizable</code> interface.  It is not
-     * intended for public (client) use.
-     *
-     * @since 1.2
-     */
-    public DataFlavor() {
-        super();
-    }
-
-    /**
-     * Constructs a fully specified <code>DataFlavor</code>.
-     *
-     * @exception NullPointerException if either <code>primaryType</code>,
-     *            <code>subType</code> or <code>representationClass</code> is null
-     */
-    private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class<?> representationClass, String humanPresentableName) {
-        super();
-        if (primaryType == null) {
-            throw new NullPointerException("primaryType");
-        }
-        if (subType == null) {
-            throw new NullPointerException("subType");
-        }
-        if (representationClass == null) {
-            throw new NullPointerException("representationClass");
-        }
-
-        if (params == null) params = new MimeTypeParameterList();
-
-        params.set("class", representationClass.getName());
-
-        if (humanPresentableName == null) {
-            humanPresentableName = params.get("humanPresentableName");
-
-            if (humanPresentableName == null)
-                humanPresentableName = primaryType + "/" + subType;
-        }
-
-        try {
-            mimeType = new MimeType(primaryType, subType, params);
-        } catch (MimeTypeParseException mtpe) {
-            throw new IllegalArgumentException("MimeType Parse Exception: " + mtpe.getMessage());
-        }
-
-        this.representationClass  = representationClass;
-        this.humanPresentableName = humanPresentableName;
-
-        mimeType.removeParameter("humanPresentableName");
-    }
-
-    /**
-     * Constructs a <code>DataFlavor</code> that represents a Java class.
-     * <p>
-     * The returned <code>DataFlavor</code> will have the following
-     * characteristics:
-     * <pre>
-     *    representationClass = representationClass
-     *    mimeType            = application/x-java-serialized-object
-     * </pre>
-     * @param representationClass the class used to transfer data in this flavor
-     * @param humanPresentableName the human-readable string used to identify
-     *                 this flavor; if this parameter is <code>null</code>
-     *                 then the value of the MIME Content Type is used
-     * @exception NullPointerException if <code>representationClass</code> is null
-     */
-    public DataFlavor(Class<?> representationClass, String humanPresentableName) {
-        this("application", "x-java-serialized-object", null, representationClass, humanPresentableName);
-        if (representationClass == null) {
-            throw new NullPointerException("representationClass");
-        }
-    }
-
-    /**
-     * Constructs a <code>DataFlavor</code> that represents a
-     * <code>MimeType</code>.
-     * <p>
-     * The returned <code>DataFlavor</code> will have the following
-     * characteristics:
-     * <p>
-     * If the <code>mimeType</code> is
-     * "application/x-java-serialized-object; class=&lt;representation class&gt;",
-     * the result is the same as calling
-     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
-     * <p>
-     * Otherwise:
-     * <pre>
-     *     representationClass = InputStream
-     *     mimeType            = mimeType
-     * </pre>
-     * @param mimeType the string used to identify the MIME type for this flavor;
-     *                 if the <code>mimeType</code> does not specify a
-     *                 "class=" parameter, or if the class is not successfully
-     *                 loaded, then an <code>IllegalArgumentException</code>
-     *                 is thrown
-     * @param humanPresentableName the human-readable string used to identify
-     *                 this flavor; if this parameter is <code>null</code>
-     *                 then the value of the MIME Content Type is used
-     * @exception IllegalArgumentException if <code>mimeType</code> is
-     *                 invalid or if the class is not successfully loaded
-     * @exception NullPointerException if <code>mimeType</code> is null
-     */
-    public DataFlavor(String mimeType, String humanPresentableName) {
-        super();
-        if (mimeType == null) {
-            throw new NullPointerException("mimeType");
-        }
-        try {
-            initialize(mimeType, humanPresentableName, this.getClass().getClassLoader());
-        } catch (MimeTypeParseException mtpe) {
-            throw new IllegalArgumentException("failed to parse:" + mimeType);
-        } catch (ClassNotFoundException cnfe) {
-            throw new IllegalArgumentException("can't find specified class: " + cnfe.getMessage());
-        }
-    }
-
-    /**
-     * Constructs a <code>DataFlavor</code> that represents a
-     * <code>MimeType</code>.
-     * <p>
-     * The returned <code>DataFlavor</code> will have the following
-     * characteristics:
-     * <p>
-     * If the mimeType is
-     * "application/x-java-serialized-object; class=&lt;representation class&gt;",
-     * the result is the same as calling
-     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
-     * <p>
-     * Otherwise:
-     * <pre>
-     *     representationClass = InputStream
-     *     mimeType            = mimeType
-     * </pre>
-     * @param mimeType the string used to identify the MIME type for this flavor
-     * @param humanPresentableName the human-readable string used to
-     *          identify this flavor
-     * @param classLoader the class loader to use
-     * @exception ClassNotFoundException if the class is not loaded
-     * @exception IllegalArgumentException if <code>mimeType</code> is
-     *                 invalid
-     * @exception NullPointerException if <code>mimeType</code> is null
-     */
-    public DataFlavor(String mimeType, String humanPresentableName, ClassLoader classLoader) throws ClassNotFoundException {
-        super();
-        if (mimeType == null) {
-            throw new NullPointerException("mimeType");
-        }
-        try {
-            initialize(mimeType, humanPresentableName, classLoader);
-        } catch (MimeTypeParseException mtpe) {
-            throw new IllegalArgumentException("failed to parse:" + mimeType);
-        }
-    }
-
-    /**
-     * Constructs a <code>DataFlavor</code> from a <code>mimeType</code> string.
-     * The string can specify a "class=&lt;fully specified Java class name&gt;"
-     * parameter to create a <code>DataFlavor</code> with the desired
-     * representation class. If the string does not contain "class=" parameter,
-     * <code>java.io.InputStream</code> is used as default.
-     *
-     * @param mimeType the string used to identify the MIME type for this flavor;
-     *                 if the class specified by "class=" parameter is not
-     *                 successfully loaded, then an
-     *                 <code>ClassNotFoundException</code> is thrown
-     * @exception ClassNotFoundException if the class is not loaded
-     * @exception IllegalArgumentException if <code>mimeType</code> is
-     *                 invalid
-     * @exception NullPointerException if <code>mimeType</code> is null
-     */
-    public DataFlavor(String mimeType) throws ClassNotFoundException {
-        super();
-        if (mimeType == null) {
-            throw new NullPointerException("mimeType");
-        }
-        try {
-            initialize(mimeType, null, this.getClass().getClassLoader());
-        } catch (MimeTypeParseException mtpe) {
-            throw new IllegalArgumentException("failed to parse:" + mimeType);
-        }
-    }
-
-   /**
-    * Common initialization code called from various constructors.
-    *
-    * @param mimeType the MIME Content Type (must have a class= param)
-    * @param humanPresentableName the human Presentable Name or
-    *                 <code>null</code>
-    * @param classLoader the fallback class loader to resolve against
-    *
-    * @throws MimeTypeParseException
-    * @throws ClassNotFoundException
-    * @throws  NullPointerException if <code>mimeType</code> is null
-    *
-    * @see #tryToLoadClass
-    */
-    private void initialize(String mimeType, String humanPresentableName, ClassLoader classLoader) throws MimeTypeParseException, ClassNotFoundException {
-        if (mimeType == null) {
-            throw new NullPointerException("mimeType");
-        }
-
-        this.mimeType = new MimeType(mimeType); // throws
-
-        String rcn = getParameter("class");
-
-        if (rcn == null) {
-            if ("application/x-java-serialized-object".equals(this.mimeType.getBaseType()))
-
-                throw new IllegalArgumentException("no representation class specified for:" + mimeType);
-            else
-                representationClass = java.io.InputStream.class; // default
-        } else { // got a class name
-            representationClass = DataFlavor.tryToLoadClass(rcn, classLoader);
-        }
-
-        this.mimeType.setParameter("class", representationClass.getName());
-
-        if (humanPresentableName == null) {
-            humanPresentableName = this.mimeType.getParameter("humanPresentableName");
-            if (humanPresentableName == null)
-                humanPresentableName = this.mimeType.getPrimaryType() + "/" + this.mimeType.getSubType();
-        }
-
-        this.humanPresentableName = humanPresentableName; // set it.
-
-        this.mimeType.removeParameter("humanPresentableName"); // just in case
-    }
-
-    /**
-     * String representation of this <code>DataFlavor</code> and its
-     * parameters. The resulting <code>String</code> contains the name of
-     * the <code>DataFlavor</code> class, this flavor's MIME type, and its
-     * representation class. If this flavor has a primary MIME type of "text",
-     * supports the charset parameter, and has an encoded representation, the
-     * flavor's charset is also included. See <code>selectBestTextFlavor</code>
-     * for a list of text flavors which support the charset parameter.
-     *
-     * @return  string representation of this <code>DataFlavor</code>
-     * @see #selectBestTextFlavor
-     */
-    public String toString() {
-        String string = getClass().getName();
-        string += "["+paramString()+"]";
-        return string;
-    }
-
-    private String paramString() {
-        String params = "";
-        params += "mimetype=";
-        if (mimeType == null) {
-            params += "null";
-        } else {
-            params += mimeType.getBaseType();
-        }
-        params += ";representationclass=";
-        if (representationClass == null) {
-           params += "null";
-        } else {
-           params += representationClass.getName();
-        }
-        if (DataFlavorUtil.isFlavorCharsetTextType(this) &&
-            (isRepresentationClassInputStream() ||
-             isRepresentationClassByteBuffer() ||
-             byte[].class.equals(representationClass)))
-        {
-            params += ";charset=" + DataFlavorUtil.getTextCharset(this);
-        }
-        return params;
-    }
-
-    /**
-     * Returns a <code>DataFlavor</code> representing plain text with Unicode
-     * encoding, where:
-     * <pre>
-     *     representationClass = java.io.InputStream
-     *     mimeType            = "text/plain;
-     *                            charset=&lt;platform default Unicode encoding&gt;"
-     * </pre>
-     * Sun's implementation for Microsoft Windows uses the encoding <code>utf-16le</code>.
-     * Sun's implementation for Solaris and Linux uses the encoding
-     * <code>iso-10646-ucs-2</code>.
-     *
-     * @return a <code>DataFlavor</code> representing plain text
-     *    with Unicode encoding
-     * @since 1.3
-     */
-    public static final DataFlavor getTextPlainUnicodeFlavor() {
-        return new DataFlavor(
-            "text/plain;charset=" + DataFlavorUtil.getDesktopService().getDefaultUnicodeEncoding()
-            +";class=java.io.InputStream", "Plain Text");
-    }
-
-    /**
-     * Selects the best text <code>DataFlavor</code> from an array of <code>
-     * DataFlavor</code>s. Only <code>DataFlavor.stringFlavor</code>, and
-     * equivalent flavors, and flavors that have a primary MIME type of "text",
-     * are considered for selection.
-     * <p>
-     * Flavors are first sorted by their MIME types in the following order:
-     * <ul>
-     * <li>"text/sgml"
-     * <li>"text/xml"
-     * <li>"text/html"
-     * <li>"text/rtf"
-     * <li>"text/enriched"
-     * <li>"text/richtext"
-     * <li>"text/uri-list"
-     * <li>"text/tab-separated-values"
-     * <li>"text/t140"
-     * <li>"text/rfc822-headers"
-     * <li>"text/parityfec"
-     * <li>"text/directory"
-     * <li>"text/css"
-     * <li>"text/calendar"
-     * <li>"application/x-java-serialized-object"
-     * <li>"text/plain"
-     * <li>"text/&lt;other&gt;"
-     * </ul>
-     * <p>For example, "text/sgml" will be selected over
-     * "text/html", and <code>DataFlavor.stringFlavor</code> will be chosen
-     * over <code>DataFlavor.plainTextFlavor</code>.
-     * <p>
-     * If two or more flavors share the best MIME type in the array, then that
-     * MIME type will be checked to see if it supports the charset parameter.
-     * <p>
-     * The following MIME types support, or are treated as though they support,
-     * the charset parameter:
-     * <ul>
-     * <li>"text/sgml"
-     * <li>"text/xml"
-     * <li>"text/html"
-     * <li>"text/enriched"
-     * <li>"text/richtext"
-     * <li>"text/uri-list"
-     * <li>"text/directory"
-     * <li>"text/css"
-     * <li>"text/calendar"
-     * <li>"application/x-java-serialized-object"
-     * <li>"text/plain"
-     * </ul>
-     * The following MIME types do not support, or are treated as though they
-     * do not support, the charset parameter:
-     * <ul>
-     * <li>"text/rtf"
-     * <li>"text/tab-separated-values"
-     * <li>"text/t140"
-     * <li>"text/rfc822-headers"
-     * <li>"text/parityfec"
-     * </ul>
-     * For "text/&lt;other&gt;" MIME types, the first time the JRE needs to
-     * determine whether the MIME type supports the charset parameter, it will
-     * check whether the parameter is explicitly listed in an arbitrarily
-     * chosen <code>DataFlavor</code> which uses that MIME type. If so, the JRE
-     * will assume from that point on that the MIME type supports the charset
-     * parameter and will not check again. If the parameter is not explicitly
-     * listed, the JRE will assume from that point on that the MIME type does
-     * not support the charset parameter and will not check again. Because
-     * this check is performed on an arbitrarily chosen
-     * <code>DataFlavor</code>, developers must ensure that all
-     * <code>DataFlavor</code>s with a "text/&lt;other&gt;" MIME type specify
-     * the charset parameter if it is supported by that MIME type. Developers
-     * should never rely on the JRE to substitute the platform's default
-     * charset for a "text/&lt;other&gt;" DataFlavor. Failure to adhere to this
-     * restriction will lead to undefined behavior.
-     * <p>
-     * If the best MIME type in the array does not support the charset
-     * parameter, the flavors which share that MIME type will then be sorted by
-     * their representation classes in the following order:
-     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
-     * <code>[B</code>, &lt;all others&gt;.
-     * <p>
-     * If two or more flavors share the best representation class, or if no
-     * flavor has one of the three specified representations, then one of those
-     * flavors will be chosen non-deterministically.
-     * <p>
-     * If the best MIME type in the array does support the charset parameter,
-     * the flavors which share that MIME type will then be sorted by their
-     * representation classes in the following order:
-     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
-     * <code>java.nio.CharBuffer</code>, <code>[C</code>, &lt;all others&gt;.
-     * <p>
-     * If two or more flavors share the best representation class, and that
-     * representation is one of the four explicitly listed, then one of those
-     * flavors will be chosen non-deterministically. If, however, no flavor has
-     * one of the four specified representations, the flavors will then be
-     * sorted by their charsets. Unicode charsets, such as "UTF-16", "UTF-8",
-     * "UTF-16BE", "UTF-16LE", and their aliases, are considered best. After
-     * them, the platform default charset and its aliases are selected.
-     * "US-ASCII" and its aliases are worst. All other charsets are chosen in
-     * alphabetical order, but only charsets supported by this implementation
-     * of the Java platform will be considered.
-     * <p>
-     * If two or more flavors share the best charset, the flavors will then
-     * again be sorted by their representation classes in the following order:
-     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
-     * <code>[B</code>, &lt;all others&gt;.
-     * <p>
-     * If two or more flavors share the best representation class, or if no
-     * flavor has one of the three specified representations, then one of those
-     * flavors will be chosen non-deterministically.
-     *
-     * @param availableFlavors an array of available <code>DataFlavor</code>s
-     * @return the best (highest fidelity) flavor according to the rules
-     *         specified above, or <code>null</code>,
-     *         if <code>availableFlavors</code> is <code>null</code>,
-     *         has zero length, or contains no text flavors
-     * @since 1.3
-     */
-    public static final DataFlavor selectBestTextFlavor(
-                                       DataFlavor[] availableFlavors) {
-        if (availableFlavors == null || availableFlavors.length == 0) {
-            return null;
-        }
-
-        DataFlavor bestFlavor = Collections.max(Arrays.asList(availableFlavors),
-                                                DataFlavorUtil.getTextFlavorComparator());
-
-        if (!bestFlavor.isFlavorTextType()) {
-            return null;
-        }
-
-        return bestFlavor;
-    }
-
-    /**
-     * Gets a Reader for a text flavor, decoded, if necessary, for the expected
-     * charset (encoding). The supported representation classes are
-     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
-     * <code>java.nio.CharBuffer</code>, <code>[C</code>,
-     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
-     * and <code>[B</code>.
-     * <p>
-     * Because text flavors which do not support the charset parameter are
-     * encoded in a non-standard format, this method should not be called for
-     * such flavors. However, in order to maintain backward-compatibility,
-     * if this method is called for such a flavor, this method will treat the
-     * flavor as though it supports the charset parameter and attempt to
-     * decode it accordingly. See <code>selectBestTextFlavor</code> for a list
-     * of text flavors which do not support the charset parameter.
-     *
-     * @param transferable the <code>Transferable</code> whose data will be
-     *        requested in this flavor
-     *
-     * @return a <code>Reader</code> to read the <code>Transferable</code>'s
-     *         data
-     *
-     * @exception IllegalArgumentException if the representation class
-     *            is not one of the seven listed above
-     * @exception IllegalArgumentException if the <code>Transferable</code>
-     *            has <code>null</code> data
-     * @exception NullPointerException if the <code>Transferable</code> is
-     *            <code>null</code>
-     * @exception UnsupportedEncodingException if this flavor's representation
-     *            is <code>java.io.InputStream</code>,
-     *            <code>java.nio.ByteBuffer</code>, or <code>[B</code> and
-     *            this flavor's encoding is not supported by this
-     *            implementation of the Java platform
-     * @exception UnsupportedFlavorException if the <code>Transferable</code>
-     *            does not support this flavor
-     * @exception IOException if the data cannot be read because of an
-     *            I/O error
-     * @see #selectBestTextFlavor
-     * @since 1.3
-     */
-    public Reader getReaderForText(Transferable transferable)
-        throws UnsupportedFlavorException, IOException
-    {
-        Object transferObject = transferable.getTransferData(this);
-        if (transferObject == null) {
-            throw new IllegalArgumentException
-                ("getTransferData() returned null");
-        }
-
-        if (transferObject instanceof Reader) {
-            return (Reader)transferObject;
-        } else if (transferObject instanceof String) {
-            return new StringReader((String)transferObject);
-        } else if (transferObject instanceof CharBuffer) {
-            CharBuffer buffer = (CharBuffer)transferObject;
-            int size = buffer.remaining();
-            char[] chars = new char[size];
-            buffer.get(chars, 0, size);
-            return new CharArrayReader(chars);
-        } else if (transferObject instanceof char[]) {
-            return new CharArrayReader((char[])transferObject);
-        }
-
-        InputStream stream = null;
-
-        if (transferObject instanceof InputStream) {
-            stream = (InputStream)transferObject;
-        } else if (transferObject instanceof ByteBuffer) {
-            ByteBuffer buffer = (ByteBuffer)transferObject;
-            int size = buffer.remaining();
-            byte[] bytes = new byte[size];
-            buffer.get(bytes, 0, size);
-            stream = new ByteArrayInputStream(bytes);
-        } else if (transferObject instanceof byte[]) {
-            stream = new ByteArrayInputStream((byte[])transferObject);
-        }
-
-        if (stream == null) {
-            throw new IllegalArgumentException("transfer data is not Reader, String, CharBuffer, char array, InputStream, ByteBuffer, or byte array");
-        }
-
-        String encoding = getParameter("charset");
-        return (encoding == null)
-            ? new InputStreamReader(stream)
-            : new InputStreamReader(stream, encoding);
-    }
-
-    /**
-     * Returns the MIME type string for this <code>DataFlavor</code>.
-     * @return the MIME type string for this flavor
-     */
-    public String getMimeType() {
-        return (mimeType != null) ? mimeType.toString() : null;
-    }
-
-    /**
-     * Returns the <code>Class</code> which objects supporting this
-     * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
-     * is requested.
-     * @return the <code>Class</code> which objects supporting this
-     * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
-     * is requested
-     */
-    public Class<?> getRepresentationClass() {
-        return representationClass;
-    }
-
-    /**
-     * Returns the human presentable name for the data format that this
-     * <code>DataFlavor</code> represents.  This name would be localized
-     * for different countries.
-     * @return the human presentable name for the data format that this
-     *    <code>DataFlavor</code> represents
-     */
-    public String getHumanPresentableName() {
-        return humanPresentableName;
-    }
-
-    /**
-     * Returns the primary MIME type for this <code>DataFlavor</code>.
-     * @return the primary MIME type of this <code>DataFlavor</code>
-     */
-    public String getPrimaryType() {
-        return (mimeType != null) ? mimeType.getPrimaryType() : null;
-    }
-
-    /**
-     * Returns the sub MIME type of this <code>DataFlavor</code>.
-     * @return the Sub MIME type of this <code>DataFlavor</code>
-     */
-    public String getSubType() {
-        return (mimeType != null) ? mimeType.getSubType() : null;
-    }
-
-    /**
-     * Returns the human presentable name for this <code>DataFlavor</code>
-     * if <code>paramName</code> equals "humanPresentableName".  Otherwise
-     * returns the MIME type value associated with <code>paramName</code>.
-     *
-     * @param paramName the parameter name requested
-     * @return the value of the name parameter, or <code>null</code>
-     *  if there is no associated value
-     */
-    public String getParameter(String paramName) {
-        if (paramName.equals("humanPresentableName")) {
-            return humanPresentableName;
-        } else {
-            return (mimeType != null)
-                ? mimeType.getParameter(paramName) : null;
-        }
-    }
-
-    /**
-     * Sets the human presentable name for the data format that this
-     * <code>DataFlavor</code> represents. This name would be localized
-     * for different countries.
-     * @param humanPresentableName the new human presentable name
-     */
-    public void setHumanPresentableName(String humanPresentableName) {
-        this.humanPresentableName = humanPresentableName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The equals comparison for the {@code DataFlavor} class is implemented
-     * as follows: Two <code>DataFlavor</code>s are considered equal if and
-     * only if their MIME primary type and subtype and representation class are
-     * equal. Additionally, if the primary type is "text", the subtype denotes
-     * a text flavor which supports the charset parameter, and the
-     * representation class is not <code>java.io.Reader</code>,
-     * <code>java.lang.String</code>, <code>java.nio.CharBuffer</code>, or
-     * <code>[C</code>, the <code>charset</code> parameter must also be equal.
-     * If a charset is not explicitly specified for one or both
-     * <code>DataFlavor</code>s, the platform default encoding is assumed. See
-     * <code>selectBestTextFlavor</code> for a list of text flavors which
-     * support the charset parameter.
-     *
-     * @param o the <code>Object</code> to compare with <code>this</code>
-     * @return <code>true</code> if <code>that</code> is equivalent to this
-     *         <code>DataFlavor</code>; <code>false</code> otherwise
-     * @see #selectBestTextFlavor
-     */
-    public boolean equals(Object o) {
-        return ((o instanceof DataFlavor) && equals((DataFlavor)o));
-    }
-
-    /**
-     * This method has the same behavior as {@link #equals(Object)}.
-     * The only difference being that it takes a {@code DataFlavor} instance
-     * as a parameter.
-     *
-     * @param that the <code>DataFlavor</code> to compare with
-     *        <code>this</code>
-     * @return <code>true</code> if <code>that</code> is equivalent to this
-     *         <code>DataFlavor</code>; <code>false</code> otherwise
-     * @see #selectBestTextFlavor
-     */
-    public boolean equals(DataFlavor that) {
-        if (that == null) {
-            return false;
-        }
-        if (this == that) {
-            return true;
-        }
-
-        if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) {
-            return false;
-        }
-
-        if (mimeType == null) {
-            if (that.mimeType != null) {
-                return false;
-            }
-        } else {
-            if (!mimeType.match(that.mimeType)) {
-                return false;
-            }
-
-            if ("text".equals(getPrimaryType())) {
-                if (DataFlavorUtil.doesSubtypeSupportCharset(this)
-                        && representationClass != null
-                        && !isStandardTextRepresentationClass()) {
-                    String thisCharset =
-                            DataFlavorUtil.canonicalName(this.getParameter("charset"));
-                    String thatCharset =
-                            DataFlavorUtil.canonicalName(that.getParameter("charset"));
-                    if (!Objects.equals(thisCharset, thatCharset)) {
-                        return false;
-                    }
-                }
-
-                if ("html".equals(getSubType())) {
-                    String thisDocument = this.getParameter("document");
-                    String thatDocument = that.getParameter("document");
-                    if (!Objects.equals(thisDocument, thatDocument)) {
-                        return false;
-                    }
-                }
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * Compares only the <code>mimeType</code> against the passed in
-     * <code>String</code> and <code>representationClass</code> is
-     * not considered in the comparison.
-     *
-     * If <code>representationClass</code> needs to be compared, then
-     * <code>equals(new DataFlavor(s))</code> may be used.
-     * @deprecated As inconsistent with <code>hashCode()</code> contract,
-     *             use <code>isMimeTypeEqual(String)</code> instead.
-     * @param s the {@code mimeType} to compare.
-     * @return true if the String (MimeType) is equal; false otherwise or if
-     *         {@code s} is {@code null}
-     */
-    @Deprecated
-    public boolean equals(String s) {
-        if (s == null || mimeType == null)
-            return false;
-        return isMimeTypeEqual(s);
-    }
-
-    /**
-     * Returns hash code for this <code>DataFlavor</code>.
-     * For two equal <code>DataFlavor</code>s, hash codes are equal.
-     * For the <code>String</code>
-     * that matches <code>DataFlavor.equals(String)</code>, it is not
-     * guaranteed that <code>DataFlavor</code>'s hash code is equal
-     * to the hash code of the <code>String</code>.
-     *
-     * @return a hash code for this <code>DataFlavor</code>
-     */
-    public int hashCode() {
-        int total = 0;
-
-        if (representationClass != null) {
-            total += representationClass.hashCode();
-        }
-
-        if (mimeType != null) {
-            String primaryType = mimeType.getPrimaryType();
-            if (primaryType != null) {
-                total += primaryType.hashCode();
-            }
-
-            // Do not add subType.hashCode() to the total. equals uses
-            // MimeType.match which reports a match if one or both of the
-            // subTypes is '*', regardless of the other subType.
-
-            if ("text".equals(primaryType)) {
-                if (DataFlavorUtil.doesSubtypeSupportCharset(this)
-                        && representationClass != null
-                        && !isStandardTextRepresentationClass()) {
-                    String charset = DataFlavorUtil.canonicalName(getParameter("charset"));
-                    if (charset != null) {
-                        total += charset.hashCode();
-                    }
-                }
-
-                if ("html".equals(getSubType())) {
-                    String document = this.getParameter("document");
-                    if (document != null) {
-                        total += document.hashCode();
-                    }
-                }
-            }
-        }
-
-        return total;
-    }
-
-    /**
-     * Identical to {@link #equals(DataFlavor)}.
-     *
-     * @param that the <code>DataFlavor</code> to compare with
-     *        <code>this</code>
-     * @return <code>true</code> if <code>that</code> is equivalent to this
-     *         <code>DataFlavor</code>; <code>false</code> otherwise
-     * @see #selectBestTextFlavor
-     * @since 1.3
-     */
-    public boolean match(DataFlavor that) {
-        return equals(that);
-    }
-
-    /**
-     * Returns whether the string representation of the MIME type passed in
-     * is equivalent to the MIME type of this <code>DataFlavor</code>.
-     * Parameters are not included in the comparison.
-     *
-     * @param mimeType the string representation of the MIME type
-     * @return true if the string representation of the MIME type passed in is
-     *         equivalent to the MIME type of this <code>DataFlavor</code>;
-     *         false otherwise
-     * @throws NullPointerException if mimeType is <code>null</code>
-     */
-    public boolean isMimeTypeEqual(String mimeType) {
-        // JCK Test DataFlavor0117: if 'mimeType' is null, throw NPE
-        if (mimeType == null) {
-            throw new NullPointerException("mimeType");
-        }
-        if (this.mimeType == null) {
-            return false;
-        }
-        try {
-            return this.mimeType.match(new MimeType(mimeType));
-        } catch (MimeTypeParseException mtpe) {
-            return false;
-        }
-    }
-
-    /**
-     * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
-     * objects. No parameters are considered.
-     *
-     * @param dataFlavor the <code>DataFlavor</code> to be compared
-     * @return true if the <code>MimeType</code>s are equal,
-     *  otherwise false
-     */
-
-    public final boolean isMimeTypeEqual(DataFlavor dataFlavor) {
-        return isMimeTypeEqual(dataFlavor.mimeType);
-    }
-
-    /**
-     * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
-     * objects.  No parameters are considered.
-     *
-     * @return true if the <code>MimeType</code>s are equal,
-     *  otherwise false
-     */
-
-    private boolean isMimeTypeEqual(MimeType mtype) {
-        if (this.mimeType == null) {
-            return (mtype == null);
-        }
-        return mimeType.match(mtype);
-    }
-
-    /**
-     * Checks if the representation class is one of the standard text
-     * representation classes.
-     *
-     * @return true if the representation class is one of the standard text
-     *              representation classes, otherwise false
-     */
-    private boolean isStandardTextRepresentationClass() {
-        return isRepresentationClassReader()
-                || String.class.equals(representationClass)
-                || isRepresentationClassCharBuffer()
-                || char[].class.equals(representationClass);
-    }
-
-   /**
-    * Does the <code>DataFlavor</code> represent a serialized object?
-    * @return whether or not a serialized object is represented
-    */
-    public boolean isMimeTypeSerializedObject() {
-        return isMimeTypeEqual(javaSerializedObjectMimeType);
-    }
-
-    /**
-     * Returns the default representation class.
-     * @return the default representation class
-     */
-    public final Class<?> getDefaultRepresentationClass() {
-        return ioInputStreamClass;
-    }
-
-    /**
-     * Returns the name of the default representation class.
-     * @return the name of the default representation class
-     */
-    public final String getDefaultRepresentationClassAsString() {
-        return getDefaultRepresentationClass().getName();
-    }
-
-   /**
-    * Does the <code>DataFlavor</code> represent a
-    * <code>java.io.InputStream</code>?
-    * @return whether or not this {@code DataFlavor} represent a
-    * {@code java.io.InputStream}
-    */
-    public boolean isRepresentationClassInputStream() {
-        return ioInputStreamClass.isAssignableFrom(representationClass);
-    }
-
-    /**
-     * Returns whether the representation class for this
-     * <code>DataFlavor</code> is <code>java.io.Reader</code> or a subclass
-     * thereof.
-     * @return whether or not the representation class for this
-     * {@code DataFlavor} is {@code java.io.Reader} or a subclass
-     * thereof
-     *
-     * @since 1.4
-     */
-    public boolean isRepresentationClassReader() {
-        return java.io.Reader.class.isAssignableFrom(representationClass);
-    }
-
-    /**
-     * Returns whether the representation class for this
-     * <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a
-     * subclass thereof.
-     * @return whether or not the representation class for this
-     * {@code DataFlavor} is {@code java.nio.CharBuffer} or a subclass
-     * thereof
-     *
-     * @since 1.4
-     */
-    public boolean isRepresentationClassCharBuffer() {
-        return java.nio.CharBuffer.class.isAssignableFrom(representationClass);
-    }
-
-    /**
-     * Returns whether the representation class for this
-     * <code>DataFlavor</code> is <code>java.nio.ByteBuffer</code> or a
-     * subclass thereof.
-     * @return whether or not the representation class for this
-     * {@code DataFlavor} is {@code java.nio.ByteBuffer} or a subclass
-     * thereof
-     *
-     * @since 1.4
-     */
-    public boolean isRepresentationClassByteBuffer() {
-        return java.nio.ByteBuffer.class.isAssignableFrom(representationClass);
-    }
-
-   /**
-    * Returns true if the representation class can be serialized.
-    * @return true if the representation class can be serialized
-    */
-
-    public boolean isRepresentationClassSerializable() {
-        return java.io.Serializable.class.isAssignableFrom(representationClass);
-    }
-
-   /**
-    * Returns true if the representation class is <code>Remote</code>.
-    * @return true if the representation class is <code>Remote</code>
-    */
-    public boolean isRepresentationClassRemote() {
-        return DataFlavorUtil.RMI.isRemote(representationClass);
-    }
-
-   /**
-    * Returns true if the <code>DataFlavor</code> specified represents
-    * a serialized object.
-    * @return true if the <code>DataFlavor</code> specified represents
-    *   a Serialized Object
-    */
-
-    public boolean isFlavorSerializedObjectType() {
-        return isRepresentationClassSerializable() && isMimeTypeEqual(javaSerializedObjectMimeType);
-    }
-
-    /**
-     * Returns true if the <code>DataFlavor</code> specified represents
-     * a remote object.
-     * @return true if the <code>DataFlavor</code> specified represents
-     *  a Remote Object
-     */
-
-    public boolean isFlavorRemoteObjectType() {
-        return isRepresentationClassRemote()
-            && isRepresentationClassSerializable()
-            && isMimeTypeEqual(javaRemoteObjectMimeType);
-    }
-
-
-   /**
-    * Returns true if the <code>DataFlavor</code> specified represents
-    * a list of file objects.
-    * @return true if the <code>DataFlavor</code> specified represents
-    *   a List of File objects
-    */
-
-   public boolean isFlavorJavaFileListType() {
-        if (mimeType == null || representationClass == null)
-            return false;
-        return java.util.List.class.isAssignableFrom(representationClass) &&
-               mimeType.match(javaFileListFlavor.mimeType);
-
-   }
-
-    /**
-     * Returns whether this <code>DataFlavor</code> is a valid text flavor for
-     * this implementation of the Java platform. Only flavors equivalent to
-     * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
-     * a primary MIME type of "text" can be valid text flavors.
-     * <p>
-     * If this flavor supports the charset parameter, it must be equivalent to
-     * <code>DataFlavor.stringFlavor</code>, or its representation must be
-     * <code>java.io.Reader</code>, <code>java.lang.String</code>,
-     * <code>java.nio.CharBuffer</code>, <code>[C</code>,
-     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
-     * <code>[B</code>. If the representation is
-     * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
-     * <code>[B</code>, then this flavor's <code>charset</code> parameter must
-     * be supported by this implementation of the Java platform. If a charset
-     * is not specified, then the platform default charset, which is always
-     * supported, is assumed.
-     * <p>
-     * If this flavor does not support the charset parameter, its
-     * representation must be <code>java.io.InputStream</code>,
-     * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
-     * <p>
-     * See <code>selectBestTextFlavor</code> for a list of text flavors which
-     * support the charset parameter.
-     *
-     * @return <code>true</code> if this <code>DataFlavor</code> is a valid
-     *         text flavor as described above; <code>false</code> otherwise
-     * @see #selectBestTextFlavor
-     * @since 1.4
-     */
-    public boolean isFlavorTextType() {
-        return (DataFlavorUtil.isFlavorCharsetTextType(this) ||
-                DataFlavorUtil.isFlavorNoncharsetTextType(this));
-    }
-
-   /**
-    * Serializes this <code>DataFlavor</code>.
-    */
-
-   public synchronized void writeExternal(ObjectOutput os) throws IOException {
-       if (mimeType != null) {
-           mimeType.setParameter("humanPresentableName", humanPresentableName);
-           os.writeObject(mimeType);
-           mimeType.removeParameter("humanPresentableName");
-       } else {
-           os.writeObject(null);
-       }
-
-       os.writeObject(representationClass);
-   }
-
-   /**
-    * Restores this <code>DataFlavor</code> from a Serialized state.
-    */
-
-   public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException {
-       String rcn = null;
-        mimeType = (MimeType)is.readObject();
-
-        if (mimeType != null) {
-            humanPresentableName =
-                mimeType.getParameter("humanPresentableName");
-            mimeType.removeParameter("humanPresentableName");
-            rcn = mimeType.getParameter("class");
-            if (rcn == null) {
-                throw new IOException("no class parameter specified in: " +
-                                      mimeType);
-            }
-        }
-
-        try {
-            representationClass = (Class)is.readObject();
-        } catch (OptionalDataException ode) {
-            if (!ode.eof || ode.length != 0) {
-                throw ode;
-            }
-            // Ensure backward compatibility.
-            // Old versions didn't write the representation class to the stream.
-            if (rcn != null) {
-                representationClass =
-                    DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader());
-            }
-        }
-   }
-
-   /**
-    * Returns a clone of this <code>DataFlavor</code>.
-    * @return a clone of this <code>DataFlavor</code>
-    */
-
-    public Object clone() throws CloneNotSupportedException {
-        Object newObj = super.clone();
-        if (mimeType != null) {
-            ((DataFlavor)newObj).mimeType = (MimeType)mimeType.clone();
-        }
-        return newObj;
-    } // clone()
-
-   /**
-    * Called on <code>DataFlavor</code> for every MIME Type parameter
-    * to allow <code>DataFlavor</code> subclasses to handle special
-    * parameters like the text/plain <code>charset</code>
-    * parameters, whose values are case insensitive.  (MIME type parameter
-    * values are supposed to be case sensitive.
-    * <p>
-    * This method is called for each parameter name/value pair and should
-    * return the normalized representation of the <code>parameterValue</code>.
-    *
-    * This method is never invoked by this implementation from 1.1 onwards.
-    *
-    * @param parameterName the parameter name
-    * @param parameterValue the parameter value
-    * @return the parameter value
-    * @deprecated
-    */
-    @Deprecated
-    protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) {
-        return parameterValue;
-    }
-
-   /**
-    * Called for each MIME type string to give <code>DataFlavor</code> subtypes
-    * the opportunity to change how the normalization of MIME types is
-    * accomplished.  One possible use would be to add default
-    * parameter/value pairs in cases where none are present in the MIME
-    * type string passed in.
-    *
-    * This method is never invoked by this implementation from 1.1 onwards.
-    *
-    * @param mimeType the mime type
-    * @return the mime type
-    * @deprecated
-    */
-    @Deprecated
-    protected String normalizeMimeType(String mimeType) {
-        return mimeType;
-    }
-
-    /*
-     * fields
-     */
-
-    /* placeholder for caching any platform-specific data for flavor */
-
-    transient int       atom;
-
-    /* Mime Type of DataFlavor */
-
-    MimeType            mimeType;
-
-    private String      humanPresentableName;
-
-    /** Java class of objects this DataFlavor represents **/
-
-    private Class<?>       representationClass;
-
-} // class DataFlavor
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorEvent.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, 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 java.awt.datatransfer;
-
-import java.util.EventObject;
-
-
-/**
- * <code>FlavorEvent</code> is used to notify interested parties
- * that available {@link DataFlavor}s have changed in the
- * {@link Clipboard} (the event source).
- *
- * @see FlavorListener
- *
- * @author Alexander Gerasimov
- * @since 1.5
- */
-public class FlavorEvent extends EventObject {
-    private static final long serialVersionUID = -5842664112252414548L;
-
-    /**
-     * Constructs a <code>FlavorEvent</code> object.
-     *
-     * @param source  the <code>Clipboard</code> that is the source of the event
-     *
-     * @throws IllegalArgumentException if the {@code source} is {@code null}
-     */
-    public FlavorEvent(Clipboard source) {
-        super(source);
-    }
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorListener.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package java.awt.datatransfer;
-
-import java.util.EventListener;
-
-
-/**
- * Defines an object which listens for {@link FlavorEvent}s.
- *
- * @author Alexander Gerasimov
- * @since 1.5
- */
-public interface FlavorListener extends EventListener {
-    /**
-     * Invoked when the target {@link Clipboard} of the listener
-     * has changed its available {@link DataFlavor}s.
-     * <p>
-     * Some notifications may be redundant &#8212; they are not
-     * caused by a change of the set of DataFlavors available
-     * on the clipboard.
-     * For example, if the clipboard subsystem supposes that
-     * the system clipboard's contents has been changed but it
-     * can't ascertain whether its DataFlavors have been changed
-     * because of some exceptional condition when accessing the
-     * clipboard, the notification is sent to ensure from omitting
-     * a significant notification. Ordinarily, those redundant
-     * notifications should be occasional.
-     *
-     * @param e  a <code>FlavorEvent</code> object
-     */
-    void flavorsChanged(FlavorEvent e);
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorMap.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-import java.util.Map;
-
-
-/**
- * A two-way Map between "natives" (Strings), which correspond to platform-
- * specific data formats, and "flavors" (DataFlavors), which correspond to
- * platform-independent MIME types. FlavorMaps need not be symmetric, but
- * typically are.
- *
- *
- * @since 1.2
- */
-public interface FlavorMap {
-
-    /**
-     * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
-     * their corresponding <code>String</code> native. The returned
-     * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
-     * internal data. Client code is free to modify the <code>Map</code>
-     * without affecting this object.
-     *
-     * @param flavors an array of <code>DataFlavor</code>s which will be the
-     *        key set of the returned <code>Map</code>. If <code>null</code> is
-     *        specified, a mapping of all <code>DataFlavor</code>s currently
-     *        known to this <code>FlavorMap</code> to their corresponding
-     *        <code>String</code> natives will be returned.
-     * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
-     *         <code>String</code> natives
-     */
-    Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors);
-
-    /**
-     * Returns a <code>Map</code> of the specified <code>String</code> natives
-     * to their corresponding <code>DataFlavor</code>. The returned
-     * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
-     * internal data. Client code is free to modify the <code>Map</code>
-     * without affecting this object.
-     *
-     * @param natives an array of <code>String</code>s which will be the
-     *        key set of the returned <code>Map</code>. If <code>null</code> is
-     *        specified, a mapping of all <code>String</code> natives currently
-     *        known to this <code>FlavorMap</code> to their corresponding
-     *        <code>DataFlavor</code>s will be returned.
-     * @return a <code>java.util.Map</code> of <code>String</code> natives to
-     *         <code>DataFlavor</code>s
-     */
-    Map<String,DataFlavor> getFlavorsForNatives(String[] natives);
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/FlavorTable.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-import java.util.List;
-
-
-/**
- * A FlavorMap which relaxes the traditional 1-to-1 restriction of a Map. A
- * flavor is permitted to map to any number of natives, and likewise a native
- * is permitted to map to any number of flavors. FlavorTables need not be
- * symmetric, but typically are.
- *
- * @author David Mendenhall
- *
- * @since 1.4
- */
-public interface FlavorTable extends FlavorMap {
-
-    /**
-     * Returns a <code>List</code> of <code>String</code> natives to which the
-     * specified <code>DataFlavor</code> corresponds. The <code>List</code>
-     * will be sorted from best native to worst. That is, the first native will
-     * best reflect data in the specified flavor to the underlying native
-     * platform. The returned <code>List</code> is a modifiable copy of this
-     * <code>FlavorTable</code>'s internal data. Client code is free to modify
-     * the <code>List</code> without affecting this object.
-     *
-     * @param flav the <code>DataFlavor</code> whose corresponding natives
-     *        should be returned. If <code>null</code> is specified, all
-     *        natives currently known to this <code>FlavorTable</code> are
-     *        returned in a non-deterministic order.
-     * @return a <code>java.util.List</code> of <code>java.lang.String</code>
-     *         objects which are platform-specific representations of platform-
-     *         specific data formats
-     */
-    List<String> getNativesForFlavor(DataFlavor flav);
-
-    /**
-     * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
-     * specified <code>String</code> corresponds. The <code>List</code> will be
-     * sorted from best <code>DataFlavor</code> to worst. That is, the first
-     * <code>DataFlavor</code> will best reflect data in the specified
-     * native to a Java application. The returned <code>List</code> is a
-     * modifiable copy of this <code>FlavorTable</code>'s internal data.
-     * Client code is free to modify the <code>List</code> without affecting
-     * this object.
-     *
-     * @param nat the native whose corresponding <code>DataFlavor</code>s
-     *        should be returned. If <code>null</code> is specified, all
-     *        <code>DataFlavor</code>s currently known to this
-     *        <code>FlavorTable</code> are returned in a non-deterministic
-     *        order.
-     * @return a <code>java.util.List</code> of <code>DataFlavor</code>
-     *         objects into which platform-specific data in the specified,
-     *         platform-specific native can be translated
-     */
-    List<DataFlavor> getFlavorsForNative(String nat);
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Locale;
-
-
-/**
- * A Multipurpose Internet Mail Extension (MIME) type, as defined
- * in RFC 2045 and 2046.
- *
- * THIS IS *NOT* - REPEAT *NOT* - A PUBLIC CLASS! DataFlavor IS
- * THE PUBLIC INTERFACE, AND THIS IS PROVIDED AS A ***PRIVATE***
- * (THAT IS AS IN *NOT* PUBLIC) HELPER CLASS!
- */
-class MimeType implements Externalizable, Cloneable {
-
-    /*
-     * serialization support
-     */
-
-    static final long serialVersionUID = -6568722458793895906L;
-
-    /**
-     * Constructor for externalization; this constructor should not be
-     * called directly by an application, since the result will be an
-     * uninitialized, immutable <code>MimeType</code> object.
-     */
-    public MimeType() {
-    }
-
-    /**
-     * Builds a <code>MimeType</code> from a <code>String</code>.
-     *
-     * @param rawdata text used to initialize the <code>MimeType</code>
-     * @throws NullPointerException if <code>rawdata</code> is null
-     */
-    public MimeType(String rawdata) throws MimeTypeParseException {
-        parse(rawdata);
-    }
-
-    /**
-     * Builds a <code>MimeType</code> with the given primary and sub
-     * type but has an empty parameter list.
-     *
-     * @param primary the primary type of this <code>MimeType</code>
-     * @param sub the subtype of this <code>MimeType</code>
-     * @throws NullPointerException if either <code>primary</code> or
-     *         <code>sub</code> is null
-     */
-    public MimeType(String primary, String sub) throws MimeTypeParseException {
-        this(primary, sub, new MimeTypeParameterList());
-    }
-
-    /**
-     * Builds a <code>MimeType</code> with a pre-defined
-     * and valid (or empty) parameter list.
-     *
-     * @param primary the primary type of this <code>MimeType</code>
-     * @param sub the subtype of this <code>MimeType</code>
-     * @param mtpl the requested parameter list
-     * @throws NullPointerException if either <code>primary</code>,
-     *         <code>sub</code> or <code>mtpl</code> is null
-     */
-    public MimeType(String primary, String sub, MimeTypeParameterList mtpl) throws
-MimeTypeParseException {
-        //    check to see if primary is valid
-        if(isValidToken(primary)) {
-            primaryType = primary.toLowerCase(Locale.ENGLISH);
-        } else {
-            throw new MimeTypeParseException("Primary type is invalid.");
-        }
-
-        //    check to see if sub is valid
-        if(isValidToken(sub)) {
-            subType = sub.toLowerCase(Locale.ENGLISH);
-        } else {
-            throw new MimeTypeParseException("Sub type is invalid.");
-        }
-
-        parameters = (MimeTypeParameterList)mtpl.clone();
-    }
-
-    public int hashCode() {
-
-        // We sum up the hash codes for all of the strings. This
-        // way, the order of the strings is irrelevant
-        int code = 0;
-        code += primaryType.hashCode();
-        code += subType.hashCode();
-        code += parameters.hashCode();
-        return code;
-    } // hashCode()
-
-    /**
-     * <code>MimeType</code>s are equal if their primary types,
-     * subtypes, and  parameters are all equal. No default values
-     * are taken into account.
-     * @param thatObject the object to be evaluated as a
-     *    <code>MimeType</code>
-     * @return <code>true</code> if <code>thatObject</code> is
-     *    a <code>MimeType</code>; otherwise returns <code>false</code>
-     */
-    public boolean equals(Object thatObject) {
-        if (!(thatObject instanceof MimeType)) {
-            return false;
-        }
-        MimeType that = (MimeType)thatObject;
-        boolean isIt =
-            ((this.primaryType.equals(that.primaryType)) &&
-             (this.subType.equals(that.subType)) &&
-             (this.parameters.equals(that.parameters)));
-        return isIt;
-    } // equals()
-
-    /**
-     * A routine for parsing the MIME type out of a String.
-     *
-     * @throws NullPointerException if <code>rawdata</code> is null
-     */
-    private void parse(String rawdata) throws MimeTypeParseException {
-        int slashIndex = rawdata.indexOf('/');
-        int semIndex = rawdata.indexOf(';');
-        if((slashIndex < 0) && (semIndex < 0)) {
-            //    neither character is present, so treat it
-            //    as an error
-            throw new MimeTypeParseException("Unable to find a sub type.");
-        } else if((slashIndex < 0) && (semIndex >= 0)) {
-            //    we have a ';' (and therefore a parameter list),
-            //    but no '/' indicating a sub type is present
-            throw new MimeTypeParseException("Unable to find a sub type.");
-        } else if((slashIndex >= 0) && (semIndex < 0)) {
-            //    we have a primary and sub type but no parameter list
-            primaryType = rawdata.substring(0,slashIndex).
-                trim().toLowerCase(Locale.ENGLISH);
-            subType = rawdata.substring(slashIndex + 1).
-                trim().toLowerCase(Locale.ENGLISH);
-            parameters = new MimeTypeParameterList();
-        } else if (slashIndex < semIndex) {
-            //    we have all three items in the proper sequence
-            primaryType = rawdata.substring(0, slashIndex).
-                trim().toLowerCase(Locale.ENGLISH);
-            subType = rawdata.substring(slashIndex + 1,
-                semIndex).trim().toLowerCase(Locale.ENGLISH);
-            parameters = new
-MimeTypeParameterList(rawdata.substring(semIndex));
-        } else {
-            //    we have a ';' lexically before a '/' which means we have a primary type
-            //    & a parameter list but no sub type
-            throw new MimeTypeParseException("Unable to find a sub type.");
-        }
-
-        //    now validate the primary and sub types
-
-        //    check to see if primary is valid
-        if(!isValidToken(primaryType)) {
-            throw new MimeTypeParseException("Primary type is invalid.");
-        }
-
-        //    check to see if sub is valid
-        if(!isValidToken(subType)) {
-            throw new MimeTypeParseException("Sub type is invalid.");
-        }
-    }
-
-    /**
-     * Retrieve the primary type of this object.
-     */
-    public String getPrimaryType() {
-        return primaryType;
-    }
-
-    /**
-     * Retrieve the sub type of this object.
-     */
-    public String getSubType() {
-        return subType;
-    }
-
-    /**
-     * Retrieve a copy of this object's parameter list.
-     */
-    public MimeTypeParameterList getParameters() {
-        return (MimeTypeParameterList)parameters.clone();
-    }
-
-    /**
-     * Retrieve the value associated with the given name, or null if there
-     * is no current association.
-     */
-    public String getParameter(String name) {
-        return parameters.get(name);
-    }
-
-    /**
-     * Set the value to be associated with the given name, replacing
-     * any previous association.
-     *
-     * @throw IllegalArgumentException if parameter or value is illegal
-     */
-    public void setParameter(String name, String value) {
-        parameters.set(name, value);
-    }
-
-    /**
-     * Remove any value associated with the given name.
-     *
-     * @throw IllegalArgumentException if parameter may not be deleted
-     */
-    public void removeParameter(String name) {
-        parameters.remove(name);
-    }
-
-    /**
-     * Return the String representation of this object.
-     */
-    public String toString() {
-        return getBaseType() + parameters.toString();
-    }
-
-    /**
-     * Return a String representation of this object
-     * without the parameter list.
-     */
-    public String getBaseType() {
-        return primaryType + "/" + subType;
-    }
-
-    /**
-     * Returns <code>true</code> if the primary type and the
-     * subtype of this object are the same as the specified
-     * <code>type</code>; otherwise returns <code>false</code>.
-     *
-     * @param type the type to compare to <code>this</code>'s type
-     * @return <code>true</code> if the primary type and the
-     *    subtype of this object are the same as the
-     *    specified <code>type</code>; otherwise returns
-     *    <code>false</code>
-     */
-    public boolean match(MimeType type) {
-        if (type == null)
-            return false;
-        return primaryType.equals(type.getPrimaryType())
-                    && (subType.equals("*")
-                            || type.getSubType().equals("*")
-                            || (subType.equals(type.getSubType())));
-    }
-
-    /**
-     * Returns <code>true</code> if the primary type and the
-     * subtype of this object are the same as the content type
-     * described in <code>rawdata</code>; otherwise returns
-     * <code>false</code>.
-     *
-     * @param rawdata the raw data to be examined
-     * @return <code>true</code> if the primary type and the
-     *    subtype of this object are the same as the content type
-     *    described in <code>rawdata</code>; otherwise returns
-     *    <code>false</code>; if <code>rawdata</code> is
-     *    <code>null</code>, returns <code>false</code>
-     */
-    public boolean match(String rawdata) throws MimeTypeParseException {
-        if (rawdata == null)
-            return false;
-        return match(new MimeType(rawdata));
-    }
-
-    /**
-     * The object implements the writeExternal method to save its contents
-     * by calling the methods of DataOutput for its primitive values or
-     * calling the writeObject method of ObjectOutput for objects, strings
-     * and arrays.
-     * @exception IOException Includes any I/O exceptions that may occur
-     */
-    public void writeExternal(ObjectOutput out) throws IOException {
-        String s = toString(); // contains ASCII chars only
-        // one-to-one correspondence between ASCII char and byte in UTF string
-        if (s.length() <= 65535) { // 65535 is max length of UTF string
-            out.writeUTF(s);
-        } else {
-            out.writeByte(0);
-            out.writeByte(0);
-            out.writeInt(s.length());
-            out.write(s.getBytes());
-        }
-    }
-
-    /**
-     * The object implements the readExternal method to restore its
-     * contents by calling the methods of DataInput for primitive
-     * types and readObject for objects, strings and arrays.  The
-     * readExternal method must read the values in the same sequence
-     * and with the same types as were written by writeExternal.
-     * @exception ClassNotFoundException If the class for an object being
-     *              restored cannot be found.
-     */
-    public void readExternal(ObjectInput in) throws IOException,
-ClassNotFoundException {
-        String s = in.readUTF();
-        if (s == null || s.length() == 0) { // long mime type
-            byte[] ba = new byte[in.readInt()];
-            in.readFully(ba);
-            s = new String(ba);
-        }
-        try {
-            parse(s);
-        } catch(MimeTypeParseException e) {
-            throw new IOException(e.toString());
-        }
-    }
-
-    /**
-     * Returns a clone of this object.
-     * @return a clone of this object
-     */
-
-    public Object clone() {
-        MimeType newObj = null;
-        try {
-            newObj = (MimeType)super.clone();
-        } catch (CloneNotSupportedException cannotHappen) {
-        }
-        newObj.parameters = (MimeTypeParameterList)parameters.clone();
-        return newObj;
-    }
-
-    private String    primaryType;
-    private String    subType;
-    private MimeTypeParameterList parameters;
-
-    //    below here be scary parsing related things
-
-    /**
-     * Determines whether or not a given character belongs to a legal token.
-     */
-    private static boolean isTokenChar(char c) {
-        return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
-    }
-
-    /**
-     * Determines whether or not a given string is a legal token.
-     *
-     * @throws NullPointerException if <code>s</code> is null
-     */
-    private boolean isValidToken(String s) {
-        int len = s.length();
-        if(len > 0) {
-            for (int i = 0; i < len; ++i) {
-                char c = s.charAt(i);
-                if (!isTokenChar(c)) {
-                    return false;
-                }
-            }
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * A string that holds all the special chars.
-     */
-
-    private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
-
-} // class MimeType
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,404 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * An object that encapsulates the parameter list of a MimeType
- * as defined in RFC 2045 and 2046.
- *
- * @author jeff.dunn@eng.sun.com
- */
-class MimeTypeParameterList implements Cloneable {
-
-    /**
-     * Default constructor.
-     */
-    public MimeTypeParameterList() {
-        parameters = new Hashtable<>();
-    }
-
-    public MimeTypeParameterList(String rawdata)
-        throws MimeTypeParseException
-    {
-        parameters = new Hashtable<>();
-
-        //    now parse rawdata
-        parse(rawdata);
-    }
-
-    public int hashCode() {
-        int code = Integer.MAX_VALUE/45; // "random" value for empty lists
-        String paramName = null;
-        Enumeration<String> enum_ = this.getNames();
-
-        while (enum_.hasMoreElements()) {
-            paramName = enum_.nextElement();
-            code += paramName.hashCode();
-            code += this.get(paramName).hashCode();
-        }
-
-        return code;
-    } // hashCode()
-
-    /**
-     * Two parameter lists are considered equal if they have exactly
-     * the same set of parameter names and associated values. The
-     * order of the parameters is not considered.
-     */
-    public boolean equals(Object thatObject) {
-        //System.out.println("MimeTypeParameterList.equals("+this+","+thatObject+")");
-        if (!(thatObject instanceof MimeTypeParameterList)) {
-            return false;
-        }
-        MimeTypeParameterList that = (MimeTypeParameterList)thatObject;
-        if (this.size() != that.size()) {
-            return false;
-        }
-        String name = null;
-        String thisValue = null;
-        String thatValue = null;
-        Set<Map.Entry<String, String>> entries = parameters.entrySet();
-        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
-        Map.Entry<String, String> entry = null;
-        while (iterator.hasNext()) {
-            entry = iterator.next();
-            name = entry.getKey();
-            thisValue = entry.getValue();
-            thatValue = that.parameters.get(name);
-            if ((thisValue == null) || (thatValue == null)) {
-                // both null -> equal, only one null -> not equal
-                if (thisValue != thatValue) {
-                    return false;
-                }
-            } else if (!thisValue.equals(thatValue)) {
-                return false;
-            }
-        } // while iterator
-
-        return true;
-    } // equals()
-
-    /**
-     * A routine for parsing the parameter list out of a String.
-     */
-    protected void parse(String rawdata) throws MimeTypeParseException {
-        int length = rawdata.length();
-        if(length > 0) {
-            int currentIndex = skipWhiteSpace(rawdata, 0);
-            int lastIndex = 0;
-
-            if(currentIndex < length) {
-                char currentChar = rawdata.charAt(currentIndex);
-                while ((currentIndex < length) && (currentChar == ';')) {
-                    String name;
-                    String value;
-                    boolean foundit;
-
-                    //    eat the ';'
-                    ++currentIndex;
-
-                    //    now parse the parameter name
-
-                    //    skip whitespace
-                    currentIndex = skipWhiteSpace(rawdata, currentIndex);
-
-                    if(currentIndex < length) {
-                        //    find the end of the token char run
-                        lastIndex = currentIndex;
-                        currentChar = rawdata.charAt(currentIndex);
-                        while((currentIndex < length) && isTokenChar(currentChar)) {
-                            ++currentIndex;
-                            currentChar = rawdata.charAt(currentIndex);
-                        }
-                        name = rawdata.substring(lastIndex, currentIndex).toLowerCase();
-
-                        //    now parse the '=' that separates the name from the value
-
-                        //    skip whitespace
-                        currentIndex = skipWhiteSpace(rawdata, currentIndex);
-
-                        if((currentIndex < length) && (rawdata.charAt(currentIndex) == '='))  {
-                            //    eat it and parse the parameter value
-                            ++currentIndex;
-
-                            //    skip whitespace
-                            currentIndex = skipWhiteSpace(rawdata, currentIndex);
-
-                            if(currentIndex < length) {
-                                //    now find out whether or not we have a quoted value
-                                currentChar = rawdata.charAt(currentIndex);
-                                if(currentChar == '"') {
-                                    //    yup it's quoted so eat it and capture the quoted string
-                                    ++currentIndex;
-                                    lastIndex = currentIndex;
-
-                                    if(currentIndex < length) {
-                                        //    find the next unescaped quote
-                                        foundit = false;
-                                        while((currentIndex < length) && !foundit) {
-                                            currentChar = rawdata.charAt(currentIndex);
-                                            if(currentChar == '\\') {
-                                                //    found an escape sequence so pass this and the next character
-                                                currentIndex += 2;
-                                            } else if(currentChar == '"') {
-                                                //    found it!
-                                                foundit = true;
-                                            } else {
-                                                ++currentIndex;
-                                            }
-                                        }
-                                        if(currentChar == '"') {
-                                            value = unquote(rawdata.substring(lastIndex, currentIndex));
-                                            //    eat the quote
-                                            ++currentIndex;
-                                        } else {
-                                            throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
-                                        }
-                                    } else {
-                                        throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
-                                    }
-                                } else if(isTokenChar(currentChar)) {
-                                    //    nope it's an ordinary token so it ends with a non-token char
-                                    lastIndex = currentIndex;
-                                    foundit = false;
-                                    while((currentIndex < length) && !foundit) {
-                                        currentChar = rawdata.charAt(currentIndex);
-
-                                        if(isTokenChar(currentChar)) {
-                                            ++currentIndex;
-                                        } else {
-                                            foundit = true;
-                                        }
-                                    }
-                                    value = rawdata.substring(lastIndex, currentIndex);
-                                } else {
-                                    //    it ain't a value
-                                    throw new MimeTypeParseException("Unexpected character encountered at index " + currentIndex);
-                                }
-
-                                //    now put the data into the hashtable
-                                parameters.put(name, value);
-                            } else {
-                                throw new MimeTypeParseException("Couldn't find a value for parameter named " + name);
-                            }
-                        } else {
-                            throw new MimeTypeParseException("Couldn't find the '=' that separates a parameter name from its value.");
-                        }
-                    } else {
-                        throw new MimeTypeParseException("Couldn't find parameter name");
-                    }
-
-                    //    setup the next iteration
-                    currentIndex = skipWhiteSpace(rawdata, currentIndex);
-                    if(currentIndex < length) {
-                        currentChar = rawdata.charAt(currentIndex);
-                    }
-                }
-                if(currentIndex < length) {
-                    throw new MimeTypeParseException("More characters encountered in input than expected.");
-                }
-            }
-        }
-    }
-
-    /**
-     * return the number of name-value pairs in this list.
-     */
-    public int size() {
-        return parameters.size();
-    }
-
-    /**
-     * Determine whether or not this list is empty.
-     */
-    public boolean isEmpty() {
-        return parameters.isEmpty();
-    }
-
-    /**
-     * Retrieve the value associated with the given name, or null if there
-     * is no current association.
-     */
-    public String get(String name) {
-        return parameters.get(name.trim().toLowerCase());
-    }
-
-    /**
-     * Set the value to be associated with the given name, replacing
-     * any previous association.
-     */
-    public void set(String name, String value) {
-        parameters.put(name.trim().toLowerCase(), value);
-    }
-
-    /**
-     * Remove any value associated with the given name.
-     */
-    public void remove(String name) {
-        parameters.remove(name.trim().toLowerCase());
-    }
-
-    /**
-     * Retrieve an enumeration of all the names in this list.
-     */
-    public Enumeration<String> getNames() {
-        return parameters.keys();
-    }
-
-    public String toString() {
-        // Heuristic: 8 characters per field
-        StringBuilder buffer = new StringBuilder(parameters.size() * 16);
-
-        Enumeration<String> keys = parameters.keys();
-        while(keys.hasMoreElements())
-        {
-            buffer.append("; ");
-
-            String key = keys.nextElement();
-            buffer.append(key);
-            buffer.append('=');
-               buffer.append(quote(parameters.get(key)));
-        }
-
-        return buffer.toString();
-    }
-
-    /**
-     * @return a clone of this object
-     */
-    @SuppressWarnings("unchecked") // Cast from clone
-     public Object clone() {
-         MimeTypeParameterList newObj = null;
-         try {
-             newObj = (MimeTypeParameterList)super.clone();
-         } catch (CloneNotSupportedException cannotHappen) {
-         }
-         newObj.parameters = (Hashtable<String, String>)parameters.clone();
-         return newObj;
-     }
-
-    private Hashtable<String, String> parameters;
-
-    //    below here be scary parsing related things
-
-    /**
-     * Determine whether or not a given character belongs to a legal token.
-     */
-    private static boolean isTokenChar(char c) {
-        return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
-    }
-
-    /**
-     * return the index of the first non white space character in
-     * rawdata at or after index i.
-     */
-    private static int skipWhiteSpace(String rawdata, int i) {
-        int length = rawdata.length();
-        if (i < length) {
-            char c =  rawdata.charAt(i);
-            while ((i < length) && Character.isWhitespace(c)) {
-                ++i;
-                c = rawdata.charAt(i);
-            }
-        }
-
-        return i;
-    }
-
-    /**
-     * A routine that knows how and when to quote and escape the given value.
-     */
-    private static String quote(String value) {
-        boolean needsQuotes = false;
-
-        //    check to see if we actually have to quote this thing
-        int length = value.length();
-        for(int i = 0; (i < length) && !needsQuotes; ++i) {
-            needsQuotes = !isTokenChar(value.charAt(i));
-        }
-
-        if(needsQuotes) {
-            StringBuilder buffer = new StringBuilder((int)(length * 1.5));
-
-            //    add the initial quote
-            buffer.append('"');
-
-            //    add the properly escaped text
-            for(int i = 0; i < length; ++i) {
-                char c = value.charAt(i);
-                if((c == '\\') || (c == '"')) {
-                    buffer.append('\\');
-                }
-                buffer.append(c);
-            }
-
-            //    add the closing quote
-            buffer.append('"');
-
-            return buffer.toString();
-        }
-        else
-        {
-            return value;
-        }
-    }
-
-    /**
-     * A routine that knows how to strip the quotes and escape sequences from the given value.
-     */
-    private static String unquote(String value) {
-        int valueLength = value.length();
-        StringBuilder buffer = new StringBuilder(valueLength);
-
-        boolean escaped = false;
-        for(int i = 0; i < valueLength; ++i) {
-            char currentChar = value.charAt(i);
-            if(!escaped && (currentChar != '\\')) {
-                buffer.append(currentChar);
-            } else if(escaped) {
-                buffer.append(currentChar);
-                escaped = false;
-            } else {
-                escaped = true;
-            }
-        }
-
-        return buffer.toString();
-    }
-
-    /**
-     * A string that holds all the special chars.
-     */
-    private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
-
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParseException.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-
-/**
- *    A class to encapsulate MimeType parsing related exceptions
- *
- * @serial exclude
- * @since 1.3
- */
-public class MimeTypeParseException extends Exception {
-
-    // use serialVersionUID from JDK 1.2.2 for interoperability
-    private static final long serialVersionUID = -5604407764691570741L;
-
-    /**
-     * Constructs a MimeTypeParseException with no specified detail message.
-     */
-    public MimeTypeParseException() {
-        super();
-    }
-
-    /**
-     * Constructs a MimeTypeParseException with the specified detail message.
-     *
-     * @param   s   the detail message.
-     */
-    public MimeTypeParseException(String s) {
-        super(s);
-    }
-} // class MimeTypeParseException
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/StringSelection.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 1996, 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 java.awt.datatransfer;
-
-import java.io.*;
-
-
-/**
- * A <code>Transferable</code> which implements the capability required
- * to transfer a <code>String</code>.
- *
- * This <code>Transferable</code> properly supports
- * <code>DataFlavor.stringFlavor</code>
- * and all equivalent flavors. Support for
- * <code>DataFlavor.plainTextFlavor</code>
- * and all equivalent flavors is <b>deprecated</b>. No other
- * <code>DataFlavor</code>s are supported.
- *
- * @see java.awt.datatransfer.DataFlavor#stringFlavor
- * @see java.awt.datatransfer.DataFlavor#plainTextFlavor
- */
-public class StringSelection implements Transferable, ClipboardOwner {
-
-    private static final int STRING = 0;
-    private static final int PLAIN_TEXT = 1;
-
-    @SuppressWarnings("deprecation")
-    private static final DataFlavor[] flavors = {
-        DataFlavor.stringFlavor,
-        DataFlavor.plainTextFlavor // deprecated
-    };
-
-    private String data;
-
-    /**
-     * Creates a <code>Transferable</code> capable of transferring
-     * the specified <code>String</code>.
-     * @param data the string to be transferred
-     */
-    public StringSelection(String data) {
-        this.data = data;
-    }
-
-    /**
-     * Returns an array of flavors in which this <code>Transferable</code>
-     * can provide the data. <code>DataFlavor.stringFlavor</code>
-     * is properly supported.
-     * Support for <code>DataFlavor.plainTextFlavor</code> is
-     * <b>deprecated</b>.
-     *
-     * @return an array of length two, whose elements are <code>DataFlavor.
-     *         stringFlavor</code> and <code>DataFlavor.plainTextFlavor</code>
-     */
-    public DataFlavor[] getTransferDataFlavors() {
-        // returning flavors itself would allow client code to modify
-        // our internal behavior
-        return flavors.clone();
-    }
-
-    /**
-     * Returns whether the requested flavor is supported by this
-     * <code>Transferable</code>.
-     *
-     * @param flavor the requested flavor for the data
-     * @return true if <code>flavor</code> is equal to
-     *   <code>DataFlavor.stringFlavor</code> or
-     *   <code>DataFlavor.plainTextFlavor</code>; false if <code>flavor</code>
-     *   is not one of the above flavors
-     * @throws NullPointerException if flavor is <code>null</code>
-     */
-    public boolean isDataFlavorSupported(DataFlavor flavor) {
-        // JCK Test StringSelection0003: if 'flavor' is null, throw NPE
-        for (int i = 0; i < flavors.length; i++) {
-            if (flavor.equals(flavors[i])) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Returns the <code>Transferable</code>'s data in the requested
-     * <code>DataFlavor</code> if possible. If the desired flavor is
-     * <code>DataFlavor.stringFlavor</code>, or an equivalent flavor,
-     * the <code>String</code> representing the selection is
-     * returned. If the desired flavor is
-     * <code>DataFlavor.plainTextFlavor</code>,
-     * or an equivalent flavor, a <code>Reader</code> is returned.
-     * <b>Note:</b> The behavior of this method for
-     * <code>DataFlavor.plainTextFlavor</code>
-     * and equivalent <code>DataFlavor</code>s is inconsistent with the
-     * definition of <code>DataFlavor.plainTextFlavor</code>.
-     *
-     * @param flavor the requested flavor for the data
-     * @return the data in the requested flavor, as outlined above
-     * @throws UnsupportedFlavorException if the requested data flavor is
-     *         not equivalent to either <code>DataFlavor.stringFlavor</code>
-     *         or <code>DataFlavor.plainTextFlavor</code>
-     * @throws IOException if an IOException occurs while retrieving the data.
-     *         By default, StringSelection never throws this exception, but a
-     *         subclass may.
-     * @throws NullPointerException if flavor is <code>null</code>
-     * @see java.io.Reader
-     */
-    public Object getTransferData(DataFlavor flavor)
-        throws UnsupportedFlavorException, IOException
-    {
-        // JCK Test StringSelection0007: if 'flavor' is null, throw NPE
-        if (flavor.equals(flavors[STRING])) {
-            return (Object)data;
-        } else if (flavor.equals(flavors[PLAIN_TEXT])) {
-            return new StringReader(data == null ? "" : data);
-        } else {
-            throw new UnsupportedFlavorException(flavor);
-        }
-    }
-
-    public void lostOwnership(Clipboard clipboard, Transferable contents) {
-    }
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1094 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-import sun.datatransfer.DataFlavorUtil;
-import sun.datatransfer.DesktopDatatransferService;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * The SystemFlavorMap is a configurable map between "natives" (Strings), which
- * correspond to platform-specific data formats, and "flavors" (DataFlavors),
- * which correspond to platform-independent MIME types. This mapping is used
- * by the data transfer subsystem to transfer data between Java and native
- * applications, and between Java applications in separate VMs.
- *
- * @since 1.2
- */
-public final class SystemFlavorMap implements FlavorMap, FlavorTable {
-
-    /**
-     * Constant prefix used to tag Java types converted to native platform
-     * type.
-     */
-    private static String JavaMIME = "JAVA_DATAFLAVOR:";
-
-    private static final Object FLAVOR_MAP_KEY = new Object();
-
-    /**
-     * The list of valid, decoded text flavor representation classes, in order
-     * from best to worst.
-     */
-    private static final String[] UNICODE_TEXT_CLASSES = {
-        "java.io.Reader", "java.lang.String", "java.nio.CharBuffer", "\"[C\""
-    };
-
-    /**
-     * The list of valid, encoded text flavor representation classes, in order
-     * from best to worst.
-     */
-    private static final String[] ENCODED_TEXT_CLASSES = {
-        "java.io.InputStream", "java.nio.ByteBuffer", "\"[B\""
-    };
-
-    /**
-     * A String representing text/plain MIME type.
-     */
-    private static final String TEXT_PLAIN_BASE_TYPE = "text/plain";
-
-    /**
-     * A String representing text/html MIME type.
-     */
-    private static final String HTML_TEXT_BASE_TYPE = "text/html";
-
-    /**
-     * Maps native Strings to Lists of DataFlavors (or base type Strings for
-     * text DataFlavors).
-     * Do not use the field directly, use getNativeToFlavor() instead.
-     */
-    private final Map<String, LinkedHashSet<DataFlavor>> nativeToFlavor = new HashMap<>();
-
-    /**
-     * Accessor to nativeToFlavor map.  Since we use lazy initialization we must
-     * use this accessor instead of direct access to the field which may not be
-     * initialized yet.  This method will initialize the field if needed.
-     *
-     * @return nativeToFlavor
-     */
-    private Map<String, LinkedHashSet<DataFlavor>> getNativeToFlavor() {
-        if (!isMapInitialized) {
-            initSystemFlavorMap();
-        }
-        return nativeToFlavor;
-    }
-
-    /**
-     * Maps DataFlavors (or base type Strings for text DataFlavors) to Lists of
-     * native Strings.
-     * Do not use the field directly, use getFlavorToNative() instead.
-     */
-    private final Map<DataFlavor, LinkedHashSet<String>> flavorToNative = new HashMap<>();
-
-    /**
-     * Accessor to flavorToNative map.  Since we use lazy initialization we must
-     * use this accessor instead of direct access to the field which may not be
-     * initialized yet.  This method will initialize the field if needed.
-     *
-     * @return flavorToNative
-     */
-    private synchronized Map<DataFlavor, LinkedHashSet<String>> getFlavorToNative() {
-        if (!isMapInitialized) {
-            initSystemFlavorMap();
-        }
-        return flavorToNative;
-    }
-
-    /**
-     * Maps a text DataFlavor primary mime-type to the native. Used only to store
-     * standard mappings registered in the flavormap.properties
-     * Do not use this field directly, use getTextTypeToNative() instead.
-     */
-    private Map<String, LinkedHashSet<String>> textTypeToNative = new HashMap<>();
-
-    /**
-     * Shows if the object has been initialized.
-     */
-    private boolean isMapInitialized = false;
-
-    /**
-     * An accessor to textTypeToNative map.  Since we use lazy initialization we
-     * must use this accessor instead of direct access to the field which may not
-     * be initialized yet. This method will initialize the field if needed.
-     *
-     * @return textTypeToNative
-     */
-    private synchronized Map<String, LinkedHashSet<String>> getTextTypeToNative() {
-        if (!isMapInitialized) {
-            initSystemFlavorMap();
-            // From this point the map should not be modified
-            textTypeToNative = Collections.unmodifiableMap(textTypeToNative);
-        }
-        return textTypeToNative;
-    }
-
-    /**
-     * Caches the result of getNativesForFlavor(). Maps DataFlavors to
-     * SoftReferences which reference LinkedHashSet of String natives.
-     */
-    private final SoftCache<DataFlavor, String> nativesForFlavorCache = new SoftCache<>();
-
-    /**
-     * Caches the result getFlavorsForNative(). Maps String natives to
-     * SoftReferences which reference LinkedHashSet of DataFlavors.
-     */
-    private final SoftCache<String, DataFlavor> flavorsForNativeCache = new SoftCache<>();
-
-    /**
-     * Dynamic mapping generation used for text mappings should not be applied
-     * to the DataFlavors and String natives for which the mappings have been
-     * explicitly specified with setFlavorsForNative() or
-     * setNativesForFlavor(). This keeps all such keys.
-     */
-    private Set<Object> disabledMappingGenerationKeys = new HashSet<>();
-
-    /**
-     * Returns the default FlavorMap for this thread's ClassLoader.
-     *
-     * @return the default FlavorMap for this thread's ClassLoader
-     */
-    public static FlavorMap getDefaultFlavorMap() {
-        return DataFlavorUtil.getDesktopService().getFlavorMap(SystemFlavorMap::new);
-    }
-
-    private SystemFlavorMap() {
-    }
-
-    /**
-     * Initializes a SystemFlavorMap by reading flavormap.properties
-     * For thread-safety must be called under lock on this.
-     */
-    private void initSystemFlavorMap() {
-        if (isMapInitialized) {
-            return;
-        }
-        isMapInitialized = true;
-
-        InputStream is = SystemFlavorMap.class.getResourceAsStream("/sun/datatransfer/resources/flavormap.properties");
-        if (is == null) {
-            throw new InternalError("Default flavor mapping not found");
-        }
-
-        try (InputStreamReader isr = new InputStreamReader(is);
-             BufferedReader reader = new BufferedReader(isr)) {
-            String line;
-            while ((line = reader.readLine()) != null) {
-                line = line.trim();
-                if (line.startsWith("#") || line.isEmpty()) continue;
-                while (line.endsWith("\\")) {
-                    line = line.substring(0, line.length() - 1) + reader.readLine().trim();
-                }
-                int delimiterPosition = line.indexOf('=');
-                String key = line.substring(0, delimiterPosition).replaceAll("\\ ", " ");
-                String[] values = line.substring(delimiterPosition + 1, line.length()).split(",");
-                for (String value : values) {
-                    try {
-                        value = loadConvert(value);
-                        MimeType mime = new MimeType(value);
-                        if ("text".equals(mime.getPrimaryType())) {
-                            String charset = mime.getParameter("charset");
-                            if (DataFlavorUtil.doesSubtypeSupportCharset(mime.getSubType(), charset))
-                            {
-                                // We need to store the charset and eoln
-                                // parameters, if any, so that the
-                                // DataTransferer will have this information
-                                // for conversion into the native format.
-                                DesktopDatatransferService desktopService =
-                                        DataFlavorUtil.getDesktopService();
-                                if (desktopService.isDesktopPresent()) {
-                                    desktopService.registerTextFlavorProperties(
-                                            key, charset,
-                                            mime.getParameter("eoln"),
-                                            mime.getParameter("terminators"));
-                                }
-                            }
-
-                            // But don't store any of these parameters in the
-                            // DataFlavor itself for any text natives (even
-                            // non-charset ones). The SystemFlavorMap will
-                            // synthesize the appropriate mappings later.
-                            mime.removeParameter("charset");
-                            mime.removeParameter("class");
-                            mime.removeParameter("eoln");
-                            mime.removeParameter("terminators");
-                            value = mime.toString();
-                        }
-                    } catch (MimeTypeParseException e) {
-                        e.printStackTrace();
-                        continue;
-                    }
-
-                    DataFlavor flavor;
-                    try {
-                        flavor = new DataFlavor(value);
-                    } catch (Exception e) {
-                        try {
-                            flavor = new DataFlavor(value, null);
-                        } catch (Exception ee) {
-                            ee.printStackTrace();
-                            continue;
-                        }
-                    }
-
-                    final LinkedHashSet<DataFlavor> dfs = new LinkedHashSet<>();
-                    dfs.add(flavor);
-
-                    if ("text".equals(flavor.getPrimaryType())) {
-                        dfs.addAll(convertMimeTypeToDataFlavors(value));
-                        store(flavor.mimeType.getBaseType(), key, getTextTypeToNative());
-                    }
-
-                    for (DataFlavor df : dfs) {
-                        store(df, key, getFlavorToNative());
-                        store(key, df, getNativeToFlavor());
-                    }
-                }
-            }
-        } catch (IOException e) {
-            throw new InternalError("Error reading default flavor mapping", e);
-        }
-    }
-
-    // Copied from java.util.Properties
-    private static String loadConvert(String theString) {
-        char aChar;
-        int len = theString.length();
-        StringBuilder outBuffer = new StringBuilder(len);
-
-        for (int x = 0; x < len; ) {
-            aChar = theString.charAt(x++);
-            if (aChar == '\\') {
-                aChar = theString.charAt(x++);
-                if (aChar == 'u') {
-                    // Read the xxxx
-                    int value = 0;
-                    for (int i = 0; i < 4; i++) {
-                        aChar = theString.charAt(x++);
-                        switch (aChar) {
-                            case '0': case '1': case '2': case '3': case '4':
-                            case '5': case '6': case '7': case '8': case '9': {
-                                value = (value << 4) + aChar - '0';
-                                break;
-                            }
-                            case 'a': case 'b': case 'c':
-                            case 'd': case 'e': case 'f': {
-                                value = (value << 4) + 10 + aChar - 'a';
-                                break;
-                            }
-                            case 'A': case 'B': case 'C':
-                            case 'D': case 'E': case 'F': {
-                                value = (value << 4) + 10 + aChar - 'A';
-                                break;
-                            }
-                            default: {
-                                throw new IllegalArgumentException(
-                                        "Malformed \\uxxxx encoding.");
-                            }
-                        }
-                    }
-                    outBuffer.append((char)value);
-                } else {
-                    if (aChar == 't') {
-                        aChar = '\t';
-                    } else if (aChar == 'r') {
-                        aChar = '\r';
-                    } else if (aChar == 'n') {
-                        aChar = '\n';
-                    } else if (aChar == 'f') {
-                        aChar = '\f';
-                    }
-                    outBuffer.append(aChar);
-                }
-            } else {
-                outBuffer.append(aChar);
-            }
-        }
-        return outBuffer.toString();
-    }
-
-    /**
-     * Stores the listed object under the specified hash key in map. Unlike a
-     * standard map, the listed object will not replace any object already at
-     * the appropriate Map location, but rather will be appended to a List
-     * stored in that location.
-     */
-    private <H, L> void store(H hashed, L listed, Map<H, LinkedHashSet<L>> map) {
-        LinkedHashSet<L> list = map.get(hashed);
-        if (list == null) {
-            list = new LinkedHashSet<>(1);
-            map.put(hashed, list);
-        }
-        if (!list.contains(listed)) {
-            list.add(listed);
-        }
-    }
-
-    /**
-     * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
-     * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
-     * case, a new DataFlavor is synthesized, stored, and returned, if and
-     * only if the specified native is encoded as a Java MIME type.
-     */
-    private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
-        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
-
-        if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
-            DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
-            if (desktopService.isDesktopPresent()) {
-                LinkedHashSet<DataFlavor> platformFlavors =
-                        desktopService.getPlatformMappingsForNative(nat);
-                if (!platformFlavors.isEmpty()) {
-                    if (flavors != null) {
-                        // Prepending the platform-specific mappings ensures
-                        // that the flavors added with
-                        // addFlavorForUnencodedNative() are at the end of
-                        // list.
-                        platformFlavors.addAll(flavors);
-                    }
-                    flavors = platformFlavors;
-                }
-            }
-        }
-
-        if (flavors == null && isJavaMIMEType(nat)) {
-            String decoded = decodeJavaMIMEType(nat);
-            DataFlavor flavor = null;
-
-            try {
-                flavor = new DataFlavor(decoded);
-            } catch (Exception e) {
-                System.err.println("Exception \"" + e.getClass().getName() +
-                                   ": " + e.getMessage()  +
-                                   "\"while constructing DataFlavor for: " +
-                                   decoded);
-            }
-
-            if (flavor != null) {
-                flavors = new LinkedHashSet<>(1);
-                getNativeToFlavor().put(nat, flavors);
-                flavors.add(flavor);
-                flavorsForNativeCache.remove(nat);
-
-                LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
-                if (natives == null) {
-                    natives = new LinkedHashSet<>(1);
-                    getFlavorToNative().put(flavor, natives);
-                }
-                natives.add(nat);
-                nativesForFlavorCache.remove(flavor);
-            }
-        }
-
-        return (flavors != null) ? flavors : new LinkedHashSet<>(0);
-    }
-
-    /**
-     * Semantically equivalent to 'flavorToNative.get(flav)'. This method
-     * handles the case where 'flav' is not found in 'flavorToNative' depending
-     * on the value of passes 'synthesize' parameter. If 'synthesize' is
-     * SYNTHESIZE_IF_NOT_FOUND a native is synthesized, stored, and returned by
-     * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
-     * and 'flavorToNative' remains unaffected.
-     */
-    private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
-                                                       final boolean synthesize) {
-
-        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
-
-        if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
-            DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
-            if (desktopService.isDesktopPresent()) {
-                LinkedHashSet<String> platformNatives =
-                        desktopService.getPlatformMappingsForFlavor(flav);
-                if (!platformNatives.isEmpty()) {
-                    if (natives != null) {
-                        // Prepend the platform-specific mappings to ensure
-                        // that the natives added with
-                        // addUnencodedNativeForFlavor() are at the end of
-                        // list.
-                        platformNatives.addAll(natives);
-                    }
-                    natives = platformNatives;
-                }
-            }
-        }
-
-        if (natives == null) {
-            if (synthesize) {
-                String encoded = encodeDataFlavor(flav);
-                natives = new LinkedHashSet<>(1);
-                getFlavorToNative().put(flav, natives);
-                natives.add(encoded);
-
-                LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
-                if (flavors == null) {
-                    flavors = new LinkedHashSet<>(1);
-                    getNativeToFlavor().put(encoded, flavors);
-                }
-                flavors.add(flav);
-
-                nativesForFlavorCache.remove(flav);
-                flavorsForNativeCache.remove(encoded);
-            } else {
-                natives = new LinkedHashSet<>(0);
-            }
-        }
-
-        return new LinkedHashSet<>(natives);
-    }
-
-    /**
-     * Returns a <code>List</code> of <code>String</code> natives to which the
-     * specified <code>DataFlavor</code> can be translated by the data transfer
-     * subsystem. The <code>List</code> will be sorted from best native to
-     * worst. That is, the first native will best reflect data in the specified
-     * flavor to the underlying native platform.
-     * <p>
-     * If the specified <code>DataFlavor</code> is previously unknown to the
-     * data transfer subsystem and the data transfer subsystem is unable to
-     * translate this <code>DataFlavor</code> to any existing native, then
-     * invoking this method will establish a
-     * mapping in both directions between the specified <code>DataFlavor</code>
-     * and an encoded version of its MIME type as its native.
-     *
-     * @param flav the <code>DataFlavor</code> whose corresponding natives
-     *        should be returned. If <code>null</code> is specified, all
-     *        natives currently known to the data transfer subsystem are
-     *        returned in a non-deterministic order.
-     * @return a <code>java.util.List</code> of <code>java.lang.String</code>
-     *         objects which are platform-specific representations of platform-
-     *         specific data formats
-     *
-     * @see #encodeDataFlavor
-     * @since 1.4
-     */
-    @Override
-    public synchronized List<String> getNativesForFlavor(DataFlavor flav) {
-        LinkedHashSet<String> retval = nativesForFlavorCache.check(flav);
-        if (retval != null) {
-            return new ArrayList<>(retval);
-        }
-
-        if (flav == null) {
-            retval = new LinkedHashSet<>(getNativeToFlavor().keySet());
-        } else if (disabledMappingGenerationKeys.contains(flav)) {
-            // In this case we shouldn't synthesize a native for this flavor,
-            // since its mappings were explicitly specified.
-            retval = flavorToNativeLookup(flav, false);
-        } else if (DataFlavorUtil.isFlavorCharsetTextType(flav)) {
-            retval = new LinkedHashSet<>(0);
-
-            // For text/* flavors, flavor-to-native mappings specified in
-            // flavormap.properties are stored per flavor's base type.
-            if ("text".equals(flav.getPrimaryType())) {
-                LinkedHashSet<String> textTypeNatives =
-                        getTextTypeToNative().get(flav.mimeType.getBaseType());
-                if (textTypeNatives != null) {
-                    retval.addAll(textTypeNatives);
-                }
-            }
-
-            // Also include text/plain natives, but don't duplicate Strings
-            LinkedHashSet<String> textTypeNatives =
-                    getTextTypeToNative().get(TEXT_PLAIN_BASE_TYPE);
-            if (textTypeNatives != null) {
-                retval.addAll(textTypeNatives);
-            }
-
-            if (retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, true);
-            } else {
-                // In this branch it is guaranteed that natives explicitly
-                // listed for flav's MIME type were added with
-                // addUnencodedNativeForFlavor(), so they have lower priority.
-                retval.addAll(flavorToNativeLookup(flav, false));
-            }
-        } else if (DataFlavorUtil.isFlavorNoncharsetTextType(flav)) {
-            retval = getTextTypeToNative().get(flav.mimeType.getBaseType());
-
-            if (retval == null || retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, true);
-            } else {
-                // In this branch it is guaranteed that natives explicitly
-                // listed for flav's MIME type were added with
-                // addUnencodedNativeForFlavor(), so they have lower priority.
-                retval.addAll(flavorToNativeLookup(flav, false));
-            }
-        } else {
-            retval = flavorToNativeLookup(flav, true);
-        }
-
-        nativesForFlavorCache.put(flav, retval);
-        // Create a copy, because client code can modify the returned list.
-        return new ArrayList<>(retval);
-    }
-
-    /**
-     * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
-     * specified <code>String</code> native can be translated by the data
-     * transfer subsystem. The <code>List</code> will be sorted from best
-     * <code>DataFlavor</code> to worst. That is, the first
-     * <code>DataFlavor</code> will best reflect data in the specified
-     * native to a Java application.
-     * <p>
-     * If the specified native is previously unknown to the data transfer
-     * subsystem, and that native has been properly encoded, then invoking this
-     * method will establish a mapping in both directions between the specified
-     * native and a <code>DataFlavor</code> whose MIME type is a decoded
-     * version of the native.
-     * <p>
-     * If the specified native is not a properly encoded native and the
-     * mappings for this native have not been altered with
-     * <code>setFlavorsForNative</code>, then the contents of the
-     * <code>List</code> is platform dependent, but <code>null</code>
-     * cannot be returned.
-     *
-     * @param nat the native whose corresponding <code>DataFlavor</code>s
-     *        should be returned. If <code>null</code> is specified, all
-     *        <code>DataFlavor</code>s currently known to the data transfer
-     *        subsystem are returned in a non-deterministic order.
-     * @return a <code>java.util.List</code> of <code>DataFlavor</code>
-     *         objects into which platform-specific data in the specified,
-     *         platform-specific native can be translated
-     *
-     * @see #encodeJavaMIMEType
-     * @since 1.4
-     */
-    @Override
-    public synchronized List<DataFlavor> getFlavorsForNative(String nat) {
-        LinkedHashSet<DataFlavor> returnValue = flavorsForNativeCache.check(nat);
-        if (returnValue != null) {
-            return new ArrayList<>(returnValue);
-        } else {
-            returnValue = new LinkedHashSet<>();
-        }
-
-        if (nat == null) {
-            for (String n : getNativesForFlavor(null)) {
-                returnValue.addAll(getFlavorsForNative(n));
-            }
-        } else {
-            final LinkedHashSet<DataFlavor> flavors = nativeToFlavorLookup(nat);
-            if (disabledMappingGenerationKeys.contains(nat)) {
-                return new ArrayList<>(flavors);
-            }
-
-            final LinkedHashSet<DataFlavor> flavorsWithSynthesized =
-                    nativeToFlavorLookup(nat);
-
-            for (DataFlavor df : flavorsWithSynthesized) {
-                returnValue.add(df);
-                if ("text".equals(df.getPrimaryType())) {
-                    String baseType = df.mimeType.getBaseType();
-                    returnValue.addAll(convertMimeTypeToDataFlavors(baseType));
-                }
-            }
-        }
-        flavorsForNativeCache.put(nat, returnValue);
-        return new ArrayList<>(returnValue);
-    }
-
-    @SuppressWarnings("deprecation")
-    private static Set<DataFlavor> convertMimeTypeToDataFlavors(
-        final String baseType) {
-
-        final Set<DataFlavor> returnValue = new LinkedHashSet<>();
-
-        String subType = null;
-
-        try {
-            final MimeType mimeType = new MimeType(baseType);
-            subType = mimeType.getSubType();
-        } catch (MimeTypeParseException mtpe) {
-            // Cannot happen, since we checked all mappings
-            // on load from flavormap.properties.
-        }
-
-        if (DataFlavorUtil.doesSubtypeSupportCharset(subType, null)) {
-            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
-            {
-                returnValue.add(DataFlavor.stringFlavor);
-            }
-
-            for (String unicodeClassName : UNICODE_TEXT_CLASSES) {
-                final String mimeType = baseType + ";charset=Unicode;class=" +
-                                            unicodeClassName;
-
-                final LinkedHashSet<String> mimeTypes =
-                    handleHtmlMimeTypes(baseType, mimeType);
-                for (String mt : mimeTypes) {
-                    DataFlavor toAdd = null;
-                    try {
-                        toAdd = new DataFlavor(mt);
-                    } catch (ClassNotFoundException cannotHappen) {
-                    }
-                    returnValue.add(toAdd);
-                }
-            }
-
-            for (String charset : DataFlavorUtil.standardEncodings()) {
-
-                for (String encodedTextClass : ENCODED_TEXT_CLASSES) {
-                    final String mimeType =
-                            baseType + ";charset=" + charset +
-                            ";class=" + encodedTextClass;
-
-                    final LinkedHashSet<String> mimeTypes =
-                        handleHtmlMimeTypes(baseType, mimeType);
-
-                    for (String mt : mimeTypes) {
-
-                        DataFlavor df = null;
-
-                        try {
-                            df = new DataFlavor(mt);
-                            // Check for equality to plainTextFlavor so
-                            // that we can ensure that the exact charset of
-                            // plainTextFlavor, not the canonical charset
-                            // or another equivalent charset with a
-                            // different name, is used.
-                            if (df.equals(DataFlavor.plainTextFlavor)) {
-                                df = DataFlavor.plainTextFlavor;
-                            }
-                        } catch (ClassNotFoundException cannotHappen) {
-                        }
-
-                        returnValue.add(df);
-                    }
-                }
-            }
-
-            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
-            {
-                returnValue.add(DataFlavor.plainTextFlavor);
-            }
-        } else {
-            // Non-charset text natives should be treated as
-            // opaque, 8-bit data in any of its various
-            // representations.
-            for (String encodedTextClassName : ENCODED_TEXT_CLASSES) {
-                DataFlavor toAdd = null;
-                try {
-                    toAdd = new DataFlavor(baseType +
-                         ";class=" + encodedTextClassName);
-                } catch (ClassNotFoundException cannotHappen) {
-                }
-                returnValue.add(toAdd);
-            }
-        }
-        return returnValue;
-    }
-
-    private static final String [] htmlDocumentTypes =
-            new String [] {"all", "selection", "fragment"};
-
-    private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
-                                                             String mimeType) {
-
-        LinkedHashSet<String> returnValues = new LinkedHashSet<>();
-
-        if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
-            for (String documentType : htmlDocumentTypes) {
-                returnValues.add(mimeType + ";document=" + documentType);
-            }
-        } else {
-            returnValues.add(mimeType);
-        }
-
-        return returnValues;
-    }
-
-    /**
-     * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
-     * their most preferred <code>String</code> native. Each native value will
-     * be the same as the first native in the List returned by
-     * <code>getNativesForFlavor</code> for the specified flavor.
-     * <p>
-     * If a specified <code>DataFlavor</code> is previously unknown to the
-     * data transfer subsystem, then invoking this method will establish a
-     * mapping in both directions between the specified <code>DataFlavor</code>
-     * and an encoded version of its MIME type as its native.
-     *
-     * @param flavors an array of <code>DataFlavor</code>s which will be the
-     *        key set of the returned <code>Map</code>. If <code>null</code> is
-     *        specified, a mapping of all <code>DataFlavor</code>s known to the
-     *        data transfer subsystem to their most preferred
-     *        <code>String</code> natives will be returned.
-     * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
-     *         <code>String</code> natives
-     *
-     * @see #getNativesForFlavor
-     * @see #encodeDataFlavor
-     */
-    @Override
-    public synchronized Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors)
-    {
-        // Use getNativesForFlavor to generate extra natives for text flavors
-        // and stringFlavor
-
-        if (flavors == null) {
-            List<DataFlavor> flavor_list = getFlavorsForNative(null);
-            flavors = new DataFlavor[flavor_list.size()];
-            flavor_list.toArray(flavors);
-        }
-
-        Map<DataFlavor, String> retval = new HashMap<>(flavors.length, 1.0f);
-        for (DataFlavor flavor : flavors) {
-            List<String> natives = getNativesForFlavor(flavor);
-            String nat = (natives.isEmpty()) ? null : natives.get(0);
-            retval.put(flavor, nat);
-        }
-
-        return retval;
-    }
-
-    /**
-     * Returns a <code>Map</code> of the specified <code>String</code> natives
-     * to their most preferred <code>DataFlavor</code>. Each
-     * <code>DataFlavor</code> value will be the same as the first
-     * <code>DataFlavor</code> in the List returned by
-     * <code>getFlavorsForNative</code> for the specified native.
-     * <p>
-     * If a specified native is previously unknown to the data transfer
-     * subsystem, and that native has been properly encoded, then invoking this
-     * method will establish a mapping in both directions between the specified
-     * native and a <code>DataFlavor</code> whose MIME type is a decoded
-     * version of the native.
-     *
-     * @param natives an array of <code>String</code>s which will be the
-     *        key set of the returned <code>Map</code>. If <code>null</code> is
-     *        specified, a mapping of all supported <code>String</code> natives
-     *        to their most preferred <code>DataFlavor</code>s will be
-     *        returned.
-     * @return a <code>java.util.Map</code> of <code>String</code> natives to
-     *         <code>DataFlavor</code>s
-     *
-     * @see #getFlavorsForNative
-     * @see #encodeJavaMIMEType
-     */
-    @Override
-    public synchronized Map<String,DataFlavor> getFlavorsForNatives(String[] natives)
-    {
-        // Use getFlavorsForNative to generate extra flavors for text natives
-        if (natives == null) {
-            List<String> nativesList = getNativesForFlavor(null);
-            natives = new String[nativesList.size()];
-            nativesList.toArray(natives);
-        }
-
-        Map<String, DataFlavor> retval = new HashMap<>(natives.length, 1.0f);
-        for (String aNative : natives) {
-            List<DataFlavor> flavors = getFlavorsForNative(aNative);
-            DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0);
-            retval.put(aNative, flav);
-        }
-        return retval;
-    }
-
-    /**
-     * Adds a mapping from the specified <code>DataFlavor</code> (and all
-     * <code>DataFlavor</code>s equal to the specified <code>DataFlavor</code>)
-     * to the specified <code>String</code> native.
-     * Unlike <code>getNativesForFlavor</code>, the mapping will only be
-     * established in one direction, and the native will not be encoded. To
-     * establish a two-way mapping, call
-     * <code>addFlavorForUnencodedNative</code> as well. The new mapping will
-     * be of lower priority than any existing mapping.
-     * This method has no effect if a mapping from the specified or equal
-     * <code>DataFlavor</code> to the specified <code>String</code> native
-     * already exists.
-     *
-     * @param flav the <code>DataFlavor</code> key for the mapping
-     * @param nat the <code>String</code> native value for the mapping
-     * @throws NullPointerException if flav or nat is <code>null</code>
-     *
-     * @see #addFlavorForUnencodedNative
-     * @since 1.4
-     */
-    public synchronized void addUnencodedNativeForFlavor(DataFlavor flav,
-                                                         String nat) {
-        Objects.requireNonNull(nat, "Null native not permitted");
-        Objects.requireNonNull(flav, "Null flavor not permitted");
-
-        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
-        if (natives == null) {
-            natives = new LinkedHashSet<>(1);
-            getFlavorToNative().put(flav, natives);
-        }
-        natives.add(nat);
-        nativesForFlavorCache.remove(flav);
-    }
-
-    /**
-     * Discards the current mappings for the specified <code>DataFlavor</code>
-     * and all <code>DataFlavor</code>s equal to the specified
-     * <code>DataFlavor</code>, and creates new mappings to the
-     * specified <code>String</code> natives.
-     * Unlike <code>getNativesForFlavor</code>, the mappings will only be
-     * established in one direction, and the natives will not be encoded. To
-     * establish two-way mappings, call <code>setFlavorsForNative</code>
-     * as well. The first native in the array will represent the highest
-     * priority mapping. Subsequent natives will represent mappings of
-     * decreasing priority.
-     * <p>
-     * If the array contains several elements that reference equal
-     * <code>String</code> natives, this method will establish new mappings
-     * for the first of those elements and ignore the rest of them.
-     * <p>
-     * It is recommended that client code not reset mappings established by the
-     * data transfer subsystem. This method should only be used for
-     * application-level mappings.
-     *
-     * @param flav the <code>DataFlavor</code> key for the mappings
-     * @param natives the <code>String</code> native values for the mappings
-     * @throws NullPointerException if flav or natives is <code>null</code>
-     *         or if natives contains <code>null</code> elements
-     *
-     * @see #setFlavorsForNative
-     * @since 1.4
-     */
-    public synchronized void setNativesForFlavor(DataFlavor flav,
-                                                 String[] natives) {
-        Objects.requireNonNull(natives, "Null natives not permitted");
-        Objects.requireNonNull(flav, "Null flavors not permitted");
-
-        getFlavorToNative().remove(flav);
-        for (String aNative : natives) {
-            addUnencodedNativeForFlavor(flav, aNative);
-        }
-        disabledMappingGenerationKeys.add(flav);
-        nativesForFlavorCache.remove(flav);
-    }
-
-    /**
-     * Adds a mapping from a single <code>String</code> native to a single
-     * <code>DataFlavor</code>. Unlike <code>getFlavorsForNative</code>, the
-     * mapping will only be established in one direction, and the native will
-     * not be encoded. To establish a two-way mapping, call
-     * <code>addUnencodedNativeForFlavor</code> as well. The new mapping will
-     * be of lower priority than any existing mapping.
-     * This method has no effect if a mapping from the specified
-     * <code>String</code> native to the specified or equal
-     * <code>DataFlavor</code> already exists.
-     *
-     * @param nat the <code>String</code> native key for the mapping
-     * @param flav the <code>DataFlavor</code> value for the mapping
-     * @throws NullPointerException if nat or flav is <code>null</code>
-     *
-     * @see #addUnencodedNativeForFlavor
-     * @since 1.4
-     */
-    public synchronized void addFlavorForUnencodedNative(String nat,
-                                                         DataFlavor flav) {
-        Objects.requireNonNull(nat, "Null native not permitted");
-        Objects.requireNonNull(flav, "Null flavor not permitted");
-
-        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
-        if (flavors == null) {
-            flavors = new LinkedHashSet<>(1);
-            getNativeToFlavor().put(nat, flavors);
-        }
-        flavors.add(flav);
-        flavorsForNativeCache.remove(nat);
-    }
-
-    /**
-     * Discards the current mappings for the specified <code>String</code>
-     * native, and creates new mappings to the specified
-     * <code>DataFlavor</code>s. Unlike <code>getFlavorsForNative</code>, the
-     * mappings will only be established in one direction, and the natives need
-     * not be encoded. To establish two-way mappings, call
-     * <code>setNativesForFlavor</code> as well. The first
-     * <code>DataFlavor</code> in the array will represent the highest priority
-     * mapping. Subsequent <code>DataFlavor</code>s will represent mappings of
-     * decreasing priority.
-     * <p>
-     * If the array contains several elements that reference equal
-     * <code>DataFlavor</code>s, this method will establish new mappings
-     * for the first of those elements and ignore the rest of them.
-     * <p>
-     * It is recommended that client code not reset mappings established by the
-     * data transfer subsystem. This method should only be used for
-     * application-level mappings.
-     *
-     * @param nat the <code>String</code> native key for the mappings
-     * @param flavors the <code>DataFlavor</code> values for the mappings
-     * @throws NullPointerException if nat or flavors is <code>null</code>
-     *         or if flavors contains <code>null</code> elements
-     *
-     * @see #setNativesForFlavor
-     * @since 1.4
-     */
-    public synchronized void setFlavorsForNative(String nat,
-                                                 DataFlavor[] flavors) {
-        Objects.requireNonNull(nat, "Null native not permitted");
-        Objects.requireNonNull(flavors, "Null flavors not permitted");
-
-        getNativeToFlavor().remove(nat);
-        for (DataFlavor flavor : flavors) {
-            addFlavorForUnencodedNative(nat, flavor);
-        }
-        disabledMappingGenerationKeys.add(nat);
-        flavorsForNativeCache.remove(nat);
-    }
-
-    /**
-     * Encodes a MIME type for use as a <code>String</code> native. The format
-     * of an encoded representation of a MIME type is implementation-dependent.
-     * The only restrictions are:
-     * <ul>
-     * <li>The encoded representation is <code>null</code> if and only if the
-     * MIME type <code>String</code> is <code>null</code>.</li>
-     * <li>The encoded representations for two non-<code>null</code> MIME type
-     * <code>String</code>s are equal if and only if these <code>String</code>s
-     * are equal according to <code>String.equals(Object)</code>.</li>
-     * </ul>
-     * <p>
-     * The reference implementation of this method returns the specified MIME
-     * type <code>String</code> prefixed with <code>JAVA_DATAFLAVOR:</code>.
-     *
-     * @param mimeType the MIME type to encode
-     * @return the encoded <code>String</code>, or <code>null</code> if
-     *         mimeType is <code>null</code>
-     */
-    public static String encodeJavaMIMEType(String mimeType) {
-        return (mimeType != null)
-            ? JavaMIME + mimeType
-            : null;
-    }
-
-    /**
-     * Encodes a <code>DataFlavor</code> for use as a <code>String</code>
-     * native. The format of an encoded <code>DataFlavor</code> is
-     * implementation-dependent. The only restrictions are:
-     * <ul>
-     * <li>The encoded representation is <code>null</code> if and only if the
-     * specified <code>DataFlavor</code> is <code>null</code> or its MIME type
-     * <code>String</code> is <code>null</code>.</li>
-     * <li>The encoded representations for two non-<code>null</code>
-     * <code>DataFlavor</code>s with non-<code>null</code> MIME type
-     * <code>String</code>s are equal if and only if the MIME type
-     * <code>String</code>s of these <code>DataFlavor</code>s are equal
-     * according to <code>String.equals(Object)</code>.</li>
-     * </ul>
-     * <p>
-     * The reference implementation of this method returns the MIME type
-     * <code>String</code> of the specified <code>DataFlavor</code> prefixed
-     * with <code>JAVA_DATAFLAVOR:</code>.
-     *
-     * @param flav the <code>DataFlavor</code> to encode
-     * @return the encoded <code>String</code>, or <code>null</code> if
-     *         flav is <code>null</code> or has a <code>null</code> MIME type
-     */
-    public static String encodeDataFlavor(DataFlavor flav) {
-        return (flav != null)
-            ? SystemFlavorMap.encodeJavaMIMEType(flav.getMimeType())
-            : null;
-    }
-
-    /**
-     * Returns whether the specified <code>String</code> is an encoded Java
-     * MIME type.
-     *
-     * @param str the <code>String</code> to test
-     * @return <code>true</code> if the <code>String</code> is encoded;
-     *         <code>false</code> otherwise
-     */
-    public static boolean isJavaMIMEType(String str) {
-        return (str != null && str.startsWith(JavaMIME, 0));
-    }
-
-    /**
-     * Decodes a <code>String</code> native for use as a Java MIME type.
-     *
-     * @param nat the <code>String</code> to decode
-     * @return the decoded Java MIME type, or <code>null</code> if nat is not
-     *         an encoded <code>String</code> native
-     */
-    public static String decodeJavaMIMEType(String nat) {
-        return (isJavaMIMEType(nat))
-            ? nat.substring(JavaMIME.length(), nat.length()).trim()
-            : null;
-    }
-
-    /**
-     * Decodes a <code>String</code> native for use as a
-     * <code>DataFlavor</code>.
-     *
-     * @param nat the <code>String</code> to decode
-     * @return the decoded <code>DataFlavor</code>, or <code>null</code> if
-     *         nat is not an encoded <code>String</code> native
-     * @throws ClassNotFoundException if the class of the data flavor
-     * is not loaded
-     */
-    public static DataFlavor decodeDataFlavor(String nat)
-        throws ClassNotFoundException
-    {
-        String retval_str = SystemFlavorMap.decodeJavaMIMEType(nat);
-        return (retval_str != null)
-            ? new DataFlavor(retval_str)
-            : null;
-    }
-
-    private static final class SoftCache<K, V> {
-        Map<K, SoftReference<LinkedHashSet<V>>> cache;
-
-        public void put(K key, LinkedHashSet<V> value) {
-            if (cache == null) {
-                cache = new HashMap<>(1);
-            }
-            cache.put(key, new SoftReference<>(value));
-        }
-
-        public void remove(K key) {
-            if (cache == null) return;
-            cache.remove(null);
-            cache.remove(key);
-        }
-
-        public LinkedHashSet<V> check(K key) {
-            if (cache == null) return null;
-            SoftReference<LinkedHashSet<V>> ref = cache.get(key);
-            if (ref != null) {
-                return ref.get();
-            }
-            return null;
-        }
-    }
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/Transferable.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1996, 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 java.awt.datatransfer;
-
-import java.io.IOException;
-
-/**
- * Defines the interface for classes that can be used to provide data
- * for a transfer operation.
- * <p>
- * For information on using data transfer with Swing, see
- * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
- * How to Use Drag and Drop and Data Transfer</a>,
- * a section in <em>The Java Tutorial</em>, for more information.
- *
- * @author      Amy Fowler
- */
-
-public interface Transferable {
-
-    /**
-     * Returns an array of DataFlavor objects indicating the flavors the data
-     * can be provided in.  The array should be ordered according to preference
-     * for providing the data (from most richly descriptive to least descriptive).
-     * @return an array of data flavors in which this data can be transferred
-     */
-    public DataFlavor[] getTransferDataFlavors();
-
-    /**
-     * Returns whether or not the specified data flavor is supported for
-     * this object.
-     * @param flavor the requested flavor for the data
-     * @return boolean indicating whether or not the data flavor is supported
-     */
-    public boolean isDataFlavorSupported(DataFlavor flavor);
-
-    /**
-     * Returns an object which represents the data to be transferred.  The class
-     * of the object returned is defined by the representation class of the flavor.
-     *
-     * @param flavor the requested flavor for the data
-     * @return an object which represents the data to be transferred
-     * @see DataFlavor#getRepresentationClass
-     * @exception IOException                if the data is no longer available
-     *              in the requested flavor.
-     * @exception UnsupportedFlavorException if the requested data flavor is
-     *              not supported.
-     */
-    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
-
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.awt.datatransfer;
-
-/**
- * Signals that the requested data is not supported in this flavor.
- * @see Transferable#getTransferData
- *
- * @author      Amy Fowler
- */
-public class UnsupportedFlavorException extends Exception {
-
-    /*
-     * JDK 1.1 serialVersionUID
-     */
-    private static final long serialVersionUID = 5383814944251665601L;
-
-    /**
-     * Constructs an UnsupportedFlavorException.
-     *
-     * @param flavor the flavor object which caused the exception. May
-     *        be <code>null</code>.
-     */
-    public UnsupportedFlavorException(DataFlavor flavor) {
-        super((flavor != null) ? flavor.getHumanPresentableName() : null);
-    }
-}
--- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/package.html	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<!--
- Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head><title></title></head>
-<body bgcolor="white">
-
-Provides interfaces and classes for transferring data
-between and within applications.  It defines the notion of a
-"transferable" object, which is an object capable of being
-transferred between or within applications. An object identifies
-itself as being transferable by implementing the Transferable
-interface.
-<p>
-It also provides a clipboard mechanism, which is an object that
-temporarily holds a transferable object that can be transferred
-between or within an application. The clipboard is typically used
-for copy and paste operations. Although it is possible to create
-a clipboard to use within an application, most applications will
-use the system clipboard to ensure the data can be transferred
-across applications running on the platform.
-
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
-  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.1
-</body>
-</html>
--- a/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,26 +25,23 @@
 
 package java.awt.image;
 
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.Point;
+import java.awt.Rectangle;
 import java.awt.Transparency;
 import java.awt.color.ColorSpace;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
-import java.awt.ImageCapabilities;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.Point2D;
-import java.awt.Point;
-import java.awt.Rectangle;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Hashtable;
+import java.util.Set;
 import java.util.Vector;
 
+import sun.awt.image.ByteComponentRaster;
 import sun.awt.image.BytePackedRaster;
-import sun.awt.image.ShortComponentRaster;
-import sun.awt.image.ByteComponentRaster;
 import sun.awt.image.IntegerComponentRaster;
 import sun.awt.image.OffScreenImageSource;
+import sun.awt.image.ShortComponentRaster;
 
 /**
  *
@@ -68,18 +65,14 @@
  * @see Raster
  * @see WritableRaster
  */
-
 public class BufferedImage extends java.awt.Image
                            implements WritableRenderedImage, Transparency
 {
-    int        imageType = TYPE_CUSTOM;
-    ColorModel colorModel;
-    WritableRaster raster;
-    OffScreenImageSource osis;
-    Hashtable<?, ?> properties;
-
-    boolean    isAlphaPremultiplied;// If true, alpha has been premultiplied in
-    // color channels
+    private int imageType = TYPE_CUSTOM;
+    private ColorModel colorModel;
+    private final WritableRaster raster;
+    private OffScreenImageSource osis;
+    private Hashtable<String, Object> properties;
 
     /**
      * Image Type Constants
@@ -328,8 +321,8 @@
                                                   0x000000ff,   // Blue
                                                   0x0           // Alpha
                                                   );
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -355,9 +348,8 @@
                                      true,       // Alpha Premultiplied
                                      DataBuffer.TYPE_INT
                                      );
-
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -368,8 +360,8 @@
                                                   0x0000ff00,   // Green
                                                   0x00ff0000    // Blue
                                                   );
-                  raster = colorModel.createCompatibleWritableRaster(width,
-                                                                      height);
+                raster = colorModel.createCompatibleWritableRaster(width,
+                                                                   height);
             }
         break;
 
@@ -642,7 +634,14 @@
 
         colorModel = cm;
         this.raster  = raster;
-        this.properties = properties;
+        if (properties != null && !properties.isEmpty()) {
+            this.properties = new Hashtable<>();
+            for (final Object key : properties.keySet()) {
+                if (key instanceof String) {
+                    this.properties.put((String) key, properties.get(key));
+                }
+            }
+        }
         int numBands = raster.getNumBands();
         boolean isAlphaPre = cm.isAlphaPremultiplied();
         final boolean isStandard = isStandard(cm, raster);
@@ -1272,7 +1271,11 @@
      *          or <code>null</code> if no property names are recognized.
      */
     public String[] getPropertyNames() {
-         return null;
+        if (properties == null || properties.isEmpty()) {
+            return null;
+        }
+        final Set<String> keys = properties.keySet();
+        return keys.toArray(new String[keys.size()]);
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2215,10 +2215,7 @@
      */
     public boolean imageUpdate(Image img, int infoflags,
                                int x, int y, int w, int h) {
-        Icon iconDisplayed = getIcon();
-        if (iconDisplayed == null) {
-            return false;
-        }
+        Icon iconDisplayed = null;
 
         if (!model.isEnabled()) {
             if (model.isSelected()) {
@@ -2238,7 +2235,12 @@
             iconDisplayed = getSelectedIcon();
         }
 
-        if (!SwingUtilities.doesIconReferenceImage(iconDisplayed, img)) {
+        if (iconDisplayed == null) {
+            iconDisplayed = getIcon();
+        }
+
+        if (iconDisplayed == null
+            || !SwingUtilities.doesIconReferenceImage(iconDisplayed, img)) {
             // We don't know about this image, disable the notification so
             // we don't keep repainting.
             return false;
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,22 +27,15 @@
 
 import java.util.HashSet;
 import java.util.Hashtable;
-import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Vector;
 import java.util.EventListener;
 import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.image.VolatileImage;
-import java.awt.Graphics2D;
 import java.awt.peer.LightweightPeer;
-import java.awt.dnd.DropTarget;
-import java.awt.font.FontRenderContext;
 import java.beans.PropertyChangeListener;
 import java.beans.VetoableChangeListener;
 import java.beans.VetoableChangeSupport;
@@ -1868,7 +1861,7 @@
 
     /**
      * Overrides <code>Container.getAlignmentY</code> to return
-     * the horizontal alignment.
+     * the vertical alignment.
      *
      * @return the value of the <code>alignmentY</code> property
      * @see #setAlignmentY
@@ -1882,9 +1875,9 @@
     }
 
     /**
-     * Sets the horizontal alignment.
+     * Sets the vertical alignment.
      *
-     * @param alignmentY  the new horizontal alignment
+     * @param alignmentY  the new vertical alignment
      * @see #getAlignmentY
      * @beaninfo
      *   description: The preferred vertical alignment of the component.
@@ -1897,7 +1890,7 @@
 
     /**
      * Overrides <code>Container.getAlignmentX</code> to return
-     * the vertical alignment.
+     * the horizontal alignment.
      *
      * @return the value of the <code>alignmentX</code> property
      * @see #setAlignmentX
@@ -1911,9 +1904,9 @@
     }
 
     /**
-     * Sets the vertical alignment.
+     * Sets the horizontal alignment.
      *
-     * @param alignmentX  the new vertical alignment
+     * @param alignmentX  the new horizontal alignment
      * @see #getAlignmentX
      * @beaninfo
      *   description: The preferred horizontal alignment of the component.
--- a/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.io.*;
 import java.text.*;
 import java.util.*;
-import javax.swing.UIManager;
 import javax.swing.event.*;
 import javax.swing.plaf.UIResource;
 import javax.swing.text.*;
@@ -151,7 +150,7 @@
  * will be created to handle formatting of numbers:
  * <pre>
  *   JFormattedTextField tf = new JFormattedTextField();
- *   tf.setValue(new Number(100));
+ *   tf.setValue(100);
  * </pre>
  * <p>
  * <strong>Warning:</strong> As the <code>AbstractFormatter</code> will
--- a/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1287,10 +1287,10 @@
         return paintTrack;
     }
 
-
     /**
-     * Determines whether the track is painted on the slider.
-     * By default, this property is {@code true}.
+     * Determines whether the track is painted on the slider. By default, this
+     * property is {@code true}. It is up to the look and feel to honor this
+     * property, some may choose to ignore it.
      *
      * @param  b  whether or not to paint the slider track
      * @see #getPaintTrack
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -493,7 +493,6 @@
      * @exception IllegalArgumentException  if part of the range is an
      *  invalid position in the model
      * @see #insert
-     * @see #replaceRange
      */
     public void replaceRange(String str, int start, int end) {
         if (end < start) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,9 @@
 import java.awt.Graphics;
 import java.awt.KeyboardFocusManager;
 import java.awt.*;
-import java.util.Vector;
+
 import sun.swing.DefaultLookup;
 import sun.swing.UIAction;
-import sun.awt.AppContext;
 
 /**
  * Basic L&amp;F for a desktop.
@@ -49,9 +48,6 @@
 public class BasicDesktopPaneUI extends DesktopPaneUI {
     // Old actions forward to an instance of this.
     private static final Actions SHARED_ACTION = new Actions();
-    private static Dimension minSize = new Dimension(0,0);
-    private static Dimension maxSize = new Dimension(Integer.MAX_VALUE,
-            Integer.MAX_VALUE);
     private Handler handler;
     private PropertyChangeListener pcl;
 
@@ -304,13 +300,19 @@
 
     public void paint(Graphics g, JComponent c) {}
 
-    public Dimension getPreferredSize(JComponent c) {return null;}
+    @Override
+    public Dimension getPreferredSize(JComponent c) {
+        return null;
+    }
 
+    @Override
     public Dimension getMinimumSize(JComponent c) {
-        return minSize;
-        }
-    public Dimension getMaximumSize(JComponent c){
-        return maxSize;
+        return new Dimension(0, 0);
+    }
+
+    @Override
+    public Dimension getMaximumSize(JComponent c) {
+        return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,8 +92,6 @@
 
     private static int MIN_WIDTH = 500;
     private static int MIN_HEIGHT = 326;
-    private static Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
-
     private static int LIST_PREF_WIDTH = 405;
     private static int LIST_PREF_HEIGHT = 135;
     private static Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT);
@@ -615,6 +613,7 @@
      * @return   a <code>Dimension</code> specifying the preferred
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         int prefWidth = PREF_SIZE.width;
         Dimension d = c.getLayout().preferredLayoutSize(c);
@@ -633,8 +632,9 @@
      * @return   a <code>Dimension</code> specifying the minimum
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
-        return MIN_SIZE;
+        return new Dimension(MIN_WIDTH, MIN_HEIGHT);
     }
 
     /**
@@ -644,6 +644,7 @@
      * @return   a <code>Dimension</code> specifying the maximum
      *           width and height of the file chooser
      */
+    @Override
     public Dimension getMaximumSize(JComponent c) {
         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
@@ -654,7 +655,8 @@
         } else {
             JFileChooser fc = getFileChooser();
             if ((fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) ||
-                (fc.isDirectorySelectionEnabled() && fc.isFileSelectionEnabled() && fc.getFileSystemView().isFileSystemRoot(file))) {
+                (fc.isDirectorySelectionEnabled() && fc.isFileSelectionEnabled()
+                 && fc.getFileSystemView().isFileSystemRoot(file))) {
                 return file.getPath();
             } else {
                 return file.getName();
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java	Wed Jul 05 20:20:43 2017 +0200
@@ -710,8 +710,9 @@
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
-                                                     int offset, int length) {
+    @SuppressWarnings({"rawtypes", "unchecked"}) // UndoPosRef type cannot be exposed
+    protected Vector getPositionsInRange(Vector v,
+                                         int offset, int length) {
         int endOffset = offset + length;
         int startIndex;
         int endIndex;
@@ -758,7 +759,8 @@
      *
      * @param positions the UndoPosRef instances to reset
      */
-    protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset,
+    @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+    protected void updateUndoPositions(Vector positions, int offset,
                                        int length) {
         // Find the indexs of the end points.
         int endOffset = offset + length;
@@ -775,7 +777,7 @@
 
         // Reset the location of the refenences.
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = positions.elementAt(counter);
+            UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);
             ref.resetLocation(endOffset, g1);
         }
         // We have to resort the marks in the range startIndex to endIndex.
@@ -902,7 +904,8 @@
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid after undo. */
-        protected Vector<UndoPosRef> posRefs;
+        @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+        protected Vector posRefs;
     } // GapContent.InsertUndo
 
 
@@ -911,6 +914,7 @@
      */
     @SuppressWarnings("serial") // JDK-implementation class
     class RemoveUndo extends AbstractUndoableEdit {
+        @SuppressWarnings("unchecked")
         protected RemoveUndo(int offset, String string) {
             super();
             this.offset = offset;
@@ -934,6 +938,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void redo() throws CannotRedoException {
             super.redo();
             try {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Wed Jul 05 20:20:43 2017 +0200
@@ -271,11 +271,12 @@
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, int offset,
-                                                      int length) {
+    @SuppressWarnings({"rawtypes", "unchecked"}) // UndoPosRef type cannot be exposed
+    protected Vector getPositionsInRange(Vector v, int offset,
+                                         int length) {
         int n = marks.size();
         int end = offset + length;
-        Vector<UndoPosRef> placeIn = (v == null) ? new Vector<>() : v;
+        Vector placeIn = (v == null) ? new Vector() : v;
         for (int i = 0; i < n; i++) {
             PosRec mark = marks.elementAt(i);
             if (mark.unused) {
@@ -298,9 +299,10 @@
      *
      * @param positions the positions of the instances
      */
-    protected void updateUndoPositions(Vector<UndoPosRef> positions) {
+    @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+    protected void updateUndoPositions(Vector positions) {
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = positions.elementAt(counter);
+            UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);
             // Check if the Position is still valid.
             if(ref.rec.unused) {
                 positions.removeElementAt(counter);
@@ -437,7 +439,8 @@
         protected String string;
         // An array of instances of UndoPosRef for the Positions in the
         // range that was removed, valid after undo.
-        protected Vector<UndoPosRef> posRefs;
+        @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+        protected Vector posRefs;
     }
 
 
@@ -445,6 +448,7 @@
      * UndoableEdit created for removes.
      */
     class RemoveUndo extends AbstractUndoableEdit {
+        @SuppressWarnings("unchecked")
         protected RemoveUndo(int offset, String string) {
             super();
             this.offset = offset;
@@ -471,6 +475,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void redo() throws CannotRedoException {
             super.redo();
             try {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,8 +28,6 @@
 import java.awt.*;
 import java.io.*;
 import java.util.Properties;
-import sun.net.www.http.HttpClient;
-import sun.net.ftp.FtpClient;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
--- a/jdk/src/java.desktop/share/classes/sun/awt/HKSCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/HKSCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -34,11 +34,21 @@
    ExtendedCharsets class, because if we want to have a public HKSCS,
    it probably should be HKSCS_2001 not HKSCS.
 */
-public class HKSCS extends sun.nio.cs.ext.MS950_HKSCS_XP {
+public class HKSCS extends Charset {
+    private static Charset cs = Charset.forName("x-MS950-HKSCS-XP");
+
     public HKSCS () {
-        super();
+        super("HKSCS", null);
     }
     public boolean contains(Charset cs) {
         return (cs instanceof HKSCS);
     }
+
+    public CharsetDecoder newDecoder() {
+        return cs.newDecoder();
+    }
+
+    public CharsetEncoder newEncoder() {
+        return cs.newEncoder();
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/datatransfer/DataFlavorUtil.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,841 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.datatransfer;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.FlavorMap;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.StandardCharsets;
-import java.nio.charset.UnsupportedCharsetException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.function.Supplier;
-
-
-/**
- * Utility class with different datatransfer helper functions
- *
- * @see 1.9
- */
-public class DataFlavorUtil {
-
-    private DataFlavorUtil() {
-        // Avoid instantiation
-    }
-
-    private static Comparator<String> getCharsetComparator() {
-       return CharsetComparator.INSTANCE;
-    }
-
-    public static Comparator<DataFlavor> getDataFlavorComparator() {
-       return DataFlavorComparator.INSTANCE;
-    }
-
-    public static Comparator<Long> getIndexOrderComparator(Map<Long, Integer> indexMap) {
-        return new IndexOrderComparator(indexMap);
-    }
-
-    public static Comparator<DataFlavor> getTextFlavorComparator() {
-        return TextFlavorComparator.INSTANCE;
-    }
-
-    /**
-     * Tracks whether a particular text/* MIME type supports the charset
-     * parameter. The Map is initialized with all of the standard MIME types
-     * listed in the DataFlavor.selectBestTextFlavor method comment. Additional
-     * entries may be added during the life of the JRE for text/<other> types.
-     */
-    private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
-
-    static {
-        Map<String, Boolean> tempMap = new HashMap<>(17);
-        tempMap.put("sgml", Boolean.TRUE);
-        tempMap.put("xml", Boolean.TRUE);
-        tempMap.put("html", Boolean.TRUE);
-        tempMap.put("enriched", Boolean.TRUE);
-        tempMap.put("richtext", Boolean.TRUE);
-        tempMap.put("uri-list", Boolean.TRUE);
-        tempMap.put("directory", Boolean.TRUE);
-        tempMap.put("css", Boolean.TRUE);
-        tempMap.put("calendar", Boolean.TRUE);
-        tempMap.put("plain", Boolean.TRUE);
-        tempMap.put("rtf", Boolean.FALSE);
-        tempMap.put("tab-separated-values", Boolean.FALSE);
-        tempMap.put("t140", Boolean.FALSE);
-        tempMap.put("rfc822-headers", Boolean.FALSE);
-        tempMap.put("parityfec", Boolean.FALSE);
-        textMIMESubtypeCharsetSupport = Collections.synchronizedMap(tempMap);
-    }
-
-    /**
-     * Lazy initialization of Standard Encodings.
-     */
-    private static class StandardEncodingsHolder {
-        private static final SortedSet<String> standardEncodings = load();
-
-        private static SortedSet<String> load() {
-            final SortedSet<String> tempSet = new TreeSet<>(getCharsetComparator().reversed());
-            tempSet.add("US-ASCII");
-            tempSet.add("ISO-8859-1");
-            tempSet.add("UTF-8");
-            tempSet.add("UTF-16BE");
-            tempSet.add("UTF-16LE");
-            tempSet.add("UTF-16");
-            tempSet.add(Charset.defaultCharset().name());
-            return Collections.unmodifiableSortedSet(tempSet);
-        }
-    }
-
-    /**
-     * Returns a {@code SortedSet} of Strings which are a total order of the standard
-     * character sets supported by the JRE. The ordering follows the same principles as
-     * {@link java.awt.datatransfer.DataFlavor#selectBestTextFlavor(java.awt.datatransfer.DataFlavor[])}.
-     * So as to avoid loading all available character converters, optional, non-standard,
-     * character sets are not included.
-     */
-    public static Set<String> standardEncodings() {
-        return StandardEncodingsHolder.standardEncodings;
-    }
-
-    /**
-     * Converts an arbitrary text encoding to its canonical name.
-     */
-    public static String canonicalName(String encoding) {
-        if (encoding == null) {
-            return null;
-        }
-        try {
-            return Charset.forName(encoding).name();
-        } catch (IllegalCharsetNameException icne) {
-            return encoding;
-        } catch (UnsupportedCharsetException uce) {
-            return encoding;
-        }
-    }
-
-    /**
-     * Tests only whether the flavor's MIME type supports the charset
-     * parameter. Must only be called for flavors with a primary type of
-     * "text".
-     */
-    public static boolean doesSubtypeSupportCharset(DataFlavor flavor) {
-        String subType = flavor.getSubType();
-        if (subType == null) {
-            return false;
-        }
-
-        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
-
-        if (support != null) {
-            return support;
-        }
-
-        boolean ret_val = (flavor.getParameter("charset") != null);
-        textMIMESubtypeCharsetSupport.put(subType, ret_val);
-        return ret_val;
-    }
-    public static boolean doesSubtypeSupportCharset(String subType,
-                                                    String charset)
-    {
-        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
-
-        if (support != null) {
-            return support;
-        }
-
-        boolean ret_val = (charset != null);
-        textMIMESubtypeCharsetSupport.put(subType, ret_val);
-        return ret_val;
-    }
-
-
-    /**
-     * Returns whether this flavor is a text type which supports the
-     * 'charset' parameter.
-     */
-    public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
-        // Although stringFlavor doesn't actually support the charset
-        // parameter (because its primary MIME type is not "text"), it should
-        // be treated as though it does. stringFlavor is semantically
-        // equivalent to "text/plain" data.
-        if (DataFlavor.stringFlavor.equals(flavor)) {
-            return true;
-        }
-
-        if (!"text".equals(flavor.getPrimaryType()) ||
-                !doesSubtypeSupportCharset(flavor))
-        {
-            return false;
-        }
-
-        Class<?> rep_class = flavor.getRepresentationClass();
-
-        if (flavor.isRepresentationClassReader() ||
-                String.class.equals(rep_class) ||
-                flavor.isRepresentationClassCharBuffer() ||
-                char[].class.equals(rep_class))
-        {
-            return true;
-        }
-
-        if (!(flavor.isRepresentationClassInputStream() ||
-                flavor.isRepresentationClassByteBuffer() ||
-                byte[].class.equals(rep_class))) {
-            return false;
-        }
-
-        String charset = flavor.getParameter("charset");
-
-        // null equals default encoding which is always supported
-        return (charset == null) || isEncodingSupported(charset);
-    }
-
-    /**
-     * Returns whether this flavor is a text type which does not support the
-     * 'charset' parameter.
-     */
-    public static boolean isFlavorNoncharsetTextType(DataFlavor flavor) {
-        if (!"text".equals(flavor.getPrimaryType()) || doesSubtypeSupportCharset(flavor)) {
-            return false;
-        }
-
-        return (flavor.isRepresentationClassInputStream() ||
-                flavor.isRepresentationClassByteBuffer() ||
-                byte[].class.equals(flavor.getRepresentationClass()));
-    }
-
-    /**
-     * If the specified flavor is a text flavor which supports the "charset"
-     * parameter, then this method returns that parameter, or the default
-     * charset if no such parameter was specified at construction. For non-
-     * text DataFlavors, and for non-charset text flavors, this method returns
-     * null.
-     */
-    public static String getTextCharset(DataFlavor flavor) {
-        if (!isFlavorCharsetTextType(flavor)) {
-            return null;
-        }
-
-        String encoding = flavor.getParameter("charset");
-
-        return (encoding != null) ? encoding : Charset.defaultCharset().name();
-    }
-
-    /**
-     * Determines whether this JRE can both encode and decode text in the
-     * specified encoding.
-     */
-    private static boolean isEncodingSupported(String encoding) {
-        if (encoding == null) {
-            return false;
-        }
-        try {
-            return Charset.isSupported(encoding);
-        } catch (IllegalCharsetNameException icne) {
-            return false;
-        }
-    }
-
-    /**
-     * Helper method to compare two objects by their Integer indices in the
-     * given map. If the map doesn't contain an entry for either of the
-     * objects, the fallback index will be used for the object instead.
-     *
-     * @param indexMap the map which maps objects into Integer indexes.
-     * @param obj1 the first object to be compared.
-     * @param obj2 the second object to be compared.
-     * @param fallbackIndex the Integer to be used as a fallback index.
-     * @return a negative integer, zero, or a positive integer as the
-     *             first object is mapped to a less, equal to, or greater
-     *             index than the second.
-     */
-    static <T> int compareIndices(Map<T, Integer> indexMap,
-                                  T obj1, T obj2,
-                                  Integer fallbackIndex) {
-        Integer index1 = indexMap.getOrDefault(obj1, fallbackIndex);
-        Integer index2 = indexMap.getOrDefault(obj2, fallbackIndex);
-        return index1.compareTo(index2);
-    }
-
-    /**
-     * An IndexedComparator which compares two String charsets. The comparison
-     * follows the rules outlined in DataFlavor.selectBestTextFlavor. In order
-     * to ensure that non-Unicode, non-ASCII, non-default charsets are sorted
-     * in alphabetical order, charsets are not automatically converted to their
-     * canonical forms.
-     */
-    private static class CharsetComparator implements Comparator<String> {
-        static final CharsetComparator INSTANCE = new CharsetComparator();
-
-        private static final Map<String, Integer> charsets;
-
-        private static final Integer DEFAULT_CHARSET_INDEX = 2;
-        private static final Integer OTHER_CHARSET_INDEX = 1;
-        private static final Integer WORST_CHARSET_INDEX = 0;
-        private static final Integer UNSUPPORTED_CHARSET_INDEX = Integer.MIN_VALUE;
-
-        private static final String UNSUPPORTED_CHARSET = "UNSUPPORTED";
-
-        static {
-            Map<String, Integer> charsetsMap = new HashMap<>(8, 1.0f);
-
-            // we prefer Unicode charsets
-            charsetsMap.put(canonicalName("UTF-16LE"), 4);
-            charsetsMap.put(canonicalName("UTF-16BE"), 5);
-            charsetsMap.put(canonicalName("UTF-8"), 6);
-            charsetsMap.put(canonicalName("UTF-16"), 7);
-
-            // US-ASCII is the worst charset supported
-            charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
-
-            charsetsMap.putIfAbsent(Charset.defaultCharset().name(), DEFAULT_CHARSET_INDEX);
-
-            charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
-
-            charsets = Collections.unmodifiableMap(charsetsMap);
-        }
-
-        /**
-         * Compares charsets. Returns a negative integer, zero, or a positive
-         * integer as the first charset is worse than, equal to, or better than
-         * the second.
-         * <p>
-         * Charsets are ordered according to the following rules:
-         * <ul>
-         * <li>All unsupported charsets are equal.
-         * <li>Any unsupported charset is worse than any supported charset.
-         * <li>Unicode charsets, such as "UTF-16", "UTF-8", "UTF-16BE" and
-         *     "UTF-16LE", are considered best.
-         * <li>After them, platform default charset is selected.
-         * <li>"US-ASCII" is the worst of supported charsets.
-         * <li>For all other supported charsets, the lexicographically less
-         *     one is considered the better.
-         * </ul>
-         *
-         * @param charset1 the first charset to be compared
-         * @param charset2 the second charset to be compared.
-         * @return a negative integer, zero, or a positive integer as the
-         *             first argument is worse, equal to, or better than the
-         *             second.
-         */
-        public int compare(String charset1, String charset2) {
-            charset1 = getEncoding(charset1);
-            charset2 = getEncoding(charset2);
-
-            int comp = compareIndices(charsets, charset1, charset2, OTHER_CHARSET_INDEX);
-
-            if (comp == 0) {
-                return charset2.compareTo(charset1);
-            }
-
-            return comp;
-        }
-
-        /**
-         * Returns encoding for the specified charset according to the
-         * following rules:
-         * <ul>
-         * <li>If the charset is <code>null</code>, then <code>null</code> will
-         *     be returned.
-         * <li>Iff the charset specifies an encoding unsupported by this JRE,
-         *     <code>UNSUPPORTED_CHARSET</code> will be returned.
-         * <li>If the charset specifies an alias name, the corresponding
-         *     canonical name will be returned iff the charset is a known
-         *     Unicode, ASCII, or default charset.
-         * </ul>
-         *
-         * @param charset the charset.
-         * @return an encoding for this charset.
-         */
-        static String getEncoding(String charset) {
-            if (charset == null) {
-                return null;
-            } else if (!isEncodingSupported(charset)) {
-                return UNSUPPORTED_CHARSET;
-            } else {
-                // Only convert to canonical form if the charset is one
-                // of the charsets explicitly listed in the known charsets
-                // map. This will happen only for Unicode, ASCII, or default
-                // charsets.
-                String canonicalName = canonicalName(charset);
-                return (charsets.containsKey(canonicalName))
-                        ? canonicalName
-                        : charset;
-            }
-        }
-    }
-
-    /**
-     * An IndexedComparator which compares two DataFlavors. For text flavors,
-     * the comparison follows the rules outlined in
-     * DataFlavor.selectBestTextFlavor. For non-text flavors, unknown
-     * application MIME types are preferred, followed by known
-     * application/x-java-* MIME types. Unknown application types are preferred
-     * because if the user provides his own data flavor, it will likely be the
-     * most descriptive one. For flavors which are otherwise equal, the
-     * flavors' string representation are compared in the alphabetical order.
-     */
-    private static class DataFlavorComparator implements Comparator<DataFlavor> {
-
-        static final DataFlavorComparator INSTANCE = new DataFlavorComparator();
-
-        private static final Map<String, Integer> exactTypes;
-        private static final Map<String, Integer> primaryTypes;
-        private static final Map<Class<?>, Integer> nonTextRepresentations;
-        private static final Map<String, Integer> textTypes;
-        private static final Map<Class<?>, Integer> decodedTextRepresentations;
-        private static final Map<Class<?>, Integer> encodedTextRepresentations;
-
-        private static final Integer UNKNOWN_OBJECT_LOSES = Integer.MIN_VALUE;
-        private static final Integer UNKNOWN_OBJECT_WINS = Integer.MAX_VALUE;
-
-        static {
-            {
-                Map<String, Integer> exactTypesMap = new HashMap<>(4, 1.0f);
-
-                // application/x-java-* MIME types
-                exactTypesMap.put("application/x-java-file-list", 0);
-                exactTypesMap.put("application/x-java-serialized-object", 1);
-                exactTypesMap.put("application/x-java-jvm-local-objectref", 2);
-                exactTypesMap.put("application/x-java-remote-object", 3);
-
-                exactTypes = Collections.unmodifiableMap(exactTypesMap);
-            }
-
-            {
-                Map<String, Integer> primaryTypesMap = new HashMap<>(1, 1.0f);
-
-                primaryTypesMap.put("application", 0);
-
-                primaryTypes = Collections.unmodifiableMap(primaryTypesMap);
-            }
-
-            {
-                Map<Class<?>, Integer> nonTextRepresentationsMap = new HashMap<>(3, 1.0f);
-
-                nonTextRepresentationsMap.put(java.io.InputStream.class, 0);
-                nonTextRepresentationsMap.put(java.io.Serializable.class, 1);
-
-                nonTextRepresentationsMap.put(RMI.remoteClass(), 2);
-
-                nonTextRepresentations = Collections.unmodifiableMap(nonTextRepresentationsMap);
-            }
-
-            {
-                Map<String, Integer> textTypesMap = new HashMap<>(16, 1.0f);
-
-                // plain text
-                textTypesMap.put("text/plain", 0);
-
-                // stringFlavor
-                textTypesMap.put("application/x-java-serialized-object", 1);
-
-                // misc
-                textTypesMap.put("text/calendar", 2);
-                textTypesMap.put("text/css", 3);
-                textTypesMap.put("text/directory", 4);
-                textTypesMap.put("text/parityfec", 5);
-                textTypesMap.put("text/rfc822-headers", 6);
-                textTypesMap.put("text/t140", 7);
-                textTypesMap.put("text/tab-separated-values", 8);
-                textTypesMap.put("text/uri-list", 9);
-
-                // enriched
-                textTypesMap.put("text/richtext", 10);
-                textTypesMap.put("text/enriched", 11);
-                textTypesMap.put("text/rtf", 12);
-
-                // markup
-                textTypesMap.put("text/html", 13);
-                textTypesMap.put("text/xml", 14);
-                textTypesMap.put("text/sgml", 15);
-
-                textTypes = Collections.unmodifiableMap(textTypesMap);
-            }
-
-            {
-                Map<Class<?>, Integer> decodedTextRepresentationsMap = new HashMap<>(4, 1.0f);
-
-                decodedTextRepresentationsMap.put(char[].class, 0);
-                decodedTextRepresentationsMap.put(CharBuffer.class, 1);
-                decodedTextRepresentationsMap.put(String.class, 2);
-                decodedTextRepresentationsMap.put(Reader.class, 3);
-
-                decodedTextRepresentations =
-                        Collections.unmodifiableMap(decodedTextRepresentationsMap);
-            }
-
-            {
-                Map<Class<?>, Integer> encodedTextRepresentationsMap = new HashMap<>(3, 1.0f);
-
-                encodedTextRepresentationsMap.put(byte[].class, 0);
-                encodedTextRepresentationsMap.put(ByteBuffer.class, 1);
-                encodedTextRepresentationsMap.put(InputStream.class, 2);
-
-                encodedTextRepresentations =
-                        Collections.unmodifiableMap(encodedTextRepresentationsMap);
-            }
-        }
-
-
-        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
-            if (flavor1.equals(flavor2)) {
-                return 0;
-            }
-
-            int comp;
-
-            String primaryType1 = flavor1.getPrimaryType();
-            String subType1 = flavor1.getSubType();
-            String mimeType1 = primaryType1 + "/" + subType1;
-            Class<?> class1 = flavor1.getRepresentationClass();
-
-            String primaryType2 = flavor2.getPrimaryType();
-            String subType2 = flavor2.getSubType();
-            String mimeType2 = primaryType2 + "/" + subType2;
-            Class<?> class2 = flavor2.getRepresentationClass();
-
-            if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
-                // First, compare MIME types
-                comp = compareIndices(textTypes, mimeType1, mimeType2, UNKNOWN_OBJECT_LOSES);
-                if (comp != 0) {
-                    return comp;
-                }
-
-                // Only need to test one flavor because they both have the
-                // same MIME type. Also don't need to worry about accidentally
-                // passing stringFlavor because either
-                //   1. Both flavors are stringFlavor, in which case the
-                //      equality test at the top of the function succeeded.
-                //   2. Only one flavor is stringFlavor, in which case the MIME
-                //      type comparison returned a non-zero value.
-                if (doesSubtypeSupportCharset(flavor1)) {
-                    // Next, prefer the decoded text representations of Reader,
-                    // String, CharBuffer, and [C, in that order.
-                    comp = compareIndices(decodedTextRepresentations, class1,
-                            class2, UNKNOWN_OBJECT_LOSES);
-                    if (comp != 0) {
-                        return comp;
-                    }
-
-                    // Next, compare charsets
-                    comp = CharsetComparator.INSTANCE.compare(getTextCharset(flavor1),
-                            getTextCharset(flavor2));
-                    if (comp != 0) {
-                        return comp;
-                    }
-                }
-
-                // Finally, prefer the encoded text representations of
-                // InputStream, ByteBuffer, and [B, in that order.
-                comp = compareIndices(encodedTextRepresentations, class1,
-                        class2, UNKNOWN_OBJECT_LOSES);
-                if (comp != 0) {
-                    return comp;
-                }
-            } else {
-                // First, prefer application types.
-                comp = compareIndices(primaryTypes, primaryType1, primaryType2,
-                        UNKNOWN_OBJECT_LOSES);
-                if (comp != 0) {
-                    return comp;
-                }
-
-                // Next prefer text types
-                if (flavor1.isFlavorTextType()) {
-                    return 1;
-                }
-
-                if (flavor2.isFlavorTextType()) {
-                    return -1;
-                }
-
-                // Next, look for application/x-java-* types. Prefer unknown
-                // MIME types because if the user provides his own data flavor,
-                // it will likely be the most descriptive one.
-                comp = compareIndices(exactTypes, mimeType1, mimeType2,
-                        UNKNOWN_OBJECT_WINS);
-                if (comp != 0) {
-                    return comp;
-                }
-
-                // Finally, prefer the representation classes of Remote,
-                // Serializable, and InputStream, in that order.
-                comp = compareIndices(nonTextRepresentations, class1, class2,
-                        UNKNOWN_OBJECT_LOSES);
-                if (comp != 0) {
-                    return comp;
-                }
-            }
-
-            // The flavours are not equal but still not distinguishable.
-            // Compare String representations in alphabetical order
-            return flavor1.getMimeType().compareTo(flavor2.getMimeType());
-        }
-    }
-
-    /*
-     * Given the Map that maps objects to Integer indices and a boolean value,
-     * this Comparator imposes a direct or reverse order on set of objects.
-     * <p>
-     * If the specified boolean value is SELECT_BEST, the Comparator imposes the
-     * direct index-based order: an object A is greater than an object B if and
-     * only if the index of A is greater than the index of B. An object that
-     * doesn't have an associated index is less or equal than any other object.
-     * <p>
-     * If the specified boolean value is SELECT_WORST, the Comparator imposes the
-     * reverse index-based order: an object A is greater than an object B if and
-     * only if A is less than B with the direct index-based order.
-     */
-    private static class IndexOrderComparator implements Comparator<Long> {
-        private final Map<Long, Integer> indexMap;
-        private static final Integer FALLBACK_INDEX = Integer.MIN_VALUE;
-
-        public IndexOrderComparator(Map<Long, Integer> indexMap) {
-            this.indexMap = indexMap;
-        }
-
-        public int compare(Long obj1, Long obj2) {
-            return compareIndices(indexMap, obj1, obj2, FALLBACK_INDEX);
-        }
-    }
-
-    private static class TextFlavorComparator extends DataFlavorComparator {
-
-        static final TextFlavorComparator INSTANCE = new TextFlavorComparator();
-        /**
-         * Compares two <code>DataFlavor</code> objects. Returns a negative
-         * integer, zero, or a positive integer as the first
-         * <code>DataFlavor</code> is worse than, equal to, or better than the
-         * second.
-         * <p>
-         * <code>DataFlavor</code>s are ordered according to the rules outlined
-         * for <code>selectBestTextFlavor</code>.
-         *
-         * @param flavor1 the first <code>DataFlavor</code> to be compared
-         * @param flavor2 the second <code>DataFlavor</code> to be compared
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is worse, equal to, or better than the second
-         * @throws ClassCastException if either of the arguments is not an
-         *         instance of <code>DataFlavor</code>
-         * @throws NullPointerException if either of the arguments is
-         *         <code>null</code>
-         *
-         * @see java.awt.datatransfer.DataFlavor#selectBestTextFlavor
-         */
-        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
-            if (flavor1.isFlavorTextType()) {
-                if (flavor2.isFlavorTextType()) {
-                    return super.compare(flavor1, flavor2);
-                } else {
-                    return 1;
-                }
-            } else if (flavor2.isFlavorTextType()) {
-                return -1;
-            } else {
-                return 0;
-            }
-        }
-    }
-
-    /**
-     * A fallback implementation of {@link sun.datatransfer.DesktopDatatransferService}
-     * used if there is no desktop.
-     */
-    private static final class DefaultDesktopDatatransferService implements DesktopDatatransferService {
-        static final DesktopDatatransferService INSTANCE = getDesktopService();
-
-        private static DesktopDatatransferService getDesktopService() {
-            ServiceLoader<DesktopDatatransferService> loader =
-                    ServiceLoader.load(DesktopDatatransferService.class, null);
-            Iterator<DesktopDatatransferService> iterator = loader.iterator();
-            if (iterator.hasNext()) {
-                return iterator.next();
-            } else {
-                return new DefaultDesktopDatatransferService();
-            }
-        }
-
-        /**
-         * System singleton FlavorTable.
-         * Only used if there is no desktop
-         * to provide an appropriate FlavorMap.
-         */
-        private volatile FlavorMap flavorMap;
-
-        @Override
-        public void invokeOnEventThread(Runnable r) {
-            r.run();
-        }
-
-        @Override
-        public String getDefaultUnicodeEncoding() {
-            return StandardCharsets.UTF_8.name();
-        }
-
-        @Override
-        public FlavorMap getFlavorMap(Supplier<FlavorMap> supplier) {
-            FlavorMap map = flavorMap;
-            if (map == null) {
-                synchronized (this) {
-                    map = flavorMap;
-                    if (map == null) {
-                        flavorMap = map = supplier.get();
-                    }
-                }
-            }
-            return map;
-        }
-
-        @Override
-        public boolean isDesktopPresent() {
-            return false;
-        }
-
-        @Override
-        public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
-            return new LinkedHashSet<>();
-        }
-
-        @Override
-        public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
-            return new LinkedHashSet<>();
-        }
-
-        @Override
-        public void registerTextFlavorProperties(String nat, String charset,
-                                                 String eoln, String terminators) {
-            // Not needed if desktop module is absent
-        }
-    }
-
-    public static DesktopDatatransferService getDesktopService() {
-        return DefaultDesktopDatatransferService.INSTANCE;
-    }
-
-    /**
-     * A class that provides access to java.rmi.Remote and java.rmi.MarshalledObject
-     * without creating a static dependency.
-     */
-    public static class RMI {
-        private static final Class<?> remoteClass = getClass("java.rmi.Remote");
-        private static final Class<?> marshallObjectClass = getClass("java.rmi.MarshalledObject");
-        private static final Constructor<?> marshallCtor = getConstructor(marshallObjectClass, Object.class);
-        private static final Method marshallGet = getMethod(marshallObjectClass, "get");
-
-        private static Class<?> getClass(String name) {
-            try {
-                return Class.forName(name, true, null);
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
-        }
-
-        private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getDeclaredConstructor(types);
-            } catch (NoSuchMethodException x) {
-                throw new AssertionError(x);
-            }
-        }
-
-        private static Method getMethod(Class<?> c, String name, Class<?>... types) {
-            try {
-                return (c == null) ? null : c.getMethod(name, types);
-            } catch (NoSuchMethodException e) {
-                throw new AssertionError(e);
-            }
-        }
-
-        /**
-         * Returns java.rmi.Remote.class if RMI is present; otherwise {@code null}.
-         */
-        static Class<?> remoteClass() {
-            return remoteClass;
-        }
-
-        /**
-         * Returns {@code true} if the given class is java.rmi.Remote.
-         */
-        public static boolean isRemote(Class<?> c) {
-            return (remoteClass != null) && remoteClass.isAssignableFrom(c);
-        }
-
-        /**
-         * Returns a new MarshalledObject containing the serialized representation
-         * of the given object.
-         */
-        public static Object newMarshalledObject(Object obj) throws IOException {
-            try {
-                return marshallCtor == null ? null : marshallCtor.newInstance(obj);
-            } catch (InstantiationException | IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof IOException)
-                    throw (IOException) cause;
-                throw new AssertionError(x);
-            }
-        }
-
-        /**
-         * Returns a new copy of the contained marshalled object.
-         */
-        public static Object getMarshalledObject(Object obj)
-                throws IOException, ClassNotFoundException {
-            try {
-                return marshallGet == null ? null : marshallGet.invoke(obj);
-            } catch (IllegalAccessException x) {
-                throw new AssertionError(x);
-            } catch (InvocationTargetException x) {
-                Throwable cause = x.getCause();
-                if (cause instanceof IOException)
-                    throw (IOException) cause;
-                if (cause instanceof ClassNotFoundException)
-                    throw (ClassNotFoundException) cause;
-                throw new AssertionError(x);
-            }
-        }
-
-    }
-}
--- a/jdk/src/java.desktop/share/classes/sun/datatransfer/DesktopDatatransferService.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.datatransfer;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.FlavorMap;
-import java.util.LinkedHashSet;
-import java.util.function.Supplier;
-
-/**
- * Contains services which desktop provides to the datatransfer system
- * to enrich it's functionality
- *
- * @author Petr Pchelko
- * @since 1.9
- */
-public interface DesktopDatatransferService {
-
-    /**
-     * If desktop is present - invokes a {@code Runnable} on
-     * the event dispatch thread. Otherwise invokes a {@code run()}
-     * method directly.
-     *
-     * @param r a {@code Runnable} to invoke
-     */
-    void invokeOnEventThread(Runnable r);
-
-    /**
-     * Get a platform-dependent default unicode encoding to use in
-     * datatransfer system.
-     *
-     * @return default unicode encoding
-     */
-    String getDefaultUnicodeEncoding();
-
-    /**
-     * Takes an appropriate {@code FlavorMap} from the desktop.
-     * If no appropriate table is found - uses a provided supplier to
-     * instantiate a table. If the desktop is absent - creates and returns
-     * a system singleton.
-     *
-     * @param supplier a constructor that should be used to create a new instance of
-     *                 the {@code FlavorMap}
-     * @return a {@code FlavorMap}
-     */
-    FlavorMap getFlavorMap(Supplier<FlavorMap> supplier);
-
-    /**
-     * Checks if desktop is present
-     *
-     * @return {@code true} is the desktop is present
-     */
-    boolean isDesktopPresent();
-
-    /**
-     * Returns platform-specific mappings for the specified native format.
-     * If there are no platform-specific mappings for this native, the method
-     * returns an empty {@code Set}
-     *
-     * @param nat a native format to return flavors for
-     * @return set of platform-specific mappings for a native format
-     */
-    LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat);
-
-    /**
-     * Returns platform-specific mappings for the specified flavor.
-     * If there are no platform-specific mappings for this flavor, the method
-     * returns an empty {@code Set}
-     *
-     * @param df {@code DataFlavor} to return mappings for
-     * @return set of platform-specific mappings for a {@code DataFlavor}
-     */
-    LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df);
-
-    /**
-     * This method is called for text flavor mappings established while parsing
-     * the default flavor mappings file. It stores the "eoln" and "terminators"
-     * parameters which are not officially part of the MIME type. They are
-     * MIME parameters specific to the flavormap.properties file format.
-     */
-    void registerTextFlavorProperties(String nat, String charset,
-                                      String eoln, String terminators);
-}
--- a/jdk/src/java.desktop/share/classes/sun/font/Font2D.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/Font2D.java	Wed Jul 05 20:20:43 2017 +0200
@@ -157,6 +157,21 @@
         }
     }
 
+    public static final int FWIDTH_NORMAL = 5;    // OS/2 usWidthClass
+    public static final int FWEIGHT_NORMAL = 400; // OS/2 usWeightClass
+    public static final int FWEIGHT_BOLD   = 700; // OS/2 usWeightClass
+
+    public int getWidth() {
+        return FWIDTH_NORMAL;
+    }
+
+    public int getWeight() {
+        if ((style & Font.BOLD) !=0) {
+            return FWEIGHT_BOLD;
+        } else {
+            return FWEIGHT_NORMAL;
+        }
+    }
 
     int getRank() {
         return fontRank;
--- a/jdk/src/java.desktop/share/classes/sun/font/FontFamily.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/FontFamily.java	Wed Jul 05 20:20:43 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.io.File;
 import java.awt.Font;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.Locale;
@@ -77,7 +78,7 @@
             family.bolditalic = null;
         }
         if (family.plain == null && family.bold == null &&
-            family.plain == null && family.bold == null) {
+            family.italic == null && family.bolditalic == null) {
             familyNameMap.remove(name);
         }
     }
@@ -134,7 +135,98 @@
         return java.util.Objects.equals(newDir, existDir);
     }
 
+    /*
+     * We want a family to be of the same width and prefer medium/normal width.
+     * Once we find a particular width we accept more of the same width
+     * until we find one closer to normal when we 'evict' all existing fonts.
+     * So once we see a 'normal' width font we evict all members that are not
+     * normal width and then accept only new ones that are normal width.
+     *
+     * Once a font passes the width test we subject it to the weight test.
+     * For Plain we target the weight the closest that is <= NORMAL (400)
+     * For Bold we target the weight that is closest to BOLD (700).
+     *
+     * In the future, rather than discarding these fonts, we should
+     * extend the family to include these so lookups on these properties
+     * can locate them, as presently they will only be located by full name
+     * based lookup.
+     */
+
+    private int familyWidth = 0;
+    private boolean preferredWidth(Font2D font) {
+
+        int newWidth = font.getWidth();
+
+        if (familyWidth == 0) {
+            familyWidth = newWidth;
+            return true;
+        }
+
+        if (newWidth == familyWidth) {
+            return true;
+        }
+
+        if (Math.abs(Font2D.FWIDTH_NORMAL - newWidth) <
+            Math.abs(Font2D.FWIDTH_NORMAL - familyWidth))
+        {
+           if (FontUtilities.debugFonts()) {
+               FontUtilities.getLogger().info(
+               "Found more preferred width. New width = " + newWidth +
+               " Old width = " + familyWidth + " in font " + font +
+               " nulling out fonts plain: " + plain + " bold: " + bold +
+               " italic: " + italic + " bolditalic: " + bolditalic);
+           }
+           familyWidth = newWidth;
+           plain = bold = italic = bolditalic = null;
+           return true;
+        } else if (FontUtilities.debugFonts()) {
+               FontUtilities.getLogger().info(
+               "Family rejecting font " + font +
+               " of less preferred width " + newWidth);
+        }
+        return false;
+    }
+
+    private boolean closerWeight(Font2D currFont, Font2D font, int style) {
+        if (familyWidth != font.getWidth()) {
+            return false;
+        }
+
+        if (currFont == null) {
+            return true;
+        }
+
+        if (FontUtilities.debugFonts()) {
+            FontUtilities.getLogger().info(
+            "New weight for style " + style + ". Curr.font=" + currFont +
+            " New font="+font+" Curr.weight="+ + currFont.getWeight()+
+            " New weight="+font.getWeight());
+        }
+
+        int newWeight = font.getWeight();
+        switch (style) {
+            case Font.PLAIN:
+            case Font.ITALIC:
+                return (newWeight <= Font2D.FWEIGHT_NORMAL &&
+                        newWeight > currFont.getWeight());
+
+            case Font.BOLD:
+            case Font.BOLD|Font.ITALIC:
+                return (Math.abs(newWeight - Font2D.FWEIGHT_BOLD) <
+                        Math.abs(currFont.getWeight() - Font2D.FWEIGHT_BOLD));
+
+            default:
+               return false;
+        }
+    }
+
     public void setFont(Font2D font, int style) {
+
+        if (FontUtilities.isLogging()) {
+            FontUtilities.getLogger().info(
+            "Request to add " + font + " with style " + style +
+            " to family " + this);
+        }
         /* Allow a lower-rank font only if its a file font
          * from the exact same source as any previous font.
          */
@@ -152,19 +244,27 @@
         switch (style) {
 
         case Font.PLAIN:
-            plain = font;
+            if (preferredWidth(font) && closerWeight(plain, font, style)) {
+                plain = font;
+            }
             break;
 
         case Font.BOLD:
-            bold = font;
+            if (preferredWidth(font) && closerWeight(bold, font, style)) {
+                bold = font;
+            }
             break;
 
         case Font.ITALIC:
-            italic = font;
+            if (preferredWidth(font) && closerWeight(italic, font, style)) {
+                italic = font;
+            }
             break;
 
         case Font.BOLD|Font.ITALIC:
-            bolditalic = font;
+            if (preferredWidth(font) && closerWeight(bolditalic, font, style)) {
+                bolditalic = font;
+            }
             break;
 
         default:
@@ -316,6 +416,11 @@
         return allLocaleNames.get(name.toLowerCase());
     }
 
+    public static FontFamily[] getAllFontFamilies() {
+       Collection<FontFamily> families = familyNameMap.values();
+       return families.toArray(new FontFamily[0]);
+    }
+
     public String toString() {
         return
             "Font family: " + familyName +
--- a/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/TrueTypeFont.java	Wed Jul 05 20:20:43 2017 +0200
@@ -963,6 +963,18 @@
         setStyle(getTableBuffer(os_2Tag));
     }
 
+    private int fontWidth = 0;
+    @Override
+    public int getWidth() {
+       return (fontWidth > 0) ? fontWidth : super.getWidth();
+    }
+
+    private int fontWeight = 0;
+    @Override
+    public int getWeight() {
+       return (fontWeight > 0) ? fontWeight : super.getWeight();
+    }
+
     /* TrueTypeFont can use the fsSelection fields of OS/2 table
      * to determine the style. In the unlikely case that doesn't exist,
      * can use macStyle in the 'head' table but simpler to
@@ -978,8 +990,15 @@
     private static final int fsSelectionBoldBit    = 0x00020;
     private static final int fsSelectionRegularBit = 0x00040;
     private void setStyle(ByteBuffer os_2Table) {
+        if (os_2Table == null) {
+            return;
+        }
+        if (os_2Table.capacity() >= 8) {
+            fontWeight = os_2Table.getChar(4) & 0xffff;
+            fontWidth  = os_2Table.getChar(6) & 0xffff;
+        }
         /* fsSelection is unsigned short at buffer offset 62 */
-        if (os_2Table == null || os_2Table.capacity() < 64) {
+        if (os_2Table.capacity() < 64) {
             super.setStyle();
             return;
         }
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1564,7 +1564,7 @@
                 bmObj = bmTmpObj;
             } else {
                 if (lmObj == null || rmObj == null ||
-                    tmObj == null || rmObj == null) {
+                    tmObj == null || bmObj == null) {
                     return;
                 } else {
                     leftMargin.setValue(lmObj);
--- a/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import java.awt.event.*;
 import java.awt.font.*;
 import java.awt.print.PrinterGraphics;
+import java.text.BreakIterator;
 import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
 import java.text.AttributedString;
@@ -461,16 +462,15 @@
             }
         }
         if (needsTextLayout) {
-            FontRenderContext frc = getFontRenderContext(c, fm);
             AttributedString aString = new AttributedString(string);
             if (c != null) {
                 aString.addAttribute(TextAttribute.NUMERIC_SHAPING,
                         c.getClientProperty(TextAttribute.NUMERIC_SHAPING));
             }
-            LineBreakMeasurer measurer =
-                new LineBreakMeasurer(aString.getIterator(), frc);
-            int nChars = measurer.nextOffset(availTextWidth);
-            string = string.substring(0, nChars);
+            LineBreakMeasurer measurer = new LineBreakMeasurer(
+                    aString.getIterator(), BreakIterator.getCharacterInstance(),
+                    getFontRenderContext(c, fm));
+            string = string.substring(0, measurer.nextOffset(availTextWidth));
 
         }
         return string + clipString;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XAWTFormatter.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2003, 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 sun.awt.X11;
-
-import java.util.logging.*;
-import java.text.*;
-import java.util.*;
-import java.io.*;
-
-/**
- * Formatter class providing ANSI output. Based on java.util.logging.SimpleFormatter sources.
- */
-
-public class XAWTFormatter extends java.util.logging.Formatter {
-    Date dat = new Date();
-    private final static String format = "{0,date} {0,time}";
-    private MessageFormat formatter;
-
-    private Object args[] = new Object[1];
-
-    // Line separator string.  This is the value of the line.separator
-    // property at the moment that the SimpleFormatter was created.
-    private String lineSeparator = System.lineSeparator();
-
-    boolean displayFullRecord = false;
-    boolean useANSI = false;
-    boolean showDate = true;
-    boolean showLevel = true;
-    boolean swapMethodClass = false;
-    public XAWTFormatter() {
-        displayFullRecord = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.displayFullRecord"));
-        useANSI = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.useANSI"));
-        showDate = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showDate"));
-        showLevel = !"false".equals(LogManager.getLogManager().getProperty("XAWTFormatter.showLevel"));
-        swapMethodClass = "true".equals(LogManager.getLogManager().getProperty("XAWTFormatter.swapMethodClass"));
-    }
-
-    /**
-     * Format the given LogRecord.
-     * @param record the log record to be formatted.
-     * @return a formatted log record
-     */
-    public synchronized String format(LogRecord record) {
-        StringBuffer sb = new StringBuffer();
-        if (useANSI) {
-            Level lev = record.getLevel();
-            if (Level.FINEST.equals(lev)) {
-                sb.append("");
-            } else if (Level.FINER.equals(lev)) {
-                sb.append("");
-            } else if (Level.FINE.equals(lev)) {
-                sb.append("");
-            }
-        }
-        if (displayFullRecord) {
-            if (showDate) {
-                // Minimize memory allocations here.
-                dat.setTime(record.getMillis());
-                args[0] = dat;
-                StringBuffer text = new StringBuffer();
-                if (formatter == null) {
-                    formatter = new MessageFormat(format);
-                }
-                formatter.format(args, text, null);
-                sb.append(text);
-                sb.append(" ");
-            } else {
-                sb.append("    ");
-            }
-            if (swapMethodClass) {
-                if (record.getSourceMethodName() != null) {
-                    sb.append(" ");
-                    sb.append(record.getSourceMethodName());
-                    sb.append(" ");
-                }
-                if (record.getSourceClassName() != null) {
-                    sb.append(record.getSourceClassName());
-                } else {
-                    sb.append(record.getLoggerName());
-                }
-            } else {
-                if (record.getSourceClassName() != null) {
-                    sb.append(record.getSourceClassName());
-                } else {
-                    sb.append(record.getLoggerName());
-                }
-                if (record.getSourceMethodName() != null) {
-                    sb.append(" ");
-                    sb.append(record.getSourceMethodName());
-                    sb.append("");
-                }
-            }
-            sb.append(lineSeparator);
-        }
-        if (useANSI) {
-            Level lev = record.getLevel();
-            if (Level.FINEST.equals(lev)) {
-                sb.append("");
-            } else if (Level.FINER.equals(lev)) {
-                sb.append("");
-            } else if (Level.FINE.equals(lev)) {
-                sb.append("");
-            }
-        }
-        if (showLevel) {
-            sb.append(record.getLevel().getLocalizedName());
-            sb.append(": ");
-        }
-        String message = formatMessage(record);
-        sb.append(message);
-        sb.append(lineSeparator);
-        if (record.getThrown() != null) {
-            try {
-                StringWriter sw = new StringWriter();
-                PrintWriter pw = new PrintWriter(sw);
-                record.getThrown().printStackTrace(pw);
-                pw.close();
-                sb.append(sw.toString());
-            } catch (Exception ex) {
-            }
-        }
-        if (useANSI) {
-            sb.append("");
-        }
-        return sb.toString();
-    }
-}
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,17 @@
 
 package sun.awt.X11;
 
+import java.awt.AWTKeyStroke;
+import java.awt.Toolkit;
+
 import sun.awt.EmbeddedFrame;
-import java.awt.*;
-import java.awt.AWTKeyStroke;
-import java.util.logging.Logger;
+import sun.util.logging.PlatformLogger;
 
 @SuppressWarnings("serial") // JDK-implementation class
 public class XEmbeddedFrame extends EmbeddedFrame {
 
-    private static final Logger log = Logger.getLogger(XEmbeddedFrame.class.getName());
+    private static final PlatformLogger log =
+            PlatformLogger.getLogger(XEmbeddedFrame.class.getName());
 
     long handle;
     public XEmbeddedFrame() {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11GB2312.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11GB2312.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,7 @@
 import java.nio.CharBuffer;
 import java.nio.ByteBuffer;
 import java.nio.charset.*;
+import sun.nio.cs.*;
 import sun.nio.cs.ext.*;
 import static sun.nio.cs.CharsetMapping.*;
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11GBK.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11GBK.java	Wed Jul 05 20:20:43 2017 +0200
@@ -26,6 +26,7 @@
 package sun.awt.motif;
 
 import java.nio.charset.*;
+import sun.nio.cs.*;
 import sun.nio.cs.ext.*;
 import static sun.nio.cs.CharsetMapping.*;
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0201.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0201.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,7 +29,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.*;
 import sun.nio.cs.*;
-import sun.nio.cs.ext.JIS_X_0201;
+import sun.nio.cs.ext.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 public class X11JIS0201 extends Charset {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0208.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0208.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,7 +28,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CharsetDecoder;
-import sun.nio.cs.ext.JIS_X_0208;
+import sun.nio.cs.*;
+import sun.nio.cs.ext.*;
 
 public class X11JIS0208 extends Charset {
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0212.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11JIS0212.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,7 +28,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CharsetDecoder;
-import sun.nio.cs.ext.JIS_X_0212;
+import sun.nio.cs.*;
+import sun.nio.cs.ext.*;
 
 public class X11JIS0212 extends Charset {
     private static Charset jis0212 = new JIS_X_0212();
--- a/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11KSC5601.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/motif/X11KSC5601.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,7 @@
 import java.nio.CharBuffer;
 import java.nio.ByteBuffer;
 import java.nio.charset.*;
+import sun.nio.cs.*;
 import sun.nio.cs.ext.*;
 import static sun.nio.cs.CharsetMapping.*;
 
--- a/jdk/src/java.desktop/unix/classes/sun/datatransfer/resources/flavormap.properties	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific,
-# default mappings between common X11 selection atoms and platform-independent
-# MIME type strings, which will be converted into
-# java.awt.datatransfer.DataFlavors.
-#
-# The standard format is:
-#
-# <native>=<MIME type>,<MIME type>, ...
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate DataFlavor values and set multiple values for a single native by
-# separating them with ",". If a mapping contains a duplicate key or value,
-# earlier mappings which included this key or value will be preferred.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-
-# The COMPOUND_TEXT support for inter-client text transfer is disabled by 
-# default. The reason is that many native applications prefer this format over 
-# other native text formats, but are unable to decode the textual data in this 
-# format properly. This results in java-to-native text transfer failures.
-# To enable the COMPOUND_TEXT support for this JRE installation uncomment 
-# the line below.
-
-# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
-
-TEXT=text/plain;eoln="\n";terminators=0
-STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
-FILE_NAME=application/x-java-file-list;class=java.util.List
-text/uri-list=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
--- a/jdk/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java	Wed Jul 05 20:20:43 2017 +0200
@@ -180,7 +180,7 @@
         String[] componentFaceNames = cfi[idx].getComponentFaceNames();
         FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
         for (int i = 0; i < componentFaceNames.length; i++) {
-            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
+            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
         }
 
         return ret;
--- a/jdk/src/java.desktop/windows/classes/sun/datatransfer/resources/flavormap.properties	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the Win32 platform-
-# specific, default mappings between common Win32 Clipboard atoms and platform-
-# independent MIME type strings, which will be converted into
-# java.awt.datatransfer.DataFlavors.
-#
-# The standard format is:
-#
-# <native>=<MIME type>,<MIME type>, ...
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate DataFlavor values and set multiple values for a single native by
-# separating them with ",". If a mapping contains a duplicate key or value,
-# earlier mappings which included this key or value will be preferred.#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UNICODE\ TEXT=text/plain;charset=utf-16le;eoln="\r\n";terminators=2
-TEXT=text/plain;eoln="\r\n";terminators=1
-HTML\ Format=text/html;charset=utf-8;eoln="\r\n";terminators=1
-Rich\ Text\ Format=text/rtf
-HDROP=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
-DIB=image/x-java-image;class=java.awt.Image
-ENHMETAFILE=image/x-java-image;class=java.awt.Image
-METAFILEPICT=image/x-java-image;class=java.awt.Image
-LOCALE=application/x-java-text-encoding;class="[B"
-UniformResourceLocator=application/x-java-url;class=java.net.URL,\
-                       text/uri-list;eoln="\r\n";terminators=1,\
-                       text/plain;eoln="\r\n";terminators=1
-FileGroupDescriptorW=application/x-java-file-list;class=java.util.List
-FileGroupDescriptor=application/x-java-file-list;class=java.util.List
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp	Wed Jul 05 20:20:43 2017 +0200
@@ -52,6 +52,7 @@
     // 6457572: ShellExecute possibly changes FPU control word - saving it here
     unsigned oldcontrol87 = _control87(0, 0);
     HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, SW_SHOWNORMAL);
+    DWORD error = ::GetLastError();
     _control87(oldcontrol87, 0xffffffff);
 
     JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
@@ -65,7 +66,7 @@
                     FORMAT_MESSAGE_FROM_SYSTEM  |
                     FORMAT_MESSAGE_IGNORE_INSERTS,
                     NULL,
-                    (int)retval,
+                    error,
                     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                     (LPTSTR)&buffer,
                     0,
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Wed Jul 05 20:20:43 2017 +0200
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMSignatureMethod.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -111,6 +111,34 @@
         }
     }
 
+    /**
+     * Returns the signature bytes with any additional formatting
+     * necessary for the signature algorithm used. For RSA signatures,
+     * no changes are required, and this method should simply return
+     * back {@code sig}. For DSA and ECDSA, this method should return the
+     * signature in the IEEE P1363 format, the concatenation of r and s.
+     *
+     * @param key the key used to sign
+     * @param sig the signature returned by {@code Signature.sign()}
+     * @return the formatted signature
+     * @throws IOException
+     */
+    abstract byte[] postSignFormat(Key key, byte[] sig) throws IOException;
+
+    /**
+     * Returns the signature bytes with any conversions that are necessary
+     * before the signature can be verified. For RSA signatures,
+     * no changes are required, and this method should simply
+     * return back {@code sig}. For DSA and ECDSA, this method should
+     * return the signature in the DER-encoded ASN.1 format.
+     *
+     * @param key the key used to sign
+     * @param sig the signature
+     * @return the formatted signature
+     * @throws IOException
+     */
+    abstract byte[] preVerifyFormat(Key key, byte[] sig) throws IOException;
+
     static SignatureMethod unmarshal(Element smElem) throws MarshalException {
         String alg = DOMUtils.getAttributeValue(smElem, "Algorithm");
         if (alg.equals(SignatureMethod.RSA_SHA1)) {
@@ -151,6 +179,23 @@
         return params;
     }
 
+    /**
+     * Returns an instance of Signature from the specified Provider.
+     * The algorithm is specified by the {@code getJCAAlgorithm()} method.
+     *
+     * @param p the Provider to use
+     * @return an instance of Signature implementing the algorithm
+     *    specified by {@code getJCAAlgorithm()}
+     * @throws NoSuchAlgorithmException if the Provider does not support the
+     *    signature algorithm
+     */
+    Signature getSignature(Provider p)
+            throws NoSuchAlgorithmException {
+        return (p == null)
+            ? Signature.getInstance(getJCAAlgorithm())
+            : Signature.getInstance(getJCAAlgorithm(), p);
+    }
+
     boolean verify(Key key, SignedInfo si, byte[] sig,
                    XMLValidateContext context)
         throws InvalidKeyException, SignatureException, XMLSignatureException
@@ -163,38 +208,30 @@
             throw new InvalidKeyException("key must be PublicKey");
         }
         if (signature == null) {
+            Provider p = (Provider)context.getProperty(
+                    "org.jcp.xml.dsig.internal.dom.SignatureProvider");
             try {
-                Provider p = (Provider)context.getProperty
-                    ("org.jcp.xml.dsig.internal.dom.SignatureProvider");
-                signature = (p == null)
-                    ? Signature.getInstance(getJCAAlgorithm())
-                    : Signature.getInstance(getJCAAlgorithm(), p);
+                signature = getSignature(p);
             } catch (NoSuchAlgorithmException nsae) {
                 throw new XMLSignatureException(nsae);
             }
         }
         signature.initVerify((PublicKey)key);
         if (log.isLoggable(java.util.logging.Level.FINE)) {
-            log.log(java.util.logging.Level.FINE, "Signature provider:" + signature.getProvider());
+            log.log(java.util.logging.Level.FINE,
+                    "Signature provider:" + signature.getProvider());
             log.log(java.util.logging.Level.FINE, "verifying with key: " + key);
         }
         ((DOMSignedInfo)si).canonicalize(context,
                                          new SignerOutputStream(signature));
-
+        byte[] s;
         try {
-            Type type = getAlgorithmType();
-            if (type == Type.DSA) {
-                int size = ((DSAKey)key).getParams().getQ().bitLength();
-                return signature.verify(JavaUtils.convertDsaXMLDSIGtoASN1(sig,
-                                                                       size/8));
-            } else if (type == Type.ECDSA) {
-                return signature.verify(SignatureECDSA.convertXMLDSIGtoASN1(sig));
-            } else {
-                return signature.verify(sig);
-            }
+            // Do any necessary format conversions
+            s = preVerifyFormat(key, sig);
         } catch (IOException ioe) {
             throw new XMLSignatureException(ioe);
         }
+        return signature.verify(s);
     }
 
     byte[] sign(Key key, SignedInfo si, XMLSignContext context)
@@ -208,19 +245,18 @@
             throw new InvalidKeyException("key must be PrivateKey");
         }
         if (signature == null) {
+            Provider p = (Provider)context.getProperty(
+                    "org.jcp.xml.dsig.internal.dom.SignatureProvider");
             try {
-                Provider p = (Provider)context.getProperty
-                    ("org.jcp.xml.dsig.internal.dom.SignatureProvider");
-                signature = (p == null)
-                    ? Signature.getInstance(getJCAAlgorithm())
-                    : Signature.getInstance(getJCAAlgorithm(), p);
+                signature = getSignature(p);
             } catch (NoSuchAlgorithmException nsae) {
                 throw new XMLSignatureException(nsae);
             }
         }
         signature.initSign((PrivateKey)key);
         if (log.isLoggable(java.util.logging.Level.FINE)) {
-            log.log(java.util.logging.Level.FINE, "Signature provider:" + signature.getProvider());
+            log.log(java.util.logging.Level.FINE,
+                    "Signature provider:" + signature.getProvider());
             log.log(java.util.logging.Level.FINE, "Signing with key: " + key);
         }
 
@@ -228,24 +264,171 @@
                                          new SignerOutputStream(signature));
 
         try {
-            Type type = getAlgorithmType();
-            if (type == Type.DSA) {
-                int size = ((DSAKey)key).getParams().getQ().bitLength();
-                return JavaUtils.convertDsaASN1toXMLDSIG(signature.sign(),
-                                                         size/8);
-            } else if (type == Type.ECDSA) {
-                return SignatureECDSA.convertASN1toXMLDSIG(signature.sign());
-            } else {
-                return signature.sign();
-            }
-        } catch (SignatureException se) {
-            throw new XMLSignatureException(se);
-        } catch (IOException ioe) {
-            throw new XMLSignatureException(ioe);
+            // Return signature with any necessary format conversions
+            return postSignFormat(key, signature.sign());
+        } catch (SignatureException | IOException ex){
+            throw new XMLSignatureException(ex);
+        }
+    }
+
+    abstract static class AbstractRSASignatureMethod
+            extends DOMSignatureMethod {
+
+        AbstractRSASignatureMethod(AlgorithmParameterSpec params)
+                throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+
+        AbstractRSASignatureMethod(Element dmElem) throws MarshalException {
+            super(dmElem);
+        }
+
+        /**
+         * Returns {@code sig}. No extra formatting is necessary for RSA.
+         */
+        @Override
+        byte[] postSignFormat(Key key, byte[] sig) {
+            return sig;
+        }
+
+        /**
+         * Returns {@code sig}. No extra formatting is necessary for RSA.
+         */
+        @Override
+        byte[] preVerifyFormat(Key key, byte[] sig) {
+            return sig;
         }
     }
 
-    static final class SHA1withRSA extends DOMSignatureMethod {
+    /**
+     * Abstract class to support signature algorithms that sign and verify
+     * signatures in the IEEE P1363 format. The P1363 format is the
+     * concatenation of r and s in DSA and ECDSA signatures, and thus, only
+     * DSA and ECDSA signature methods should extend this class. Subclasses
+     * must supply a fallback algorithm to be used when the provider does
+     * not offer signature algorithms that use the P1363 format.
+     */
+    abstract static class AbstractP1363FormatSignatureMethod
+            extends DOMSignatureMethod {
+
+        /* Set to true when the fallback algorithm is used */
+        boolean asn1;
+
+        AbstractP1363FormatSignatureMethod(AlgorithmParameterSpec params)
+                throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+
+        AbstractP1363FormatSignatureMethod(Element dmElem)
+                throws MarshalException {
+            super(dmElem);
+        }
+
+        /**
+         * Return the fallback algorithm to be used when the provider does not
+         * support signatures in the IEEE P1363 format. This algorithm should
+         * return signatures in the DER-encoded ASN.1 format.
+         */
+        abstract String getJCAFallbackAlgorithm();
+
+        /*
+         * Try to return an instance of Signature implementing signatures
+         * in the IEEE P1363 format. If the provider doesn't support the
+         * P1363 format, return an instance of Signature implementing
+         * signatures in the DER-encoded ASN.1 format.
+         */
+        @Override
+        Signature getSignature(Provider p)
+                throws NoSuchAlgorithmException {
+            try {
+                return (p == null)
+                    ? Signature.getInstance(getJCAAlgorithm())
+                    : Signature.getInstance(getJCAAlgorithm(), p);
+            } catch (NoSuchAlgorithmException nsae) {
+                Signature s = (p == null)
+                    ? Signature.getInstance(getJCAFallbackAlgorithm())
+                    : Signature.getInstance(getJCAFallbackAlgorithm(), p);
+                asn1 = true;
+                return s;
+            }
+        }
+    }
+
+    abstract static class AbstractDSASignatureMethod
+        extends AbstractP1363FormatSignatureMethod {
+
+        AbstractDSASignatureMethod(AlgorithmParameterSpec params)
+                throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+
+        AbstractDSASignatureMethod(Element dmElem) throws MarshalException {
+            super(dmElem);
+        }
+
+        @Override
+        byte[] postSignFormat(Key key, byte[] sig) throws IOException {
+            // If signature is in ASN.1 (i.e., if the fallback algorithm
+            // was used), convert the signature to the P1363 format
+            if (asn1) {
+                int size = ((DSAKey) key).getParams().getQ().bitLength();
+                return JavaUtils.convertDsaASN1toXMLDSIG(sig, size / 8);
+            } else {
+                return sig;
+            }
+        }
+
+        @Override
+        byte[] preVerifyFormat(Key key, byte[] sig) throws IOException {
+            // If signature needs to be in ASN.1 (i.e., if the fallback
+            // algorithm will be used to verify the sig), convert the signature
+            // to the ASN.1 format
+            if (asn1) {
+                int size = ((DSAKey) key).getParams().getQ().bitLength();
+                return JavaUtils.convertDsaXMLDSIGtoASN1(sig, size / 8);
+            } else {
+                return sig;
+            }
+        }
+    }
+
+    abstract static class AbstractECDSASignatureMethod
+        extends AbstractP1363FormatSignatureMethod {
+
+        AbstractECDSASignatureMethod(AlgorithmParameterSpec params)
+                throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+
+        AbstractECDSASignatureMethod(Element dmElem) throws MarshalException {
+            super(dmElem);
+        }
+
+        @Override
+        byte[] postSignFormat(Key key, byte[] sig) throws IOException {
+            // If signature is in ASN.1 (i.e., if the fallback algorithm
+            // was used), convert the signature to the P1363 format
+            if (asn1) {
+                return SignatureECDSA.convertASN1toXMLDSIG(sig);
+            } else {
+                return sig;
+            }
+        }
+
+        @Override
+        byte[] preVerifyFormat(Key key, byte[] sig) throws IOException {
+            // If signature needs to be in ASN.1 (i.e., if the fallback
+            // algorithm will be used to verify the sig), convert the signature
+            // to the ASN.1 format
+            if (asn1) {
+                return SignatureECDSA.convertXMLDSIGtoASN1(sig);
+            } else {
+                return sig;
+            }
+        }
+    }
+
+    static final class SHA1withRSA extends AbstractRSASignatureMethod {
         SHA1withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -264,7 +447,7 @@
         }
     }
 
-    static final class SHA256withRSA extends DOMSignatureMethod {
+    static final class SHA256withRSA extends AbstractRSASignatureMethod {
         SHA256withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -283,7 +466,7 @@
         }
     }
 
-    static final class SHA384withRSA extends DOMSignatureMethod {
+    static final class SHA384withRSA extends AbstractRSASignatureMethod {
         SHA384withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -302,7 +485,7 @@
         }
     }
 
-    static final class SHA512withRSA extends DOMSignatureMethod {
+    static final class SHA512withRSA extends AbstractRSASignatureMethod {
         SHA512withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -321,7 +504,7 @@
         }
     }
 
-    static final class SHA1withDSA extends DOMSignatureMethod {
+    static final class SHA1withDSA extends AbstractDSASignatureMethod {
         SHA1withDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -333,6 +516,9 @@
             return SignatureMethod.DSA_SHA1;
         }
         String getJCAAlgorithm() {
+            return "SHA1withDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA1withDSA";
         }
         Type getAlgorithmType() {
@@ -340,7 +526,7 @@
         }
     }
 
-    static final class SHA256withDSA extends DOMSignatureMethod {
+    static final class SHA256withDSA extends AbstractDSASignatureMethod {
         SHA256withDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -352,6 +538,9 @@
             return DSA_SHA256;
         }
         String getJCAAlgorithm() {
+            return "SHA256withDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA256withDSA";
         }
         Type getAlgorithmType() {
@@ -359,7 +548,7 @@
         }
     }
 
-    static final class SHA1withECDSA extends DOMSignatureMethod {
+    static final class SHA1withECDSA extends AbstractECDSASignatureMethod {
         SHA1withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -371,6 +560,9 @@
             return ECDSA_SHA1;
         }
         String getJCAAlgorithm() {
+            return "SHA1withECDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA1withECDSA";
         }
         Type getAlgorithmType() {
@@ -378,7 +570,7 @@
         }
     }
 
-    static final class SHA256withECDSA extends DOMSignatureMethod {
+    static final class SHA256withECDSA extends AbstractECDSASignatureMethod {
         SHA256withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -390,6 +582,9 @@
             return ECDSA_SHA256;
         }
         String getJCAAlgorithm() {
+            return "SHA256withECDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA256withECDSA";
         }
         Type getAlgorithmType() {
@@ -397,7 +592,7 @@
         }
     }
 
-    static final class SHA384withECDSA extends DOMSignatureMethod {
+    static final class SHA384withECDSA extends AbstractECDSASignatureMethod {
         SHA384withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -409,6 +604,9 @@
             return ECDSA_SHA384;
         }
         String getJCAAlgorithm() {
+            return "SHA384withECDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA384withECDSA";
         }
         Type getAlgorithmType() {
@@ -416,7 +614,7 @@
         }
     }
 
-    static final class SHA512withECDSA extends DOMSignatureMethod {
+    static final class SHA512withECDSA extends AbstractECDSASignatureMethod {
         SHA512withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
             super(params);
@@ -428,6 +626,9 @@
             return ECDSA_SHA512;
         }
         String getJCAAlgorithm() {
+            return "SHA512withECDSAinP1363Format";
+        }
+        String getJCAFallbackAlgorithm() {
             return "SHA512withECDSA";
         }
         Type getAlgorithmType() {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.HistoricallyNamedCharset;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
-{
-    public Big5_HKSCS() {
-        super("Big5-HKSCS", ExtendedCharsets.aliasesFor("Big5-HKSCS"));
-    }
-
-    public String historicalName() {
-        return "Big5_HKSCS";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof Big5)
-                || (cs instanceof Big5_HKSCS));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    static class Decoder extends HKSCS.Decoder {
-        private static DoubleByte.Decoder big5 =
-            (DoubleByte.Decoder)new Big5().newDecoder();
-
-        private static char[][] b2cBmp = new char[0x100][];
-        private static char[][] b2cSupp = new char[0x100][];
-        static {
-            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
-            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
-        }
-
-        private Decoder(Charset cs) {
-            super(cs, big5, b2cBmp, b2cSupp);
-        }
-    }
-
-    static class Encoder extends HKSCS.Encoder {
-        private static DoubleByte.Encoder big5 =
-            (DoubleByte.Encoder)new Big5().newEncoder();
-
-        static char[][] c2bBmp = new char[0x100][];
-        static char[][] c2bSupp = new char[0x100][];
-        static {
-            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
-            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
-        }
-
-        private Encoder(Charset cs) {
-            super(cs, big5, c2bBmp, c2bSupp);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2010 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 $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.HKSCS;
+import sun.nio.cs.HistoricallyNamedCharset;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
+{
+    public Big5_HKSCS() {
+        super("Big5-HKSCS", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "Big5_HKSCS";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof Big5)
+                || (cs instanceof Big5_HKSCS));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    static class Decoder extends HKSCS.Decoder {
+        private static DoubleByte.Decoder big5 =
+            (DoubleByte.Decoder)new Big5().newDecoder();
+
+        private static char[][] b2cBmp = new char[0x100][];
+        private static char[][] b2cSupp = new char[0x100][];
+        static {
+            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
+            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
+        }
+
+        private Decoder(Charset cs) {
+            super(cs, big5, b2cBmp, b2cSupp);
+        }
+    }
+
+    static class Encoder extends HKSCS.Encoder {
+        private static DoubleByte.Encoder big5 =
+            (DoubleByte.Encoder)new Big5().newEncoder();
+
+        static char[][] c2bBmp = new char[0x100][];
+        static char[][] c2bSupp = new char[0x100][];
+        static {
+            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
+            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
+        }
+
+        private Encoder(Charset cs) {
+            super(cs, big5, c2bBmp, c2bSupp);
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,7 +28,9 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
 
 public class Big5_HKSCS_2001 extends Charset
 {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_Solaris.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.HistoricallyNamedCharset;
-import java.util.Arrays;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
-{
-    public Big5_Solaris() {
-        super("x-Big5-Solaris", ExtendedCharsets.aliasesFor("x-Big5-Solaris"));
-    }
-
-    public String historicalName() {
-        return "Big5_Solaris";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof Big5)
-                || (cs instanceof Big5_Solaris));
-    }
-
-    public CharsetDecoder newDecoder() {
-        initb2c();
-        return new  DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe);
-    }
-
-    public CharsetEncoder newEncoder() {
-        initc2b();
-        return new DoubleByte.Encoder(this, c2b, c2bIndex);
-    }
-
-    static char[][] b2c;
-    static char[] b2cSB;
-    private static volatile boolean b2cInitialized = false;
-
-    static void initb2c() {
-        if (b2cInitialized)
-            return;
-        synchronized (Big5_Solaris.class) {
-            if (b2cInitialized)
-                return;
-            Big5.initb2c();
-            b2c = Big5.b2c.clone();
-            // Big5 Solaris implementation has 7 additional mappings
-            int[] sol = new int[] {
-                0xF9D6, 0x7881,
-                0xF9D7, 0x92B9,
-                0xF9D8, 0x88CF,
-                0xF9D9, 0x58BB,
-                0xF9DA, 0x6052,
-                0xF9DB, 0x7CA7,
-                0xF9DC, 0x5AFA };
-            if (b2c[0xf9] == DoubleByte.B2C_UNMAPPABLE) {
-                b2c[0xf9] = new char[0xfe - 0x40 + 1];
-                Arrays.fill(b2c[0xf9], UNMAPPABLE_DECODING);
-            }
-
-            for (int i = 0; i < sol.length;) {
-                b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
-            }
-            b2cSB = Big5.b2cSB;
-            b2cInitialized = true;
-        }
-    }
-
-    static char[] c2b;
-    static char[] c2bIndex;
-    private static volatile boolean c2bInitialized = false;
-
-    static void initc2b() {
-        if (c2bInitialized)
-            return;
-        synchronized (Big5_Solaris.class) {
-            if (c2bInitialized)
-                return;
-            Big5.initc2b();
-            c2b = Big5.c2b.clone();
-            c2bIndex = Big5.c2bIndex.clone();
-            int[] sol = new int[] {
-                0x7881, 0xF9D6,
-                0x92B9, 0xF9D7,
-                0x88CF, 0xF9D8,
-                0x58BB, 0xF9D9,
-                0x6052, 0xF9DA,
-                0x7CA7, 0xF9DB,
-                0x5AFA, 0xF9DC };
-
-            for (int i = 0; i < sol.length;) {
-                int c = sol[i++];
-                // no need to check c2bIndex[c >>8], we know it points
-                // to the appropriate place.
-                c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
-            }
-            c2bInitialized = true;
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_Solaris.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2004, 2010, 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 $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.HistoricallyNamedCharset;
+import java.util.Arrays;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
+{
+    public Big5_Solaris() {
+        super("x-Big5-Solaris", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "Big5_Solaris";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof Big5)
+                || (cs instanceof Big5_Solaris));
+    }
+
+    public CharsetDecoder newDecoder() {
+        initb2c();
+        return new  DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe);
+    }
+
+    public CharsetEncoder newEncoder() {
+        initc2b();
+        return new DoubleByte.Encoder(this, c2b, c2bIndex);
+    }
+
+    static char[][] b2c;
+    static char[] b2cSB;
+    private static volatile boolean b2cInitialized = false;
+
+    static void initb2c() {
+        if (b2cInitialized)
+            return;
+        synchronized (Big5_Solaris.class) {
+            if (b2cInitialized)
+                return;
+            Big5.initb2c();
+            b2c = Big5.b2c.clone();
+            // Big5 Solaris implementation has 7 additional mappings
+            int[] sol = new int[] {
+                0xF9D6, 0x7881,
+                0xF9D7, 0x92B9,
+                0xF9D8, 0x88CF,
+                0xF9D9, 0x58BB,
+                0xF9DA, 0x6052,
+                0xF9DB, 0x7CA7,
+                0xF9DC, 0x5AFA };
+            if (b2c[0xf9] == DoubleByte.B2C_UNMAPPABLE) {
+                b2c[0xf9] = new char[0xfe - 0x40 + 1];
+                Arrays.fill(b2c[0xf9], UNMAPPABLE_DECODING);
+            }
+
+            for (int i = 0; i < sol.length;) {
+                b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
+            }
+            b2cSB = Big5.b2cSB;
+            b2cInitialized = true;
+        }
+    }
+
+    static char[] c2b;
+    static char[] c2bIndex;
+    private static volatile boolean c2bInitialized = false;
+
+    static void initc2b() {
+        if (c2bInitialized)
+            return;
+        synchronized (Big5_Solaris.class) {
+            if (c2bInitialized)
+                return;
+            Big5.initc2b();
+            c2b = Big5.c2b.clone();
+            c2bIndex = Big5.c2bIndex.clone();
+            int[] sol = new int[] {
+                0x7881, 0xF9D6,
+                0x92B9, 0xF9D7,
+                0x88CF, 0xF9D8,
+                0x58BB, 0xF9D9,
+                0x6052, 0xF9DA,
+                0x7CA7, 0xF9DB,
+                0x5AFA, 0xF9DC };
+
+            for (int i = 0; i < sol.length;) {
+                int c = sol[i++];
+                // no need to check c2bIndex[c >>8], we know it points
+                // to the appropriate place.
+                c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
+            }
+            c2bInitialized = true;
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/DelegatableDecoder.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.CoderResult;
-
-/**
- * A decoder that can be delegated to by another decoder
- * when normal inheritance cannot be used.
- * Used by autodecting decoders.
- */
-interface DelegatableDecoder {
-    CoderResult decodeLoop(ByteBuffer src, CharBuffer dst);
-    void implReset();
-    CoderResult implFlush(CharBuffer out);
-}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/DoubleByte.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,929 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import java.util.Arrays;
-import sun.nio.cs.Surrogate;
-import sun.nio.cs.ArrayDecoder;
-import sun.nio.cs.ArrayEncoder;
-import static sun.nio.cs.CharsetMapping.*;
-
-/*
- * Four types of "DoubleByte" charsets are implemented in this class
- * (1)DoubleByte
- *    The "mostly widely used" multibyte charset, a combination of
- *    a singlebyte character set (usually the ASCII charset) and a
- *    doublebyte character set. The codepoint values of singlebyte
- *    and doublebyte don't overlap. Microsoft's multibyte charsets
- *    and IBM's "DBCS_ASCII" charsets, such as IBM1381, 942, 943,
- *    948, 949 and 950 are such charsets.
- *
- * (2)DoubleByte_EBCDIC
- *    IBM EBCDIC Mix multibyte charset. Use SO and SI to shift (switch)
- *    in and out between the singlebyte character set and doublebyte
- *    character set.
- *
- * (3)DoubleByte_SIMPLE_EUC
- *    It's a "simple" form of EUC encoding scheme, only have the
- *    singlebyte character set G0 and one doublebyte character set
- *    G1 are defined, G2 (with SS2) and G3 (with SS3) are not used.
- *    So it is actually the same as the "typical" type (1) mentioned
- *    above, except it return "malformed" for the SS2 and SS3 when
- *    decoding.
- *
- * (4)DoubleByte ONLY
- *    A "pure" doublebyte only character set. From implementation
- *    point of view, this is the type (1) with "decodeSingle" always
- *    returns unmappable.
- *
- * For simplicity, all implementations share the same decoding and
- * encoding data structure.
- *
- * Decoding:
- *
- *    char[][] b2c;
- *    char[] b2cSB;
- *    int b2Min, b2Max
- *
- *    public char decodeSingle(int b) {
- *        return b2cSB.[b];
- *    }
- *
- *    public char decodeDouble(int b1, int b2) {
- *        if (b2 < b2Min || b2 > b2Max)
- *            return UNMAPPABLE_DECODING;
- *         return b2c[b1][b2 - b2Min];
- *    }
- *
- *    (1)b2Min, b2Max are the corresponding min and max value of the
- *       low-half of the double-byte.
- *    (2)The high 8-bit/b1 of the double-byte are used to indexed into
- *       b2c array.
- *
- * Encoding:
- *
- *    char[] c2b;
- *    char[] c2bIndex;
- *
- *    public int encodeChar(char ch) {
- *        return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
- *    }
- *
- */
-
-public class DoubleByte {
-
-    public final static char[] B2C_UNMAPPABLE;
-    static {
-        B2C_UNMAPPABLE = new char[0x100];
-        Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING);
-    }
-
-    public static class Decoder extends CharsetDecoder
-                                implements DelegatableDecoder, ArrayDecoder
-    {
-        final char[][] b2c;
-        final char[] b2cSB;
-        final int b2Min;
-        final int b2Max;
-
-        // for SimpleEUC override
-        protected CoderResult crMalformedOrUnderFlow(int b) {
-            return CoderResult.UNDERFLOW;
-        }
-
-        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
-            if (b2c[b1] == B2C_UNMAPPABLE ||                // isNotLeadingByte(b1)
-                b2c[b2] != B2C_UNMAPPABLE ||                // isLeadingByte(b2)
-                decodeSingle(b2) != UNMAPPABLE_DECODING) {  // isSingle(b2)
-                return CoderResult.malformedForLength(1);
-            }
-            return CoderResult.unmappableForLength(2);
-        }
-
-        Decoder(Charset cs, float avgcpb, float maxcpb,
-                char[][] b2c, char[] b2cSB,
-                int b2Min, int b2Max) {
-            super(cs, avgcpb, maxcpb);
-            this.b2c = b2c;
-            this.b2cSB = b2cSB;
-            this.b2Min = b2Min;
-            this.b2Max = b2Max;
-        }
-
-        Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
-            this(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
-        }
-
-        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
-            byte[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-
-            char[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                while (sp < sl && dp < dl) {
-                    // inline the decodeSingle/Double() for better performance
-                    int inSize = 1;
-                    int b1 = sa[sp] & 0xff;
-                    char c = b2cSB[b1];
-                    if (c == UNMAPPABLE_DECODING) {
-                        if (sl - sp < 2)
-                            return crMalformedOrUnderFlow(b1);
-                        int b2 = sa[sp + 1] & 0xff;
-                        if (b2 < b2Min || b2 > b2Max ||
-                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                            return crMalformedOrUnmappable(b1, b2);
-                        }
-                        inSize++;
-                    }
-                    da[dp++] = c;
-                    sp += inSize;
-                }
-                return (sp >= sl) ? CoderResult.UNDERFLOW
-                                  : CoderResult.OVERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
-            int mark = src.position();
-            try {
-
-                while (src.hasRemaining() && dst.hasRemaining()) {
-                    int b1 = src.get() & 0xff;
-                    char c = b2cSB[b1];
-                    int inSize = 1;
-                    if (c == UNMAPPABLE_DECODING) {
-                        if (src.remaining() < 1)
-                            return crMalformedOrUnderFlow(b1);
-                        int b2 = src.get() & 0xff;
-                        if (b2 < b2Min || b2 > b2Max ||
-                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING)
-                            return crMalformedOrUnmappable(b1, b2);
-                        inSize++;
-                    }
-                    dst.put(c);
-                    mark += inSize;
-                }
-                return src.hasRemaining()? CoderResult.OVERFLOW
-                                         : CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        // Make some protected methods public for use by JISAutoDetect
-        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
-            if (src.hasArray() && dst.hasArray())
-                return decodeArrayLoop(src, dst);
-            else
-                return decodeBufferLoop(src, dst);
-        }
-
-        public int decode(byte[] src, int sp, int len, char[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            char repl = replacement().charAt(0);
-            while (sp < sl) {
-                int b1 = src[sp++] & 0xff;
-                char c = b2cSB[b1];
-                if (c == UNMAPPABLE_DECODING) {
-                    if (sp < sl) {
-                        int b2 = src[sp++] & 0xff;
-                        if (b2 < b2Min || b2 > b2Max ||
-                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                            if (b2c[b1] == B2C_UNMAPPABLE ||  // isNotLeadingByte
-                                b2c[b2] != B2C_UNMAPPABLE ||  // isLeadingByte
-                                decodeSingle(b2) != UNMAPPABLE_DECODING) {
-                                sp--;
-                            }
-                        }
-                    }
-                    if (c == UNMAPPABLE_DECODING) {
-                        c = repl;
-                    }
-                }
-                dst[dp++] = c;
-            }
-            return dp;
-        }
-
-        public void implReset() {
-            super.implReset();
-        }
-
-        public CoderResult implFlush(CharBuffer out) {
-            return super.implFlush(out);
-        }
-
-        // decode loops are not using decodeSingle/Double() for performance
-        // reason.
-        public char decodeSingle(int b) {
-            return b2cSB[b];
-        }
-
-        public char decodeDouble(int b1, int b2) {
-            if (b1 < 0 || b1 > b2c.length ||
-                b2 < b2Min || b2 > b2Max)
-                return UNMAPPABLE_DECODING;
-            return  b2c[b1][b2 - b2Min];
-        }
-    }
-
-    // IBM_EBCDIC_DBCS
-    public static class Decoder_EBCDIC extends Decoder {
-        private static final int SBCS = 0;
-        private static final int DBCS = 1;
-        private static final int SO = 0x0e;
-        private static final int SI = 0x0f;
-        private int  currentState;
-
-        Decoder_EBCDIC(Charset cs,
-                       char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
-            super(cs, b2c, b2cSB, b2Min, b2Max);
-        }
-
-        public void implReset() {
-            currentState = SBCS;
-        }
-
-        // Check validity of dbcs ebcdic byte pair values
-        //
-        // First byte : 0x41 -- 0xFE
-        // Second byte: 0x41 -- 0xFE
-        // Doublebyte blank: 0x4040
-        //
-        // The validation implementation in "old" DBCS_IBM_EBCDIC and sun.io
-        // as
-        //            if ((b1 != 0x40 || b2 != 0x40) &&
-        //                (b2 < 0x41 || b2 > 0xfe)) {...}
-        // is not correct/complete (range check for b1)
-        //
-        private static boolean isDoubleByte(int b1, int b2) {
-            return (0x41 <= b1 && b1 <= 0xfe && 0x41 <= b2 && b2 <= 0xfe)
-                   || (b1 == 0x40 && b2 == 0x40); // DBCS-HOST SPACE
-        }
-
-        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
-            byte[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-            char[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                // don't check dp/dl together here, it's possible to
-                // decdoe a SO/SI without space in output buffer.
-                while (sp < sl) {
-                    int b1 = sa[sp] & 0xff;
-                    int inSize = 1;
-                    if (b1 == SO) {  // Shift out
-                        if (currentState != SBCS)
-                            return CoderResult.malformedForLength(1);
-                        else
-                            currentState = DBCS;
-                    } else if (b1 == SI) {
-                        if (currentState != DBCS)
-                            return CoderResult.malformedForLength(1);
-                        else
-                            currentState = SBCS;
-                    } else {
-                        char c =  UNMAPPABLE_DECODING;
-                        if (currentState == SBCS) {
-                            c = b2cSB[b1];
-                            if (c == UNMAPPABLE_DECODING)
-                                return CoderResult.unmappableForLength(1);
-                        } else {
-                            if (sl - sp < 2)
-                                return CoderResult.UNDERFLOW;
-                            int b2 = sa[sp + 1] & 0xff;
-                            if (b2 < b2Min || b2 > b2Max ||
-                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                                if (!isDoubleByte(b1, b2))
-                                    return CoderResult.malformedForLength(2);
-                                return CoderResult.unmappableForLength(2);
-                            }
-                            inSize++;
-                        }
-                        if (dl - dp < 1)
-                            return CoderResult.OVERFLOW;
-
-                        da[dp++] = c;
-                    }
-                    sp += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
-            int mark = src.position();
-            try {
-                while (src.hasRemaining()) {
-                    int b1 = src.get() & 0xff;
-                    int inSize = 1;
-                    if (b1 == SO) {  // Shift out
-                        if (currentState != SBCS)
-                            return CoderResult.malformedForLength(1);
-                        else
-                            currentState = DBCS;
-                    } else if (b1 == SI) {
-                        if (currentState != DBCS)
-                            return CoderResult.malformedForLength(1);
-                        else
-                            currentState = SBCS;
-                    } else {
-                        char c = UNMAPPABLE_DECODING;
-                        if (currentState == SBCS) {
-                            c = b2cSB[b1];
-                            if (c == UNMAPPABLE_DECODING)
-                                return CoderResult.unmappableForLength(1);
-                        } else {
-                            if (src.remaining() < 1)
-                                return CoderResult.UNDERFLOW;
-                            int b2 = src.get()&0xff;
-                            if (b2 < b2Min || b2 > b2Max ||
-                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                                if (!isDoubleByte(b1, b2))
-                                    return CoderResult.malformedForLength(2);
-                                return CoderResult.unmappableForLength(2);
-                            }
-                            inSize++;
-                        }
-
-                        if (dst.remaining() < 1)
-                            return CoderResult.OVERFLOW;
-
-                        dst.put(c);
-                    }
-                    mark += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        public int decode(byte[] src, int sp, int len, char[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            currentState = SBCS;
-            char repl = replacement().charAt(0);
-            while (sp < sl) {
-                int b1 = src[sp++] & 0xff;
-                if (b1 == SO) {  // Shift out
-                    if (currentState != SBCS)
-                        dst[dp++] = repl;
-                    else
-                        currentState = DBCS;
-                } else if (b1 == SI) {
-                    if (currentState != DBCS)
-                        dst[dp++] = repl;
-                    else
-                        currentState = SBCS;
-                } else {
-                    char c =  UNMAPPABLE_DECODING;
-                    if (currentState == SBCS) {
-                        c = b2cSB[b1];
-                        if (c == UNMAPPABLE_DECODING)
-                            c = repl;
-                    } else {
-                        if (sl == sp) {
-                            c = repl;
-                        } else {
-                            int b2 = src[sp++] & 0xff;
-                            if (b2 < b2Min || b2 > b2Max ||
-                                (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                                c = repl;
-                            }
-                        }
-                    }
-                    dst[dp++] = c;
-                }
-            }
-            return dp;
-        }
-    }
-
-    // DBCS_ONLY
-    public static class Decoder_DBCSONLY extends Decoder {
-        static final char[] b2cSB_UNMAPPABLE;
-        static {
-            b2cSB_UNMAPPABLE = new char[0x100];
-            Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
-        }
-        Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
-            super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max);
-        }
-    }
-
-    // EUC_SIMPLE
-    // The only thing we need to "override" is to check SS2/SS3 and
-    // return "malformed" if found
-    public static class Decoder_EUC_SIM extends Decoder {
-        private final int SS2 =  0x8E;
-        private final int SS3 =  0x8F;
-
-        Decoder_EUC_SIM(Charset cs,
-                        char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
-            super(cs, b2c, b2cSB, b2Min, b2Max);
-        }
-
-        // No support provided for G2/G3 for SimpleEUC
-        protected CoderResult crMalformedOrUnderFlow(int b) {
-            if (b == SS2 || b == SS3 )
-                return CoderResult.malformedForLength(1);
-            return CoderResult.UNDERFLOW;
-        }
-
-        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
-            if (b1 == SS2 || b1 == SS3 )
-                return CoderResult.malformedForLength(1);
-            return CoderResult.unmappableForLength(2);
-        }
-
-        public int decode(byte[] src, int sp, int len, char[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            char repl = replacement().charAt(0);
-            while (sp < sl) {
-                int b1 = src[sp++] & 0xff;
-                char c = b2cSB[b1];
-                if (c == UNMAPPABLE_DECODING) {
-                    if (sp < sl) {
-                        int b2 = src[sp++] & 0xff;
-                        if (b2 < b2Min || b2 > b2Max ||
-                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                            if (b1 == SS2 || b1 == SS3) {
-                                sp--;
-                            }
-                            c = repl;
-                        }
-                    } else {
-                        c = repl;
-                    }
-                }
-                dst[dp++] = c;
-            }
-            return dp;
-        }
-    }
-
-    public static class Encoder extends CharsetEncoder
-                                implements ArrayEncoder
-    {
-        final int MAX_SINGLEBYTE = 0xff;
-        private final char[] c2b;
-        private final char[] c2bIndex;
-        Surrogate.Parser sgp;
-
-        protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
-            super(cs, 2.0f, 2.0f);
-            this.c2b = c2b;
-            this.c2bIndex = c2bIndex;
-        }
-
-        Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
-            super(cs, avg, max, repl);
-            this.c2b = c2b;
-            this.c2bIndex = c2bIndex;
-        }
-
-        public boolean canEncode(char c) {
-            return encodeChar(c) != UNMAPPABLE_ENCODING;
-        }
-
-        Surrogate.Parser sgp() {
-            if (sgp == null)
-                sgp = new Surrogate.Parser();
-            return sgp;
-        }
-
-        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
-            char[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-
-            byte[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                while (sp < sl) {
-                    char c = sa[sp];
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            if (sgp().parse(c, sa, sp, sl) < 0)
-                                return sgp.error();
-                            return sgp.unmappableResult();
-                        }
-                        return CoderResult.unmappableForLength(1);
-                    }
-
-                    if (bb > MAX_SINGLEBYTE) {    // DoubleByte
-                        if (dl - dp < 2)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)(bb >> 8);
-                        da[dp++] = (byte)bb;
-                    } else {                      // SingleByte
-                        if (dl - dp < 1)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)bb;
-                    }
-
-                    sp++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
-            int mark = src.position();
-            try {
-                while (src.hasRemaining()) {
-                    char c = src.get();
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            if (sgp().parse(c, src) < 0)
-                                return sgp.error();
-                            return sgp.unmappableResult();
-                        }
-                        return CoderResult.unmappableForLength(1);
-                    }
-                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
-                        if (dst.remaining() < 2)
-                            return CoderResult.OVERFLOW;
-                        dst.put((byte)(bb >> 8));
-                        dst.put((byte)(bb));
-                    } else {
-                        if (dst.remaining() < 1)
-                        return CoderResult.OVERFLOW;
-                        dst.put((byte)bb);
-                    }
-                    mark++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
-            if (src.hasArray() && dst.hasArray())
-                return encodeArrayLoop(src, dst);
-            else
-                return encodeBufferLoop(src, dst);
-        }
-
-        protected byte[] repl = replacement();
-        protected void implReplaceWith(byte[] newReplacement) {
-            repl = newReplacement;
-        }
-
-        public int encode(char[] src, int sp, int len, byte[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            int dl = dst.length;
-            while (sp < sl) {
-                char c = src[sp++];
-                int bb = encodeChar(c);
-                if (bb == UNMAPPABLE_ENCODING) {
-                    if (Character.isHighSurrogate(c) && sp < sl &&
-                        Character.isLowSurrogate(src[sp])) {
-                        sp++;
-                    }
-                    dst[dp++] = repl[0];
-                    if (repl.length > 1)
-                        dst[dp++] = repl[1];
-                    continue;
-                } //else
-                if (bb > MAX_SINGLEBYTE) { // DoubleByte
-                    dst[dp++] = (byte)(bb >> 8);
-                    dst[dp++] = (byte)bb;
-                } else {                          // SingleByte
-                    dst[dp++] = (byte)bb;
-                }
-
-            }
-            return dp;
-        }
-
-        public int encodeChar(char ch) {
-            return c2b[c2bIndex[ch >> 8] + (ch & 0xff)];
-        }
-
-        // init the c2b and c2bIndex tables from b2c.
-        static void initC2B(String[] b2c, String b2cSB, String b2cNR,  String c2bNR,
-                            int b2Min, int b2Max,
-                            char[] c2b, char[] c2bIndex)
-        {
-            Arrays.fill(c2b, (char)UNMAPPABLE_ENCODING);
-            int off = 0x100;
-
-            char[][] b2c_ca = new char[b2c.length][];
-            char[] b2cSB_ca = null;
-            if (b2cSB != null)
-                b2cSB_ca = b2cSB.toCharArray();
-
-            for (int i = 0; i < b2c.length; i++) {
-                if (b2c[i] == null)
-                    continue;
-                b2c_ca[i] = b2c[i].toCharArray();
-            }
-
-            if (b2cNR != null) {
-                int j = 0;
-                while (j < b2cNR.length()) {
-                    char b  = b2cNR.charAt(j++);
-                    char c  = b2cNR.charAt(j++);
-                    if (b < 0x100 && b2cSB_ca != null) {
-                        if (b2cSB_ca[b] == c)
-                            b2cSB_ca[b] = UNMAPPABLE_DECODING;
-                    } else {
-                        if (b2c_ca[b >> 8][(b & 0xff) - b2Min] == c)
-                            b2c_ca[b >> 8][(b & 0xff) - b2Min] = UNMAPPABLE_DECODING;
-                    }
-                }
-            }
-
-            if (b2cSB_ca != null) {      // SingleByte
-                for (int b = 0; b < b2cSB_ca.length; b++) {
-                    char c = b2cSB_ca[b];
-                    if (c == UNMAPPABLE_DECODING)
-                        continue;
-                    int index = c2bIndex[c >> 8];
-                    if (index == 0) {
-                        index = off;
-                        off += 0x100;
-                        c2bIndex[c >> 8] = (char)index;
-                    }
-                    c2b[index + (c & 0xff)] = (char)b;
-                }
-            }
-
-            for (int b1 = 0; b1 < b2c.length; b1++) {  // DoubleByte
-                char[] db = b2c_ca[b1];
-                if (db == null)
-                    continue;
-                for (int b2 = b2Min; b2 <= b2Max; b2++) {
-                    char c = db[b2 - b2Min];
-                    if (c == UNMAPPABLE_DECODING)
-                        continue;
-                    int index = c2bIndex[c >> 8];
-                    if (index == 0) {
-                        index = off;
-                        off += 0x100;
-                        c2bIndex[c >> 8] = (char)index;
-                    }
-                    c2b[index + (c & 0xff)] = (char)((b1 << 8) | b2);
-                }
-            }
-
-            if (c2bNR != null) {
-                // add c->b only nr entries
-                for (int i = 0; i < c2bNR.length(); i += 2) {
-                    char b = c2bNR.charAt(i);
-                    char c = c2bNR.charAt(i + 1);
-                    int index = (c >> 8);
-                    if (c2bIndex[index] == 0) {
-                        c2bIndex[index] = (char)off;
-                        off += 0x100;
-                    }
-                    index = c2bIndex[index] + (c & 0xff);
-                    c2b[index] = b;
-                }
-            }
-        }
-    }
-
-    public static class Encoder_DBCSONLY extends Encoder {
-        Encoder_DBCSONLY(Charset cs, byte[] repl,
-                         char[] c2b, char[] c2bIndex) {
-            super(cs, 2.0f, 2.0f, repl, c2b, c2bIndex);
-        }
-
-        public int encodeChar(char ch) {
-            int bb = super.encodeChar(ch);
-            if (bb <= MAX_SINGLEBYTE)
-                return UNMAPPABLE_ENCODING;
-            return bb;
-        }
-    }
-
-
-
-    public static class Encoder_EBCDIC extends Encoder {
-        static final int SBCS = 0;
-        static final int DBCS = 1;
-        static final byte SO = 0x0e;
-        static final byte SI = 0x0f;
-
-        protected int  currentState = SBCS;
-
-        Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
-            super(cs, 4.0f, 5.0f, new byte[] {(byte)0x6f}, c2b, c2bIndex);
-        }
-
-        protected void implReset() {
-            currentState = SBCS;
-        }
-
-        protected CoderResult implFlush(ByteBuffer out) {
-            if (currentState == DBCS) {
-                if (out.remaining() < 1)
-                    return CoderResult.OVERFLOW;
-                out.put(SI);
-            }
-            implReset();
-            return CoderResult.UNDERFLOW;
-        }
-
-        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
-            char[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-            byte[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                while (sp < sl) {
-                    char c = sa[sp];
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            if (sgp().parse(c, sa, sp, sl) < 0)
-                                return sgp.error();
-                            return sgp.unmappableResult();
-                        }
-                        return CoderResult.unmappableForLength(1);
-                    }
-                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
-                        if (currentState == SBCS) {
-                            if (dl - dp < 1)
-                                return CoderResult.OVERFLOW;
-                            currentState = DBCS;
-                            da[dp++] = SO;
-                        }
-                        if (dl - dp < 2)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)(bb >> 8);
-                        da[dp++] = (byte)bb;
-                    } else {                    // SingleByte
-                        if (currentState == DBCS) {
-                            if (dl - dp < 1)
-                                return CoderResult.OVERFLOW;
-                            currentState = SBCS;
-                            da[dp++] = SI;
-                        }
-                        if (dl - dp < 1)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)bb;
-
-                    }
-                    sp++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
-            int mark = src.position();
-            try {
-                while (src.hasRemaining()) {
-                    char c = src.get();
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            if (sgp().parse(c, src) < 0)
-                                return sgp.error();
-                            return sgp.unmappableResult();
-                        }
-                        return CoderResult.unmappableForLength(1);
-                    }
-                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
-                        if (currentState == SBCS) {
-                            if (dst.remaining() < 1)
-                                return CoderResult.OVERFLOW;
-                            currentState = DBCS;
-                            dst.put(SO);
-                        }
-                        if (dst.remaining() < 2)
-                            return CoderResult.OVERFLOW;
-                        dst.put((byte)(bb >> 8));
-                        dst.put((byte)(bb));
-                    } else {                  // Single-byte
-                        if (currentState == DBCS) {
-                            if (dst.remaining() < 1)
-                                return CoderResult.OVERFLOW;
-                            currentState = SBCS;
-                            dst.put(SI);
-                        }
-                        if (dst.remaining() < 1)
-                            return CoderResult.OVERFLOW;
-                        dst.put((byte)bb);
-                    }
-                    mark++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        public int encode(char[] src, int sp, int len, byte[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            while (sp < sl) {
-                char c = src[sp++];
-                int bb = encodeChar(c);
-
-                if (bb == UNMAPPABLE_ENCODING) {
-                    if (Character.isHighSurrogate(c) && sp < sl &&
-                        Character.isLowSurrogate(src[sp])) {
-                        sp++;
-                    }
-                    dst[dp++] = repl[0];
-                    if (repl.length > 1)
-                        dst[dp++] = repl[1];
-                    continue;
-                } //else
-                if (bb > MAX_SINGLEBYTE) {           // DoubleByte
-                    if (currentState == SBCS) {
-                        currentState = DBCS;
-                        dst[dp++] = SO;
-                    }
-                    dst[dp++] = (byte)(bb >> 8);
-                    dst[dp++] = (byte)bb;
-                } else {                             // SingleByte
-                    if (currentState == DBCS) {
-                         currentState = SBCS;
-                         dst[dp++] = SI;
-                    }
-                    dst[dp++] = (byte)bb;
-                }
-            }
-
-            if (currentState == DBCS) {
-                 currentState = SBCS;
-                 dst[dp++] = SI;
-            }
-            return dp;
-        }
-    }
-
-    // EUC_SIMPLE
-    public static class Encoder_EUC_SIM extends Encoder {
-        Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
-            super(cs, c2b, c2bIndex);
-        }
-    }
-
-}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,411 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.Surrogate;
-import sun.nio.cs.SingleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class EUC_JP
-    extends Charset
-    implements HistoricallyNamedCharset
-{
-    public EUC_JP() {
-        super("EUC-JP", ExtendedCharsets.aliasesFor("EUC-JP"));
-    }
-
-    public String historicalName() {
-        return "EUC_JP";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof JIS_X_0201)
-                || (cs instanceof JIS_X_0208)
-                || (cs instanceof JIS_X_0212)
-                || (cs instanceof EUC_JP));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    static class Decoder extends CharsetDecoder
-        implements DelegatableDecoder {
-
-        final static SingleByte.Decoder DEC0201 =
-            (SingleByte.Decoder)new JIS_X_0201().newDecoder();
-
-        final static DoubleByte.Decoder DEC0208 =
-            (DoubleByte.Decoder)new JIS_X_0208().newDecoder();
-
-        final static DoubleByte.Decoder DEC0212 =
-            (DoubleByte.Decoder)new JIS_X_0212().newDecoder();
-
-        private final SingleByte.Decoder dec0201;
-        private final DoubleByte.Decoder dec0208;
-        private final DoubleByte.Decoder dec0212;
-
-        protected Decoder(Charset cs) {
-            this(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212);
-        }
-
-        protected Decoder(Charset cs, float avgCpb, float maxCpb,
-                          SingleByte.Decoder dec0201,
-                          DoubleByte.Decoder dec0208,
-                          DoubleByte.Decoder dec0212) {
-            super(cs, avgCpb, maxCpb);
-            this.dec0201 = dec0201;
-            this.dec0208 = dec0208;
-            this.dec0212 = dec0212;
-        }
-
-
-        protected char decodeDouble(int byte1, int byte2) {
-            if (byte1 == 0x8e) {
-                if (byte2 < 0x80)
-                    return UNMAPPABLE_DECODING;
-                return dec0201.decode((byte)byte2);
-            }
-            return dec0208.decodeDouble(byte1 - 0x80, byte2 - 0x80);
-        }
-
-        private CoderResult decodeArrayLoop(ByteBuffer src,
-                                            CharBuffer dst)
-        {
-            byte[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-            assert (sp <= sl);
-            sp = (sp <= sl ? sp : sl);
-
-            char[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-            assert (dp <= dl);
-            dp = (dp <= dl ? dp : dl);
-
-            int b1 = 0, b2 = 0;
-            int inputSize = 0;
-            char outputChar = UNMAPPABLE_DECODING;
-            try {
-                while (sp < sl) {
-                    b1 = sa[sp] & 0xff;
-                    inputSize = 1;
-
-                    if ((b1 & 0x80) == 0) {
-                        outputChar = (char)b1;
-                    } else {                        // Multibyte char
-                        if (b1 == 0x8f) {           // JIS0212
-                            if (sp + 3 > sl)
-                               return CoderResult.UNDERFLOW;
-                            b1 = sa[sp + 1] & 0xff;
-                            b2 = sa[sp + 2] & 0xff;
-                            inputSize += 2;
-                            if (dec0212 == null)    // JIS02012 not supported
-                                return CoderResult.unmappableForLength(inputSize);
-                            outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
-                        } else {                     // JIS0201, JIS0208
-                            if (sp + 2 > sl)
-                               return CoderResult.UNDERFLOW;
-                            b2 = sa[sp + 1] & 0xff;
-                            inputSize++;
-                            outputChar = decodeDouble(b1, b2);
-                        }
-                    }
-                    if (outputChar == UNMAPPABLE_DECODING) { // can't be decoded
-                        return CoderResult.unmappableForLength(inputSize);
-                    }
-                    if (dp + 1 > dl)
-                        return CoderResult.OVERFLOW;
-                    da[dp++] = outputChar;
-                    sp += inputSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        private CoderResult decodeBufferLoop(ByteBuffer src,
-                                             CharBuffer dst)
-        {
-            int mark = src.position();
-            int b1 = 0, b2 = 0;
-            int inputSize = 0;
-            char outputChar = UNMAPPABLE_DECODING;
-
-            try {
-                while (src.hasRemaining()) {
-                    b1 = src.get() & 0xff;
-                    inputSize = 1;
-                    if ((b1 & 0x80) == 0) {
-                        outputChar = (char)b1;
-                    } else {                         // Multibyte char
-                        if (b1 == 0x8f) {   // JIS0212
-                            if (src.remaining() < 2)
-                               return CoderResult.UNDERFLOW;
-                            b1 = src.get() & 0xff;
-                            b2 = src.get() & 0xff;
-                            inputSize += 2;
-                            if (dec0212 == null)    // JIS02012 not supported
-                                return CoderResult.unmappableForLength(inputSize);
-                            outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
-                        } else {                     // JIS0201 JIS0208
-                            if (src.remaining() < 1)
-                               return CoderResult.UNDERFLOW;
-                            b2 = src.get() & 0xff;
-                            inputSize++;
-                            outputChar = decodeDouble(b1, b2);
-                        }
-                    }
-                    if (outputChar == UNMAPPABLE_DECODING) {
-                        return CoderResult.unmappableForLength(inputSize);
-                    }
-                if (dst.remaining() < 1)
-                    return CoderResult.OVERFLOW;
-                dst.put(outputChar);
-                mark += inputSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        // Make some protected methods public for use by JISAutoDetect
-        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
-            if (src.hasArray() && dst.hasArray())
-                return decodeArrayLoop(src, dst);
-            else
-                return decodeBufferLoop(src, dst);
-        }
-        public void implReset() {
-            super.implReset();
-        }
-        public CoderResult implFlush(CharBuffer out) {
-            return super.implFlush(out);
-        }
-    }
-
-
-    static class Encoder extends CharsetEncoder {
-
-        final static SingleByte.Encoder ENC0201 =
-            (SingleByte.Encoder)new JIS_X_0201().newEncoder();
-
-        final static DoubleByte.Encoder ENC0208 =
-            (DoubleByte.Encoder)new JIS_X_0208().newEncoder();
-
-        final static DoubleByte.Encoder ENC0212 =
-            (DoubleByte.Encoder)new JIS_X_0212().newEncoder();
-
-        private final Surrogate.Parser sgp = new Surrogate.Parser();
-
-
-        private final SingleByte.Encoder enc0201;
-        private final DoubleByte.Encoder enc0208;
-        private final DoubleByte.Encoder enc0212;
-
-        protected Encoder(Charset cs) {
-            this(cs, 3.0f, 3.0f, ENC0201, ENC0208, ENC0212);
-        }
-
-        protected Encoder(Charset cs, float avgBpc, float maxBpc,
-                          SingleByte.Encoder enc0201,
-                          DoubleByte.Encoder enc0208,
-                          DoubleByte.Encoder enc0212) {
-            super(cs, avgBpc, maxBpc);
-            this.enc0201 = enc0201;
-            this.enc0208 = enc0208;
-            this.enc0212 = enc0212;
-        }
-
-        public boolean canEncode(char c) {
-            byte[]  encodedBytes = new byte[3];
-            return encodeSingle(c, encodedBytes) != 0 ||
-                   encodeDouble(c) != UNMAPPABLE_ENCODING;
-        }
-
-        protected int encodeSingle(char inputChar, byte[] outputByte) {
-            int b = enc0201.encode(inputChar);
-            if (b == UNMAPPABLE_ENCODING)
-                return 0;
-            if (b >= 0 && b < 128) {
-                outputByte[0] = (byte)b;
-                return 1;
-            }
-            outputByte[0] = (byte)0x8e;
-            outputByte[1] = (byte)b;
-            return 2;
-        }
-
-        protected int encodeDouble(char ch) {
-            int b = enc0208.encodeChar(ch);
-            if (b != UNMAPPABLE_ENCODING)
-                return b + 0x8080;
-            if (enc0212 != null) {
-                b = enc0212.encodeChar(ch);
-                if (b != UNMAPPABLE_ENCODING)
-                    b += 0x8F8080;
-            }
-            return b;
-        }
-
-        private CoderResult encodeArrayLoop(CharBuffer src,
-                                            ByteBuffer dst)
-        {
-            char[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-            assert (sp <= sl);
-            sp = (sp <= sl ? sp : sl);
-            byte[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-            assert (dp <= dl);
-            dp = (dp <= dl ? dp : dl);
-
-            int outputSize = 0;
-            byte[]  outputByte;
-            int     inputSize = 0;                 // Size of input
-            byte[]  tmpBuf = new byte[3];
-
-            try {
-                while (sp < sl) {
-                    outputByte = tmpBuf;
-                    char c = sa[sp];
-                    if (Character.isSurrogate(c)) {
-                        if (sgp.parse(c, sa, sp, sl) < 0)
-                            return sgp.error();
-                        return sgp.unmappableResult();
-                    }
-                    outputSize = encodeSingle(c, outputByte);
-                    if (outputSize == 0) { // DoubleByte
-                        int ncode = encodeDouble(c);
-                        if (ncode != UNMAPPABLE_ENCODING) {
-                            if ((ncode & 0xFF0000) == 0) {
-                                outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
-                                outputByte[1] = (byte) (ncode & 0xff);
-                                outputSize = 2;
-                            } else {
-                                outputByte[0] = (byte) 0x8f;
-                                outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
-                                outputByte[2] = (byte) (ncode & 0xff);
-                                outputSize = 3;
-                            }
-                        } else {
-                            return CoderResult.unmappableForLength(1);
-                        }
-                    }
-                    if (dl - dp < outputSize)
-                        return CoderResult.OVERFLOW;
-                    // Put the byte in the output buffer
-                    for (int i = 0; i < outputSize; i++) {
-                        da[dp++] = outputByte[i];
-                    }
-                    sp++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        private CoderResult encodeBufferLoop(CharBuffer src,
-                                             ByteBuffer dst)
-        {
-            int outputSize = 0;
-            byte[]  outputByte;
-            int     inputSize = 0;                 // Size of input
-            byte[]  tmpBuf = new byte[3];
-
-            int mark = src.position();
-
-            try {
-                while (src.hasRemaining()) {
-                    outputByte = tmpBuf;
-                    char c = src.get();
-                    if (Character.isSurrogate(c)) {
-                        if (sgp.parse(c, src) < 0)
-                            return sgp.error();
-                        return sgp.unmappableResult();
-                    }
-                    outputSize = encodeSingle(c, outputByte);
-                    if (outputSize == 0) { // DoubleByte
-                        int ncode = encodeDouble(c);
-                        if (ncode != UNMAPPABLE_ENCODING) {
-                            if ((ncode & 0xFF0000) == 0) {
-                                outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
-                                outputByte[1] = (byte) (ncode & 0xff);
-                                outputSize = 2;
-                            } else {
-                                outputByte[0] = (byte) 0x8f;
-                                outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
-                                outputByte[2] = (byte) (ncode & 0xff);
-                                outputSize = 3;
-                            }
-                        } else {
-                            return CoderResult.unmappableForLength(1);
-                        }
-                    }
-                    if (dst.remaining() < outputSize)
-                        return CoderResult.OVERFLOW;
-                    // Put the byte in the output buffer
-                    for (int i = 0; i < outputSize; i++) {
-                        dst.put(outputByte[i]);
-                    }
-                    mark++;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        protected CoderResult encodeLoop(CharBuffer src,
-                                         ByteBuffer dst)
-        {
-            if (src.hasArray() && dst.hasArray())
-                return encodeArrayLoop(src, dst);
-            else
-                return encodeBufferLoop(src, dst);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 $PACKAGE$;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.DelegatableDecoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.Surrogate;
+import sun.nio.cs.SingleByte;
+import sun.nio.cs.*;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class EUC_JP
+    extends Charset
+    implements HistoricallyNamedCharset
+{
+    public EUC_JP() {
+        super("EUC-JP",  $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "EUC_JP";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof JIS_X_0201)
+                || (cs instanceof JIS_X_0208)
+                || (cs instanceof JIS_X_0212)
+                || (cs instanceof EUC_JP));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    static class Decoder extends CharsetDecoder
+        implements DelegatableDecoder {
+
+        final static SingleByte.Decoder DEC0201 =
+            (SingleByte.Decoder)new JIS_X_0201().newDecoder();
+
+        final static DoubleByte.Decoder DEC0208 =
+            (DoubleByte.Decoder)new JIS_X_0208().newDecoder();
+
+        final static DoubleByte.Decoder DEC0212 =
+            (DoubleByte.Decoder)new JIS_X_0212().newDecoder();
+
+        private final SingleByte.Decoder dec0201;
+        private final DoubleByte.Decoder dec0208;
+        private final DoubleByte.Decoder dec0212;
+
+        protected Decoder(Charset cs) {
+            this(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212);
+        }
+
+        protected Decoder(Charset cs, float avgCpb, float maxCpb,
+                          SingleByte.Decoder dec0201,
+                          DoubleByte.Decoder dec0208,
+                          DoubleByte.Decoder dec0212) {
+            super(cs, avgCpb, maxCpb);
+            this.dec0201 = dec0201;
+            this.dec0208 = dec0208;
+            this.dec0212 = dec0212;
+        }
+
+
+        protected char decodeDouble(int byte1, int byte2) {
+            if (byte1 == 0x8e) {
+                if (byte2 < 0x80)
+                    return UNMAPPABLE_DECODING;
+                return dec0201.decode((byte)byte2);
+            }
+            return dec0208.decodeDouble(byte1 - 0x80, byte2 - 0x80);
+        }
+
+        private CoderResult decodeArrayLoop(ByteBuffer src,
+                                            CharBuffer dst)
+        {
+            byte[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+            assert (sp <= sl);
+            sp = (sp <= sl ? sp : sl);
+
+            char[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+            assert (dp <= dl);
+            dp = (dp <= dl ? dp : dl);
+
+            int b1 = 0, b2 = 0;
+            int inputSize = 0;
+            char outputChar = UNMAPPABLE_DECODING;
+            try {
+                while (sp < sl) {
+                    b1 = sa[sp] & 0xff;
+                    inputSize = 1;
+
+                    if ((b1 & 0x80) == 0) {
+                        outputChar = (char)b1;
+                    } else {                        // Multibyte char
+                        if (b1 == 0x8f) {           // JIS0212
+                            if (sp + 3 > sl)
+                               return CoderResult.UNDERFLOW;
+                            b1 = sa[sp + 1] & 0xff;
+                            b2 = sa[sp + 2] & 0xff;
+                            inputSize += 2;
+                            if (dec0212 == null)    // JIS02012 not supported
+                                return CoderResult.unmappableForLength(inputSize);
+                            outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
+                        } else {                     // JIS0201, JIS0208
+                            if (sp + 2 > sl)
+                               return CoderResult.UNDERFLOW;
+                            b2 = sa[sp + 1] & 0xff;
+                            inputSize++;
+                            outputChar = decodeDouble(b1, b2);
+                        }
+                    }
+                    if (outputChar == UNMAPPABLE_DECODING) { // can't be decoded
+                        return CoderResult.unmappableForLength(inputSize);
+                    }
+                    if (dp + 1 > dl)
+                        return CoderResult.OVERFLOW;
+                    da[dp++] = outputChar;
+                    sp += inputSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        private CoderResult decodeBufferLoop(ByteBuffer src,
+                                             CharBuffer dst)
+        {
+            int mark = src.position();
+            int b1 = 0, b2 = 0;
+            int inputSize = 0;
+            char outputChar = UNMAPPABLE_DECODING;
+
+            try {
+                while (src.hasRemaining()) {
+                    b1 = src.get() & 0xff;
+                    inputSize = 1;
+                    if ((b1 & 0x80) == 0) {
+                        outputChar = (char)b1;
+                    } else {                         // Multibyte char
+                        if (b1 == 0x8f) {   // JIS0212
+                            if (src.remaining() < 2)
+                               return CoderResult.UNDERFLOW;
+                            b1 = src.get() & 0xff;
+                            b2 = src.get() & 0xff;
+                            inputSize += 2;
+                            if (dec0212 == null)    // JIS02012 not supported
+                                return CoderResult.unmappableForLength(inputSize);
+                            outputChar = dec0212.decodeDouble(b1-0x80, b2-0x80);
+                        } else {                     // JIS0201 JIS0208
+                            if (src.remaining() < 1)
+                               return CoderResult.UNDERFLOW;
+                            b2 = src.get() & 0xff;
+                            inputSize++;
+                            outputChar = decodeDouble(b1, b2);
+                        }
+                    }
+                    if (outputChar == UNMAPPABLE_DECODING) {
+                        return CoderResult.unmappableForLength(inputSize);
+                    }
+                if (dst.remaining() < 1)
+                    return CoderResult.OVERFLOW;
+                dst.put(outputChar);
+                mark += inputSize;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        // Make some protected methods public for use by JISAutoDetect
+        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
+            if (src.hasArray() && dst.hasArray())
+                return decodeArrayLoop(src, dst);
+            else
+                return decodeBufferLoop(src, dst);
+        }
+        public void implReset() {
+            super.implReset();
+        }
+        public CoderResult implFlush(CharBuffer out) {
+            return super.implFlush(out);
+        }
+    }
+
+
+    static class Encoder extends CharsetEncoder {
+
+        final static SingleByte.Encoder ENC0201 =
+            (SingleByte.Encoder)new JIS_X_0201().newEncoder();
+
+        final static DoubleByte.Encoder ENC0208 =
+            (DoubleByte.Encoder)new JIS_X_0208().newEncoder();
+
+        final static DoubleByte.Encoder ENC0212 =
+            (DoubleByte.Encoder)new JIS_X_0212().newEncoder();
+
+        private final Surrogate.Parser sgp = new Surrogate.Parser();
+
+
+        private final SingleByte.Encoder enc0201;
+        private final DoubleByte.Encoder enc0208;
+        private final DoubleByte.Encoder enc0212;
+
+        protected Encoder(Charset cs) {
+            this(cs, 3.0f, 3.0f, ENC0201, ENC0208, ENC0212);
+        }
+
+        protected Encoder(Charset cs, float avgBpc, float maxBpc,
+                          SingleByte.Encoder enc0201,
+                          DoubleByte.Encoder enc0208,
+                          DoubleByte.Encoder enc0212) {
+            super(cs, avgBpc, maxBpc);
+            this.enc0201 = enc0201;
+            this.enc0208 = enc0208;
+            this.enc0212 = enc0212;
+        }
+
+        public boolean canEncode(char c) {
+            byte[]  encodedBytes = new byte[3];
+            return encodeSingle(c, encodedBytes) != 0 ||
+                   encodeDouble(c) != UNMAPPABLE_ENCODING;
+        }
+
+        protected int encodeSingle(char inputChar, byte[] outputByte) {
+            int b = enc0201.encode(inputChar);
+            if (b == UNMAPPABLE_ENCODING)
+                return 0;
+            if (b >= 0 && b < 128) {
+                outputByte[0] = (byte)b;
+                return 1;
+            }
+            outputByte[0] = (byte)0x8e;
+            outputByte[1] = (byte)b;
+            return 2;
+        }
+
+        protected int encodeDouble(char ch) {
+            int b = enc0208.encodeChar(ch);
+            if (b != UNMAPPABLE_ENCODING)
+                return b + 0x8080;
+            if (enc0212 != null) {
+                b = enc0212.encodeChar(ch);
+                if (b != UNMAPPABLE_ENCODING)
+                    b += 0x8F8080;
+            }
+            return b;
+        }
+
+        private CoderResult encodeArrayLoop(CharBuffer src,
+                                            ByteBuffer dst)
+        {
+            char[] sa = src.array();
+            int sp = src.arrayOffset() + src.position();
+            int sl = src.arrayOffset() + src.limit();
+            assert (sp <= sl);
+            sp = (sp <= sl ? sp : sl);
+            byte[] da = dst.array();
+            int dp = dst.arrayOffset() + dst.position();
+            int dl = dst.arrayOffset() + dst.limit();
+            assert (dp <= dl);
+            dp = (dp <= dl ? dp : dl);
+
+            int outputSize = 0;
+            byte[]  outputByte;
+            int     inputSize = 0;                 // Size of input
+            byte[]  tmpBuf = new byte[3];
+
+            try {
+                while (sp < sl) {
+                    outputByte = tmpBuf;
+                    char c = sa[sp];
+                    if (Character.isSurrogate(c)) {
+                        if (sgp.parse(c, sa, sp, sl) < 0)
+                            return sgp.error();
+                        return sgp.unmappableResult();
+                    }
+                    outputSize = encodeSingle(c, outputByte);
+                    if (outputSize == 0) { // DoubleByte
+                        int ncode = encodeDouble(c);
+                        if (ncode != UNMAPPABLE_ENCODING) {
+                            if ((ncode & 0xFF0000) == 0) {
+                                outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
+                                outputByte[1] = (byte) (ncode & 0xff);
+                                outputSize = 2;
+                            } else {
+                                outputByte[0] = (byte) 0x8f;
+                                outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
+                                outputByte[2] = (byte) (ncode & 0xff);
+                                outputSize = 3;
+                            }
+                        } else {
+                            return CoderResult.unmappableForLength(1);
+                        }
+                    }
+                    if (dl - dp < outputSize)
+                        return CoderResult.OVERFLOW;
+                    // Put the byte in the output buffer
+                    for (int i = 0; i < outputSize; i++) {
+                        da[dp++] = outputByte[i];
+                    }
+                    sp++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(sp - src.arrayOffset());
+                dst.position(dp - dst.arrayOffset());
+            }
+        }
+
+        private CoderResult encodeBufferLoop(CharBuffer src,
+                                             ByteBuffer dst)
+        {
+            int outputSize = 0;
+            byte[]  outputByte;
+            int     inputSize = 0;                 // Size of input
+            byte[]  tmpBuf = new byte[3];
+
+            int mark = src.position();
+
+            try {
+                while (src.hasRemaining()) {
+                    outputByte = tmpBuf;
+                    char c = src.get();
+                    if (Character.isSurrogate(c)) {
+                        if (sgp.parse(c, src) < 0)
+                            return sgp.error();
+                        return sgp.unmappableResult();
+                    }
+                    outputSize = encodeSingle(c, outputByte);
+                    if (outputSize == 0) { // DoubleByte
+                        int ncode = encodeDouble(c);
+                        if (ncode != UNMAPPABLE_ENCODING) {
+                            if ((ncode & 0xFF0000) == 0) {
+                                outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
+                                outputByte[1] = (byte) (ncode & 0xff);
+                                outputSize = 2;
+                            } else {
+                                outputByte[0] = (byte) 0x8f;
+                                outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
+                                outputByte[2] = (byte) (ncode & 0xff);
+                                outputSize = 3;
+                            }
+                        } else {
+                            return CoderResult.unmappableForLength(1);
+                        }
+                    }
+                    if (dst.remaining() < outputSize)
+                        return CoderResult.OVERFLOW;
+                    // Put the byte in the output buffer
+                    for (int i = 0; i < outputSize; i++) {
+                        dst.put(outputByte[i]);
+                    }
+                    mark++;
+                }
+                return CoderResult.UNDERFLOW;
+            } finally {
+                src.position(mark);
+            }
+        }
+
+        protected CoderResult encodeLoop(CharBuffer src,
+                                         ByteBuffer dst)
+        {
+            if (src.hasArray() && dst.hasArray())
+                return encodeArrayLoop(src, dst);
+            else
+                return encodeBufferLoop(src, dst);
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import sun.nio.cs.HistoricallyNamedCharset;
-
-public class EUC_JP_LINUX
-    extends Charset
-    implements HistoricallyNamedCharset
-{
-    public EUC_JP_LINUX() {
-        super("x-euc-jp-linux", ExtendedCharsets.aliasesFor("x-euc-jp-linux"));
-    }
-
-    public String historicalName() {
-        return "EUC_JP_LINUX";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs instanceof JIS_X_0201)
-               || (cs.name().equals("US-ASCII"))
-               || (cs instanceof EUC_JP_LINUX));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    private static class Decoder extends EUC_JP.Decoder {
-        private Decoder(Charset cs) {
-            super(cs, 1.0f, 1.0f, DEC0201, DEC0208, null);
-        }
-    }
-
-    private static class Encoder extends EUC_JP.Encoder {
-        private Encoder(Charset cs) {
-            super(cs, 2.0f, 2.0f, ENC0201, ENC0208, null);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 $PACKAGE$;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
+
+public class EUC_JP_LINUX
+    extends Charset
+    implements HistoricallyNamedCharset
+{
+    public EUC_JP_LINUX() {
+        super("x-euc-jp-linux", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "EUC_JP_LINUX";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs instanceof JIS_X_0201)
+               || (cs.name().equals("US-ASCII"))
+               || (cs instanceof EUC_JP_LINUX));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    private static class Decoder extends EUC_JP.Decoder {
+        private Decoder(Charset cs) {
+            super(cs, 1.0f, 1.0f, DEC0201, DEC0208, null);
+        }
+    }
+
+    private static class Encoder extends EUC_JP.Encoder {
+        private Encoder(Charset cs) {
+            super(cs, 2.0f, 2.0f, ENC0201, ENC0208, null);
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_Open.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import sun.nio.cs.HistoricallyNamedCharset;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class EUC_JP_Open
-    extends Charset
-    implements HistoricallyNamedCharset
-{
-    public EUC_JP_Open() {
-        super("x-eucJP-Open", ExtendedCharsets.aliasesFor("x-eucJP-Open"));
-    }
-
-    public String historicalName() {
-        return "EUC_JP_Solaris";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof JIS_X_0201)
-                || (cs instanceof EUC_JP));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    private static class Decoder extends EUC_JP.Decoder {
-        private static DoubleByte.Decoder DEC0208_Solaris =
-            (DoubleByte.Decoder)new JIS_X_0208_Solaris().newDecoder();
-        private static DoubleByte.Decoder DEC0212_Solaris =
-            (DoubleByte.Decoder)new JIS_X_0212_Solaris().newDecoder();
-
-        private Decoder(Charset cs) {
-            // JIS_X_0208_Solaris only has the "extra" mappings, it
-            // does not have the JIS_X_0208 entries
-            super(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212_Solaris);
-        }
-
-        protected char decodeDouble(int byte1, int byte2) {
-            char c = super.decodeDouble(byte1, byte2);
-            if (c == UNMAPPABLE_DECODING)
-                return DEC0208_Solaris.decodeDouble(byte1 - 0x80, byte2 - 0x80);
-            return c;
-        }
-    }
-
-    private static class Encoder extends EUC_JP.Encoder {
-        private static DoubleByte.Encoder ENC0208_Solaris =
-            (DoubleByte.Encoder)new JIS_X_0208_Solaris().newEncoder();
-
-        private static DoubleByte.Encoder ENC0212_Solaris =
-            (DoubleByte.Encoder)new JIS_X_0212_Solaris().newEncoder();
-
-        private Encoder(Charset cs) {
-            // The EUC_JP_Open has some interesting tweak for the
-            // encoding, so can't just pass the euc0208_solaris to
-            // the euc_jp. Have to override the encodeDouble() as
-            // showed below (mapping testing catches this).
-            // super(cs, 3.0f, 3.0f, ENC0201, ENC0208_Solaris, ENC0212_Solaris);
-            super(cs);
-        }
-
-        protected int encodeDouble(char ch) {
-            int b = super.encodeDouble(ch);
-            if (b != UNMAPPABLE_ENCODING)
-                return b;
-            b = ENC0208_Solaris.encodeChar(ch);
-            if (b != UNMAPPABLE_ENCODING && b > 0x7500) {
-                return 0x8F8080 + ENC0212_Solaris.encodeChar(ch);
-            }
-            return b == UNMAPPABLE_ENCODING ? b : b + 0x8080;
-
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP_Open.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 $PACKAGE$;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class EUC_JP_Open
+    extends Charset
+    implements HistoricallyNamedCharset
+{
+    public EUC_JP_Open() {
+        super("x-eucJP-Open", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "EUC_JP_Solaris";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof JIS_X_0201)
+                || (cs instanceof EUC_JP));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    private static class Decoder extends EUC_JP.Decoder {
+        private static DoubleByte.Decoder DEC0208_Solaris =
+            (DoubleByte.Decoder)new JIS_X_0208_Solaris().newDecoder();
+        private static DoubleByte.Decoder DEC0212_Solaris =
+            (DoubleByte.Decoder)new JIS_X_0212_Solaris().newDecoder();
+
+        private Decoder(Charset cs) {
+            // JIS_X_0208_Solaris only has the "extra" mappings, it
+            // does not have the JIS_X_0208 entries
+            super(cs, 0.5f, 1.0f, DEC0201, DEC0208, DEC0212_Solaris);
+        }
+
+        protected char decodeDouble(int byte1, int byte2) {
+            char c = super.decodeDouble(byte1, byte2);
+            if (c == UNMAPPABLE_DECODING)
+                return DEC0208_Solaris.decodeDouble(byte1 - 0x80, byte2 - 0x80);
+            return c;
+        }
+    }
+
+    private static class Encoder extends EUC_JP.Encoder {
+        private static DoubleByte.Encoder ENC0208_Solaris =
+            (DoubleByte.Encoder)new JIS_X_0208_Solaris().newEncoder();
+
+        private static DoubleByte.Encoder ENC0212_Solaris =
+            (DoubleByte.Encoder)new JIS_X_0212_Solaris().newEncoder();
+
+        private Encoder(Charset cs) {
+            // The EUC_JP_Open has some interesting tweak for the
+            // encoding, so can't just pass the euc0208_solaris to
+            // the euc_jp. Have to override the encodeDouble() as
+            // showed below (mapping testing catches this).
+            // super(cs, 3.0f, 3.0f, ENC0201, ENC0208_Solaris, ENC0212_Solaris);
+            super(cs);
+        }
+
+        protected int encodeDouble(char ch) {
+            int b = super.encodeDouble(ch);
+            if (b != UNMAPPABLE_ENCODING)
+                return b;
+            b = ENC0208_Solaris.encodeChar(ch);
+            if (b != UNMAPPABLE_ENCODING && b > 0x7500) {
+                return 0x8F8080 + ENC0212_Solaris.encodeChar(ch);
+            }
+            return b == UNMAPPABLE_ENCODING ? b : b + 0x8080;
+
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1326 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.lang.ref.SoftReference;
-import java.nio.charset.Charset;
-import java.nio.charset.spi.CharsetProvider;
-import sun.nio.cs.AbstractCharsetProvider;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Provider for extended charsets.
- */
-
-public class ExtendedCharsets
-    extends AbstractCharsetProvider
-{
-
-    static volatile ExtendedCharsets instance = null;
-
-    public ExtendedCharsets() {
-
-        super("sun.nio.cs.ext");  // identify provider pkg name.
-
-        // Traditional Chinese
-
-        charset("Big5", "Big5",
-                new String[] {
-                    // IANA aliases
-                    "csBig5"
-                });
-
-        charset("x-MS950-HKSCS-XP", "MS950_HKSCS_XP",
-                new String[] {
-                    "MS950_HKSCS_XP"  // JDK historical;
-                });
-
-        charset("x-MS950-HKSCS", "MS950_HKSCS",
-                new String[] {
-                    // IANA aliases
-                    "MS950_HKSCS"     // JDK historical;
-                });
-
-        charset("x-windows-950", "MS950",
-                new String[] {
-                    "ms950",    // JDK historical
-                    "windows-950"
-                });
-
-        charset("x-windows-874", "MS874",
-                new String[] {
-                    "ms874",  // JDK historical
-                    "ms-874",
-                    "windows-874" });
-
-        charset("x-EUC-TW", "EUC_TW",
-                new String[] {
-                    "euc_tw", // JDK historical
-                    "euctw",
-                    "cns11643",
-                    "EUC-TW"
-                });
-
-        charset("Big5-HKSCS", "Big5_HKSCS",
-                new String[] {
-                    "Big5_HKSCS", // JDK historical
-                    "big5hk",
-                    "big5-hkscs",
-                    "big5hkscs"   // Linux alias
-                });
-
-        charset("x-Big5-HKSCS-2001", "Big5_HKSCS_2001",
-                new String[] {
-                    "Big5_HKSCS_2001",
-                    "big5hk-2001",
-                    "big5-hkscs-2001",
-                    "big5-hkscs:unicode3.0",
-                    "big5hkscs-2001",
-                });
-
-        charset("x-Big5-Solaris", "Big5_Solaris",
-                new String[] {
-                    "Big5_Solaris", // JDK historical
-                });
-
-        // Simplified Chinese
-        charset("GBK", "GBK",
-                new String[] {
-                    "windows-936",
-                    "CP936"
-                });
-
-        charset("GB18030", "GB18030",
-                new String[] {
-                    "gb18030-2000"
-                });
-
-        charset("GB2312", "EUC_CN",
-                new String[] {
-                    // IANA aliases
-                    "gb2312",
-                    "gb2312-80",
-                    "gb2312-1980",
-                    "euc-cn",
-                    "euccn",
-                    "x-EUC-CN", // 1.4 compatibility
-                    "EUC_CN" //JDK historical
-                });
-
-        charset("x-mswin-936", "MS936",
-                new String[] {
-                    "ms936", // historical
-                    // IANA aliases
-                    "ms_936"
-                });
-
-        // The definition of this charset may be overridden by the init method,
-        // below, if the sun.nio.cs.map property is defined.
-        //
-        charset("Shift_JIS", "SJIS",
-                new String[] {
-                    // IANA aliases
-                    "sjis", // historical
-                    "shift_jis",
-                    "shift-jis",
-                    "ms_kanji",
-                    "x-sjis",
-                    "csShiftJIS"
-                });
-
-        // The definition of this charset may be overridden by the init method,
-        // below, if the sun.nio.cs.map property is defined.
-        //
-        charset("windows-31j", "MS932",
-                new String[] {
-                    "MS932", // JDK historical
-                    "windows-932",
-                    "csWindows31J"
-                });
-
-        charset("JIS_X0201", "JIS_X_0201",
-                new String[] {
-                    "JIS0201", // JDK historical
-                    // IANA aliases
-                    "JIS_X0201",
-                    "X0201",
-                    "csHalfWidthKatakana"
-                });
-
-        charset("x-JIS0208", "JIS_X_0208",
-                new String[] {
-                    "JIS0208", // JDK historical
-                    // IANA aliases
-                    "JIS_C6226-1983",
-                    "iso-ir-87",
-                    "x0208",
-                    "JIS_X0208-1983",
-                    "csISO87JISX0208"
-                });
-
-        charset("JIS_X0212-1990", "JIS_X_0212",
-                new String[] {
-                    "JIS0212", // JDK historical
-                    // IANA aliases
-                    "jis_x0212-1990",
-                    "x0212",
-                    "iso-ir-159",
-                    "csISO159JISX02121990"
-                });
-
-        charset("x-SJIS_0213", "SJIS_0213",
-                new String[] {
-                    "sjis-0213",
-                    "sjis_0213",
-                    "sjis:2004",
-                    "sjis_0213:2004",
-                    "shift_jis_0213:2004",
-                    "shift_jis:2004"
-                });
-
-        charset("x-MS932_0213", "MS932_0213",
-                new String[] {
-                    "MS932-0213",
-                    "MS932_0213",
-                    "MS932:2004",
-                    "windows-932-0213",
-                    "windows-932:2004"
-                });
-
-        charset("EUC-JP", "EUC_JP",
-                new String[] {
-                    "euc_jp", // JDK historical
-                    // IANA aliases
-                    "eucjis",
-                    "eucjp",
-                    "Extended_UNIX_Code_Packed_Format_for_Japanese",
-                    "csEUCPkdFmtjapanese",
-                    "x-euc-jp",
-                    "x-eucjp"
-                });
-
-        charset("x-euc-jp-linux", "EUC_JP_LINUX",
-                new String[] {
-                    "euc_jp_linux", // JDK historical
-                    "euc-jp-linux"
-                });
-
-        charset("x-eucjp-open", "EUC_JP_Open",
-                new String[] {
-                    "EUC_JP_Solaris",   // JDK historical
-                    "eucJP-open"
-                });
-
-        charset("x-PCK", "PCK",
-                new String[] {
-                    // IANA aliases
-                    "pck" // historical
-                });
-
-        charset("ISO-2022-JP", "ISO2022_JP",
-            new String[] {
-            // IANA aliases
-            "iso2022jp", // historical
-            "jis",
-            "csISO2022JP",
-            "jis_encoding",
-            "csjisencoding"
-        });
-
-        charset("ISO-2022-JP-2", "ISO2022_JP_2",
-            new String[] {
-            // IANA aliases
-            "csISO2022JP2",
-            "iso2022jp2"
-        });
-
-        charset("x-windows-50221", "MS50221",
-            new String[] {
-            "ms50221", // historical
-            "cp50221",
-        });
-
-        charset("x-windows-50220", "MS50220",
-            new String[] {
-            "ms50220", // historical
-            "cp50220",
-        });
-
-        charset("x-windows-iso2022jp", "MSISO2022JP",
-            new String[] {
-            "windows-iso2022jp", // historical
-        });
-
-        charset("x-JISAutoDetect", "JISAutoDetect",
-                new String[] {
-                    "JISAutoDetect" // historical
-                });
-
-        // Korean
-        charset("EUC-KR", "EUC_KR",
-                new String[] {
-                    "euc_kr", // JDK historical
-                    // IANA aliases
-                    "ksc5601",
-                    "euckr",
-                    "ks_c_5601-1987",
-                    "ksc5601-1987",
-                    "ksc5601_1987",
-                    "ksc_5601",
-                    "csEUCKR",
-                    "5601"
-                });
-
-        charset("x-windows-949", "MS949",
-                new String[] {
-                    "ms949",    // JDK historical
-                    "windows949",
-                    "windows-949",
-                    // IANA aliases
-                    "ms_949"
-                });
-
-        charset("x-Johab", "Johab",
-                new String[] {
-                        "ksc5601-1992",
-                        "ksc5601_1992",
-                        "ms1361",
-                        "johab" // JDK historical
-                });
-
-        charset("ISO-2022-KR", "ISO2022_KR",
-                new String[] {
-                        "ISO2022KR", // JDK historical
-                        "csISO2022KR"
-                });
-
-        charset("ISO-2022-CN", "ISO2022_CN",
-                new String[] {
-                        "ISO2022CN", // JDK historical
-                        "csISO2022CN"
-                });
-
-        charset("x-ISO-2022-CN-CNS", "ISO2022_CN_CNS",
-                new String[] {
-                        "ISO2022CN_CNS", // JDK historical
-                        "ISO-2022-CN-CNS"
-                });
-
-        charset("x-ISO-2022-CN-GB", "ISO2022_CN_GB",
-                new String[] {
-                        "ISO2022CN_GB", // JDK historical
-                        "ISO-2022-CN-GB"
-                });
-
-        charset("x-ISCII91", "ISCII91",
-                new String[] {
-                        "iscii",
-                        "ST_SEV_358-88",
-                        "iso-ir-153",
-                        "csISO153GOST1976874",
-                        "ISCII91" // JDK historical
-                });
-
-        charset("ISO-8859-3", "ISO_8859_3",
-                new String[] {
-                    "iso8859_3", // JDK historical
-                    "8859_3",
-                    "ISO_8859-3:1988",
-                    "iso-ir-109",
-                    "ISO_8859-3",
-                    "ISO8859-3",
-                    "latin3",
-                    "l3",
-                    "ibm913",
-                    "ibm-913",
-                    "cp913",
-                    "913",
-                    "csISOLatin3"
-                });
-
-        charset("ISO-8859-6", "ISO_8859_6",
-                new String[] {
-                    "iso8859_6", // JDK historical
-                    "8859_6",
-                    "iso-ir-127",
-                    "ISO_8859-6",
-                    "ISO_8859-6:1987",
-                    "ISO8859-6",
-                    "ECMA-114",
-                    "ASMO-708",
-                    "arabic",
-                    "ibm1089",
-                    "ibm-1089",
-                    "cp1089",
-                    "1089",
-                    "csISOLatinArabic"
-                });
-
-        charset("ISO-8859-8", "ISO_8859_8",
-                new String[] {
-                    "iso8859_8", // JDK historical
-                    "8859_8",
-                    "iso-ir-138",
-                    "ISO_8859-8",
-                    "ISO_8859-8:1988",
-                    "ISO8859-8",
-                    "cp916",
-                    "916",
-                    "ibm916",
-                    "ibm-916",
-                    "hebrew",
-                    "csISOLatinHebrew"
-                });
-
-        charset("x-ISO-8859-11", "ISO_8859_11",
-                new String[] {
-                    "iso-8859-11",
-                    "iso8859_11"
-                });
-
-        charset("TIS-620", "TIS_620",
-                new String[] {
-                    "tis620", // JDK historical
-                    "tis620.2533"
-                });
-
-        // Various Microsoft Windows international codepages
-
-        charset("windows-1255", "MS1255",
-                new String[] {
-                    "cp1255" // JDK historical
-                });
-
-        charset("windows-1256", "MS1256",
-                new String[] {
-                    "cp1256" // JDK historical
-                });
-
-        charset("windows-1258", "MS1258",
-                new String[] {
-                    "cp1258" // JDK historical
-                });
-
-        // IBM & PC/MSDOS encodings
-
-        charset("x-IBM942", "IBM942",
-                new String[] {
-                    "cp942", // JDK historical
-                    "ibm942",
-                    "ibm-942",
-                    "942"
-                });
-
-        charset("x-IBM942C", "IBM942C",
-                new String[] {
-                    "cp942C", // JDK historical
-                    "ibm942C",
-                    "ibm-942C",
-                    "942C"
-                });
-
-        charset("x-IBM943", "IBM943",
-                new String[] {
-                    "cp943", // JDK historical
-                    "ibm943",
-                    "ibm-943",
-                    "943"
-                });
-
-        charset("x-IBM943C", "IBM943C",
-                new String[] {
-                    "cp943C", // JDK historical
-                    "ibm943C",
-                    "ibm-943C",
-                    "943C"
-                });
-
-        charset("x-IBM948", "IBM948",
-                new String[] {
-                    "cp948", // JDK historical
-                    "ibm948",
-                    "ibm-948",
-                    "948"
-                });
-
-        charset("x-IBM950", "IBM950",
-                new String[] {
-                    "cp950", // JDK historical
-                    "ibm950",
-                    "ibm-950",
-                    "950"
-                });
-
-        charset("x-IBM930", "IBM930",
-                new String[] {
-                    "cp930", // JDK historical
-                    "ibm930",
-                    "ibm-930",
-                    "930"
-                });
-
-        charset("x-IBM935", "IBM935",
-                new String[] {
-                    "cp935", // JDK historical
-                    "ibm935",
-                    "ibm-935",
-                    "935"
-                });
-
-        charset("x-IBM937", "IBM937",
-                new String[] {
-                    "cp937", // JDK historical
-                    "ibm937",
-                    "ibm-937",
-                    "937"
-                });
-
-        charset("x-IBM856", "IBM856",
-                new String[] {
-                    "cp856", // JDK historical
-                    "ibm-856",
-                    "ibm856",
-                    "856"
-                });
-
-        charset("IBM860", "IBM860",
-                new String[] {
-                    "cp860", // JDK historical
-                    "ibm860",
-                    "ibm-860",
-                    "860",
-                    "csIBM860"
-                });
-        charset("IBM861", "IBM861",
-                new String[] {
-                    "cp861", // JDK historical
-                    "ibm861",
-                    "ibm-861",
-                    "861",
-                    "csIBM861",
-                    "cp-is"
-                });
-
-        charset("IBM863", "IBM863",
-                new String[] {
-                    "cp863", // JDK historical
-                    "ibm863",
-                    "ibm-863",
-                    "863",
-                    "csIBM863"
-                });
-
-        charset("IBM864", "IBM864",
-                new String[] {
-                    "cp864", // JDK historical
-                    "ibm864",
-                    "ibm-864",
-                    "864",
-                    "csIBM864"
-                });
-
-        charset("IBM865", "IBM865",
-                new String[] {
-                    "cp865", // JDK historical
-                    "ibm865",
-                    "ibm-865",
-                    "865",
-                    "csIBM865"
-                });
-
-        charset("IBM868", "IBM868",
-                new String[] {
-                    "cp868", // JDK historical
-                    "ibm868",
-                    "ibm-868",
-                    "868",
-                    "cp-ar",
-                    "csIBM868"
-                });
-
-        charset("IBM869", "IBM869",
-                new String[] {
-                    "cp869", // JDK historical
-                    "ibm869",
-                    "ibm-869",
-                    "869",
-                    "cp-gr",
-                    "csIBM869"
-                });
-
-        charset("x-IBM921", "IBM921",
-                new String[] {
-                    "cp921", // JDK historical
-                    "ibm921",
-                    "ibm-921",
-                    "921"
-                });
-
-        charset("x-IBM1006", "IBM1006",
-                new String[] {
-                    "cp1006", // JDK historical
-                    "ibm1006",
-                    "ibm-1006",
-                    "1006"
-                });
-
-        charset("x-IBM1046", "IBM1046",
-                new String[] {
-                    "cp1046", // JDK historical
-                    "ibm1046",
-                    "ibm-1046",
-                    "1046"
-                });
-
-        charset("IBM1047", "IBM1047",
-                new String[] {
-                    "cp1047", // JDK historical
-                    "ibm-1047",
-                    "1047"
-                });
-
-        charset("x-IBM1098", "IBM1098",
-                new String[] {
-                    "cp1098", // JDK historical
-                    "ibm1098",
-                    "ibm-1098",
-                    "1098",
-                });
-
-        charset("IBM037", "IBM037",
-                new String[] {
-                    "cp037", // JDK historical
-                    "ibm037",
-                    "ebcdic-cp-us",
-                    "ebcdic-cp-ca",
-                    "ebcdic-cp-wt",
-                    "ebcdic-cp-nl",
-                    "csIBM037",
-                    "cs-ebcdic-cp-us",
-                    "cs-ebcdic-cp-ca",
-                    "cs-ebcdic-cp-wt",
-                    "cs-ebcdic-cp-nl",
-                    "ibm-037",
-                    "ibm-37",
-                    "cpibm37",
-                    "037"
-                });
-
-        charset("x-IBM1025", "IBM1025",
-                new String[] {
-                    "cp1025", // JDK historical
-                    "ibm1025",
-                    "ibm-1025",
-                    "1025"
-                });
-
-        charset("IBM1026", "IBM1026",
-                new String[] {
-                    "cp1026", // JDK historical
-                    "ibm1026",
-                    "ibm-1026",
-                    "1026"
-                });
-
-        charset("x-IBM1112", "IBM1112",
-                new String[] {
-                    "cp1112", // JDK historical
-                    "ibm1112",
-                    "ibm-1112",
-                    "1112"
-                });
-
-        charset("x-IBM1122", "IBM1122",
-                new String[] {
-                    "cp1122", // JDK historical
-                    "ibm1122",
-                    "ibm-1122",
-                    "1122"
-                });
-
-        charset("x-IBM1123", "IBM1123",
-                new String[] {
-                    "cp1123", // JDK historical
-                    "ibm1123",
-                    "ibm-1123",
-                    "1123"
-                });
-
-        charset("x-IBM1124", "IBM1124",
-                new String[] {
-                    "cp1124", // JDK historical
-                    "ibm1124",
-                    "ibm-1124",
-                    "1124"
-                });
-
-        charset("x-IBM1364", "IBM1364",
-                new String[] {
-                    "cp1364",
-                    "ibm1364",
-                    "ibm-1364",
-                    "1364"
-                });
-
-        charset("IBM273", "IBM273",
-                new String[] {
-                    "cp273", // JDK historical
-                    "ibm273",
-                    "ibm-273",
-                    "273"
-                });
-
-        charset("IBM277", "IBM277",
-                new String[] {
-                    "cp277", // JDK historical
-                    "ibm277",
-                    "ibm-277",
-                    "277"
-                });
-
-        charset("IBM278", "IBM278",
-                new String[] {
-                    "cp278", // JDK historical
-                    "ibm278",
-                    "ibm-278",
-                    "278",
-                    "ebcdic-sv",
-                    "ebcdic-cp-se",
-                    "csIBM278"
-                });
-
-        charset("IBM280", "IBM280",
-                new String[] {
-                    "cp280", // JDK historical
-                    "ibm280",
-                    "ibm-280",
-                    "280"
-                });
-
-        charset("IBM284", "IBM284",
-                new String[] {
-                    "cp284", // JDK historical
-                    "ibm284",
-                    "ibm-284",
-                    "284",
-                    "csIBM284",
-                    "cpibm284"
-                });
-
-        charset("IBM285", "IBM285",
-                new String[] {
-                    "cp285", // JDK historical
-                    "ibm285",
-                    "ibm-285",
-                    "285",
-                    "ebcdic-cp-gb",
-                    "ebcdic-gb",
-                    "csIBM285",
-                    "cpibm285"
-                });
-
-        charset("IBM297", "IBM297",
-                new String[] {
-                    "cp297", // JDK historical
-                    "ibm297",
-                    "ibm-297",
-                    "297",
-                    "ebcdic-cp-fr",
-                    "cpibm297",
-                    "csIBM297",
-                });
-
-        charset("IBM420", "IBM420",
-                new String[] {
-                    "cp420", // JDK historical
-                    "ibm420",
-                    "ibm-420",
-                    "ebcdic-cp-ar1",
-                    "420",
-                    "csIBM420"
-                });
-
-        charset("IBM424", "IBM424",
-                new String[] {
-                    "cp424", // JDK historical
-                    "ibm424",
-                    "ibm-424",
-                    "424",
-                    "ebcdic-cp-he",
-                    "csIBM424"
-                });
-
-        charset("IBM500", "IBM500",
-                new String[] {
-                    "cp500", // JDK historical
-                    "ibm500",
-                    "ibm-500",
-                    "500",
-                    "ebcdic-cp-ch",
-                    "ebcdic-cp-bh",
-                    "csIBM500"
-                });
-
-        charset("x-IBM833", "IBM833",
-                new String[] {
-                     "cp833",
-                     "ibm833",
-                     "ibm-833"
-                 });
-
-        //EBCDIC DBCS-only Korean
-        charset("x-IBM834", "IBM834",
-                new String[] {
-                    "cp834",
-                    "ibm834",
-                    "834",
-                    "ibm-834"
-        });
-
-
-        charset("IBM-Thai", "IBM838",
-                new String[] {
-                    "cp838", // JDK historical
-                    "ibm838",
-                    "ibm-838",
-                    "838"
-                });
-
-        charset("IBM870", "IBM870",
-                new String[] {
-                    "cp870", // JDK historical
-                    "ibm870",
-                    "ibm-870",
-                    "870",
-                    "ebcdic-cp-roece",
-                    "ebcdic-cp-yu",
-                    "csIBM870"
-                });
-
-        charset("IBM871", "IBM871",
-                new String[] {
-                    "cp871", // JDK historical
-                    "ibm871",
-                    "ibm-871",
-                    "871",
-                    "ebcdic-cp-is",
-                    "csIBM871"
-                });
-
-        charset("x-IBM875", "IBM875",
-                new String[] {
-                    "cp875", // JDK historical
-                    "ibm875",
-                    "ibm-875",
-                    "875"
-                });
-
-        charset("IBM918", "IBM918",
-                new String[] {
-                    "cp918", // JDK historical
-                    "ibm-918",
-                    "918",
-                    "ebcdic-cp-ar2"
-                });
-
-        charset("x-IBM922", "IBM922",
-                new String[] {
-                    "cp922", // JDK historical
-                    "ibm922",
-                    "ibm-922",
-                    "922"
-                });
-
-        charset("x-IBM1097", "IBM1097",
-                new String[] {
-                    "cp1097", // JDK historical
-                    "ibm1097",
-                    "ibm-1097",
-                    "1097"
-                });
-
-        charset("x-IBM949", "IBM949",
-                new String[] {
-                    "cp949", // JDK historical
-                    "ibm949",
-                    "ibm-949",
-                    "949"
-                });
-
-        charset("x-IBM949C", "IBM949C",
-                new String[] {
-                    "cp949C", // JDK historical
-                    "ibm949C",
-                    "ibm-949C",
-                    "949C"
-                });
-
-        charset("x-IBM939", "IBM939",
-                new String[] {
-                    "cp939", // JDK historical
-                    "ibm939",
-                    "ibm-939",
-                    "939"
-                });
-
-        charset("x-IBM933", "IBM933",
-                new String[] {
-                    "cp933", // JDK historical
-                    "ibm933",
-                    "ibm-933",
-                    "933"
-                });
-
-        charset("x-IBM1381", "IBM1381",
-                new String[] {
-                    "cp1381", // JDK historical
-                    "ibm1381",
-                    "ibm-1381",
-                    "1381"
-                });
-
-        charset("x-IBM1383", "IBM1383",
-                new String[] {
-                    "cp1383", // JDK historical
-                    "ibm1383",
-                    "ibm-1383",
-                    "1383"
-                });
-
-        charset("x-IBM970", "IBM970",
-                new String[] {
-                    "cp970", // JDK historical
-                    "ibm970",
-                    "ibm-970",
-                    "ibm-eucKR",
-                    "970"
-                });
-
-        charset("x-IBM964", "IBM964",
-                new String[] {
-                    "cp964", // JDK historical
-                    "ibm964",
-                    "ibm-964",
-                    "964"
-                });
-
-        charset("x-IBM33722", "IBM33722",
-                new String[] {
-                    "cp33722", // JDK historical
-                    "ibm33722",
-                    "ibm-33722",
-                    "ibm-5050", // from IBM alias list
-                    "ibm-33722_vascii_vpua", // from IBM alias list
-                    "33722"
-                });
-
-        charset("IBM01140", "IBM1140",
-                new String[] {
-                    "cp1140", // JDK historical
-                    "ccsid01140",
-                    "cp01140",
-                    "1140",
-                    "ebcdic-us-037+euro"
-                });
-
-        charset("IBM01141", "IBM1141",
-                new String[] {
-                    "cp1141", // JDK historical
-                    "ccsid01141",
-                    "cp01141",
-                    "1141",
-                    "ebcdic-de-273+euro"
-                });
-
-        charset("IBM01142", "IBM1142",
-                new String[] {
-                    "cp1142", // JDK historical
-                    "ccsid01142",
-                    "cp01142",
-                    "1142",
-                    "ebcdic-no-277+euro",
-                    "ebcdic-dk-277+euro"
-                });
-
-        charset("IBM01143", "IBM1143",
-                new String[] {
-                    "cp1143", // JDK historical
-                    "ccsid01143",
-                    "cp01143",
-                    "1143",
-                    "ebcdic-fi-278+euro",
-                    "ebcdic-se-278+euro"
-                });
-
-        charset("IBM01144", "IBM1144",
-                new String[] {
-                    "cp1144", // JDK historical
-                    "ccsid01144",
-                    "cp01144",
-                    "1144",
-                    "ebcdic-it-280+euro"
-                });
-
-        charset("IBM01145", "IBM1145",
-                new String[] {
-                    "cp1145", // JDK historical
-                    "ccsid01145",
-                    "cp01145",
-                    "1145",
-                    "ebcdic-es-284+euro"
-                });
-
-        charset("IBM01146", "IBM1146",
-                new String[] {
-                    "cp1146", // JDK historical
-                    "ccsid01146",
-                    "cp01146",
-                    "1146",
-                    "ebcdic-gb-285+euro"
-                });
-
-        charset("IBM01147", "IBM1147",
-                new String[] {
-                    "cp1147", // JDK historical
-                    "ccsid01147",
-                    "cp01147",
-                    "1147",
-                    "ebcdic-fr-277+euro"
-                });
-
-        charset("IBM01148", "IBM1148",
-                new String[] {
-                    "cp1148", // JDK historical
-                    "ccsid01148",
-                    "cp01148",
-                    "1148",
-                    "ebcdic-international-500+euro"
-                });
-
-        charset("IBM01149", "IBM1149",
-                new String[] {
-                    "cp1149", // JDK historical
-                    "ccsid01149",
-                    "cp01149",
-                    "1149",
-                    "ebcdic-s-871+euro"
-                });
-
-        charset("IBM290", "IBM290",
-                new String[] {
-                    "cp290",
-                    "ibm290",
-                    "ibm-290",
-                    "csIBM290",
-                    "EBCDIC-JP-kana",
-                    "290"
-                });
-
-        charset("x-IBM300", "IBM300",
-                new String[] {
-                    "cp300",
-                    "ibm300",
-                    "ibm-300",
-                    "300"
-                });
-
-        // Macintosh MacOS/Apple char encodingd
-
-
-        charset("x-MacRoman", "MacRoman",
-                new String[] {
-                    "MacRoman" // JDK historical
-                });
-
-        charset("x-MacCentralEurope", "MacCentralEurope",
-                new String[] {
-                    "MacCentralEurope" // JDK historical
-                });
-
-        charset("x-MacCroatian", "MacCroatian",
-                new String[] {
-                    "MacCroatian" // JDK historical
-                });
-
-
-        charset("x-MacGreek", "MacGreek",
-                new String[] {
-                    "MacGreek" // JDK historical
-                });
-
-        charset("x-MacCyrillic", "MacCyrillic",
-                new String[] {
-                    "MacCyrillic" // JDK historical
-                });
-
-        charset("x-MacUkraine", "MacUkraine",
-                new String[] {
-                    "MacUkraine" // JDK historical
-                });
-
-        charset("x-MacTurkish", "MacTurkish",
-                new String[] {
-                    "MacTurkish" // JDK historical
-                });
-
-        charset("x-MacArabic", "MacArabic",
-                new String[] {
-                    "MacArabic" // JDK historical
-                });
-
-        charset("x-MacHebrew", "MacHebrew",
-                new String[] {
-                    "MacHebrew" // JDK historical
-                });
-
-        charset("x-MacIceland", "MacIceland",
-                new String[] {
-                    "MacIceland" // JDK historical
-                });
-
-        charset("x-MacRomania", "MacRomania",
-                new String[] {
-                    "MacRomania" // JDK historical
-                });
-
-        charset("x-MacThai", "MacThai",
-                new String[] {
-                    "MacThai" // JDK historical
-                });
-
-        charset("x-MacSymbol", "MacSymbol",
-                new String[] {
-                    "MacSymbol" // JDK historical
-                });
-
-        charset("x-MacDingbat", "MacDingbat",
-                new String[] {
-                    "MacDingbat" // JDK historical
-                });
-
-        instance = this;
-
-    }
-
-    private boolean initialized = false;
-
-    // If the sun.nio.cs.map property is defined on the command line we won't
-    // see it in the system-properties table until after the charset subsystem
-    // has been initialized.  We therefore delay the effect of this property
-    // until after the JRE has completely booted.
-    //
-    // At the moment following values for this property are supported, property
-    // value string is case insensitive.
-    //
-    // (1)"Windows-31J/Shift_JIS"
-    // In 1.4.1 we added a correct implementation of the Shift_JIS charset
-    // but in previous releases this charset name had been treated as an alias
-    // for Windows-31J, aka MS932. Users who have existing code that depends
-    // upon this alias can restore the previous behavior by defining this
-    // property to have this value.
-    //
-    // (2)"x-windows-50221/ISO-2022-JP"
-    //    "x-windows-50220/ISO-2022-JP"
-    //    "x-windows-iso2022jp/ISO-2022-JP"
-    // The charset ISO-2022-JP is a "standard based" implementation by default,
-    // which supports ASCII, JIS_X_0201 and JIS_X_0208 mappings based encoding
-    // and decoding only.
-    // There are three Microsoft iso-2022-jp variants, namely x-windows-50220,
-    // x-windows-50221 and x-windows-iso2022jp which behaves "slightly" differently
-    // compared to the "standard based" implementation. See ISO2022_JP.java for
-    // detailed description. Users who prefer the behavior of MS iso-2022-jp
-    // variants should use these names explicitly instead of using "ISO-2022-JP"
-    // and its aliases. However for those who need the ISO-2022-JP charset behaves
-    // exactly the same as MS variants do, above properties can be defined to
-    // switch.
-    //
-    // If we need to define other charset-alias mappings in the future then
-    // this property could be further extended, the general idea being that its
-    // value should be of the form
-    //
-    //     new-charset-1/old-charset-1,new-charset-2/old-charset-2,...
-    //
-    // where each charset named to the left of a slash is intended to replace
-    // (most) uses of the charset named to the right of the slash.
-    //
-    protected void init() {
-        if (initialized)
-            return;
-        if (!sun.misc.VM.isBooted())
-            return;
-
-        String map = getProperty("sun.nio.cs.map");
-        boolean sjisIsMS932 = false;
-        boolean iso2022jpIsMS50221 = false;
-        boolean iso2022jpIsMS50220 = false;
-        boolean iso2022jpIsMSISO2022JP = false;
-        if (map != null) {
-            String[] maps = map.split(",");
-            for (int i = 0; i < maps.length; i++) {
-                if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
-                    sjisIsMS932 = true;
-                } else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) {
-                    iso2022jpIsMS50221 = true;
-                } else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) {
-                    iso2022jpIsMS50220 = true;
-                } else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) {
-                    iso2022jpIsMSISO2022JP = true;
-                }
-            }
-        }
-        if (sjisIsMS932) {
-            deleteCharset("Shift_JIS",
-                          new String[] {
-                              // IANA aliases
-                              "sjis", // historical
-                              "shift_jis",
-                              "shift-jis",
-                              "ms_kanji",
-                              "x-sjis",
-                              "csShiftJIS"
-                          });
-            deleteCharset("windows-31j",
-                          new String[] {
-                              "MS932", // JDK historical
-                              "windows-932",
-                              "csWindows31J"
-                          });
-            charset("Shift_JIS", "SJIS",
-                    new String[] {
-                        // IANA aliases
-                        "sjis"          // JDK historical
-                    });
-            charset("windows-31j", "MS932",
-                    new String[] {
-                        "MS932",        // JDK historical
-                        "windows-932",
-                        "csWindows31J",
-                        "shift-jis",
-                        "ms_kanji",
-                        "x-sjis",
-                        "csShiftJIS",
-                        // This alias takes precedence over the actual
-                        // Shift_JIS charset itself since aliases are always
-                        // resolved first, before looking up canonical names.
-                        "shift_jis"
-                    });
-        }
-        if (iso2022jpIsMS50221 ||
-            iso2022jpIsMS50220 ||
-            iso2022jpIsMSISO2022JP) {
-            deleteCharset("ISO-2022-JP",
-                          new String[] {
-                              "iso2022jp",
-                                "jis",
-                                "csISO2022JP",
-                                "jis_encoding",
-                                "csjisencoding"
-                          });
-            if (iso2022jpIsMS50221) {
-                deleteCharset("x-windows-50221",
-                              new String[] {
-                                  "cp50221",
-                                  "ms50221"
-                              });
-                charset("x-windows-50221", "MS50221",
-                        new String[] {
-                            "cp50221",
-                            "ms50221",
-                            "iso-2022-jp",
-                            "iso2022jp",
-                            "jis",
-                            "csISO2022JP",
-                            "jis_encoding",
-                            "csjisencoding"
-                        });
-            } else if (iso2022jpIsMS50220) {
-                deleteCharset("x-windows-50220",
-                              new String[] {
-                                  "cp50220",
-                                  "ms50220"
-                              });
-                charset("x-windows-50220", "MS50220",
-                        new String[] {
-                            "cp50220",
-                            "ms50220",
-                            "iso-2022-jp",
-                            "iso2022jp",
-                            "jis",
-                            "csISO2022JP",
-                            "jis_encoding",
-                            "csjisencoding"
-                        });
-            } else {
-                deleteCharset("x-windows-iso2022jp",
-                              new String[] {
-                                  "windows-iso2022jp"
-                              });
-                charset("x-windows-iso2022jp", "MSISO2022JP",
-                        new String[] {
-                            "windows-iso2022jp",
-                            "iso-2022-jp",
-                            "iso2022jp",
-                            "jis",
-                            "csISO2022JP",
-                            "jis_encoding",
-                            "csjisencoding"
-                        });
-
-
-            }
-        }
-        String osName = getProperty("os.name");
-        if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
-               || osName.contains("OS X")) {
-            charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
-                    new String[] {
-                        "COMPOUND_TEXT",        // JDK historical
-                        "x11-compound_text",
-                        "x-compound-text"
-                    });
-        }
-        initialized = true;
-    }
-
-    private static String getProperty(String key) {
-        // this method may be called during initialization of
-        // system class loader and thus not using lambda
-        return AccessController.doPrivileged(
-            new PrivilegedAction<String>() {
-                @Override
-                public String run() {
-                    return System.getProperty(key);
-                }
-            });
-    }
-
-    public static String[] aliasesFor(String charsetName) {
-        if (instance == null)
-            return null;
-        return instance.aliases(charsetName);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ *
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package sun.nio.cs.ext;
+
+import java.lang.ref.SoftReference;
+import java.nio.charset.Charset;
+import java.nio.charset.spi.CharsetProvider;
+import sun.nio.cs.AbstractCharsetProvider;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import sun.nio.cs.AbstractCharsetProvider;
+
+/**
+ * Provider for extended charsets.
+ */
+
+public class ExtendedCharsets extends AbstractCharsetProvider {
+
+    static volatile ExtendedCharsets instance = null;
+
+    public ExtendedCharsets() {
+
+        super("sun.nio.cs.ext");  // identify provider pkg name.
+
+        _CHARSETS_DEF_LIST_
+
+        instance = this;
+
+    }
+
+    private boolean initialized = false;
+
+    // If the sun.nio.cs.map property is defined on the command line we won't
+    // see it in the system-properties table until after the charset subsystem
+    // has been initialized.  We therefore delay the effect of this property
+    // until after the JRE has completely booted.
+    //
+    // At the moment following values for this property are supported, property
+    // value string is case insensitive.
+    //
+    // (1)"Windows-31J/Shift_JIS"
+    // In 1.4.1 we added a correct implementation of the Shift_JIS charset
+    // but in previous releases this charset name had been treated as an alias
+    // for Windows-31J, aka MS932. Users who have existing code that depends
+    // upon this alias can restore the previous behavior by defining this
+    // property to have this value.
+    //
+    // (2)"x-windows-50221/ISO-2022-JP"
+    //    "x-windows-50220/ISO-2022-JP"
+    //    "x-windows-iso2022jp/ISO-2022-JP"
+    // The charset ISO-2022-JP is a "standard based" implementation by default,
+    // which supports ASCII, JIS_X_0201 and JIS_X_0208 mappings based encoding
+    // and decoding only.
+    // There are three Microsoft iso-2022-jp variants, namely x-windows-50220,
+    // x-windows-50221 and x-windows-iso2022jp which behaves "slightly" differently
+    // compared to the "standard based" implementation. See ISO2022_JP.java for
+    // detailed description. Users who prefer the behavior of MS iso-2022-jp
+    // variants should use these names explicitly instead of using "ISO-2022-JP"
+    // and its aliases. However for those who need the ISO-2022-JP charset behaves
+    // exactly the same as MS variants do, above properties can be defined to
+    // switch.
+    //
+    // If we need to define other charset-alias mappings in the future then
+    // this property could be further extended, the general idea being that its
+    // value should be of the form
+    //
+    //     new-charset-1/old-charset-1,new-charset-2/old-charset-2,...
+    //
+    // where each charset named to the left of a slash is intended to replace
+    // (most) uses of the charset named to the right of the slash.
+    //
+    protected void init() {
+        if (initialized)
+            return;
+        if (!sun.misc.VM.isBooted())
+            return;
+
+        String map = getProperty("sun.nio.cs.map");
+        boolean sjisIsMS932 = false;
+        boolean iso2022jpIsMS50221 = false;
+        boolean iso2022jpIsMS50220 = false;
+        boolean iso2022jpIsMSISO2022JP = false;
+        if (map != null) {
+            String[] maps = map.split(",");
+            for (int i = 0; i < maps.length; i++) {
+                if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
+                    sjisIsMS932 = true;
+                } else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) {
+                    iso2022jpIsMS50221 = true;
+                } else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) {
+                    iso2022jpIsMS50220 = true;
+                } else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) {
+                    iso2022jpIsMSISO2022JP = true;
+                }
+            }
+        }
+        if (sjisIsMS932 && hasCharset("Shift_JIS")) {
+            deleteCharset("Shift_JIS",
+                          new String[] {
+                              // IANA aliases
+                              "sjis", // historical
+                              "shift_jis",
+                              "shift-jis",
+                              "ms_kanji",
+                              "x-sjis",
+                              "csShiftJIS"
+                          });
+            deleteCharset("windows-31j",
+                          new String[] {
+                              "MS932", // JDK historical
+                              "windows-932",
+                              "csWindows31J"
+                          });
+            charset("Shift_JIS", "SJIS",
+                    new String[] {
+                        // IANA aliases
+                        "sjis"          // JDK historical
+                    });
+            charset("windows-31j", "MS932",
+                    new String[] {
+                        "MS932",        // JDK historical
+                        "windows-932",
+                        "csWindows31J",
+                        "shift-jis",
+                        "ms_kanji",
+                        "x-sjis",
+                        "csShiftJIS",
+                        // This alias takes precedence over the actual
+                        // Shift_JIS charset itself since aliases are always
+                        // resolved first, before looking up canonical names.
+                        "shift_jis"
+                    });
+        }
+        if (iso2022jpIsMS50221 ||
+            iso2022jpIsMS50220 ||
+            iso2022jpIsMSISO2022JP) {
+            deleteCharset("ISO-2022-JP",
+                          new String[] {
+                              "iso2022jp",
+                                "jis",
+                                "csISO2022JP",
+                                "jis_encoding",
+                                "csjisencoding"
+                          });
+            if (iso2022jpIsMS50221) {
+                deleteCharset("x-windows-50221",
+                              new String[] {
+                                  "cp50221",
+                                  "ms50221"
+                              });
+                charset("x-windows-50221", "MS50221",
+                        new String[] {
+                            "cp50221",
+                            "ms50221",
+                            "iso-2022-jp",
+                            "iso2022jp",
+                            "jis",
+                            "csISO2022JP",
+                            "jis_encoding",
+                            "csjisencoding"
+                        });
+            } else if (iso2022jpIsMS50220) {
+                deleteCharset("x-windows-50220",
+                              new String[] {
+                                  "cp50220",
+                                  "ms50220"
+                              });
+                charset("x-windows-50220", "MS50220",
+                        new String[] {
+                            "cp50220",
+                            "ms50220",
+                            "iso-2022-jp",
+                            "iso2022jp",
+                            "jis",
+                            "csISO2022JP",
+                            "jis_encoding",
+                            "csjisencoding"
+                        });
+            } else {
+                deleteCharset("x-windows-iso2022jp",
+                              new String[] {
+                                  "windows-iso2022jp"
+                              });
+                charset("x-windows-iso2022jp", "MSISO2022JP",
+                        new String[] {
+                            "windows-iso2022jp",
+                            "iso-2022-jp",
+                            "iso2022jp",
+                            "jis",
+                            "csISO2022JP",
+                            "jis_encoding",
+                            "csjisencoding"
+                        });
+
+
+            }
+        }
+        String osName = getProperty("os.name");
+        if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
+               || osName.contains("OS X")) {
+            charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
+                    new String[] {
+                        "COMPOUND_TEXT",        // JDK historical
+                        "x11-compound_text",
+                        "x-compound-text"
+                    });
+        }
+        initialized = true;
+    }
+
+    private static String getProperty(String key) {
+        // this method may be called during initialization of
+        // system class loader and thus not using lambda
+        return AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty(key);
+                }
+            });
+    }
+
+    public static String[] aliasesFor(String charsetName) {
+        if (instance == null)
+            return null;
+        return instance.aliases(charsetName);
+    }
+
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/HKSCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import java.util.Arrays;
-import sun.nio.cs.Surrogate;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class HKSCS {
-
-    public static class Decoder extends DoubleByte.Decoder {
-        static int b2Min = 0x40;
-        static int b2Max = 0xfe;
-
-        private char[][] b2cBmp;
-        private char[][] b2cSupp;
-        private DoubleByte.Decoder big5Dec;
-
-        protected Decoder(Charset cs,
-                          DoubleByte.Decoder big5Dec,
-                          char[][] b2cBmp, char[][] b2cSupp)
-        {
-            // super(cs, 0.5f, 1.0f);
-            // need to extends DoubleByte.Decoder so the
-            // sun.io can use it. this implementation
-            super(cs, 0.5f, 1.0f, null, null, 0, 0);
-            this.big5Dec = big5Dec;
-            this.b2cBmp = b2cBmp;
-            this.b2cSupp = b2cSupp;
-        }
-
-        public char decodeSingle(int b) {
-            return big5Dec.decodeSingle(b);
-        }
-
-        public char decodeBig5(int b1, int b2) {
-            return big5Dec.decodeDouble(b1, b2);
-        }
-
-        public char decodeDouble(int b1, int b2) {
-            return b2cBmp[b1][b2 - b2Min];
-        }
-
-        public char decodeDoubleEx(int b1, int b2) {
-            /* if the b2cSupp is null, the subclass need
-               to override the methold
-            if (b2cSupp == null)
-                return UNMAPPABLE_DECODING;
-             */
-            return b2cSupp[b1][b2 - b2Min];
-        }
-
-        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
-            byte[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-
-            char[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                while (sp < sl) {
-                    int b1 = sa[sp] & 0xff;
-                    char c = decodeSingle(b1);
-                    int inSize = 1, outSize = 1;
-                    char[] cc = null;
-                    if (c == UNMAPPABLE_DECODING) {
-                        if (sl - sp < 2)
-                            return CoderResult.UNDERFLOW;
-                        int b2 = sa[sp + 1] & 0xff;
-                        inSize++;
-                        if (b2 < b2Min || b2 > b2Max)
-                            return CoderResult.unmappableForLength(2);
-                        c = decodeDouble(b1, b2);           //bmp
-                        if (c == UNMAPPABLE_DECODING) {
-                            c = decodeDoubleEx(b1, b2);     //supp
-                            if (c == UNMAPPABLE_DECODING) {
-                                c = decodeBig5(b1, b2);     //big5
-                                if (c == UNMAPPABLE_DECODING)
-                                    return CoderResult.unmappableForLength(2);
-                            } else {
-                                // supplementary character in u+2xxxx area
-                                outSize = 2;
-                            }
-                        }
-                    }
-                    if (dl - dp < outSize)
-                        return CoderResult.OVERFLOW;
-                    if (outSize == 2) {
-                        // supplementary characters
-                        da[dp++] = Surrogate.high(0x20000 + c);
-                        da[dp++] = Surrogate.low(0x20000 + c);
-                    } else {
-                        da[dp++] = c;
-                    }
-                    sp += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
-            int mark = src.position();
-            try {
-                while (src.hasRemaining()) {
-                    char[] cc = null;
-                    int b1 = src.get() & 0xff;
-                    int inSize = 1, outSize = 1;
-                    char c = decodeSingle(b1);
-                    if (c == UNMAPPABLE_DECODING) {
-                        if (src.remaining() < 1)
-                            return CoderResult.UNDERFLOW;
-                        int b2 = src.get() & 0xff;
-                        inSize++;
-                        if (b2 < b2Min || b2 > b2Max)
-                            return CoderResult.unmappableForLength(2);
-                        c = decodeDouble(b1, b2);           //bmp
-                        if (c == UNMAPPABLE_DECODING) {
-                            c = decodeDoubleEx(b1, b2);     //supp
-                            if (c == UNMAPPABLE_DECODING) {
-                                c = decodeBig5(b1, b2);     //big5
-                                if (c == UNMAPPABLE_DECODING)
-                                    return CoderResult.unmappableForLength(2);
-                            } else {
-                                outSize = 2;
-                            }
-                        }
-                    }
-                    if (dst.remaining() < outSize)
-                        return CoderResult.OVERFLOW;
-                    if (outSize == 2) {
-                        dst.put(Surrogate.high(0x20000 + c));
-                        dst.put(Surrogate.low(0x20000 + c));
-                    } else {
-                        dst.put(c);
-                    }
-                    mark += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        public int decode(byte[] src, int sp, int len, char[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            char repl = replacement().charAt(0);
-            while (sp < sl) {
-                int b1 = src[sp++] & 0xff;
-                char c = decodeSingle(b1);
-                if (c == UNMAPPABLE_DECODING) {
-                    if (sl == sp) {
-                        c = repl;
-                    } else {
-                        int b2 = src[sp++] & 0xff;
-                        if (b2 < b2Min || b2 > b2Max) {
-                            c = repl;
-                        } else if ((c = decodeDouble(b1, b2)) == UNMAPPABLE_DECODING) {
-                            c = decodeDoubleEx(b1, b2);     //supp
-                            if (c == UNMAPPABLE_DECODING) {
-                                c = decodeBig5(b1, b2);     //big5
-                                if (c == UNMAPPABLE_DECODING)
-                                    c = repl;
-                            } else {
-                                // supplementary character in u+2xxxx area
-                                dst[dp++] = Surrogate.high(0x20000 + c);
-                                dst[dp++] = Surrogate.low(0x20000 + c);
-                                continue;
-                            }
-                        }
-                    }
-                }
-                dst[dp++] = c;
-            }
-            return dp;
-        }
-
-        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
-            if (src.hasArray() && dst.hasArray())
-                return decodeArrayLoop(src, dst);
-            else
-                return decodeBufferLoop(src, dst);
-        }
-
-        static void initb2c(char[][]b2c, String[] b2cStr)
-        {
-            for (int i = 0; i < b2cStr.length; i++) {
-                if (b2cStr[i] == null)
-                    b2c[i] = DoubleByte.B2C_UNMAPPABLE;
-                else
-                    b2c[i] = b2cStr[i].toCharArray();
-            }
-        }
-
-    }
-
-    public static class Encoder extends DoubleByte.Encoder {
-        private DoubleByte.Encoder big5Enc;
-        private char[][] c2bBmp;
-        private char[][] c2bSupp;
-
-        protected Encoder(Charset cs,
-                          DoubleByte.Encoder big5Enc,
-                          char[][] c2bBmp,
-                          char[][] c2bSupp)
-        {
-            super(cs, null, null);
-            this.big5Enc = big5Enc;
-            this.c2bBmp = c2bBmp;
-            this.c2bSupp = c2bSupp;
-        }
-
-        public int encodeBig5(char ch) {
-            return big5Enc.encodeChar(ch);
-        }
-
-        public int encodeChar(char ch) {
-            int bb = c2bBmp[ch >> 8][ch & 0xff];
-            if (bb == UNMAPPABLE_ENCODING)
-                return encodeBig5(ch);
-            return bb;
-        }
-
-        public int encodeSupp(int cp) {
-            if ((cp & 0xf0000) != 0x20000)
-                return UNMAPPABLE_ENCODING;
-            return c2bSupp[(cp >> 8) & 0xff][cp & 0xff];
-        }
-
-        public boolean canEncode(char c) {
-            return encodeChar(c) != UNMAPPABLE_ENCODING;
-        }
-
-        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
-            char[] sa = src.array();
-            int sp = src.arrayOffset() + src.position();
-            int sl = src.arrayOffset() + src.limit();
-
-            byte[] da = dst.array();
-            int dp = dst.arrayOffset() + dst.position();
-            int dl = dst.arrayOffset() + dst.limit();
-
-            try {
-                while (sp < sl) {
-                    char c = sa[sp];
-                    int inSize = 1;
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            int cp;
-                            if ((cp = sgp().parse(c, sa, sp, sl)) < 0)
-                                return sgp.error();
-                            bb = encodeSupp(cp);
-                            if (bb == UNMAPPABLE_ENCODING)
-                                return CoderResult.unmappableForLength(2);
-                            inSize = 2;
-                        } else {
-                            return CoderResult.unmappableForLength(1);
-                        }
-                    }
-                    if (bb > MAX_SINGLEBYTE) {    // DoubleByte
-                        if (dl - dp < 2)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)(bb >> 8);
-                        da[dp++] = (byte)bb;
-                    } else {                      // SingleByte
-                        if (dl - dp < 1)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (byte)bb;
-                    }
-                    sp += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(sp - src.arrayOffset());
-                dst.position(dp - dst.arrayOffset());
-            }
-        }
-
-        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
-            int mark = src.position();
-            try {
-                while (src.hasRemaining()) {
-                    int inSize = 1;
-                    char c = src.get();
-                    int bb = encodeChar(c);
-                    if (bb == UNMAPPABLE_ENCODING) {
-                        if (Character.isSurrogate(c)) {
-                            int cp;
-                            if ((cp = sgp().parse(c, src)) < 0)
-                                return sgp.error();
-                            bb = encodeSupp(cp);
-                            if (bb == UNMAPPABLE_ENCODING)
-                                return CoderResult.unmappableForLength(2);
-                            inSize = 2;
-                        } else {
-                            return CoderResult.unmappableForLength(1);
-                        }
-                    }
-                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
-                        if (dst.remaining() < 2)
-                            return CoderResult.OVERFLOW;
-                        dst.put((byte)(bb >> 8));
-                        dst.put((byte)(bb));
-                    } else {
-                        if (dst.remaining() < 1)
-                        return CoderResult.OVERFLOW;
-                        dst.put((byte)bb);
-                    }
-                    mark += inSize;
-                }
-                return CoderResult.UNDERFLOW;
-            } finally {
-                src.position(mark);
-            }
-        }
-
-        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
-            if (src.hasArray() && dst.hasArray())
-                return encodeArrayLoop(src, dst);
-            else
-                return encodeBufferLoop(src, dst);
-        }
-
-        private byte[] repl = replacement();
-        protected void implReplaceWith(byte[] newReplacement) {
-            repl = newReplacement;
-        }
-
-        public int encode(char[] src, int sp, int len, byte[] dst) {
-            int dp = 0;
-            int sl = sp + len;
-            while (sp < sl) {
-                char c = src[sp++];
-                int bb = encodeChar(c);
-                if (bb == UNMAPPABLE_ENCODING) {
-                    if (!Character.isHighSurrogate(c) || sp == sl ||
-                        !Character.isLowSurrogate(src[sp]) ||
-                        (bb = encodeSupp(Character.toCodePoint(c, src[sp++])))
-                        == UNMAPPABLE_ENCODING) {
-                        dst[dp++] = repl[0];
-                        if (repl.length > 1)
-                            dst[dp++] = repl[1];
-                        continue;
-                    }
-                    sp++;
-                }
-                if (bb > MAX_SINGLEBYTE) {        // DoubleByte
-                    dst[dp++] = (byte)(bb >> 8);
-                    dst[dp++] = (byte)bb;
-                } else {                          // SingleByte
-                    dst[dp++] = (byte)bb;
-                }
-            }
-            return dp;
-        }
-
-
-        static char[] C2B_UNMAPPABLE = new char[0x100];
-        static {
-            Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
-        }
-
-       static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
-            // init c2b/c2bSupp from b2cStr and supp
-            int b2Min = 0x40;
-            Arrays.fill(c2b, C2B_UNMAPPABLE);
-            for (int b1 = 0; b1 < 0x100; b1++) {
-                String s = b2cStr[b1];
-                if (s == null)
-                    continue;
-                for (int i = 0; i < s.length(); i++) {
-                    char c = s.charAt(i);
-                    int hi = c >> 8;
-                    if (c2b[hi] == C2B_UNMAPPABLE) {
-                        c2b[hi] = new char[0x100];
-                        Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
-                    }
-                    c2b[hi][c & 0xff] = (char)((b1 << 8) | (i + b2Min));
-                }
-            }
-            if (pua != null) {        // add the compatibility pua entries
-                char c = '\ue000';    //first pua character
-                for (int i = 0; i < pua.length(); i++) {
-                    char bb = pua.charAt(i);
-                    if (bb != UNMAPPABLE_DECODING) {
-                        int hi = c >> 8;
-                        if (c2b[hi] == C2B_UNMAPPABLE) {
-                            c2b[hi] = new char[0x100];
-                            Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
-                        }
-                        c2b[hi][c & 0xff] = bb;
-                    }
-                    c++;
-                }
-            }
-        }
-    }
-}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java	Wed Jul 05 20:20:43 2017 +0200
@@ -34,6 +34,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
+import sun.nio.cs.DoubleByte;
 import static sun.nio.cs.CharsetMapping.*;
 
 // EBCDIC DBCS-only Korean
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM942C.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM942C.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.util.Arrays;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
 import static sun.nio.cs.CharsetMapping.*;
 
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM943C.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM943C.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.util.Arrays;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
 
 public class IBM943C extends Charset implements HistoricallyNamedCharset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.util.Arrays;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
 
 public class IBM949C extends Charset implements HistoricallyNamedCharset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN.java	Wed Jul 05 20:20:43 2017 +0200
@@ -35,8 +35,10 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CharacterCodingException;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
 import sun.nio.cs.US_ASCII;
+import sun.nio.cs.*;
 
 public class ISO2022_CN
     extends Charset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_GB.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_GB.java	Wed Jul 05 20:20:43 2017 +0200
@@ -34,6 +34,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
+import sun.nio.cs.*;
 import sun.nio.cs.HistoricallyNamedCharset;
 
 public class ISO2022_CN_GB extends ISO2022 implements HistoricallyNamedCharset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_JP.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_JP.java	Wed Jul 05 20:20:43 2017 +0200
@@ -32,9 +32,12 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
+import sun.nio.cs.DelegatableDecoder;
+import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HistoricallyNamedCharset;
 import sun.nio.cs.Surrogate;
 import sun.nio.cs.US_ASCII;
+import sun.nio.cs.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 /*
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_JP_2.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_JP_2.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.*;
 
 public class ISO2022_JP_2 extends ISO2022_JP
 {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_KR.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_KR.java	Wed Jul 05 20:20:43 2017 +0200
@@ -35,7 +35,7 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.ext.EUC_KR;
+import sun.nio.cs.*;
 
 public class ISO2022_KR extends ISO2022
 implements HistoricallyNamedCharset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Wed Jul 05 20:20:43 2017 +0200
@@ -33,9 +33,11 @@
 import java.nio.charset.CoderResult;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.MalformedInputException;
+import sun.nio.cs.DelegatableDecoder;
 import sun.nio.cs.HistoricallyNamedCharset;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import sun.nio.cs.*;
 import static java.lang.Character.UnicodeBlock;
 
 
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS50220.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS50220.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.*;
 
 public class MS50220 extends ISO2022_JP
 {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS50221.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS50221.java	Wed Jul 05 20:20:43 2017 +0200
@@ -26,6 +26,7 @@
 package sun.nio.cs.ext;
 
 import java.nio.charset.Charset;
+import sun.nio.cs.*;
 
 public class MS50221 extends MS50220
 {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS932_0213.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS932_0213.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CharsetDecoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 public class MS932_0213 extends Charset {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.HistoricallyNamedCharset;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class MS950_HKSCS_XP extends Charset
-{
-    public MS950_HKSCS_XP() {
-        super("x-MS950-HKSCS-XP", ExtendedCharsets.aliasesFor("x-MS950-HKSCS-XP"));
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof MS950)
-                || (cs instanceof MS950_HKSCS_XP));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    static class Decoder extends HKSCS.Decoder {
-        private static DoubleByte.Decoder ms950 =
-            (DoubleByte.Decoder)new MS950().newDecoder();
-
-        /*
-         * Note current decoder decodes 0x8BC2 --> U+F53A
-         * ie. maps to Unicode PUA.
-         * Unaccounted discrepancy between this mapping
-         * inferred from MS950/windows-950 and the published
-         * MS HKSCS mappings which maps 0x8BC2 --> U+5C22
-         * a character defined with the Unified CJK block
-         */
-        private static char[][] b2cBmp = new char[0x100][];
-        static {
-            initb2c(b2cBmp, HKSCS_XPMapping.b2cBmpStr);
-        }
-
-        public char decodeDoubleEx(int b1, int b2) {
-            return UNMAPPABLE_DECODING;
-        }
-
-        private Decoder(Charset cs) {
-            super(cs, ms950, b2cBmp, null);
-        }
-    }
-
-    private static class Encoder extends HKSCS.Encoder {
-        private static DoubleByte.Encoder ms950 =
-            (DoubleByte.Encoder)new MS950().newEncoder();
-
-        /*
-         * Note current encoder encodes U+F53A --> 0x8BC2
-         * Published MS HKSCS mappings show
-         * U+5C22 <--> 0x8BC2
-         */
-        static char[][] c2bBmp = new char[0x100][];
-        static {
-            initc2b(c2bBmp, HKSCS_XPMapping.b2cBmpStr, null);
-        }
-
-        public int encodeSupp(int cp) {
-            return UNMAPPABLE_ENCODING;
-        }
-
-        private Encoder(Charset cs) {
-            super(cs, ms950, c2bBmp, null);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java.template	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002, 2010, 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 $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
+import sun.nio.cs.HKSCS;
+import sun.nio.cs.HistoricallyNamedCharset;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class MS950_HKSCS_XP extends Charset
+{
+    public MS950_HKSCS_XP() {
+        super("x-MS950-HKSCS-XP", $ALIASES$);
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof MS950)
+                || (cs instanceof MS950_HKSCS_XP));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    static class Decoder extends HKSCS.Decoder {
+        private static DoubleByte.Decoder ms950 =
+            (DoubleByte.Decoder)new MS950().newDecoder();
+
+        /*
+         * Note current decoder decodes 0x8BC2 --> U+F53A
+         * ie. maps to Unicode PUA.
+         * Unaccounted discrepancy between this mapping
+         * inferred from MS950/windows-950 and the published
+         * MS HKSCS mappings which maps 0x8BC2 --> U+5C22
+         * a character defined with the Unified CJK block
+         */
+        private static char[][] b2cBmp = new char[0x100][];
+        static {
+            initb2c(b2cBmp, HKSCS_XPMapping.b2cBmpStr);
+        }
+
+        public char decodeDoubleEx(int b1, int b2) {
+            return UNMAPPABLE_DECODING;
+        }
+
+        private Decoder(Charset cs) {
+            super(cs, ms950, b2cBmp, null);
+        }
+    }
+
+    private static class Encoder extends HKSCS.Encoder {
+        private static DoubleByte.Encoder ms950 =
+            (DoubleByte.Encoder)new MS950().newEncoder();
+
+        /*
+         * Note current encoder encodes U+F53A --> 0x8BC2
+         * Published MS HKSCS mappings show
+         * U+5C22 <--> 0x8BC2
+         */
+        static char[][] c2bBmp = new char[0x100][];
+        static {
+            initc2b(c2bBmp, HKSCS_XPMapping.b2cBmpStr, null);
+        }
+
+        public int encodeSupp(int cp) {
+            return UNMAPPABLE_ENCODING;
+        }
+
+        private Encoder(Charset cs) {
+            super(cs, ms950, c2bBmp, null);
+        }
+    }
+}
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MSISO2022JP.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/MSISO2022JP.java	Wed Jul 05 20:20:43 2017 +0200
@@ -28,6 +28,7 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.DoubleByte;
 
 public class MSISO2022JP extends ISO2022_JP
 {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/SJIS_0213.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/SJIS_0213.java	Wed Jul 05 20:20:43 2017 +0200
@@ -35,6 +35,7 @@
 import java.security.PrivilegedAction;
 import java.util.Arrays;
 import sun.nio.cs.CharsetMapping;
+import sun.nio.cs.*;
 
 /*
  *  5 types of entry in SJIS_X_0213/Unicode mapping table
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/ECDSASignature.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,12 @@
  *   . "SHA256withECDSA"
  *   . "SHA384withECDSA"
  *   . "SHA512withECDSA"
+ *   . "NONEwithECDSAinP1363Format"
+ *   . "SHA1withECDSAinP1363Format"
+ *   . "SHA224withECDSAinP1363Format"
+ *   . "SHA256withECDSAinP1363Format"
+ *   . "SHA384withECDSAinP1363Format"
+ *   . "SHA512withECDSAinP1363Format"
  *
  * @since   1.7
  */
@@ -65,29 +71,56 @@
     // public key, if initialized for verifying
     private ECPublicKey publicKey;
 
+    // The format. true for the IEEE P1363 format. false (default) for ASN.1
+    private final boolean p1363Format;
+
     /**
-     * Constructs a new ECDSASignature. Used by Raw subclass.
+     * Constructs a new ECDSASignature.
      *
      * @exception ProviderException if the native ECC library is unavailable.
      */
     ECDSASignature() {
-        messageDigest = null;
+        this(false);
+    }
+
+    /**
+     * Constructs a new ECDSASignature that will use the specified
+     * signature format. {@code p1363Format} should be {@code true} to
+     * use the IEEE P1363 format. If {@code p1363Format} is {@code false},
+     * the DER-encoded ASN.1 format will be used. This constructor is
+     * used by the RawECDSA subclasses.
+     */
+    ECDSASignature(boolean p1363Format) {
+        this.messageDigest = null;
+        this.p1363Format = p1363Format;
     }
 
     /**
      * Constructs a new ECDSASignature. Used by subclasses.
      */
     ECDSASignature(String digestName) {
+        this(digestName, false);
+    }
+
+    /**
+     * Constructs a new ECDSASignature that will use the specified
+     * digest and signature format. {@code p1363Format} should be
+     * {@code true} to use the IEEE P1363 format. If {@code p1363Format}
+     * is {@code false}, the DER-encoded ASN.1 format will be used. This
+     * constructor is used by subclasses.
+     */
+    ECDSASignature(String digestName, boolean p1363Format) {
         try {
             messageDigest = MessageDigest.getInstance(digestName);
         } catch (NoSuchAlgorithmException e) {
             throw new ProviderException(e);
         }
-        needsReset = false;
+        this.needsReset = false;
+        this.p1363Format = p1363Format;
     }
 
-    // Nested class for NONEwithECDSA signatures
-    public static final class Raw extends ECDSASignature {
+    // Class for Raw ECDSA signatures.
+    static class RawECDSA extends ECDSASignature {
 
         // the longest supported digest is 512 bits (SHA-512)
         private static final int RAW_ECDSA_MAX = 64;
@@ -95,7 +128,8 @@
         private final byte[] precomputedDigest;
         private int offset = 0;
 
-        public Raw() {
+        RawECDSA(boolean p1363Format) {
+            super(p1363Format);
             precomputedDigest = new byte[RAW_ECDSA_MAX];
         }
 
@@ -156,6 +190,20 @@
         }
     }
 
+    // Nested class for NONEwithECDSA signatures
+    public static final class Raw extends RawECDSA {
+        public Raw() {
+            super(false);
+        }
+    }
+
+    // Nested class for NONEwithECDSAinP1363Format signatures
+    public static final class RawinP1363Format extends RawECDSA {
+        public RawinP1363Format() {
+            super(true);
+        }
+    }
+
     // Nested class for SHA1withECDSA signatures
     public static final class SHA1 extends ECDSASignature {
         public SHA1() {
@@ -163,6 +211,13 @@
         }
     }
 
+    // Nested class for SHA1withECDSAinP1363Format signatures
+    public static final class SHA1inP1363Format extends ECDSASignature {
+        public SHA1inP1363Format() {
+            super("SHA1", true);
+        }
+    }
+
     // Nested class for SHA224withECDSA signatures
     public static final class SHA224 extends ECDSASignature {
         public SHA224() {
@@ -170,6 +225,13 @@
         }
     }
 
+    // Nested class for SHA224withECDSAinP1363Format signatures
+    public static final class SHA224inP1363Format extends ECDSASignature {
+        public SHA224inP1363Format() {
+           super("SHA-224", true);
+        }
+    }
+
     // Nested class for SHA256withECDSA signatures
     public static final class SHA256 extends ECDSASignature {
         public SHA256() {
@@ -177,6 +239,13 @@
         }
     }
 
+    // Nested class for SHA256withECDSAinP1363Format signatures
+    public static final class SHA256inP1363Format extends ECDSASignature {
+        public SHA256inP1363Format() {
+            super("SHA-256", true);
+        }
+    }
+
     // Nested class for SHA384withECDSA signatures
     public static final class SHA384 extends ECDSASignature {
         public SHA384() {
@@ -184,6 +253,13 @@
         }
     }
 
+    // Nested class for SHA384withECDSAinP1363Format signatures
+    public static final class SHA384inP1363Format extends ECDSASignature {
+        public SHA384inP1363Format() {
+            super("SHA-384", true);
+        }
+    }
+
     // Nested class for SHA512withECDSA signatures
     public static final class SHA512 extends ECDSASignature {
         public SHA512() {
@@ -191,6 +267,13 @@
         }
     }
 
+    // Nested class for SHA512withECDSAinP1363Format signatures
+    public static final class SHA512inP1363Format extends ECDSASignature {
+        public SHA512inP1363Format() {
+            super("SHA-512", true);
+        }
+    }
+
     // initialize for verification. See JCA doc
     @Override
     protected void engineInitVerify(PublicKey publicKey)
@@ -286,14 +369,18 @@
         }
         random.nextBytes(seed);
 
+        byte[] sig;
         try {
-
-            return encodeSignature(
-                signDigest(getDigestValue(), s, encodedParams, seed));
-
+            sig = signDigest(getDigestValue(), s, encodedParams, seed);
         } catch (GeneralSecurityException e) {
             throw new SignatureException("Could not sign data", e);
         }
+
+        if (p1363Format) {
+            return sig;
+        } else {
+            return encodeSignature(sig);
+        }
     }
 
     // verify the data and return the result. See JCA doc
@@ -311,11 +398,15 @@
             w = ECUtil.encodePoint(publicKey.getW(), params.getCurve());
         }
 
-        try {
+        byte[] sig;
+        if (p1363Format) {
+            sig = signature;
+        } else {
+            sig = decodeSignature(signature);
+        }
 
-            return verifySignedDigest(
-                decodeSignature(signature), getDigestValue(), w, encodedParams);
-
+        try {
+            return verifySignedDigest(sig, getDigestValue(), w, encodedParams);
         } catch (GeneralSecurityException e) {
             throw new SignatureException("Could not verify signature", e);
         }
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunECEntries.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunECEntries.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,6 +131,19 @@
         map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");
         map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");
 
+        map.put("Signature.NONEwithECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$RawinP1363Format");
+        map.put("Signature.SHA1withECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$SHA1inP1363Format");
+        map.put("Signature.SHA224withECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$SHA224inP1363Format");
+        map.put("Signature.SHA256withECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$SHA256inP1363Format");
+        map.put("Signature.SHA384withECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$SHA384inP1363Format");
+        map.put("Signature.SHA512withECDSAinP1363Format",
+            "sun.security.ec.ECDSASignature$SHA512inP1363Format");
+
         String ecKeyClasses = "java.security.interfaces.ECPublicKey" +
                 "|java.security.interfaces.ECPrivateKey";
         map.put("Signature.NONEwithECDSA SupportedKeyClasses", ecKeyClasses);
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,8 @@
  * . DSA
  *   . NONEwithDSA (RawDSA)
  *   . SHA1withDSA
+ *   . NONEwithDSAinP1363Format (RawDSAinP1363Format)
+ *   . SHA1withDSAinP1363Format
  * . RSA:
  *   . MD2withRSA
  *   . MD5withRSA
@@ -65,6 +67,12 @@
  *   . SHA256withECDSA
  *   . SHA384withECDSA
  *   . SHA512withECDSA
+ *   . NONEwithECDSAinP1363Format
+ *   . SHA1withECDSAinP1363Format
+ *   . SHA224withECDSAinP1363Format
+ *   . SHA256withECDSAinP1363Format
+ *   . SHA384withECDSAinP1363Format
+ *   . SHA512withECDSAinP1363Format
  *
  * Note that the underlying PKCS#11 token may support complete signature
  * algorithm (e.g. CKM_DSA_SHA1, CKM_MD5_RSA_PKCS), or it may just
@@ -117,6 +125,12 @@
     // total number of bytes processed in current operation
     private int bytesProcessed;
 
+    // The format, to be used for DSA and ECDSA signatures.
+    // If true, the IEEE P1363 format will be used, the concatenation of
+    // r and s. If false (default), the signature will be formatted as a
+    // DER-encoded ASN.1 sequence of r and s.
+    private boolean p1363Format = false;
+
     // constant for signing mode
     private final static int M_SIGN   = 1;
     // constant for verification mode
@@ -166,10 +180,12 @@
             break;
         case (int)CKM_DSA:
             keyAlgorithm = "DSA";
-            if (algorithm.equals("DSA")) {
+            if (algorithm.equals("DSA") ||
+                algorithm.equals("DSAinP1363Format")) {
                 type = T_DIGEST;
                 md = MessageDigest.getInstance("SHA-1");
-            } else if (algorithm.equals("RawDSA")) {
+            } else if (algorithm.equals("RawDSA") ||
+                       algorithm.equals("RawDSAinP1363Format")) {
                 type = T_RAW;
                 buffer = new byte[20];
             } else {
@@ -178,20 +194,26 @@
             break;
         case (int)CKM_ECDSA:
             keyAlgorithm = "EC";
-            if (algorithm.equals("NONEwithECDSA")) {
+            if (algorithm.equals("NONEwithECDSA") ||
+                algorithm.equals("NONEwithECDSAinP1363Format")) {
                 type = T_RAW;
                 buffer = new byte[RAW_ECDSA_MAX];
             } else {
                 String digestAlg;
-                if (algorithm.equals("SHA1withECDSA")) {
+                if (algorithm.equals("SHA1withECDSA") ||
+                    algorithm.equals("SHA1withECDSAinP1363Format")) {
                     digestAlg = "SHA-1";
-                } else if (algorithm.equals("SHA224withECDSA")) {
+                } else if (algorithm.equals("SHA224withECDSA") ||
+                           algorithm.equals("SHA224withECDSAinP1363Format")) {
                     digestAlg = "SHA-224";
-                } else if (algorithm.equals("SHA256withECDSA")) {
+                } else if (algorithm.equals("SHA256withECDSA") ||
+                           algorithm.equals("SHA256withECDSAinP1363Format")) {
                     digestAlg = "SHA-256";
-                } else if (algorithm.equals("SHA384withECDSA")) {
+                } else if (algorithm.equals("SHA384withECDSA") ||
+                           algorithm.equals("SHA384withECDSAinP1363Format")) {
                     digestAlg = "SHA-384";
-                } else if (algorithm.equals("SHA512withECDSA")) {
+                } else if (algorithm.equals("SHA512withECDSA") ||
+                           algorithm.equals("SHA512withECDSAinP1363Format")) {
                     digestAlg = "SHA-512";
                 } else {
                     throw new ProviderException(algorithm);
@@ -235,6 +257,9 @@
         this.buffer = buffer;
         this.digestOID = digestOID;
         this.md = md;
+        if (algorithm.endsWith("inP1363Format")) {
+            this.p1363Format = true;
+        }
     }
 
     private void ensureInitialized() {
@@ -582,10 +607,14 @@
                     signature = token.p11.C_Sign(session.id(), data);
                 }
             }
-            if (keyAlgorithm.equals("RSA") == false) {
-                return dsaToASN1(signature);
+            if (keyAlgorithm.equals("RSA")) {
+                return signature;
             } else {
-                return signature;
+                if (p1363Format) {
+                    return signature;
+                } else {
+                    return dsaToASN1(signature);
+                }
             }
         } catch (PKCS11Exception e) {
             throw new ProviderException(e);
@@ -599,10 +628,12 @@
     protected boolean engineVerify(byte[] signature) throws SignatureException {
         ensureInitialized();
         try {
-            if (keyAlgorithm.equals("DSA")) {
-                signature = asn1ToDSA(signature);
-            } else if (keyAlgorithm.equals("EC")) {
-                signature = asn1ToECDSA(signature);
+            if (!p1363Format) {
+                if (keyAlgorithm.equals("DSA")) {
+                    signature = asn1ToDSA(signature);
+                } else if (keyAlgorithm.equals("EC")) {
+                    signature = asn1ToECDSA(signature);
+                }
             }
             if (type == T_UPDATE) {
                 token.p11.C_VerifyFinal(session.id(), signature);
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -680,6 +680,12 @@
                 s("SHA1withDSA", "1.3.14.3.2.13", "1.3.14.3.2.27",
                   "1.2.840.10040.4.3", "OID.1.2.840.10040.4.3"),
                 m(CKM_DSA_SHA1, CKM_DSA));
+        d(SIG, "RawDSAinP1363Format",   P11Signature,
+                s("NONEwithDSAinP1363Format"),
+                m(CKM_DSA));
+        d(SIG, "DSAinP1363Format",      P11Signature,
+                s("SHA1withDSAinP1363Format"),
+                m(CKM_DSA_SHA1, CKM_DSA));
         d(SIG, "NONEwithECDSA", P11Signature,
                 m(CKM_ECDSA));
         d(SIG, "SHA1withECDSA", P11Signature,
@@ -697,6 +703,18 @@
         d(SIG, "SHA512withECDSA",       P11Signature,
                 s("1.2.840.10045.4.3.4", "OID.1.2.840.10045.4.3.4"),
                 m(CKM_ECDSA));
+        d(SIG, "NONEwithECDSAinP1363Format",   P11Signature,
+                m(CKM_ECDSA));
+        d(SIG, "SHA1withECDSAinP1363Format",   P11Signature,
+                m(CKM_ECDSA_SHA1, CKM_ECDSA));
+        d(SIG, "SHA224withECDSAinP1363Format", P11Signature,
+                m(CKM_ECDSA));
+        d(SIG, "SHA256withECDSAinP1363Format", P11Signature,
+                m(CKM_ECDSA));
+        d(SIG, "SHA384withECDSAinP1363Format", P11Signature,
+                m(CKM_ECDSA));
+        d(SIG, "SHA512withECDSAinP1363Format", P11Signature,
+                m(CKM_ECDSA));
         d(SIG, "MD2withRSA",    P11Signature,
                 s("1.2.840.113549.1.1.2", "OID.1.2.840.113549.1.1.2"),
                 m(CKM_MD2_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
@@ -1061,7 +1079,7 @@
             }
             // EC
             if (((type == KA) && algorithm.equals("ECDH"))
-                    || ((type == SIG) && algorithm.endsWith("ECDSA"))) {
+                    || ((type == SIG) && algorithm.contains("ECDSA"))) {
                 if (keyAlgorithm.equals("EC") == false) {
                     return false;
                 }
@@ -1070,7 +1088,8 @@
                         || (key instanceof ECPublicKey);
             }
             // DSA signatures
-            if ((type == SIG) && algorithm.endsWith("DSA")) {
+            if ((type == SIG) && algorithm.contains("DSA") &&
+                    !algorithm.contains("ECDSA")) {
                 if (keyAlgorithm.equals("DSA") == false) {
                     return false;
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,4554 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+import java.io.*;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.lang.reflect.*;
+import java.text.Collator;
+import java.text.MessageFormat;
+import sun.security.util.PropertyExpander;
+import sun.security.util.PropertyExpander.ExpandException;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FileDialog;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.*;
+import sun.security.provider.*;
+import sun.security.util.PolicyUtil;
+import javax.security.auth.x500.X500Principal;
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * PolicyTool may be used by users and administrators to configure the
+ * overall java security policy (currently stored in the policy file).
+ * Using PolicyTool administrators may add and remove policies from
+ * the policy file. <p>
+ *
+ * @see java.security.Policy
+ * @since   1.2
+ */
+
+public class PolicyTool {
+
+    // for i18n
+    static final java.util.ResourceBundle rb =
+        java.util.ResourceBundle.getBundle(
+            "sun.security.tools.policytool.Resources");
+    static final Collator collator = Collator.getInstance();
+    static {
+        // this is for case insensitive string comparisons
+        collator.setStrength(Collator.PRIMARY);
+
+        // Support for Apple menu bar
+        if (System.getProperty("apple.laf.useScreenMenuBar") == null) {
+            System.setProperty("apple.laf.useScreenMenuBar", "true");
+        }
+        System.setProperty("apple.awt.application.name", getMessage("Policy.Tool"));
+
+        // Apply the system L&F if not specified with a system property.
+        if (System.getProperty("swing.defaultlaf") == null) {
+            try {
+                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+    }
+
+    // anyone can add warnings
+    Vector<String> warnings;
+    boolean newWarning = false;
+
+    // set to true if policy modified.
+    // this way upon exit we know if to ask the user to save changes
+    boolean modified = false;
+
+    private static final boolean testing = false;
+    private static final Class<?>[] TWOPARAMS = { String.class, String.class };
+    private static final Class<?>[] ONEPARAMS = { String.class };
+    private static final Class<?>[] NOPARAMS  = {};
+    /*
+     * All of the policy entries are read in from the
+     * policy file and stored here.  Updates to the policy entries
+     * using addEntry() and removeEntry() are made here.  To ultimately save
+     * the policy entries back to the policy file, the SavePolicy button
+     * must be clicked.
+     **/
+    private static String policyFileName = null;
+    private Vector<PolicyEntry> policyEntries = null;
+    private PolicyParser parser = null;
+
+    /* The public key alias information is stored here.  */
+    private KeyStore keyStore = null;
+    private String keyStoreName = " ";
+    private String keyStoreType = " ";
+    private String keyStoreProvider = " ";
+    private String keyStorePwdURL = " ";
+
+    /* standard PKCS11 KeyStore type */
+    private static final String P11KEYSTORE = "PKCS11";
+
+    /* reserved word for PKCS11 KeyStores */
+    private static final String NONE = "NONE";
+
+    /**
+     * default constructor
+     */
+    private PolicyTool() {
+        policyEntries = new Vector<PolicyEntry>();
+        parser = new PolicyParser();
+        warnings = new Vector<String>();
+    }
+
+    /**
+     * get the PolicyFileName
+     */
+    String getPolicyFileName() {
+        return policyFileName;
+    }
+
+    /**
+     * set the PolicyFileName
+     */
+    void setPolicyFileName(String policyFileName) {
+        PolicyTool.policyFileName = policyFileName;
+    }
+
+   /**
+    * clear keyStore info
+    */
+    void clearKeyStoreInfo() {
+        this.keyStoreName = null;
+        this.keyStoreType = null;
+        this.keyStoreProvider = null;
+        this.keyStorePwdURL = null;
+
+        this.keyStore = null;
+    }
+
+    /**
+     * get the keyStore URL name
+     */
+    String getKeyStoreName() {
+        return keyStoreName;
+    }
+
+    /**
+     * get the keyStore Type
+     */
+    String getKeyStoreType() {
+        return keyStoreType;
+    }
+
+    /**
+     * get the keyStore Provider
+     */
+    String getKeyStoreProvider() {
+        return keyStoreProvider;
+    }
+
+    /**
+     * get the keyStore password URL
+     */
+    String getKeyStorePwdURL() {
+        return keyStorePwdURL;
+    }
+
+    /**
+     * Open and read a policy file
+     */
+    void openPolicy(String filename) throws FileNotFoundException,
+                                        PolicyParser.ParsingException,
+                                        KeyStoreException,
+                                        CertificateException,
+                                        InstantiationException,
+                                        MalformedURLException,
+                                        IOException,
+                                        NoSuchAlgorithmException,
+                                        IllegalAccessException,
+                                        NoSuchMethodException,
+                                        UnrecoverableKeyException,
+                                        NoSuchProviderException,
+                                        ClassNotFoundException,
+                                        PropertyExpander.ExpandException,
+                                        InvocationTargetException {
+
+        newWarning = false;
+
+        // start fresh - blow away the current state
+        policyEntries = new Vector<PolicyEntry>();
+        parser = new PolicyParser();
+        warnings = new Vector<String>();
+        setPolicyFileName(null);
+        clearKeyStoreInfo();
+
+        // see if user is opening a NEW policy file
+        if (filename == null) {
+            modified = false;
+            return;
+        }
+
+        // Read in the policy entries from the file and
+        // populate the parser vector table.  The parser vector
+        // table only holds the entries as strings, so it only
+        // guarantees that the policies are syntactically
+        // correct.
+        setPolicyFileName(filename);
+        parser.read(new FileReader(filename));
+
+        // open the keystore
+        openKeyStore(parser.getKeyStoreUrl(), parser.getKeyStoreType(),
+                parser.getKeyStoreProvider(), parser.getStorePassURL());
+
+        // Update the local vector with the same policy entries.
+        // This guarantees that the policy entries are not only
+        // syntactically correct, but semantically valid as well.
+        Enumeration<PolicyParser.GrantEntry> enum_ = parser.grantElements();
+        while (enum_.hasMoreElements()) {
+            PolicyParser.GrantEntry ge = enum_.nextElement();
+
+            // see if all the signers have public keys
+            if (ge.signedBy != null) {
+
+                String signers[] = parseSigners(ge.signedBy);
+                for (int i = 0; i < signers.length; i++) {
+                    PublicKey pubKey = getPublicKeyAlias(signers[i]);
+                    if (pubKey == null) {
+                        newWarning = true;
+                        MessageFormat form = new MessageFormat(getMessage
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
+                        Object[] source = {signers[i]};
+                        warnings.addElement(form.format(source));
+                    }
+                }
+            }
+
+            // check to see if the Principals are valid
+            ListIterator<PolicyParser.PrincipalEntry> prinList =
+                                                ge.principals.listIterator(0);
+            while (prinList.hasNext()) {
+                PolicyParser.PrincipalEntry pe = prinList.next();
+                try {
+                    verifyPrincipal(pe.getPrincipalClass(),
+                                pe.getPrincipalName());
+                } catch (ClassNotFoundException fnfe) {
+                    newWarning = true;
+                    MessageFormat form = new MessageFormat(getMessage
+                                ("Warning.Class.not.found.class"));
+                    Object[] source = {pe.getPrincipalClass()};
+                    warnings.addElement(form.format(source));
+                }
+            }
+
+            // check to see if the Permissions are valid
+            Enumeration<PolicyParser.PermissionEntry> perms =
+                                                ge.permissionElements();
+            while (perms.hasMoreElements()) {
+                PolicyParser.PermissionEntry pe = perms.nextElement();
+                try {
+                    verifyPermission(pe.permission, pe.name, pe.action);
+                } catch (ClassNotFoundException fnfe) {
+                    newWarning = true;
+                    MessageFormat form = new MessageFormat(getMessage
+                                ("Warning.Class.not.found.class"));
+                    Object[] source = {pe.permission};
+                    warnings.addElement(form.format(source));
+                } catch (InvocationTargetException ite) {
+                    newWarning = true;
+                    MessageFormat form = new MessageFormat(getMessage
+                        ("Warning.Invalid.argument.s.for.constructor.arg"));
+                    Object[] source = {pe.permission};
+                    warnings.addElement(form.format(source));
+                }
+
+                // see if all the permission signers have public keys
+                if (pe.signedBy != null) {
+
+                    String signers[] = parseSigners(pe.signedBy);
+
+                    for (int i = 0; i < signers.length; i++) {
+                        PublicKey pubKey = getPublicKeyAlias(signers[i]);
+                        if (pubKey == null) {
+                            newWarning = true;
+                            MessageFormat form = new MessageFormat(getMessage
+                                ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
+                            Object[] source = {signers[i]};
+                            warnings.addElement(form.format(source));
+                        }
+                    }
+                }
+            }
+            PolicyEntry pEntry = new PolicyEntry(this, ge);
+            policyEntries.addElement(pEntry);
+        }
+
+        // just read in the policy -- nothing has been modified yet
+        modified = false;
+    }
+
+
+    /**
+     * Save a policy to a file
+     */
+    void savePolicy(String filename)
+    throws FileNotFoundException, IOException {
+        // save the policy entries to a file
+        parser.setKeyStoreUrl(keyStoreName);
+        parser.setKeyStoreType(keyStoreType);
+        parser.setKeyStoreProvider(keyStoreProvider);
+        parser.setStorePassURL(keyStorePwdURL);
+        parser.write(new FileWriter(filename));
+        modified = false;
+    }
+
+    /**
+     * Open the KeyStore
+     */
+    void openKeyStore(String name,
+                String type,
+                String provider,
+                String pwdURL) throws   KeyStoreException,
+                                        NoSuchAlgorithmException,
+                                        UnrecoverableKeyException,
+                                        IOException,
+                                        CertificateException,
+                                        NoSuchProviderException,
+                                        ExpandException {
+
+        if (name == null && type == null &&
+            provider == null && pwdURL == null) {
+
+            // policy did not specify a keystore during open
+            // or use wants to reset keystore values
+
+            this.keyStoreName = null;
+            this.keyStoreType = null;
+            this.keyStoreProvider = null;
+            this.keyStorePwdURL = null;
+
+            // caller will set (tool.modified = true) if appropriate
+
+            return;
+        }
+
+        URL policyURL = null;
+        if (policyFileName != null) {
+            File pfile = new File(policyFileName);
+            policyURL = new URL("file:" + pfile.getCanonicalPath());
+        }
+
+        // although PolicyUtil.getKeyStore may properly handle
+        // defaults and property expansion, we do it here so that
+        // if the call is successful, we can set the proper values
+        // (PolicyUtil.getKeyStore does not return expanded values)
+
+        if (name != null && name.length() > 0) {
+            name = PropertyExpander.expand(name).replace
+                                        (File.separatorChar, '/');
+        }
+        if (type == null || type.length() == 0) {
+            type = KeyStore.getDefaultType();
+        }
+        if (pwdURL != null && pwdURL.length() > 0) {
+            pwdURL = PropertyExpander.expand(pwdURL).replace
+                                        (File.separatorChar, '/');
+        }
+
+        try {
+            this.keyStore = PolicyUtil.getKeyStore(policyURL,
+                                                name,
+                                                type,
+                                                provider,
+                                                pwdURL,
+                                                null);
+        } catch (IOException ioe) {
+
+            // copied from sun.security.pkcs11.SunPKCS11
+            String MSG = "no password provided, and no callback handler " +
+                        "available for retrieving password";
+
+            Throwable cause = ioe.getCause();
+            if (cause != null &&
+                cause instanceof javax.security.auth.login.LoginException &&
+                MSG.equals(cause.getMessage())) {
+
+                // throw a more friendly exception message
+                throw new IOException(MSG);
+            } else {
+                throw ioe;
+            }
+        }
+
+        this.keyStoreName = name;
+        this.keyStoreType = type;
+        this.keyStoreProvider = provider;
+        this.keyStorePwdURL = pwdURL;
+
+        // caller will set (tool.modified = true)
+    }
+
+    /**
+     * Add a Grant entry to the overall policy at the specified index.
+     * A policy entry consists of a CodeSource.
+     */
+    boolean addEntry(PolicyEntry pe, int index) {
+
+        if (index < 0) {
+            // new entry -- just add it to the end
+            policyEntries.addElement(pe);
+            parser.add(pe.getGrantEntry());
+        } else {
+            // existing entry -- replace old one
+            PolicyEntry origPe = policyEntries.elementAt(index);
+            parser.replace(origPe.getGrantEntry(), pe.getGrantEntry());
+            policyEntries.setElementAt(pe, index);
+        }
+        return true;
+    }
+
+    /**
+     * Add a Principal entry to an existing PolicyEntry at the specified index.
+     * A Principal entry consists of a class, and name.
+     *
+     * If the principal already exists, it is not added again.
+     */
+    boolean addPrinEntry(PolicyEntry pe,
+                        PolicyParser.PrincipalEntry newPrin,
+                        int index) {
+
+        // first add the principal to the Policy Parser entry
+        PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
+        if (grantEntry.contains(newPrin) == true)
+            return false;
+
+        LinkedList<PolicyParser.PrincipalEntry> prinList =
+                                                grantEntry.principals;
+        if (index != -1)
+            prinList.set(index, newPrin);
+        else
+            prinList.add(newPrin);
+
+        modified = true;
+        return true;
+    }
+
+    /**
+     * Add a Permission entry to an existing PolicyEntry at the specified index.
+     * A Permission entry consists of a permission, name, and actions.
+     *
+     * If the permission already exists, it is not added again.
+     */
+    boolean addPermEntry(PolicyEntry pe,
+                        PolicyParser.PermissionEntry newPerm,
+                        int index) {
+
+        // first add the permission to the Policy Parser Vector
+        PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
+        if (grantEntry.contains(newPerm) == true)
+            return false;
+
+        Vector<PolicyParser.PermissionEntry> permList =
+                                                grantEntry.permissionEntries;
+        if (index != -1)
+            permList.setElementAt(newPerm, index);
+        else
+            permList.addElement(newPerm);
+
+        modified = true;
+        return true;
+    }
+
+    /**
+     * Remove a Permission entry from an existing PolicyEntry.
+     */
+    boolean removePermEntry(PolicyEntry pe,
+                        PolicyParser.PermissionEntry perm) {
+
+        // remove the Permission from the GrantEntry
+        PolicyParser.GrantEntry ppge = pe.getGrantEntry();
+        modified = ppge.remove(perm);
+        return modified;
+    }
+
+    /**
+     * remove an entry from the overall policy
+     */
+    boolean removeEntry(PolicyEntry pe) {
+
+        parser.remove(pe.getGrantEntry());
+        modified = true;
+        return (policyEntries.removeElement(pe));
+    }
+
+    /**
+     * retrieve all Policy Entries
+     */
+    PolicyEntry[] getEntry() {
+
+        if (policyEntries.size() > 0) {
+            PolicyEntry entries[] = new PolicyEntry[policyEntries.size()];
+            for (int i = 0; i < policyEntries.size(); i++)
+                entries[i] = policyEntries.elementAt(i);
+            return entries;
+        }
+        return null;
+    }
+
+    /**
+     * Retrieve the public key mapped to a particular name.
+     * If the key has expired, a KeyException is thrown.
+     */
+    PublicKey getPublicKeyAlias(String name) throws KeyStoreException {
+        if (keyStore == null) {
+            return null;
+        }
+
+        Certificate cert = keyStore.getCertificate(name);
+        if (cert == null) {
+            return null;
+        }
+        PublicKey pubKey = cert.getPublicKey();
+        return pubKey;
+    }
+
+    /**
+     * Retrieve all the alias names stored in the certificate database
+     */
+    String[] getPublicKeyAlias() throws KeyStoreException {
+
+        int numAliases = 0;
+        String aliases[] = null;
+
+        if (keyStore == null) {
+            return null;
+        }
+        Enumeration<String> enum_ = keyStore.aliases();
+
+        // first count the number of elements
+        while (enum_.hasMoreElements()) {
+            enum_.nextElement();
+            numAliases++;
+        }
+
+        if (numAliases > 0) {
+            // now copy them into an array
+            aliases = new String[numAliases];
+            numAliases = 0;
+            enum_ = keyStore.aliases();
+            while (enum_.hasMoreElements()) {
+                aliases[numAliases] = new String(enum_.nextElement());
+                numAliases++;
+            }
+        }
+        return aliases;
+    }
+
+    /**
+     * This method parses a single string of signers separated by commas
+     * ("jordan, duke, pippen") into an array of individual strings.
+     */
+    String[] parseSigners(String signedBy) {
+
+        String signers[] = null;
+        int numSigners = 1;
+        int signedByIndex = 0;
+        int commaIndex = 0;
+        int signerNum = 0;
+
+        // first pass thru "signedBy" counts the number of signers
+        while (commaIndex >= 0) {
+            commaIndex = signedBy.indexOf(',', signedByIndex);
+            if (commaIndex >= 0) {
+                numSigners++;
+                signedByIndex = commaIndex + 1;
+            }
+        }
+        signers = new String[numSigners];
+
+        // second pass thru "signedBy" transfers signers to array
+        commaIndex = 0;
+        signedByIndex = 0;
+        while (commaIndex >= 0) {
+            if ((commaIndex = signedBy.indexOf(',', signedByIndex)) >= 0) {
+                // transfer signer and ignore trailing part of the string
+                signers[signerNum] =
+                        signedBy.substring(signedByIndex, commaIndex).trim();
+                signerNum++;
+                signedByIndex = commaIndex + 1;
+            } else {
+                // we are at the end of the string -- transfer signer
+                signers[signerNum] = signedBy.substring(signedByIndex).trim();
+            }
+        }
+        return signers;
+    }
+
+    /**
+     * Check to see if the Principal contents are OK
+     */
+    void verifyPrincipal(String type, String name)
+        throws ClassNotFoundException,
+               InstantiationException
+    {
+        if (type.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
+            type.equals(PolicyParser.PrincipalEntry.REPLACE_NAME)) {
+            return;
+        }
+        Class<?> PRIN = Class.forName("java.security.Principal");
+        Class<?> pc = Class.forName(type, true,
+                Thread.currentThread().getContextClassLoader());
+        if (!PRIN.isAssignableFrom(pc)) {
+            MessageFormat form = new MessageFormat(getMessage
+                        ("Illegal.Principal.Type.type"));
+            Object[] source = {type};
+            throw new InstantiationException(form.format(source));
+        }
+
+        if (ToolDialog.X500_PRIN_CLASS.equals(pc.getName())) {
+            // PolicyParser checks validity of X500Principal name
+            // - PolicyTool needs to as well so that it doesn't store
+            //   an invalid name that can't be read in later
+            //
+            // this can throw an IllegalArgumentException
+            X500Principal newP = new X500Principal(name);
+        }
+    }
+
+    /**
+     * Check to see if the Permission contents are OK
+     */
+    @SuppressWarnings("fallthrough")
+    void verifyPermission(String type,
+                                    String name,
+                                    String actions)
+        throws ClassNotFoundException,
+               InstantiationException,
+               IllegalAccessException,
+               NoSuchMethodException,
+               InvocationTargetException
+    {
+
+        //XXX we might want to keep a hash of created factories...
+        Class<?> pc = Class.forName(type, true,
+                Thread.currentThread().getContextClassLoader());
+        Constructor<?> c = null;
+        Vector<String> objects = new Vector<>(2);
+        if (name != null) objects.add(name);
+        if (actions != null) objects.add(actions);
+        switch (objects.size()) {
+        case 0:
+            try {
+                c = pc.getConstructor(NOPARAMS);
+                break;
+            } catch (NoSuchMethodException ex) {
+                // proceed to the one-param constructor
+                objects.add(null);
+            }
+            /* fall through */
+        case 1:
+            try {
+                c = pc.getConstructor(ONEPARAMS);
+                break;
+            } catch (NoSuchMethodException ex) {
+                // proceed to the two-param constructor
+                objects.add(null);
+            }
+            /* fall through */
+        case 2:
+            c = pc.getConstructor(TWOPARAMS);
+            break;
+        }
+        Object parameters[] = objects.toArray();
+        Permission p = (Permission)c.newInstance(parameters);
+    }
+
+    /*
+     * Parse command line arguments.
+     */
+    static void parseArgs(String args[]) {
+        /* parse flags */
+        int n = 0;
+
+        for (n=0; (n < args.length) && args[n].startsWith("-"); n++) {
+
+            String flags = args[n];
+
+            if (collator.compare(flags, "-file") == 0) {
+                if (++n == args.length) usage();
+                policyFileName = args[n];
+            } else {
+                MessageFormat form = new MessageFormat(getMessage
+                                ("Illegal.option.option"));
+                Object[] source = { flags };
+                System.err.println(form.format(source));
+                usage();
+            }
+        }
+    }
+
+    static void usage() {
+        System.out.println(getMessage("Usage.policytool.options."));
+        System.out.println();
+        System.out.println(getMessage
+                (".file.file.policy.file.location"));
+        System.out.println();
+
+        System.exit(1);
+    }
+
+    /**
+     * run the PolicyTool
+     */
+    public static void main(String args[]) {
+        parseArgs(args);
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                ToolWindow tw = new ToolWindow(new PolicyTool());
+                tw.displayToolWindow(args);
+            }
+        });
+    }
+
+    // split instr to words according to capitalization,
+    // like, AWTControl -> A W T Control
+    // this method is for easy pronounciation
+    static String splitToWords(String instr) {
+        return instr.replaceAll("([A-Z])", " $1");
+    }
+
+    /**
+     * Returns the message corresponding to the key in the bundle.
+     * This is preferred over {@link #getString} because it removes
+     * any mnemonic '&' character in the string.
+     *
+     * @param key the key
+     *
+     * @return the message
+     */
+    static String getMessage(String key) {
+        return removeMnemonicAmpersand(rb.getString(key));
+    }
+
+
+    /**
+     * Returns the mnemonic for a message.
+     *
+     * @param key the key
+     *
+     * @return the mnemonic <code>int</code>
+     */
+    static int getMnemonicInt(String key) {
+        String message = rb.getString(key);
+        return (findMnemonicInt(message));
+    }
+
+    /**
+     * Returns the mnemonic display index for a message.
+     *
+     * @param key the key
+     *
+     * @return the mnemonic display index
+     */
+    static int getDisplayedMnemonicIndex(String key) {
+        String message = rb.getString(key);
+        return (findMnemonicIndex(message));
+    }
+
+    /**
+     * Finds the mnemonic character in a message.
+     *
+     * The mnemonic character is the first character followed by the first
+     * <code>&</code> that is not followed by another <code>&</code>.
+     *
+     * @return the mnemonic as an <code>int</code>, or <code>0</code> if it
+     *         can't be found.
+     */
+    private static int findMnemonicInt(String s) {
+        for (int i = 0; i < s.length() - 1; i++) {
+            if (s.charAt(i) == '&') {
+                if (s.charAt(i + 1) != '&') {
+                    return KeyEvent.getExtendedKeyCodeForChar(s.charAt(i + 1));
+                } else {
+                    i++;
+                }
+            }
+        }
+        return 0;
+    }
+
+    /**
+     * Finds the index of the mnemonic character in a message.
+     *
+     * The mnemonic character is the first character followed by the first
+     * <code>&</code> that is not followed by another <code>&</code>.
+     *
+     * @return the mnemonic character index as an <code>int</code>, or <code>-1</code> if it
+     *         can't be found.
+     */
+    private static int findMnemonicIndex(String s) {
+        for (int i = 0; i < s.length() - 1; i++) {
+            if (s.charAt(i) == '&') {
+                if (s.charAt(i + 1) != '&') {
+                    // Return the index of the '&' since it will be removed
+                    return i;
+                } else {
+                    i++;
+                }
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Removes the mnemonic identifier (<code>&</code>) from a string unless
+     * it's escaped by <code>&&</code> or placed at the end.
+     *
+     * @param message the message
+     *
+     * @return a message with the mnemonic identifier removed
+     */
+    private static String removeMnemonicAmpersand(String message) {
+        StringBuilder s = new StringBuilder();
+        for (int i = 0; i < message.length(); i++) {
+            char current = message.charAt(i);
+            if (current != '&' || i == message.length() - 1
+                    || message.charAt(i + 1) == '&') {
+                s.append(current);
+            }
+        }
+        return s.toString();
+    }
+}
+
+/**
+ * Each entry in the policy configuration file is represented by a
+ * PolicyEntry object.
+ *
+ * A PolicyEntry is a (CodeSource,Permission) pair.  The
+ * CodeSource contains the (URL, PublicKey) that together identify
+ * where the Java bytecodes come from and who (if anyone) signed
+ * them.  The URL could refer to localhost.  The URL could also be
+ * null, meaning that this policy entry is given to all comers, as
+ * long as they match the signer field.  The signer could be null,
+ * meaning the code is not signed.
+ *
+ * The Permission contains the (Type, Name, Action) triplet.
+ *
+ */
+class PolicyEntry {
+
+    private CodeSource codesource;
+    private PolicyTool tool;
+    private PolicyParser.GrantEntry grantEntry;
+    private boolean testing = false;
+
+    /**
+     * Create a PolicyEntry object from the information read in
+     * from a policy file.
+     */
+    PolicyEntry(PolicyTool tool, PolicyParser.GrantEntry ge)
+    throws MalformedURLException, NoSuchMethodException,
+    ClassNotFoundException, InstantiationException, IllegalAccessException,
+    InvocationTargetException, CertificateException,
+    IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
+
+        this.tool = tool;
+
+        URL location = null;
+
+        // construct the CodeSource
+        if (ge.codeBase != null)
+            location = new URL(ge.codeBase);
+        this.codesource = new CodeSource(location,
+            (java.security.cert.Certificate[]) null);
+
+        if (testing) {
+            System.out.println("Adding Policy Entry:");
+            System.out.println("    CodeBase = " + location);
+            System.out.println("    Signers = " + ge.signedBy);
+            System.out.println("    with " + ge.principals.size() +
+                    " Principals");
+        }
+
+        this.grantEntry = ge;
+    }
+
+    /**
+     * get the codesource associated with this PolicyEntry
+     */
+    CodeSource getCodeSource() {
+        return codesource;
+    }
+
+    /**
+     * get the GrantEntry associated with this PolicyEntry
+     */
+    PolicyParser.GrantEntry getGrantEntry() {
+        return grantEntry;
+    }
+
+    /**
+     * convert the header portion, i.e. codebase, signer, principals, of
+     * this policy entry into a string
+     */
+    String headerToString() {
+        String pString = principalsToString();
+        if (pString.length() == 0) {
+            return codebaseToString();
+        } else {
+            return codebaseToString() + ", " + pString;
+        }
+    }
+
+    /**
+     * convert the Codebase/signer portion of this policy entry into a string
+     */
+    String codebaseToString() {
+
+        String stringEntry = new String();
+
+        if (grantEntry.codeBase != null &&
+            grantEntry.codeBase.equals("") == false)
+            stringEntry = stringEntry.concat
+                                ("CodeBase \"" +
+                                grantEntry.codeBase +
+                                "\"");
+
+        if (grantEntry.signedBy != null &&
+            grantEntry.signedBy.equals("") == false)
+            stringEntry = ((stringEntry.length() > 0) ?
+                stringEntry.concat(", SignedBy \"" +
+                                grantEntry.signedBy +
+                                "\"") :
+                stringEntry.concat("SignedBy \"" +
+                                grantEntry.signedBy +
+                                "\""));
+
+        if (stringEntry.length() == 0)
+            return new String("CodeBase <ALL>");
+        return stringEntry;
+    }
+
+    /**
+     * convert the Principals portion of this policy entry into a string
+     */
+    String principalsToString() {
+        String result = "";
+        if ((grantEntry.principals != null) &&
+            (!grantEntry.principals.isEmpty())) {
+            StringBuilder sb = new StringBuilder(200);
+            ListIterator<PolicyParser.PrincipalEntry> list =
+                                grantEntry.principals.listIterator();
+            while (list.hasNext()) {
+                PolicyParser.PrincipalEntry pppe = list.next();
+                sb.append(" Principal ").append(pppe.getDisplayClass())
+                        .append(' ')
+                        .append(pppe.getDisplayName(true));
+                if (list.hasNext()) sb.append(", ");
+            }
+            result = sb.toString();
+        }
+        return result;
+    }
+
+    /**
+     * convert this policy entry into a PolicyParser.PermissionEntry
+     */
+    PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
+
+        String actions = null;
+
+        // get the actions
+        if (perm.getActions() != null &&
+            perm.getActions().trim() != "")
+                actions = perm.getActions();
+
+        PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry
+                        (perm.getClass().getName(),
+                        perm.getName(),
+                        actions);
+        return pe;
+    }
+}
+
+/**
+ * The main window for the PolicyTool
+ */
+class ToolWindow extends JFrame {
+    // use serialVersionUID from JDK 1.2.2 for interoperability
+    private static final long serialVersionUID = 5682568601210376777L;
+
+    /* ESCAPE key */
+    static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
+
+    /* external paddings */
+    public static final Insets TOP_PADDING = new Insets(25,0,0,0);
+    public static final Insets BOTTOM_PADDING = new Insets(0,0,25,0);
+    public static final Insets LITE_BOTTOM_PADDING = new Insets(0,0,10,0);
+    public static final Insets LR_PADDING = new Insets(0,10,0,10);
+    public static final Insets TOP_BOTTOM_PADDING = new Insets(15, 0, 15, 0);
+    public static final Insets L_TOP_BOTTOM_PADDING = new Insets(5,10,15,0);
+    public static final Insets LR_TOP_BOTTOM_PADDING = new Insets(15, 4, 15, 4);
+    public static final Insets LR_BOTTOM_PADDING = new Insets(0,10,5,10);
+    public static final Insets L_BOTTOM_PADDING = new Insets(0,10,5,0);
+    public static final Insets R_BOTTOM_PADDING = new Insets(0, 0, 25, 5);
+    public static final Insets R_PADDING = new Insets(0, 0, 0, 5);
+
+    /* buttons and menus */
+    public static final String NEW_POLICY_FILE          = "New";
+    public static final String OPEN_POLICY_FILE         = "Open";
+    public static final String SAVE_POLICY_FILE         = "Save";
+    public static final String SAVE_AS_POLICY_FILE      = "Save.As";
+    public static final String VIEW_WARNINGS            = "View.Warning.Log";
+    public static final String QUIT                     = "Exit";
+    public static final String ADD_POLICY_ENTRY         = "Add.Policy.Entry";
+    public static final String EDIT_POLICY_ENTRY        = "Edit.Policy.Entry";
+    public static final String REMOVE_POLICY_ENTRY      = "Remove.Policy.Entry";
+    public static final String EDIT_KEYSTORE            = "Edit";
+    public static final String ADD_PUBKEY_ALIAS         = "Add.Public.Key.Alias";
+    public static final String REMOVE_PUBKEY_ALIAS      = "Remove.Public.Key.Alias";
+
+    /* gridbag index for components in the main window (MW) */
+    public static final int MW_FILENAME_LABEL           = 0;
+    public static final int MW_FILENAME_TEXTFIELD       = 1;
+    public static final int MW_PANEL                    = 2;
+    public static final int MW_ADD_BUTTON               = 0;
+    public static final int MW_EDIT_BUTTON              = 1;
+    public static final int MW_REMOVE_BUTTON            = 2;
+    public static final int MW_POLICY_LIST              = 3; // follows MW_PANEL
+
+    /* The preferred height of JTextField should match JComboBox. */
+    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
+
+    private PolicyTool tool;
+
+    /**
+     * Constructor
+     */
+    ToolWindow(PolicyTool tool) {
+        this.tool = tool;
+    }
+
+    /**
+     * Don't call getComponent directly on the window
+     */
+    public Component getComponent(int n) {
+        Component c = getContentPane().getComponent(n);
+        if (c instanceof JScrollPane) {
+            c = ((JScrollPane)c).getViewport().getView();
+        }
+        return c;
+    }
+
+    /**
+     * Initialize the PolicyTool window with the necessary components
+     */
+    private void initWindow() {
+        // The ToolWindowListener will handle closing the window.
+        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+
+        // create the top menu bar
+        JMenuBar menuBar = new JMenuBar();
+
+        // create a File menu
+        JMenu menu = new JMenu();
+        configureButton(menu, "File");
+        ActionListener actionListener = new FileMenuListener(tool, this);
+        addMenuItem(menu, NEW_POLICY_FILE, actionListener, "N");
+        addMenuItem(menu, OPEN_POLICY_FILE, actionListener, "O");
+        addMenuItem(menu, SAVE_POLICY_FILE, actionListener, "S");
+        addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener, null);
+        addMenuItem(menu, VIEW_WARNINGS, actionListener, null);
+        addMenuItem(menu, QUIT, actionListener, null);
+        menuBar.add(menu);
+
+        // create a KeyStore menu
+        menu = new JMenu();
+        configureButton(menu, "KeyStore");
+        actionListener = new MainWindowListener(tool, this);
+        addMenuItem(menu, EDIT_KEYSTORE, actionListener, null);
+        menuBar.add(menu);
+        setJMenuBar(menuBar);
+
+        // Create some space around components
+        ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
+
+        // policy entry listing
+        JLabel label = new JLabel(PolicyTool.getMessage("Policy.File."));
+        addNewComponent(this, label, MW_FILENAME_LABEL,
+                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        LR_TOP_BOTTOM_PADDING);
+        JTextField tf = new JTextField(50);
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Policy.File."));
+        tf.setEditable(false);
+        addNewComponent(this, tf, MW_FILENAME_TEXTFIELD,
+                        1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        LR_TOP_BOTTOM_PADDING);
+
+
+        // add ADD/REMOVE/EDIT buttons in a new panel
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        JButton button = new JButton();
+        configureButton(button, ADD_POLICY_ENTRY);
+        button.addActionListener(new MainWindowListener(tool, this));
+        addNewComponent(panel, button, MW_ADD_BUTTON,
+                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        LR_PADDING);
+
+        button = new JButton();
+        configureButton(button, EDIT_POLICY_ENTRY);
+        button.addActionListener(new MainWindowListener(tool, this));
+        addNewComponent(panel, button, MW_EDIT_BUTTON,
+                        1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        LR_PADDING);
+
+        button = new JButton();
+        configureButton(button, REMOVE_POLICY_ENTRY);
+        button.addActionListener(new MainWindowListener(tool, this));
+        addNewComponent(panel, button, MW_REMOVE_BUTTON,
+                        2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        LR_PADDING);
+
+        addNewComponent(this, panel, MW_PANEL,
+                        0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        BOTTOM_PADDING);
+
+
+        String policyFile = tool.getPolicyFileName();
+        if (policyFile == null) {
+            String userHome;
+            userHome = java.security.AccessController.doPrivileged(
+                (PrivilegedAction<String>) () -> System.getProperty("user.home"));
+            policyFile = userHome + File.separatorChar + ".java.policy";
+        }
+
+        try {
+            // open the policy file
+            tool.openPolicy(policyFile);
+
+            // display the policy entries via the policy list textarea
+            DefaultListModel<String> listModel = new DefaultListModel<>();
+            JList<String> list = new JList<>(listModel);
+            list.setVisibleRowCount(15);
+            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+            list.addMouseListener(new PolicyListListener(tool, this));
+            PolicyEntry entries[] = tool.getEntry();
+            if (entries != null) {
+                for (int i = 0; i < entries.length; i++) {
+                    listModel.addElement(entries[i].headerToString());
+                }
+            }
+            JTextField newFilename = (JTextField)
+                                getComponent(MW_FILENAME_TEXTFIELD);
+            newFilename.setText(policyFile);
+            initPolicyList(list);
+
+        } catch (FileNotFoundException fnfe) {
+            // add blank policy listing
+            JList<String> list = new JList<>(new DefaultListModel<>());
+            list.setVisibleRowCount(15);
+            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+            list.addMouseListener(new PolicyListListener(tool, this));
+            initPolicyList(list);
+            tool.setPolicyFileName(null);
+            tool.modified = false;
+
+            // just add warning
+            tool.warnings.addElement(fnfe.toString());
+
+        } catch (Exception e) {
+            // add blank policy listing
+            JList<String> list = new JList<>(new DefaultListModel<>());
+            list.setVisibleRowCount(15);
+            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+            list.addMouseListener(new PolicyListListener(tool, this));
+            initPolicyList(list);
+            tool.setPolicyFileName(null);
+            tool.modified = false;
+
+            // display the error
+            MessageFormat form = new MessageFormat(PolicyTool.getMessage
+                ("Could.not.open.policy.file.policyFile.e.toString."));
+            Object[] source = {policyFile, e.toString()};
+            displayErrorDialog(null, form.format(source));
+        }
+    }
+
+
+    // Platform specific modifier (control / command).
+    private int shortCutModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+
+    private void addMenuItem(JMenu menu, String key, ActionListener actionListener, String accelerator) {
+        JMenuItem menuItem = new JMenuItem();
+        configureButton(menuItem, key);
+
+        if (PolicyTool.rb.containsKey(key + ".accelerator")) {
+            // Accelerator from resources takes precedence
+            accelerator = PolicyTool.getMessage(key + ".accelerator");
+        }
+
+        if (accelerator != null && !accelerator.isEmpty()) {
+            KeyStroke keyStroke;
+            if (accelerator.length() == 1) {
+                keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(0)),
+                                                   shortCutModifier);
+            } else {
+                keyStroke = KeyStroke.getKeyStroke(accelerator);
+            }
+            menuItem.setAccelerator(keyStroke);
+        }
+
+        menuItem.addActionListener(actionListener);
+        menu.add(menuItem);
+    }
+
+    static void configureButton(AbstractButton button, String key) {
+        button.setText(PolicyTool.getMessage(key));
+        button.setActionCommand(key);
+
+        int mnemonicInt = PolicyTool.getMnemonicInt(key);
+        if (mnemonicInt > 0) {
+            button.setMnemonic(mnemonicInt);
+            button.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
+         }
+    }
+
+    static void configureLabelFor(JLabel label, JComponent component, String key) {
+        label.setText(PolicyTool.getMessage(key));
+        label.setLabelFor(component);
+
+        int mnemonicInt = PolicyTool.getMnemonicInt(key);
+        if (mnemonicInt > 0) {
+            label.setDisplayedMnemonic(mnemonicInt);
+            label.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
+         }
+    }
+
+
+    /**
+     * Add a component to the PolicyTool window
+     */
+    void addNewComponent(Container container, JComponent component,
+        int index, int gridx, int gridy, int gridwidth, int gridheight,
+        double weightx, double weighty, int fill, Insets is) {
+
+        if (container instanceof JFrame) {
+            container = ((JFrame)container).getContentPane();
+        } else if (container instanceof JDialog) {
+            container = ((JDialog)container).getContentPane();
+        }
+
+        // add the component at the specified gridbag index
+        container.add(component, index);
+
+        // set the constraints
+        GridBagLayout gbl = (GridBagLayout)container.getLayout();
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.gridx = gridx;
+        gbc.gridy = gridy;
+        gbc.gridwidth = gridwidth;
+        gbc.gridheight = gridheight;
+        gbc.weightx = weightx;
+        gbc.weighty = weighty;
+        gbc.fill = fill;
+        if (is != null) gbc.insets = is;
+        gbl.setConstraints(component, gbc);
+    }
+
+
+    /**
+     * Add a component to the PolicyTool window without external padding
+     */
+    void addNewComponent(Container container, JComponent component,
+        int index, int gridx, int gridy, int gridwidth, int gridheight,
+        double weightx, double weighty, int fill) {
+
+        // delegate with "null" external padding
+        addNewComponent(container, component, index, gridx, gridy,
+                        gridwidth, gridheight, weightx, weighty,
+                        fill, null);
+    }
+
+
+    /**
+     * Init the policy_entry_list TEXTAREA component in the
+     * PolicyTool window
+     */
+    void initPolicyList(JList<String> policyList) {
+
+        // add the policy list to the window
+        //policyList.setPreferredSize(new Dimension(500, 350));
+        JScrollPane scrollPane = new JScrollPane(policyList);
+        addNewComponent(this, scrollPane, MW_POLICY_LIST,
+                        0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH);
+    }
+
+    /**
+     * Replace the policy_entry_list TEXTAREA component in the
+     * PolicyTool window with an updated one.
+     */
+    void replacePolicyList(JList<String> policyList) {
+
+        // remove the original list of Policy Entries
+        // and add the new list of entries
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)getComponent(MW_POLICY_LIST);
+        list.setModel(policyList.getModel());
+    }
+
+    /**
+     * display the main PolicyTool window
+     */
+    void displayToolWindow(String args[]) {
+
+        setTitle(PolicyTool.getMessage("Policy.Tool"));
+        setResizable(true);
+        addWindowListener(new ToolWindowListener(tool, this));
+        //setBounds(135, 80, 500, 500);
+        getContentPane().setLayout(new GridBagLayout());
+
+        initWindow();
+        pack();
+        setLocationRelativeTo(null);
+
+        // display it
+        setVisible(true);
+
+        if (tool.newWarning == true) {
+            displayStatusDialog(this, PolicyTool.getMessage
+                ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
+        }
+    }
+
+    /**
+     * displays a dialog box describing an error which occurred.
+     */
+    void displayErrorDialog(Window w, String error) {
+        ToolDialog ed = new ToolDialog
+                (PolicyTool.getMessage("Error"), tool, this, true);
+
+        // find where the PolicyTool gui is
+        Point location = ((w == null) ?
+                getLocationOnScreen() : w.getLocationOnScreen());
+        //ed.setBounds(location.x + 50, location.y + 50, 600, 100);
+        ed.setLayout(new GridBagLayout());
+
+        JLabel label = new JLabel(error);
+        addNewComponent(ed, label, 0,
+                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        ActionListener okListener = new ErrorOKButtonListener(ed);
+        okButton.addActionListener(okListener);
+        addNewComponent(ed, okButton, 1,
+                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+        ed.getRootPane().setDefaultButton(okButton);
+        ed.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        ed.pack();
+        ed.setLocationRelativeTo(w);
+        ed.setVisible(true);
+    }
+
+    /**
+     * displays a dialog box describing an error which occurred.
+     */
+    void displayErrorDialog(Window w, Throwable t) {
+        if (t instanceof NoDisplayException) {
+            return;
+        }
+        if (t.getClass() == Exception.class) {
+            // Exception is usually thrown inside policytool for user
+            // interaction error. There is no need to show the type.
+            displayErrorDialog(w, t.getLocalizedMessage());
+        } else {
+            displayErrorDialog(w, t.toString());
+        }
+    }
+
+    /**
+     * displays a dialog box describing the status of an event
+     */
+    void displayStatusDialog(Window w, String status) {
+        ToolDialog sd = new ToolDialog
+                (PolicyTool.getMessage("Status"), tool, this, true);
+
+        // find the location of the PolicyTool gui
+        Point location = ((w == null) ?
+                getLocationOnScreen() : w.getLocationOnScreen());
+        //sd.setBounds(location.x + 50, location.y + 50, 500, 100);
+        sd.setLayout(new GridBagLayout());
+
+        JLabel label = new JLabel(status);
+        addNewComponent(sd, label, 0,
+                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        ActionListener okListener = new StatusOKButtonListener(sd);
+        okButton.addActionListener(okListener);
+        addNewComponent(sd, okButton, 1,
+                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+        sd.getRootPane().setDefaultButton(okButton);
+        sd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        sd.pack();
+        sd.setLocationRelativeTo(w);
+        sd.setVisible(true);
+    }
+
+    /**
+     * display the warning log
+     */
+    void displayWarningLog(Window w) {
+
+        ToolDialog wd = new ToolDialog
+                (PolicyTool.getMessage("Warning"), tool, this, true);
+
+        // find the location of the PolicyTool gui
+        Point location = ((w == null) ?
+                getLocationOnScreen() : w.getLocationOnScreen());
+        //wd.setBounds(location.x + 50, location.y + 50, 500, 100);
+        wd.setLayout(new GridBagLayout());
+
+        JTextArea ta = new JTextArea();
+        ta.setEditable(false);
+        for (int i = 0; i < tool.warnings.size(); i++) {
+            ta.append(tool.warnings.elementAt(i));
+            ta.append(PolicyTool.getMessage("NEWLINE"));
+        }
+        addNewComponent(wd, ta, 0,
+                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                        BOTTOM_PADDING);
+        ta.setFocusable(false);
+
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        ActionListener okListener = new CancelButtonListener(wd);
+        okButton.addActionListener(okListener);
+        addNewComponent(wd, okButton, 1,
+                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                        LR_PADDING);
+
+        wd.getRootPane().setDefaultButton(okButton);
+        wd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        wd.pack();
+        wd.setLocationRelativeTo(w);
+        wd.setVisible(true);
+    }
+
+    char displayYesNoDialog(Window w, String title, String prompt, String yes, String no) {
+
+        final ToolDialog tw = new ToolDialog
+                (title, tool, this, true);
+        Point location = ((w == null) ?
+                getLocationOnScreen() : w.getLocationOnScreen());
+        //tw.setBounds(location.x + 75, location.y + 100, 400, 150);
+        tw.setLayout(new GridBagLayout());
+
+        JTextArea ta = new JTextArea(prompt, 10, 50);
+        ta.setEditable(false);
+        ta.setLineWrap(true);
+        ta.setWrapStyleWord(true);
+        JScrollPane scrollPane = new JScrollPane(ta,
+                                                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                                                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        addNewComponent(tw, scrollPane, 0,
+                0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+        ta.setFocusable(false);
+
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        // StringBuffer to store button press. Must be final.
+        final StringBuffer chooseResult = new StringBuffer();
+
+        JButton button = new JButton(yes);
+        button.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                chooseResult.append('Y');
+                tw.setVisible(false);
+                tw.dispose();
+            }
+        });
+        addNewComponent(panel, button, 0,
+                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           LR_PADDING);
+
+        button = new JButton(no);
+        button.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                chooseResult.append('N');
+                tw.setVisible(false);
+                tw.dispose();
+            }
+        });
+        addNewComponent(panel, button, 1,
+                           1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           LR_PADDING);
+
+        addNewComponent(tw, panel, 1,
+                0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+        tw.pack();
+        tw.setLocationRelativeTo(w);
+        tw.setVisible(true);
+        if (chooseResult.length() > 0) {
+            return chooseResult.charAt(0);
+        } else {
+            // I did encounter this once, don't why.
+            return 'N';
+        }
+    }
+
+}
+
+/**
+ * General dialog window
+ */
+class ToolDialog extends JDialog {
+    // use serialVersionUID from JDK 1.2.2 for interoperability
+    private static final long serialVersionUID = -372244357011301190L;
+
+    /* ESCAPE key */
+    static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
+
+    /* necessary constants */
+    public static final int NOACTION            = 0;
+    public static final int QUIT                = 1;
+    public static final int NEW                 = 2;
+    public static final int OPEN                = 3;
+
+    public static final String ALL_PERM_CLASS   =
+                "java.security.AllPermission";
+    public static final String FILE_PERM_CLASS  =
+                "java.io.FilePermission";
+
+    public static final String X500_PRIN_CLASS         =
+                "javax.security.auth.x500.X500Principal";
+
+    /* popup menus */
+    public static final String PERM             =
+        PolicyTool.getMessage
+        ("Permission.");
+
+    public static final String PRIN_TYPE        =
+        PolicyTool.getMessage("Principal.Type.");
+    public static final String PRIN_NAME        =
+        PolicyTool.getMessage("Principal.Name.");
+
+    /* more popu menus */
+    public static final String PERM_NAME        =
+        PolicyTool.getMessage
+        ("Target.Name.");
+
+    /* and more popup menus */
+    public static final String PERM_ACTIONS             =
+      PolicyTool.getMessage
+      ("Actions.");
+
+    /* gridbag index for display PolicyEntry (PE) components */
+    public static final int PE_CODEBASE_LABEL           = 0;
+    public static final int PE_CODEBASE_TEXTFIELD       = 1;
+    public static final int PE_SIGNEDBY_LABEL           = 2;
+    public static final int PE_SIGNEDBY_TEXTFIELD       = 3;
+
+    public static final int PE_PANEL0                   = 4;
+    public static final int PE_ADD_PRIN_BUTTON          = 0;
+    public static final int PE_EDIT_PRIN_BUTTON         = 1;
+    public static final int PE_REMOVE_PRIN_BUTTON       = 2;
+
+    public static final int PE_PRIN_LABEL               = 5;
+    public static final int PE_PRIN_LIST                = 6;
+
+    public static final int PE_PANEL1                   = 7;
+    public static final int PE_ADD_PERM_BUTTON          = 0;
+    public static final int PE_EDIT_PERM_BUTTON         = 1;
+    public static final int PE_REMOVE_PERM_BUTTON       = 2;
+
+    public static final int PE_PERM_LIST                = 8;
+
+    public static final int PE_PANEL2                   = 9;
+    public static final int PE_CANCEL_BUTTON            = 1;
+    public static final int PE_DONE_BUTTON              = 0;
+
+    /* the gridbag index for components in the Principal Dialog (PRD) */
+    public static final int PRD_DESC_LABEL              = 0;
+    public static final int PRD_PRIN_CHOICE             = 1;
+    public static final int PRD_PRIN_TEXTFIELD          = 2;
+    public static final int PRD_NAME_LABEL              = 3;
+    public static final int PRD_NAME_TEXTFIELD          = 4;
+    public static final int PRD_CANCEL_BUTTON           = 6;
+    public static final int PRD_OK_BUTTON               = 5;
+
+    /* the gridbag index for components in the Permission Dialog (PD) */
+    public static final int PD_DESC_LABEL               = 0;
+    public static final int PD_PERM_CHOICE              = 1;
+    public static final int PD_PERM_TEXTFIELD           = 2;
+    public static final int PD_NAME_CHOICE              = 3;
+    public static final int PD_NAME_TEXTFIELD           = 4;
+    public static final int PD_ACTIONS_CHOICE           = 5;
+    public static final int PD_ACTIONS_TEXTFIELD        = 6;
+    public static final int PD_SIGNEDBY_LABEL           = 7;
+    public static final int PD_SIGNEDBY_TEXTFIELD       = 8;
+    public static final int PD_CANCEL_BUTTON            = 10;
+    public static final int PD_OK_BUTTON                = 9;
+
+    /* modes for KeyStore */
+    public static final int EDIT_KEYSTORE               = 0;
+
+    /* the gridbag index for components in the Change KeyStore Dialog (KSD) */
+    public static final int KSD_NAME_LABEL              = 0;
+    public static final int KSD_NAME_TEXTFIELD          = 1;
+    public static final int KSD_TYPE_LABEL              = 2;
+    public static final int KSD_TYPE_TEXTFIELD          = 3;
+    public static final int KSD_PROVIDER_LABEL          = 4;
+    public static final int KSD_PROVIDER_TEXTFIELD      = 5;
+    public static final int KSD_PWD_URL_LABEL           = 6;
+    public static final int KSD_PWD_URL_TEXTFIELD       = 7;
+    public static final int KSD_CANCEL_BUTTON           = 9;
+    public static final int KSD_OK_BUTTON               = 8;
+
+    /* the gridbag index for components in the User Save Changes Dialog (USC) */
+    public static final int USC_LABEL                   = 0;
+    public static final int USC_PANEL                   = 1;
+    public static final int USC_YES_BUTTON              = 0;
+    public static final int USC_NO_BUTTON               = 1;
+    public static final int USC_CANCEL_BUTTON           = 2;
+
+    /* gridbag index for the ConfirmRemovePolicyEntryDialog (CRPE) */
+    public static final int CRPE_LABEL1                 = 0;
+    public static final int CRPE_LABEL2                 = 1;
+    public static final int CRPE_PANEL                  = 2;
+    public static final int CRPE_PANEL_OK               = 0;
+    public static final int CRPE_PANEL_CANCEL           = 1;
+
+    /* some private static finals */
+    private static final int PERMISSION                 = 0;
+    private static final int PERMISSION_NAME            = 1;
+    private static final int PERMISSION_ACTIONS         = 2;
+    private static final int PERMISSION_SIGNEDBY        = 3;
+    private static final int PRINCIPAL_TYPE             = 4;
+    private static final int PRINCIPAL_NAME             = 5;
+
+    /* The preferred height of JTextField should match JComboBox. */
+    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
+
+    public static java.util.ArrayList<Perm> PERM_ARRAY;
+    public static java.util.ArrayList<Prin> PRIN_ARRAY;
+    PolicyTool tool;
+    ToolWindow tw;
+
+    static {
+
+        // set up permission objects
+
+        PERM_ARRAY = new java.util.ArrayList<Perm>();
+        PERM_ARRAY.add(new AllPerm());
+        PERM_ARRAY.add(new AudioPerm());
+        PERM_ARRAY.add(new AuthPerm());
+        PERM_ARRAY.add(new AWTPerm());
+        PERM_ARRAY.add(new DelegationPerm());
+        PERM_ARRAY.add(new FilePerm());
+        PERM_ARRAY.add(new URLPerm());
+        PERM_ARRAY.add(new InqSecContextPerm());
+        PERM_ARRAY.add(new LogPerm());
+        PERM_ARRAY.add(new MgmtPerm());
+        PERM_ARRAY.add(new MBeanPerm());
+        PERM_ARRAY.add(new MBeanSvrPerm());
+        PERM_ARRAY.add(new MBeanTrustPerm());
+        PERM_ARRAY.add(new NetPerm());
+        PERM_ARRAY.add(new NetworkPerm());
+        PERM_ARRAY.add(new PrivCredPerm());
+        PERM_ARRAY.add(new PropPerm());
+        PERM_ARRAY.add(new ReflectPerm());
+        PERM_ARRAY.add(new RuntimePerm());
+        PERM_ARRAY.add(new SecurityPerm());
+        PERM_ARRAY.add(new SerialPerm());
+        PERM_ARRAY.add(new ServicePerm());
+        PERM_ARRAY.add(new SocketPerm());
+        PERM_ARRAY.add(new SQLPerm());
+        PERM_ARRAY.add(new SSLPerm());
+        PERM_ARRAY.add(new SubjDelegPerm());
+
+        // set up principal objects
+
+        PRIN_ARRAY = new java.util.ArrayList<Prin>();
+        PRIN_ARRAY.add(new KrbPrin());
+        PRIN_ARRAY.add(new X500Prin());
+    }
+
+    ToolDialog(String title, PolicyTool tool, ToolWindow tw, boolean modal) {
+        super(tw, modal);
+        setTitle(title);
+        this.tool = tool;
+        this.tw = tw;
+        addWindowListener(new ChildWindowListener(this));
+
+        // Create some space around components
+        ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
+    }
+
+    /**
+     * Don't call getComponent directly on the window
+     */
+    public Component getComponent(int n) {
+        Component c = getContentPane().getComponent(n);
+        if (c instanceof JScrollPane) {
+            c = ((JScrollPane)c).getViewport().getView();
+        }
+        return c;
+    }
+
+    /**
+     * get the Perm instance based on either the (shortened) class name
+     * or the fully qualified class name
+     */
+    static Perm getPerm(String clazz, boolean fullClassName) {
+        for (int i = 0; i < PERM_ARRAY.size(); i++) {
+            Perm next = PERM_ARRAY.get(i);
+            if (fullClassName) {
+                if (next.FULL_CLASS.equals(clazz)) {
+                    return next;
+                }
+            } else {
+                if (next.CLASS.equals(clazz)) {
+                    return next;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * get the Prin instance based on either the (shortened) class name
+     * or the fully qualified class name
+     */
+    static Prin getPrin(String clazz, boolean fullClassName) {
+        for (int i = 0; i < PRIN_ARRAY.size(); i++) {
+            Prin next = PRIN_ARRAY.get(i);
+            if (fullClassName) {
+                if (next.FULL_CLASS.equals(clazz)) {
+                    return next;
+                }
+            } else {
+                if (next.CLASS.equals(clazz)) {
+                    return next;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * pop up a dialog so the user can enter info to add a new PolicyEntry
+     * - if edit is TRUE, then the user is editing an existing entry
+     *   and we should display the original info as well.
+     *
+     * - the other reason we need the 'edit' boolean is we need to know
+     *   when we are adding a NEW policy entry.  in this case, we can
+     *   not simply update the existing entry, because it doesn't exist.
+     *   we ONLY update the GUI listing/info, and then when the user
+     *   finally clicks 'OK' or 'DONE', then we can collect that info
+     *   and add it to the policy.
+     */
+    void displayPolicyEntryDialog(boolean edit) {
+
+        int listIndex = 0;
+        PolicyEntry entries[] = null;
+        TaggedList prinList = new TaggedList(3, false);
+        prinList.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Principal.List"));
+        prinList.addMouseListener
+                (new EditPrinButtonListener(tool, tw, this, edit));
+        TaggedList permList = new TaggedList(10, false);
+        permList.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Permission.List"));
+        permList.addMouseListener
+                (new EditPermButtonListener(tool, tw, this, edit));
+
+        // find where the PolicyTool gui is
+        Point location = tw.getLocationOnScreen();
+        //setBounds(location.x + 75, location.y + 200, 650, 500);
+        setLayout(new GridBagLayout());
+        setResizable(true);
+
+        if (edit) {
+            // get the selected item
+            entries = tool.getEntry();
+            @SuppressWarnings("unchecked")
+            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            listIndex = policyList.getSelectedIndex();
+
+            // get principal list
+            LinkedList<PolicyParser.PrincipalEntry> principals =
+                entries[listIndex].getGrantEntry().principals;
+            for (int i = 0; i < principals.size(); i++) {
+                String prinString = null;
+                PolicyParser.PrincipalEntry nextPrin = principals.get(i);
+                prinList.addTaggedItem(PrincipalEntryToUserFriendlyString(nextPrin), nextPrin);
+            }
+
+            // get permission list
+            Vector<PolicyParser.PermissionEntry> permissions =
+                entries[listIndex].getGrantEntry().permissionEntries;
+            for (int i = 0; i < permissions.size(); i++) {
+                String permString = null;
+                PolicyParser.PermissionEntry nextPerm =
+                                                permissions.elementAt(i);
+                permList.addTaggedItem(ToolDialog.PermissionEntryToUserFriendlyString(nextPerm), nextPerm);
+            }
+        }
+
+        // codebase label and textfield
+        JLabel label = new JLabel();
+        tw.addNewComponent(this, label, PE_CODEBASE_LABEL,
+                0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                ToolWindow.R_PADDING);
+        JTextField tf;
+        tf = (edit ?
+                new JTextField(entries[listIndex].getGrantEntry().codeBase) :
+                new JTextField());
+        ToolWindow.configureLabelFor(label, tf, "CodeBase.");
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Code.Base"));
+        tw.addNewComponent(this, tf, PE_CODEBASE_TEXTFIELD,
+                1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
+
+        // signedby label and textfield
+        label = new JLabel();
+        tw.addNewComponent(this, label, PE_SIGNEDBY_LABEL,
+                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.R_PADDING);
+        tf = (edit ?
+                new JTextField(entries[listIndex].getGrantEntry().signedBy) :
+                new JTextField());
+        ToolWindow.configureLabelFor(label, tf, "SignedBy.");
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Signed.By."));
+        tw.addNewComponent(this, tf, PE_SIGNEDBY_TEXTFIELD,
+                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
+
+        // panel for principal buttons
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        JButton button = new JButton();
+        ToolWindow.configureButton(button, "Add.Principal");
+        button.addActionListener
+                (new AddPrinButtonListener(tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_ADD_PRIN_BUTTON,
+                0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+        button = new JButton();
+        ToolWindow.configureButton(button, "Edit.Principal");
+        button.addActionListener(new EditPrinButtonListener
+                                                (tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_EDIT_PRIN_BUTTON,
+                1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+        button = new JButton();
+        ToolWindow.configureButton(button, "Remove.Principal");
+        button.addActionListener(new RemovePrinButtonListener
+                                        (tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_REMOVE_PRIN_BUTTON,
+                2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+        tw.addNewComponent(this, panel, PE_PANEL0,
+                1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
+                           ToolWindow.LITE_BOTTOM_PADDING);
+
+        // principal label and list
+        label = new JLabel();
+        tw.addNewComponent(this, label, PE_PRIN_LABEL,
+                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.R_BOTTOM_PADDING);
+        JScrollPane scrollPane = new JScrollPane(prinList);
+        ToolWindow.configureLabelFor(label, scrollPane, "Principals.");
+        tw.addNewComponent(this, scrollPane, PE_PRIN_LIST,
+                           1, 3, 3, 1, 0.0, prinList.getVisibleRowCount(), GridBagConstraints.BOTH,
+                           ToolWindow.BOTTOM_PADDING);
+
+        // panel for permission buttons
+        panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        button = new JButton();
+        ToolWindow.configureButton(button, ".Add.Permission");
+        button.addActionListener(new AddPermButtonListener
+                                                (tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_ADD_PERM_BUTTON,
+                0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+        button = new JButton();
+        ToolWindow.configureButton(button, ".Edit.Permission");
+        button.addActionListener(new EditPermButtonListener
+                                                (tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_EDIT_PERM_BUTTON,
+                1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+
+        button = new JButton();
+        ToolWindow.configureButton(button, "Remove.Permission");
+        button.addActionListener(new RemovePermButtonListener
+                                        (tool, tw, this, edit));
+        tw.addNewComponent(panel, button, PE_REMOVE_PERM_BUTTON,
+                2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
+
+        tw.addNewComponent(this, panel, PE_PANEL1,
+                0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
+                ToolWindow.LITE_BOTTOM_PADDING);
+
+        // permission list
+        scrollPane = new JScrollPane(permList);
+        tw.addNewComponent(this, scrollPane, PE_PERM_LIST,
+                           0, 5, 3, 1, 0.0, permList.getVisibleRowCount(), GridBagConstraints.BOTH,
+                           ToolWindow.BOTTOM_PADDING);
+
+
+        // panel for Done and Cancel buttons
+        panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        // Done Button
+        JButton okButton = new JButton(PolicyTool.getMessage("Done"));
+        okButton.addActionListener
+                (new AddEntryDoneButtonListener(tool, tw, this, edit));
+        tw.addNewComponent(panel, okButton, PE_DONE_BUTTON,
+                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.LR_PADDING);
+
+        // Cancel Button
+        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
+        ActionListener cancelListener = new CancelButtonListener(this);
+        cancelButton.addActionListener(cancelListener);
+        tw.addNewComponent(panel, cancelButton, PE_CANCEL_BUTTON,
+                           1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.LR_PADDING);
+
+        // add the panel
+        tw.addNewComponent(this, panel, PE_PANEL2,
+                0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+        getRootPane().setDefaultButton(okButton);
+        getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        pack();
+        setLocationRelativeTo(tw);
+        setVisible(true);
+    }
+
+    /**
+     * Read all the Policy information data in the dialog box
+     * and construct a PolicyEntry object with it.
+     */
+    PolicyEntry getPolicyEntryFromDialog()
+        throws InvalidParameterException, MalformedURLException,
+        NoSuchMethodException, ClassNotFoundException, InstantiationException,
+        IllegalAccessException, InvocationTargetException,
+        CertificateException, IOException, Exception {
+
+        // get the Codebase
+        JTextField tf = (JTextField)getComponent(PE_CODEBASE_TEXTFIELD);
+        String codebase = null;
+        if (tf.getText().trim().equals("") == false)
+                codebase = new String(tf.getText().trim());
+
+        // get the SignedBy
+        tf = (JTextField)getComponent(PE_SIGNEDBY_TEXTFIELD);
+        String signedby = null;
+        if (tf.getText().trim().equals("") == false)
+                signedby = new String(tf.getText().trim());
+
+        // construct a new GrantEntry
+        PolicyParser.GrantEntry ge =
+                        new PolicyParser.GrantEntry(signedby, codebase);
+
+        // get the new Principals
+        LinkedList<PolicyParser.PrincipalEntry> prins = new LinkedList<>();
+        TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
+        for (int i = 0; i < prinList.getModel().getSize(); i++) {
+            prins.add((PolicyParser.PrincipalEntry)prinList.getObject(i));
+        }
+        ge.principals = prins;
+
+        // get the new Permissions
+        Vector<PolicyParser.PermissionEntry> perms = new Vector<>();
+        TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
+        for (int i = 0; i < permList.getModel().getSize(); i++) {
+            perms.addElement((PolicyParser.PermissionEntry)permList.getObject(i));
+        }
+        ge.permissionEntries = perms;
+
+        // construct a new PolicyEntry object
+        PolicyEntry entry = new PolicyEntry(tool, ge);
+
+        return entry;
+    }
+
+    /**
+     * display a dialog box for the user to enter KeyStore information
+     */
+    void keyStoreDialog(int mode) {
+
+        // find where the PolicyTool gui is
+        Point location = tw.getLocationOnScreen();
+        //setBounds(location.x + 25, location.y + 100, 500, 300);
+        setLayout(new GridBagLayout());
+
+        if (mode == EDIT_KEYSTORE) {
+
+            // KeyStore label and textfield
+            JLabel label = new JLabel();
+            tw.addNewComponent(this, label, KSD_NAME_LABEL,
+                               0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.R_BOTTOM_PADDING);
+            JTextField tf = new JTextField(tool.getKeyStoreName(), 30);
+            ToolWindow.configureLabelFor(label, tf, "KeyStore.URL.");
+            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+
+            // URL to U R L, so that accessibility reader will pronounce well
+            tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("KeyStore.U.R.L."));
+            tw.addNewComponent(this, tf, KSD_NAME_TEXTFIELD,
+                               1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.BOTTOM_PADDING);
+
+            // KeyStore type and textfield
+            label = new JLabel();
+            tw.addNewComponent(this, label, KSD_TYPE_LABEL,
+                               0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.R_BOTTOM_PADDING);
+            tf = new JTextField(tool.getKeyStoreType(), 30);
+            ToolWindow.configureLabelFor(label, tf, "KeyStore.Type.");
+            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+            tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("KeyStore.Type."));
+            tw.addNewComponent(this, tf, KSD_TYPE_TEXTFIELD,
+                               1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.BOTTOM_PADDING);
+
+            // KeyStore provider and textfield
+            label = new JLabel();
+            tw.addNewComponent(this, label, KSD_PROVIDER_LABEL,
+                               0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.R_BOTTOM_PADDING);
+            tf = new JTextField(tool.getKeyStoreProvider(), 30);
+            ToolWindow.configureLabelFor(label, tf, "KeyStore.Provider.");
+            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+            tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("KeyStore.Provider."));
+            tw.addNewComponent(this, tf, KSD_PROVIDER_TEXTFIELD,
+                               1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.BOTTOM_PADDING);
+
+            // KeyStore password URL and textfield
+            label = new JLabel();
+            tw.addNewComponent(this, label, KSD_PWD_URL_LABEL,
+                               0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.R_BOTTOM_PADDING);
+            tf = new JTextField(tool.getKeyStorePwdURL(), 30);
+            ToolWindow.configureLabelFor(label, tf, "KeyStore.Password.URL.");
+            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+            tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("KeyStore.Password.U.R.L."));
+            tw.addNewComponent(this, tf, KSD_PWD_URL_TEXTFIELD,
+                               1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.BOTTOM_PADDING);
+
+            // OK button
+            JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+            okButton.addActionListener
+                        (new ChangeKeyStoreOKButtonListener(tool, tw, this));
+            tw.addNewComponent(this, okButton, KSD_OK_BUTTON,
+                        0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+            // cancel button
+            JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
+            ActionListener cancelListener = new CancelButtonListener(this);
+            cancelButton.addActionListener(cancelListener);
+            tw.addNewComponent(this, cancelButton, KSD_CANCEL_BUTTON,
+                        1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
+
+            getRootPane().setDefaultButton(okButton);
+            getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+        }
+
+        pack();
+        setLocationRelativeTo(tw);
+        setVisible(true);
+    }
+
+    /**
+     * display a dialog box for the user to input Principal info
+     *
+     * if editPolicyEntry is false, then we are adding Principals to
+     * a new PolicyEntry, and we only update the GUI listing
+     * with the new Principal.
+     *
+     * if edit is true, then we are editing an existing Policy entry.
+     */
+    void displayPrincipalDialog(boolean editPolicyEntry, boolean edit) {
+
+        PolicyParser.PrincipalEntry editMe = null;
+
+        // get the Principal selected from the Principal List
+        TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
+        int prinIndex = prinList.getSelectedIndex();
+
+        if (edit) {
+            editMe = (PolicyParser.PrincipalEntry)prinList.getObject(prinIndex);
+        }
+
+        ToolDialog newTD = new ToolDialog
+                (PolicyTool.getMessage("Principals"), tool, tw, true);
+        newTD.addWindowListener(new ChildWindowListener(newTD));
+
+        // find where the PolicyTool gui is
+        Point location = getLocationOnScreen();
+        //newTD.setBounds(location.x + 50, location.y + 100, 650, 190);
+        newTD.setLayout(new GridBagLayout());
+        newTD.setResizable(true);
+
+        // description label
+        JLabel label = (edit ?
+                new JLabel(PolicyTool.getMessage(".Edit.Principal.")) :
+                new JLabel(PolicyTool.getMessage(".Add.New.Principal.")));
+        tw.addNewComponent(newTD, label, PRD_DESC_LABEL,
+                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+
+        // principal choice
+        JComboBox<String> choice = new JComboBox<>();
+        choice.addItem(PRIN_TYPE);
+        choice.getAccessibleContext().setAccessibleName(PRIN_TYPE);
+        for (int i = 0; i < PRIN_ARRAY.size(); i++) {
+            Prin next = PRIN_ARRAY.get(i);
+            choice.addItem(next.CLASS);
+        }
+
+        if (edit) {
+            if (PolicyParser.PrincipalEntry.WILDCARD_CLASS.equals
+                                (editMe.getPrincipalClass())) {
+                choice.setSelectedItem(PRIN_TYPE);
+            } else {
+                Prin inputPrin = getPrin(editMe.getPrincipalClass(), true);
+                if (inputPrin != null) {
+                    choice.setSelectedItem(inputPrin.CLASS);
+                }
+            }
+        }
+        // Add listener after selected item is set
+        choice.addItemListener(new PrincipalTypeMenuListener(newTD));
+
+        tw.addNewComponent(newTD, choice, PRD_PRIN_CHOICE,
+                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_PADDING);
+
+        // principal textfield
+        JTextField tf;
+        tf = (edit ?
+                new JTextField(editMe.getDisplayClass(), 30) :
+                new JTextField(30));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(PRIN_TYPE);
+        tw.addNewComponent(newTD, tf, PRD_PRIN_TEXTFIELD,
+                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_PADDING);
+
+        // name label and textfield
+        label = new JLabel(PRIN_NAME);
+        tf = (edit ?
+                new JTextField(editMe.getDisplayName(), 40) :
+                new JTextField(40));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(PRIN_NAME);
+
+        tw.addNewComponent(newTD, label, PRD_NAME_LABEL,
+                           0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_PADDING);
+        tw.addNewComponent(newTD, tf, PRD_NAME_TEXTFIELD,
+                           1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_PADDING);
+
+        // OK button
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        okButton.addActionListener(
+            new NewPolicyPrinOKButtonListener
+                                        (tool, tw, this, newTD, edit));
+        tw.addNewComponent(newTD, okButton, PRD_OK_BUTTON,
+                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+        // cancel button
+        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
+        ActionListener cancelListener = new CancelButtonListener(newTD);
+        cancelButton.addActionListener(cancelListener);
+        tw.addNewComponent(newTD, cancelButton, PRD_CANCEL_BUTTON,
+                           1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+
+        newTD.getRootPane().setDefaultButton(okButton);
+        newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        newTD.pack();
+        newTD.setLocationRelativeTo(tw);
+        newTD.setVisible(true);
+    }
+
+    /**
+     * display a dialog box for the user to input Permission info
+     *
+     * if editPolicyEntry is false, then we are adding Permissions to
+     * a new PolicyEntry, and we only update the GUI listing
+     * with the new Permission.
+     *
+     * if edit is true, then we are editing an existing Permission entry.
+     */
+    void displayPermissionDialog(boolean editPolicyEntry, boolean edit) {
+
+        PolicyParser.PermissionEntry editMe = null;
+
+        // get the Permission selected from the Permission List
+        TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
+        int permIndex = permList.getSelectedIndex();
+
+        if (edit) {
+            editMe = (PolicyParser.PermissionEntry)permList.getObject(permIndex);
+        }
+
+        ToolDialog newTD = new ToolDialog
+                (PolicyTool.getMessage("Permissions"), tool, tw, true);
+        newTD.addWindowListener(new ChildWindowListener(newTD));
+
+        // find where the PolicyTool gui is
+        Point location = getLocationOnScreen();
+        //newTD.setBounds(location.x + 50, location.y + 100, 700, 250);
+        newTD.setLayout(new GridBagLayout());
+        newTD.setResizable(true);
+
+        // description label
+        JLabel label = (edit ?
+                new JLabel(PolicyTool.getMessage(".Edit.Permission.")) :
+                new JLabel(PolicyTool.getMessage(".Add.New.Permission.")));
+        tw.addNewComponent(newTD, label, PD_DESC_LABEL,
+                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+
+        // permission choice (added in alphabetical order)
+        JComboBox<String> choice = new JComboBox<>();
+        choice.addItem(PERM);
+        choice.getAccessibleContext().setAccessibleName(PERM);
+        for (int i = 0; i < PERM_ARRAY.size(); i++) {
+            Perm next = PERM_ARRAY.get(i);
+            choice.addItem(next.CLASS);
+        }
+        tw.addNewComponent(newTD, choice, PD_PERM_CHOICE,
+                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+
+        // permission textfield
+        JTextField tf;
+        tf = (edit ? new JTextField(editMe.permission, 30) : new JTextField(30));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(PERM);
+        if (edit) {
+            Perm inputPerm = getPerm(editMe.permission, true);
+            if (inputPerm != null) {
+                choice.setSelectedItem(inputPerm.CLASS);
+            }
+        }
+        tw.addNewComponent(newTD, tf, PD_PERM_TEXTFIELD,
+                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        choice.addItemListener(new PermissionMenuListener(newTD));
+
+        // name label and textfield
+        choice = new JComboBox<>();
+        choice.addItem(PERM_NAME);
+        choice.getAccessibleContext().setAccessibleName(PERM_NAME);
+        tf = (edit ? new JTextField(editMe.name, 40) : new JTextField(40));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(PERM_NAME);
+        if (edit) {
+            setPermissionNames(getPerm(editMe.permission, true), choice, tf);
+        }
+        tw.addNewComponent(newTD, choice, PD_NAME_CHOICE,
+                           0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        tw.addNewComponent(newTD, tf, PD_NAME_TEXTFIELD,
+                           1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        choice.addItemListener(new PermissionNameMenuListener(newTD));
+
+        // actions label and textfield
+        choice = new JComboBox<>();
+        choice.addItem(PERM_ACTIONS);
+        choice.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
+        tf = (edit ? new JTextField(editMe.action, 40) : new JTextField(40));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
+        if (edit) {
+            setPermissionActions(getPerm(editMe.permission, true), choice, tf);
+        }
+        tw.addNewComponent(newTD, choice, PD_ACTIONS_CHOICE,
+                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        tw.addNewComponent(newTD, tf, PD_ACTIONS_TEXTFIELD,
+                           1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        choice.addItemListener(new PermissionActionsMenuListener(newTD));
+
+        // signedby label and textfield
+        label = new JLabel(PolicyTool.getMessage("Signed.By."));
+        tw.addNewComponent(newTD, label, PD_SIGNEDBY_LABEL,
+                           0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+        tf = (edit ? new JTextField(editMe.signedBy, 40) : new JTextField(40));
+        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
+        tf.getAccessibleContext().setAccessibleName(
+                PolicyTool.getMessage("Signed.By."));
+        tw.addNewComponent(newTD, tf, PD_SIGNEDBY_TEXTFIELD,
+                           1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.LR_BOTTOM_PADDING);
+
+        // OK button
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        okButton.addActionListener(
+            new NewPolicyPermOKButtonListener
+                                    (tool, tw, this, newTD, edit));
+        tw.addNewComponent(newTD, okButton, PD_OK_BUTTON,
+                           0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+
+        // cancel button
+        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
+        ActionListener cancelListener = new CancelButtonListener(newTD);
+        cancelButton.addActionListener(cancelListener);
+        tw.addNewComponent(newTD, cancelButton, PD_CANCEL_BUTTON,
+                           1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
+                           ToolWindow.TOP_BOTTOM_PADDING);
+
+        newTD.getRootPane().setDefaultButton(okButton);
+        newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        newTD.pack();
+        newTD.setLocationRelativeTo(tw);
+        newTD.setVisible(true);
+    }
+
+    /**
+     * construct a Principal object from the Principal Info Dialog Box
+     */
+    PolicyParser.PrincipalEntry getPrinFromDialog() throws Exception {
+
+        JTextField tf = (JTextField)getComponent(PRD_PRIN_TEXTFIELD);
+        String pclass = new String(tf.getText().trim());
+        tf = (JTextField)getComponent(PRD_NAME_TEXTFIELD);
+        String pname = new String(tf.getText().trim());
+        if (pclass.equals("*")) {
+            pclass = PolicyParser.PrincipalEntry.WILDCARD_CLASS;
+        }
+        if (pname.equals("*")) {
+            pname = PolicyParser.PrincipalEntry.WILDCARD_NAME;
+        }
+
+        PolicyParser.PrincipalEntry pppe = null;
+
+        if ((pclass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS)) &&
+            (!pname.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME))) {
+            throw new Exception
+                        (PolicyTool.getMessage("Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name"));
+        } else if (pname.equals("")) {
+            throw new Exception
+                        (PolicyTool.getMessage("Cannot.Specify.Principal.without.a.Name"));
+        } else if (pclass.equals("")) {
+            // make this consistent with what PolicyParser does
+            // when it sees an empty principal class
+            pclass = PolicyParser.PrincipalEntry.REPLACE_NAME;
+            tool.warnings.addElement(
+                        "Warning: Principal name '" + pname +
+                                "' specified without a Principal class.\n" +
+                        "\t'" + pname + "' will be interpreted " +
+                                "as a key store alias.\n" +
+                        "\tThe final principal class will be " +
+                                ToolDialog.X500_PRIN_CLASS + ".\n" +
+                        "\tThe final principal name will be " +
+                                "determined by the following:\n" +
+                        "\n" +
+                        "\tIf the key store entry identified by '"
+                                + pname + "'\n" +
+                        "\tis a key entry, then the principal name will be\n" +
+                        "\tthe subject distinguished name from the first\n" +
+                        "\tcertificate in the entry's certificate chain.\n" +
+                        "\n" +
+                        "\tIf the key store entry identified by '" +
+                                pname + "'\n" +
+                        "\tis a trusted certificate entry, then the\n" +
+                        "\tprincipal name will be the subject distinguished\n" +
+                        "\tname from the trusted public key certificate.");
+            tw.displayStatusDialog(this,
+                        "'" + pname + "' will be interpreted as a key " +
+                        "store alias.  View Warning Log for details.");
+        }
+        return new PolicyParser.PrincipalEntry(pclass, pname);
+    }
+
+
+    /**
+     * construct a Permission object from the Permission Info Dialog Box
+     */
+    PolicyParser.PermissionEntry getPermFromDialog() {
+
+        JTextField tf = (JTextField)getComponent(PD_PERM_TEXTFIELD);
+        String permission = new String(tf.getText().trim());
+        tf = (JTextField)getComponent(PD_NAME_TEXTFIELD);
+        String name = null;
+        if (tf.getText().trim().equals("") == false)
+            name = new String(tf.getText().trim());
+        if (permission.equals("") ||
+            (!permission.equals(ALL_PERM_CLASS) && name == null)) {
+            throw new InvalidParameterException(PolicyTool.getMessage
+                ("Permission.and.Target.Name.must.have.a.value"));
+        }
+
+        // When the permission is FilePermission, we need to check the name
+        // to make sure it's not escaped. We believe --
+        //
+        // String             name.lastIndexOf("\\\\")
+        // ----------------   ------------------------
+        // c:\foo\bar         -1, legal
+        // c:\\foo\\bar       2, illegal
+        // \\server\share     0, legal
+        // \\\\server\share   2, illegal
+
+        if (permission.equals(FILE_PERM_CLASS) && name.lastIndexOf("\\\\") > 0) {
+            char result = tw.displayYesNoDialog(this,
+                    PolicyTool.getMessage("Warning"),
+                    PolicyTool.getMessage(
+                        "Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes"),
+                    PolicyTool.getMessage("Retain"),
+                    PolicyTool.getMessage("Edit")
+                    );
+            if (result != 'Y') {
+                // an invisible exception
+                throw new NoDisplayException();
+            }
+        }
+        // get the Actions
+        tf = (JTextField)getComponent(PD_ACTIONS_TEXTFIELD);
+        String actions = null;
+        if (tf.getText().trim().equals("") == false)
+            actions = new String(tf.getText().trim());
+
+        // get the Signed By
+        tf = (JTextField)getComponent(PD_SIGNEDBY_TEXTFIELD);
+        String signedBy = null;
+        if (tf.getText().trim().equals("") == false)
+            signedBy = new String(tf.getText().trim());
+
+        PolicyParser.PermissionEntry pppe = new PolicyParser.PermissionEntry
+                                (permission, name, actions);
+        pppe.signedBy = signedBy;
+
+        // see if the signers have public keys
+        if (signedBy != null) {
+                String signers[] = tool.parseSigners(pppe.signedBy);
+                for (int i = 0; i < signers.length; i++) {
+                try {
+                    PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
+                    if (pubKey == null) {
+                        MessageFormat form = new MessageFormat
+                            (PolicyTool.getMessage
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
+                        Object[] source = {signers[i]};
+                        tool.warnings.addElement(form.format(source));
+                        tw.displayStatusDialog(this, form.format(source));
+                    }
+                } catch (Exception e) {
+                    tw.displayErrorDialog(this, e);
+                }
+            }
+        }
+        return pppe;
+    }
+
+    /**
+     * confirm that the user REALLY wants to remove the Policy Entry
+     */
+    void displayConfirmRemovePolicyEntry() {
+
+        // find the entry to be removed
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+        int index = list.getSelectedIndex();
+        PolicyEntry entries[] = tool.getEntry();
+
+        // find where the PolicyTool gui is
+        Point location = tw.getLocationOnScreen();
+        //setBounds(location.x + 25, location.y + 100, 600, 400);
+        setLayout(new GridBagLayout());
+
+        // ask the user do they really want to do this?
+        JLabel label = new JLabel
+                (PolicyTool.getMessage("Remove.this.Policy.Entry."));
+        tw.addNewComponent(this, label, CRPE_LABEL1,
+                           0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                           ToolWindow.BOTTOM_PADDING);
+
+        // display the policy entry
+        label = new JLabel(entries[index].codebaseToString());
+        tw.addNewComponent(this, label, CRPE_LABEL2,
+                        0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+        label = new JLabel(entries[index].principalsToString().trim());
+        tw.addNewComponent(this, label, CRPE_LABEL2+1,
+                        0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+        Vector<PolicyParser.PermissionEntry> perms =
+                        entries[index].getGrantEntry().permissionEntries;
+        for (int i = 0; i < perms.size(); i++) {
+            PolicyParser.PermissionEntry nextPerm = perms.elementAt(i);
+            String permString = ToolDialog.PermissionEntryToUserFriendlyString(nextPerm);
+            label = new JLabel("    " + permString);
+            if (i == (perms.size()-1)) {
+                tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
+                                 1, 3 + i, 1, 1, 0.0, 0.0,
+                                 GridBagConstraints.BOTH,
+                                 ToolWindow.BOTTOM_PADDING);
+            } else {
+                tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
+                                 1, 3 + i, 1, 1, 0.0, 0.0,
+                                 GridBagConstraints.BOTH);
+            }
+        }
+
+
+        // add OK/CANCEL buttons in a new panel
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        // OK button
+        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
+        okButton.addActionListener
+                (new ConfirmRemovePolicyEntryOKButtonListener(tool, tw, this));
+        tw.addNewComponent(panel, okButton, CRPE_PANEL_OK,
+                           0, 0, 1, 1, 0.0, 0.0,
+                           GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
+
+        // cancel button
+        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
+        ActionListener cancelListener = new CancelButtonListener(this);
+        cancelButton.addActionListener(cancelListener);
+        tw.addNewComponent(panel, cancelButton, CRPE_PANEL_CANCEL,
+                           1, 0, 1, 1, 0.0, 0.0,
+                           GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
+
+        tw.addNewComponent(this, panel, CRPE_LABEL2 + 2 + perms.size(),
+                           0, 3 + perms.size(), 2, 1, 0.0, 0.0,
+                           GridBagConstraints.VERTICAL, ToolWindow.TOP_BOTTOM_PADDING);
+
+        getRootPane().setDefaultButton(okButton);
+        getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+        pack();
+        setLocationRelativeTo(tw);
+        setVisible(true);
+    }
+
+    /**
+     * perform SAVE AS
+     */
+    void displaySaveAsDialog(int nextEvent) {
+
+        // pop up a dialog box for the user to enter a filename.
+        FileDialog fd = new FileDialog
+                (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE);
+        fd.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().setVisible(false);
+            }
+        });
+        fd.setVisible(true);
+
+        // see if the user hit cancel
+        if (fd.getFile() == null ||
+            fd.getFile().equals(""))
+            return;
+
+        // get the entered filename
+        File saveAsFile = new File(fd.getDirectory(), fd.getFile());
+        String filename = saveAsFile.getPath();
+        fd.dispose();
+
+        try {
+            // save the policy entries to a file
+            tool.savePolicy(filename);
+
+            // display status
+            MessageFormat form = new MessageFormat(PolicyTool.getMessage
+                    ("Policy.successfully.written.to.filename"));
+            Object[] source = {filename};
+            tw.displayStatusDialog(null, form.format(source));
+
+            // display the new policy filename
+            JTextField newFilename = (JTextField)tw.getComponent
+                            (ToolWindow.MW_FILENAME_TEXTFIELD);
+            newFilename.setText(filename);
+            tw.setVisible(true);
+
+            // now continue with the originally requested command
+            // (QUIT, NEW, or OPEN)
+            userSaveContinue(tool, tw, this, nextEvent);
+
+        } catch (FileNotFoundException fnfe) {
+            if (filename == null || filename.equals("")) {
+                tw.displayErrorDialog(null, new FileNotFoundException
+                            (PolicyTool.getMessage("null.filename")));
+            } else {
+                tw.displayErrorDialog(null, fnfe);
+            }
+        } catch (Exception ee) {
+            tw.displayErrorDialog(null, ee);
+        }
+    }
+
+    /**
+     * ask user if they want to save changes
+     */
+    void displayUserSave(int select) {
+
+        if (tool.modified == true) {
+
+            // find where the PolicyTool gui is
+            Point location = tw.getLocationOnScreen();
+            //setBounds(location.x + 75, location.y + 100, 400, 150);
+            setLayout(new GridBagLayout());
+
+            JLabel label = new JLabel
+                (PolicyTool.getMessage("Save.changes."));
+            tw.addNewComponent(this, label, USC_LABEL,
+                               0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
+                               ToolWindow.L_TOP_BOTTOM_PADDING);
+
+            JPanel panel = new JPanel();
+            panel.setLayout(new GridBagLayout());
+
+            JButton yesButton = new JButton();
+            ToolWindow.configureButton(yesButton, "Yes");
+            yesButton.addActionListener
+                        (new UserSaveYesButtonListener(this, tool, tw, select));
+            tw.addNewComponent(panel, yesButton, USC_YES_BUTTON,
+                               0, 0, 1, 1, 0.0, 0.0,
+                               GridBagConstraints.VERTICAL,
+                               ToolWindow.LR_BOTTOM_PADDING);
+            JButton noButton = new JButton();
+            ToolWindow.configureButton(noButton, "No");
+            noButton.addActionListener
+                        (new UserSaveNoButtonListener(this, tool, tw, select));
+            tw.addNewComponent(panel, noButton, USC_NO_BUTTON,
+                               1, 0, 1, 1, 0.0, 0.0,
+                               GridBagConstraints.VERTICAL,
+                               ToolWindow.LR_BOTTOM_PADDING);
+            JButton cancelButton = new JButton();
+            ToolWindow.configureButton(cancelButton, "Cancel");
+            ActionListener cancelListener = new CancelButtonListener(this);
+            cancelButton.addActionListener(cancelListener);
+            tw.addNewComponent(panel, cancelButton, USC_CANCEL_BUTTON,
+                               2, 0, 1, 1, 0.0, 0.0,
+                               GridBagConstraints.VERTICAL,
+                               ToolWindow.LR_BOTTOM_PADDING);
+
+            tw.addNewComponent(this, panel, USC_PANEL,
+                               0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
+
+            getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+            pack();
+            setLocationRelativeTo(tw);
+            setVisible(true);
+        } else {
+            // just do the original request (QUIT, NEW, or OPEN)
+            userSaveContinue(tool, tw, this, select);
+        }
+    }
+
+    /**
+     * when the user sees the 'YES', 'NO', 'CANCEL' buttons on the
+     * displayUserSave dialog, and the click on one of them,
+     * we need to continue the originally requested action
+     * (either QUITting, opening NEW policy file, or OPENing an existing
+     * policy file.  do that now.
+     */
+    @SuppressWarnings("fallthrough")
+    void userSaveContinue(PolicyTool tool, ToolWindow tw,
+                        ToolDialog us, int select) {
+
+        // now either QUIT, open a NEW policy file, or OPEN an existing policy
+        switch(select) {
+        case ToolDialog.QUIT:
+
+            tw.setVisible(false);
+            tw.dispose();
+            System.exit(0);
+
+        case ToolDialog.NEW:
+
+            try {
+                tool.openPolicy(null);
+            } catch (Exception ee) {
+                tool.modified = false;
+                tw.displayErrorDialog(null, ee);
+            }
+
+            // display the policy entries via the policy list textarea
+            JList<String> list = new JList<>(new DefaultListModel<>());
+            list.setVisibleRowCount(15);
+            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+            list.addMouseListener(new PolicyListListener(tool, tw));
+            tw.replacePolicyList(list);
+
+            // display null policy filename and keystore
+            JTextField newFilename = (JTextField)tw.getComponent(
+                    ToolWindow.MW_FILENAME_TEXTFIELD);
+            newFilename.setText("");
+            tw.setVisible(true);
+            break;
+
+        case ToolDialog.OPEN:
+
+            // pop up a dialog box for the user to enter a filename.
+            FileDialog fd = new FileDialog
+                (tw, PolicyTool.getMessage("Open"), FileDialog.LOAD);
+            fd.addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    e.getWindow().setVisible(false);
+                }
+            });
+            fd.setVisible(true);
+
+            // see if the user hit 'cancel'
+            if (fd.getFile() == null ||
+                fd.getFile().equals(""))
+                return;
+
+            // get the entered filename
+            String policyFile = new File(fd.getDirectory(), fd.getFile()).getPath();
+
+            try {
+                // open the policy file
+                tool.openPolicy(policyFile);
+
+                // display the policy entries via the policy list textarea
+                DefaultListModel<String> listModel = new DefaultListModel<>();
+                list = new JList<>(listModel);
+                list.setVisibleRowCount(15);
+                list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+                list.addMouseListener(new PolicyListListener(tool, tw));
+                PolicyEntry entries[] = tool.getEntry();
+                if (entries != null) {
+                    for (int i = 0; i < entries.length; i++) {
+                        listModel.addElement(entries[i].headerToString());
+                    }
+                }
+                tw.replacePolicyList(list);
+                tool.modified = false;
+
+                // display the new policy filename
+                newFilename = (JTextField)tw.getComponent(
+                        ToolWindow.MW_FILENAME_TEXTFIELD);
+                newFilename.setText(policyFile);
+                tw.setVisible(true);
+
+                // inform user of warnings
+                if (tool.newWarning == true) {
+                    tw.displayStatusDialog(null, PolicyTool.getMessage
+                        ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
+                }
+
+            } catch (Exception e) {
+                // add blank policy listing
+                list = new JList<>(new DefaultListModel<>());
+                list.setVisibleRowCount(15);
+                list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+                list.addMouseListener(new PolicyListListener(tool, tw));
+                tw.replacePolicyList(list);
+                tool.setPolicyFileName(null);
+                tool.modified = false;
+
+                // display a null policy filename
+                newFilename = (JTextField)tw.getComponent(
+                        ToolWindow.MW_FILENAME_TEXTFIELD);
+                newFilename.setText("");
+                tw.setVisible(true);
+
+                // display the error
+                MessageFormat form = new MessageFormat(PolicyTool.getMessage
+                    ("Could.not.open.policy.file.policyFile.e.toString."));
+                Object[] source = {policyFile, e.toString()};
+                tw.displayErrorDialog(null, form.format(source));
+            }
+            break;
+        }
+    }
+
+    /**
+     * Return a Menu list of names for a given permission
+     *
+     * If inputPerm's TARGETS are null, then this means TARGETS are
+     * not allowed to be entered (and the TextField is set to be
+     * non-editable).
+     *
+     * If TARGETS are valid but there are no standard ones
+     * (user must enter them by hand) then the TARGETS array may be empty
+     * (and of course non-null).
+     */
+    void setPermissionNames(Perm inputPerm, JComboBox<String> names, JTextField field) {
+        names.removeAllItems();
+        names.addItem(PERM_NAME);
+
+        if (inputPerm == null) {
+            // custom permission
+            field.setEditable(true);
+        } else if (inputPerm.TARGETS == null) {
+            // standard permission with no targets
+            field.setEditable(false);
+        } else {
+            // standard permission with standard targets
+            field.setEditable(true);
+            for (int i = 0; i < inputPerm.TARGETS.length; i++) {
+                names.addItem(inputPerm.TARGETS[i]);
+            }
+        }
+    }
+
+    /**
+     * Return a Menu list of actions for a given permission
+     *
+     * If inputPerm's ACTIONS are null, then this means ACTIONS are
+     * not allowed to be entered (and the TextField is set to be
+     * non-editable).  This is typically true for BasicPermissions.
+     *
+     * If ACTIONS are valid but there are no standard ones
+     * (user must enter them by hand) then the ACTIONS array may be empty
+     * (and of course non-null).
+     */
+    void setPermissionActions(Perm inputPerm, JComboBox<String> actions, JTextField field) {
+        actions.removeAllItems();
+        actions.addItem(PERM_ACTIONS);
+
+        if (inputPerm == null) {
+            // custom permission
+            field.setEditable(true);
+        } else if (inputPerm.ACTIONS == null) {
+            // standard permission with no actions
+            field.setEditable(false);
+        } else {
+            // standard permission with standard actions
+            field.setEditable(true);
+            for (int i = 0; i < inputPerm.ACTIONS.length; i++) {
+                actions.addItem(inputPerm.ACTIONS[i]);
+            }
+        }
+    }
+
+    static String PermissionEntryToUserFriendlyString(PolicyParser.PermissionEntry pppe) {
+        String result = pppe.permission;
+        if (pppe.name != null) {
+            result += " " + pppe.name;
+        }
+        if (pppe.action != null) {
+            result += ", \"" + pppe.action + "\"";
+        }
+        if (pppe.signedBy != null) {
+            result += ", signedBy " + pppe.signedBy;
+        }
+        return result;
+    }
+
+    static String PrincipalEntryToUserFriendlyString(PolicyParser.PrincipalEntry pppe) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        pppe.write(pw);
+        return sw.toString();
+    }
+}
+
+/**
+ * Event handler for the PolicyTool window
+ */
+class ToolWindowListener implements WindowListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+
+    ToolWindowListener(PolicyTool tool, ToolWindow tw) {
+        this.tool = tool;
+        this.tw = tw;
+    }
+
+    public void windowOpened(WindowEvent we) {
+    }
+
+    public void windowClosing(WindowEvent we) {
+        // Closing the window acts the same as choosing Menu->Exit.
+
+        // ask user if they want to save changes
+        ToolDialog td = new ToolDialog(PolicyTool.getMessage("Save.Changes"), tool, tw, true);
+        td.displayUserSave(ToolDialog.QUIT);
+
+        // the above method will perform the QUIT as long as the
+        // user does not CANCEL the request
+    }
+
+    public void windowClosed(WindowEvent we) {
+        System.exit(0);
+    }
+
+    public void windowIconified(WindowEvent we) {
+    }
+
+    public void windowDeiconified(WindowEvent we) {
+    }
+
+    public void windowActivated(WindowEvent we) {
+    }
+
+    public void windowDeactivated(WindowEvent we) {
+    }
+}
+
+/**
+ * Event handler for the Policy List
+ */
+class PolicyListListener extends MouseAdapter implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+
+    PolicyListListener(PolicyTool tool, ToolWindow tw) {
+        this.tool = tool;
+        this.tw = tw;
+
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // display the permission list for a policy entry
+        ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
+        td.displayPolicyEntryDialog(true);
+    }
+
+    public void mouseClicked(MouseEvent evt) {
+        if (evt.getClickCount() == 2) {
+            actionPerformed(null);
+        }
+    }
+}
+
+/**
+ * Event handler for the File Menu
+ */
+class FileMenuListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+
+    FileMenuListener(PolicyTool tool, ToolWindow tw) {
+        this.tool = tool;
+        this.tw = tw;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        if (PolicyTool.collator.compare(e.getActionCommand(),
+                                       ToolWindow.QUIT) == 0) {
+
+            // ask user if they want to save changes
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
+            td.displayUserSave(ToolDialog.QUIT);
+
+            // the above method will perform the QUIT as long as the
+            // user does not CANCEL the request
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                   ToolWindow.NEW_POLICY_FILE) == 0) {
+
+            // ask user if they want to save changes
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
+            td.displayUserSave(ToolDialog.NEW);
+
+            // the above method will perform the NEW as long as the
+            // user does not CANCEL the request
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                  ToolWindow.OPEN_POLICY_FILE) == 0) {
+
+            // ask user if they want to save changes
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
+            td.displayUserSave(ToolDialog.OPEN);
+
+            // the above method will perform the OPEN as long as the
+            // user does not CANCEL the request
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                  ToolWindow.SAVE_POLICY_FILE) == 0) {
+
+            // get the previously entered filename
+            String filename = ((JTextField)tw.getComponent(
+                    ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
+
+            // if there is no filename, do a SAVE_AS
+            if (filename == null || filename.length() == 0) {
+                // user wants to SAVE AS
+                ToolDialog td = new ToolDialog
+                        (PolicyTool.getMessage("Save.As"), tool, tw, true);
+                td.displaySaveAsDialog(ToolDialog.NOACTION);
+            } else {
+                try {
+                    // save the policy entries to a file
+                    tool.savePolicy(filename);
+
+                    // display status
+                    MessageFormat form = new MessageFormat
+                        (PolicyTool.getMessage
+                        ("Policy.successfully.written.to.filename"));
+                    Object[] source = {filename};
+                    tw.displayStatusDialog(null, form.format(source));
+                } catch (FileNotFoundException fnfe) {
+                    if (filename == null || filename.equals("")) {
+                        tw.displayErrorDialog(null, new FileNotFoundException
+                                (PolicyTool.getMessage("null.filename")));
+                    } else {
+                        tw.displayErrorDialog(null, fnfe);
+                    }
+                } catch (Exception ee) {
+                    tw.displayErrorDialog(null, ee);
+                }
+            }
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                               ToolWindow.SAVE_AS_POLICY_FILE) == 0) {
+
+            // user wants to SAVE AS
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Save.As"), tool, tw, true);
+            td.displaySaveAsDialog(ToolDialog.NOACTION);
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                     ToolWindow.VIEW_WARNINGS) == 0) {
+            tw.displayWarningLog(null);
+        }
+    }
+}
+
+/**
+ * Event handler for the main window buttons and Edit Menu
+ */
+class MainWindowListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+
+    MainWindowListener(PolicyTool tool, ToolWindow tw) {
+        this.tool = tool;
+        this.tw = tw;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        if (PolicyTool.collator.compare(e.getActionCommand(),
+                           ToolWindow.ADD_POLICY_ENTRY) == 0) {
+
+            // display a dialog box for the user to enter policy info
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
+            td.displayPolicyEntryDialog(false);
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                               ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
+
+            // get the selected entry
+            @SuppressWarnings("unchecked")
+            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            int index = list.getSelectedIndex();
+            if (index < 0) {
+                tw.displayErrorDialog(null, new Exception
+                        (PolicyTool.getMessage("No.Policy.Entry.selected")));
+                return;
+            }
+
+            // ask the user if they really want to remove the policy entry
+            ToolDialog td = new ToolDialog(PolicyTool.getMessage
+                ("Remove.Policy.Entry"), tool, tw, true);
+            td.displayConfirmRemovePolicyEntry();
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                 ToolWindow.EDIT_POLICY_ENTRY) == 0) {
+
+            // get the selected entry
+            @SuppressWarnings("unchecked")
+            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            int index = list.getSelectedIndex();
+            if (index < 0) {
+                tw.displayErrorDialog(null, new Exception
+                        (PolicyTool.getMessage("No.Policy.Entry.selected")));
+                return;
+            }
+
+            // display the permission list for a policy entry
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
+            td.displayPolicyEntryDialog(true);
+
+        } else if (PolicyTool.collator.compare(e.getActionCommand(),
+                                     ToolWindow.EDIT_KEYSTORE) == 0) {
+
+            // display a dialog box for the user to enter keystore info
+            ToolDialog td = new ToolDialog
+                (PolicyTool.getMessage("KeyStore"), tool, tw, true);
+            td.keyStoreDialog(ToolDialog.EDIT_KEYSTORE);
+        }
+    }
+}
+
+/**
+ * Event handler for AddEntryDoneButton button
+ *
+ * -- if edit is TRUE, then we are EDITing an existing PolicyEntry
+ *    and we need to update both the policy and the GUI listing.
+ *    if edit is FALSE, then we are ADDing a new PolicyEntry,
+ *    so we only need to update the GUI listing.
+ */
+class AddEntryDoneButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean edit;
+
+    AddEntryDoneButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean edit) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.edit = edit;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        try {
+            // get a PolicyEntry object from the dialog policy info
+            PolicyEntry newEntry = td.getPolicyEntryFromDialog();
+            PolicyParser.GrantEntry newGe = newEntry.getGrantEntry();
+
+            // see if all the signers have public keys
+            if (newGe.signedBy != null) {
+                String signers[] = tool.parseSigners(newGe.signedBy);
+                for (int i = 0; i < signers.length; i++) {
+                    PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
+                    if (pubKey == null) {
+                        MessageFormat form = new MessageFormat
+                            (PolicyTool.getMessage
+                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
+                        Object[] source = {signers[i]};
+                        tool.warnings.addElement(form.format(source));
+                        tw.displayStatusDialog(td, form.format(source));
+                    }
+                }
+            }
+
+            // add the entry
+            @SuppressWarnings("unchecked")
+            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+            if (edit) {
+                int listIndex = policyList.getSelectedIndex();
+                tool.addEntry(newEntry, listIndex);
+                String newCodeBaseStr = newEntry.headerToString();
+                if (PolicyTool.collator.compare
+                        (newCodeBaseStr, policyList.getModel().getElementAt(listIndex)) != 0)
+                    tool.modified = true;
+                ((DefaultListModel<String>)policyList.getModel()).set(listIndex, newCodeBaseStr);
+            } else {
+                tool.addEntry(newEntry, -1);
+                ((DefaultListModel<String>)policyList.getModel()).addElement(newEntry.headerToString());
+                tool.modified = true;
+            }
+            td.setVisible(false);
+            td.dispose();
+
+        } catch (Exception eee) {
+            tw.displayErrorDialog(td, eee);
+        }
+    }
+}
+
+/**
+ * Event handler for ChangeKeyStoreOKButton button
+ */
+class ChangeKeyStoreOKButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+
+    ChangeKeyStoreOKButtonListener(PolicyTool tool, ToolWindow tw,
+                ToolDialog td) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        String URLString = ((JTextField)td.getComponent(
+                ToolDialog.KSD_NAME_TEXTFIELD)).getText().trim();
+        String type = ((JTextField)td.getComponent(
+                ToolDialog.KSD_TYPE_TEXTFIELD)).getText().trim();
+        String provider = ((JTextField)td.getComponent(
+                ToolDialog.KSD_PROVIDER_TEXTFIELD)).getText().trim();
+        String pwdURL = ((JTextField)td.getComponent(
+                ToolDialog.KSD_PWD_URL_TEXTFIELD)).getText().trim();
+
+        try {
+            tool.openKeyStore
+                        ((URLString.length() == 0 ? null : URLString),
+                        (type.length() == 0 ? null : type),
+                        (provider.length() == 0 ? null : provider),
+                        (pwdURL.length() == 0 ? null : pwdURL));
+            tool.modified = true;
+        } catch (Exception ex) {
+            MessageFormat form = new MessageFormat(PolicyTool.getMessage
+                ("Unable.to.open.KeyStore.ex.toString."));
+            Object[] source = {ex.toString()};
+            tw.displayErrorDialog(td, form.format(source));
+            return;
+        }
+
+        td.dispose();
+    }
+}
+
+/**
+ * Event handler for AddPrinButton button
+ */
+class AddPrinButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean editPolicyEntry;
+
+    AddPrinButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean editPolicyEntry) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.editPolicyEntry = editPolicyEntry;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // display a dialog box for the user to enter principal info
+        td.displayPrincipalDialog(editPolicyEntry, false);
+    }
+}
+
+/**
+ * Event handler for AddPermButton button
+ */
+class AddPermButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean editPolicyEntry;
+
+    AddPermButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean editPolicyEntry) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.editPolicyEntry = editPolicyEntry;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // display a dialog box for the user to enter permission info
+        td.displayPermissionDialog(editPolicyEntry, false);
+    }
+}
+
+/**
+ * Event handler for AddPrinOKButton button
+ */
+class NewPolicyPrinOKButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog listDialog;
+    private ToolDialog infoDialog;
+    private boolean edit;
+
+    NewPolicyPrinOKButtonListener(PolicyTool tool,
+                                ToolWindow tw,
+                                ToolDialog listDialog,
+                                ToolDialog infoDialog,
+                                boolean edit) {
+        this.tool = tool;
+        this.tw = tw;
+        this.listDialog = listDialog;
+        this.infoDialog = infoDialog;
+        this.edit = edit;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        try {
+            // read in the new principal info from Dialog Box
+            PolicyParser.PrincipalEntry pppe =
+                        infoDialog.getPrinFromDialog();
+            if (pppe != null) {
+                try {
+                    tool.verifyPrincipal(pppe.getPrincipalClass(),
+                                        pppe.getPrincipalName());
+                } catch (ClassNotFoundException cnfe) {
+                    MessageFormat form = new MessageFormat
+                                (PolicyTool.getMessage
+                                ("Warning.Class.not.found.class"));
+                    Object[] source = {pppe.getPrincipalClass()};
+                    tool.warnings.addElement(form.format(source));
+                    tw.displayStatusDialog(infoDialog, form.format(source));
+                }
+
+                // add the principal to the GUI principal list
+                TaggedList prinList =
+                    (TaggedList)listDialog.getComponent(ToolDialog.PE_PRIN_LIST);
+
+                String prinString = ToolDialog.PrincipalEntryToUserFriendlyString(pppe);
+                if (edit) {
+                    // if editing, replace the original principal
+                    int index = prinList.getSelectedIndex();
+                    prinList.replaceTaggedItem(prinString, pppe, index);
+                } else {
+                    // if adding, just add it to the end
+                    prinList.addTaggedItem(prinString, pppe);
+                }
+            }
+            infoDialog.dispose();
+        } catch (Exception ee) {
+            tw.displayErrorDialog(infoDialog, ee);
+        }
+    }
+}
+
+/**
+ * Event handler for AddPermOKButton button
+ */
+class NewPolicyPermOKButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog listDialog;
+    private ToolDialog infoDialog;
+    private boolean edit;
+
+    NewPolicyPermOKButtonListener(PolicyTool tool,
+                                ToolWindow tw,
+                                ToolDialog listDialog,
+                                ToolDialog infoDialog,
+                                boolean edit) {
+        this.tool = tool;
+        this.tw = tw;
+        this.listDialog = listDialog;
+        this.infoDialog = infoDialog;
+        this.edit = edit;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        try {
+            // read in the new permission info from Dialog Box
+            PolicyParser.PermissionEntry pppe =
+                        infoDialog.getPermFromDialog();
+
+            try {
+                tool.verifyPermission(pppe.permission, pppe.name, pppe.action);
+            } catch (ClassNotFoundException cnfe) {
+                MessageFormat form = new MessageFormat(PolicyTool.getMessage
+                                ("Warning.Class.not.found.class"));
+                Object[] source = {pppe.permission};
+                tool.warnings.addElement(form.format(source));
+                tw.displayStatusDialog(infoDialog, form.format(source));
+            }
+
+            // add the permission to the GUI permission list
+            TaggedList permList =
+                (TaggedList)listDialog.getComponent(ToolDialog.PE_PERM_LIST);
+
+            String permString = ToolDialog.PermissionEntryToUserFriendlyString(pppe);
+            if (edit) {
+                // if editing, replace the original permission
+                int which = permList.getSelectedIndex();
+                permList.replaceTaggedItem(permString, pppe, which);
+            } else {
+                // if adding, just add it to the end
+                permList.addTaggedItem(permString, pppe);
+            }
+            infoDialog.dispose();
+
+        } catch (InvocationTargetException ite) {
+            tw.displayErrorDialog(infoDialog, ite.getTargetException());
+        } catch (Exception ee) {
+            tw.displayErrorDialog(infoDialog, ee);
+        }
+    }
+}
+
+/**
+ * Event handler for RemovePrinButton button
+ */
+class RemovePrinButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean edit;
+
+    RemovePrinButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean edit) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.edit = edit;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // get the Principal selected from the Principal List
+        TaggedList prinList = (TaggedList)td.getComponent(
+                ToolDialog.PE_PRIN_LIST);
+        int prinIndex = prinList.getSelectedIndex();
+
+        if (prinIndex < 0) {
+            tw.displayErrorDialog(td, new Exception
+                (PolicyTool.getMessage("No.principal.selected")));
+            return;
+        }
+        // remove the principal from the display
+        prinList.removeTaggedItem(prinIndex);
+    }
+}
+
+/**
+ * Event handler for RemovePermButton button
+ */
+class RemovePermButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean edit;
+
+    RemovePermButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean edit) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.edit = edit;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // get the Permission selected from the Permission List
+        TaggedList permList = (TaggedList)td.getComponent(
+                ToolDialog.PE_PERM_LIST);
+        int permIndex = permList.getSelectedIndex();
+
+        if (permIndex < 0) {
+            tw.displayErrorDialog(td, new Exception
+                (PolicyTool.getMessage("No.permission.selected")));
+            return;
+        }
+        // remove the permission from the display
+        permList.removeTaggedItem(permIndex);
+
+    }
+}
+
+/**
+ * Event handler for Edit Principal button
+ *
+ * We need the editPolicyEntry boolean to tell us if the user is
+ * adding a new PolicyEntry at this time, or editing an existing entry.
+ * If the user is adding a new PolicyEntry, we ONLY update the
+ * GUI listing.  If the user is editing an existing PolicyEntry, we
+ * update both the GUI listing and the actual PolicyEntry.
+ */
+class EditPrinButtonListener extends MouseAdapter implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean editPolicyEntry;
+
+    EditPrinButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean editPolicyEntry) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.editPolicyEntry = editPolicyEntry;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // get the Principal selected from the Principal List
+        TaggedList list = (TaggedList)td.getComponent(
+                ToolDialog.PE_PRIN_LIST);
+        int prinIndex = list.getSelectedIndex();
+
+        if (prinIndex < 0) {
+            tw.displayErrorDialog(td, new Exception
+                (PolicyTool.getMessage("No.principal.selected")));
+            return;
+        }
+        td.displayPrincipalDialog(editPolicyEntry, true);
+    }
+
+    public void mouseClicked(MouseEvent evt) {
+        if (evt.getClickCount() == 2) {
+            actionPerformed(null);
+        }
+    }
+}
+
+/**
+ * Event handler for Edit Permission button
+ *
+ * We need the editPolicyEntry boolean to tell us if the user is
+ * adding a new PolicyEntry at this time, or editing an existing entry.
+ * If the user is adding a new PolicyEntry, we ONLY update the
+ * GUI listing.  If the user is editing an existing PolicyEntry, we
+ * update both the GUI listing and the actual PolicyEntry.
+ */
+class EditPermButtonListener extends MouseAdapter implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog td;
+    private boolean editPolicyEntry;
+
+    EditPermButtonListener(PolicyTool tool, ToolWindow tw,
+                                ToolDialog td, boolean editPolicyEntry) {
+        this.tool = tool;
+        this.tw = tw;
+        this.td = td;
+        this.editPolicyEntry = editPolicyEntry;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // get the Permission selected from the Permission List
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)td.getComponent(ToolDialog.PE_PERM_LIST);
+        int permIndex = list.getSelectedIndex();
+
+        if (permIndex < 0) {
+            tw.displayErrorDialog(td, new Exception
+                (PolicyTool.getMessage("No.permission.selected")));
+            return;
+        }
+        td.displayPermissionDialog(editPolicyEntry, true);
+    }
+
+    public void mouseClicked(MouseEvent evt) {
+        if (evt.getClickCount() == 2) {
+            actionPerformed(null);
+        }
+    }
+}
+
+/**
+ * Event handler for Principal Popup Menu
+ */
+class PrincipalTypeMenuListener implements ItemListener {
+
+    private ToolDialog td;
+
+    PrincipalTypeMenuListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        if (e.getStateChange() == ItemEvent.DESELECTED) {
+            // We're only interested in SELECTED events
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        JComboBox<String> prin = (JComboBox<String>)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
+        JTextField prinField = (JTextField)td.getComponent(
+                ToolDialog.PRD_PRIN_TEXTFIELD);
+        JTextField nameField = (JTextField)td.getComponent(
+                ToolDialog.PRD_NAME_TEXTFIELD);
+
+        prin.getAccessibleContext().setAccessibleName(
+            PolicyTool.splitToWords((String)e.getItem()));
+        if (((String)e.getItem()).equals(ToolDialog.PRIN_TYPE)) {
+            // ignore if they choose "Principal Type:" item
+            if (prinField.getText() != null &&
+                prinField.getText().length() > 0) {
+                Prin inputPrin = ToolDialog.getPrin(prinField.getText(), true);
+                prin.setSelectedItem(inputPrin.CLASS);
+            }
+            return;
+        }
+
+        // if you change the principal, clear the name
+        if (prinField.getText().indexOf((String)e.getItem()) == -1) {
+            nameField.setText("");
+        }
+
+        // set the text in the textfield and also modify the
+        // pull-down choice menus to reflect the correct possible
+        // set of names and actions
+        Prin inputPrin = ToolDialog.getPrin((String)e.getItem(), false);
+        if (inputPrin != null) {
+            prinField.setText(inputPrin.FULL_CLASS);
+        }
+    }
+}
+
+/**
+ * Event handler for Permission Popup Menu
+ */
+class PermissionMenuListener implements ItemListener {
+
+    private ToolDialog td;
+
+    PermissionMenuListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        if (e.getStateChange() == ItemEvent.DESELECTED) {
+            // We're only interested in SELECTED events
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        JComboBox<String> perms = (JComboBox<String>)td.getComponent(
+                ToolDialog.PD_PERM_CHOICE);
+        @SuppressWarnings("unchecked")
+        JComboBox<String> names = (JComboBox<String>)td.getComponent(
+                ToolDialog.PD_NAME_CHOICE);
+        @SuppressWarnings("unchecked")
+        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
+                ToolDialog.PD_ACTIONS_CHOICE);
+        JTextField nameField = (JTextField)td.getComponent(
+                ToolDialog.PD_NAME_TEXTFIELD);
+        JTextField actionsField = (JTextField)td.getComponent(
+                ToolDialog.PD_ACTIONS_TEXTFIELD);
+        JTextField permField = (JTextField)td.getComponent(
+                ToolDialog.PD_PERM_TEXTFIELD);
+        JTextField signedbyField = (JTextField)td.getComponent(
+                ToolDialog.PD_SIGNEDBY_TEXTFIELD);
+
+        perms.getAccessibleContext().setAccessibleName(
+            PolicyTool.splitToWords((String)e.getItem()));
+
+        // ignore if they choose the 'Permission:' item
+        if (PolicyTool.collator.compare((String)e.getItem(),
+                                      ToolDialog.PERM) == 0) {
+            if (permField.getText() != null &&
+                permField.getText().length() > 0) {
+
+                Perm inputPerm = ToolDialog.getPerm(permField.getText(), true);
+                if (inputPerm != null) {
+                    perms.setSelectedItem(inputPerm.CLASS);
+                }
+            }
+            return;
+        }
+
+        // if you change the permission, clear the name, actions, and signedBy
+        if (permField.getText().indexOf((String)e.getItem()) == -1) {
+            nameField.setText("");
+            actionsField.setText("");
+            signedbyField.setText("");
+        }
+
+        // set the text in the textfield and also modify the
+        // pull-down choice menus to reflect the correct possible
+        // set of names and actions
+
+        Perm inputPerm = ToolDialog.getPerm((String)e.getItem(), false);
+        if (inputPerm == null) {
+            permField.setText("");
+        } else {
+            permField.setText(inputPerm.FULL_CLASS);
+        }
+        td.setPermissionNames(inputPerm, names, nameField);
+        td.setPermissionActions(inputPerm, actions, actionsField);
+    }
+}
+
+/**
+ * Event handler for Permission Name Popup Menu
+ */
+class PermissionNameMenuListener implements ItemListener {
+
+    private ToolDialog td;
+
+    PermissionNameMenuListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        if (e.getStateChange() == ItemEvent.DESELECTED) {
+            // We're only interested in SELECTED events
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        JComboBox<String> names = (JComboBox<String>)td.getComponent(ToolDialog.PD_NAME_CHOICE);
+        names.getAccessibleContext().setAccessibleName(
+            PolicyTool.splitToWords((String)e.getItem()));
+
+        if (((String)e.getItem()).indexOf(ToolDialog.PERM_NAME) != -1)
+            return;
+
+        JTextField tf = (JTextField)td.getComponent(ToolDialog.PD_NAME_TEXTFIELD);
+        tf.setText((String)e.getItem());
+    }
+}
+
+/**
+ * Event handler for Permission Actions Popup Menu
+ */
+class PermissionActionsMenuListener implements ItemListener {
+
+    private ToolDialog td;
+
+    PermissionActionsMenuListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void itemStateChanged(ItemEvent e) {
+        if (e.getStateChange() == ItemEvent.DESELECTED) {
+            // We're only interested in SELECTED events
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
+                ToolDialog.PD_ACTIONS_CHOICE);
+        actions.getAccessibleContext().setAccessibleName((String)e.getItem());
+
+        if (((String)e.getItem()).indexOf(ToolDialog.PERM_ACTIONS) != -1)
+            return;
+
+        JTextField tf = (JTextField)td.getComponent(
+                ToolDialog.PD_ACTIONS_TEXTFIELD);
+        if (tf.getText() == null || tf.getText().equals("")) {
+            tf.setText((String)e.getItem());
+        } else {
+            if (tf.getText().indexOf((String)e.getItem()) == -1)
+                tf.setText(tf.getText() + ", " + (String)e.getItem());
+        }
+    }
+}
+
+/**
+ * Event handler for all the children dialogs/windows
+ */
+class ChildWindowListener implements WindowListener {
+
+    private ToolDialog td;
+
+    ChildWindowListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void windowOpened(WindowEvent we) {
+    }
+
+    public void windowClosing(WindowEvent we) {
+        // same as pressing the "cancel" button
+        td.setVisible(false);
+        td.dispose();
+    }
+
+    public void windowClosed(WindowEvent we) {
+    }
+
+    public void windowIconified(WindowEvent we) {
+    }
+
+    public void windowDeiconified(WindowEvent we) {
+    }
+
+    public void windowActivated(WindowEvent we) {
+    }
+
+    public void windowDeactivated(WindowEvent we) {
+    }
+}
+
+/**
+ * Event handler for CancelButton button
+ */
+class CancelButtonListener implements ActionListener {
+
+    private ToolDialog td;
+
+    CancelButtonListener(ToolDialog td) {
+        this.td = td;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        td.setVisible(false);
+        td.dispose();
+    }
+}
+
+/**
+ * Event handler for ErrorOKButton button
+ */
+class ErrorOKButtonListener implements ActionListener {
+
+    private ToolDialog ed;
+
+    ErrorOKButtonListener(ToolDialog ed) {
+        this.ed = ed;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        ed.setVisible(false);
+        ed.dispose();
+    }
+}
+
+/**
+ * Event handler for StatusOKButton button
+ */
+class StatusOKButtonListener implements ActionListener {
+
+    private ToolDialog sd;
+
+    StatusOKButtonListener(ToolDialog sd) {
+        this.sd = sd;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        sd.setVisible(false);
+        sd.dispose();
+    }
+}
+
+/**
+ * Event handler for UserSaveYes button
+ */
+class UserSaveYesButtonListener implements ActionListener {
+
+    private ToolDialog us;
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private int select;
+
+    UserSaveYesButtonListener(ToolDialog us, PolicyTool tool,
+                        ToolWindow tw, int select) {
+        this.us = us;
+        this.tool = tool;
+        this.tw = tw;
+        this.select = select;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        // first get rid of the window
+        us.setVisible(false);
+        us.dispose();
+
+        try {
+            String filename = ((JTextField)tw.getComponent(
+                    ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
+            if (filename == null || filename.equals("")) {
+                us.displaySaveAsDialog(select);
+
+                // the above dialog will continue with the originally
+                // requested command if necessary
+            } else {
+                // save the policy entries to a file
+                tool.savePolicy(filename);
+
+                // display status
+                MessageFormat form = new MessageFormat
+                        (PolicyTool.getMessage
+                        ("Policy.successfully.written.to.filename"));
+                Object[] source = {filename};
+                tw.displayStatusDialog(null, form.format(source));
+
+                // now continue with the originally requested command
+                // (QUIT, NEW, or OPEN)
+                us.userSaveContinue(tool, tw, us, select);
+            }
+        } catch (Exception ee) {
+            // error -- just report it and bail
+            tw.displayErrorDialog(null, ee);
+        }
+    }
+}
+
+/**
+ * Event handler for UserSaveNoButton
+ */
+class UserSaveNoButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog us;
+    private int select;
+
+    UserSaveNoButtonListener(ToolDialog us, PolicyTool tool,
+                        ToolWindow tw, int select) {
+        this.us = us;
+        this.tool = tool;
+        this.tw = tw;
+        this.select = select;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        us.setVisible(false);
+        us.dispose();
+
+        // now continue with the originally requested command
+        // (QUIT, NEW, or OPEN)
+        us.userSaveContinue(tool, tw, us, select);
+    }
+}
+
+/**
+ * Event handler for UserSaveCancelButton
+ */
+class UserSaveCancelButtonListener implements ActionListener {
+
+    private ToolDialog us;
+
+    UserSaveCancelButtonListener(ToolDialog us) {
+        this.us = us;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        us.setVisible(false);
+        us.dispose();
+
+        // do NOT continue with the originally requested command
+        // (QUIT, NEW, or OPEN)
+    }
+}
+
+/**
+ * Event handler for ConfirmRemovePolicyEntryOKButtonListener
+ */
+class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener {
+
+    private PolicyTool tool;
+    private ToolWindow tw;
+    private ToolDialog us;
+
+    ConfirmRemovePolicyEntryOKButtonListener(PolicyTool tool,
+                                ToolWindow tw, ToolDialog us) {
+        this.tool = tool;
+        this.tw = tw;
+        this.us = us;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        // remove the entry
+        @SuppressWarnings("unchecked")
+        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
+        int index = list.getSelectedIndex();
+        PolicyEntry entries[] = tool.getEntry();
+        tool.removeEntry(entries[index]);
+
+        // redraw the window listing
+        DefaultListModel<String> listModel = new DefaultListModel<>();
+        list = new JList<>(listModel);
+        list.setVisibleRowCount(15);
+        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        list.addMouseListener(new PolicyListListener(tool, tw));
+        entries = tool.getEntry();
+        if (entries != null) {
+                for (int i = 0; i < entries.length; i++) {
+                    listModel.addElement(entries[i].headerToString());
+                }
+        }
+        tw.replacePolicyList(list);
+        us.setVisible(false);
+        us.dispose();
+    }
+}
+
+/**
+ * Just a special name, so that the codes dealing with this exception knows
+ * it's special, and does not pop out a warning box.
+ */
+class NoDisplayException extends RuntimeException {
+    private static final long serialVersionUID = -4611761427108719794L;
+}
+
+/**
+ * This is a java.awt.List that bind an Object to each String it holds.
+ */
+class TaggedList extends JList<String> {
+    private static final long serialVersionUID = -5676238110427785853L;
+
+    private java.util.List<Object> data = new LinkedList<>();
+    public TaggedList(int i, boolean b) {
+        super(new DefaultListModel<>());
+        setVisibleRowCount(i);
+        setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
+    }
+
+    public Object getObject(int index) {
+        return data.get(index);
+    }
+
+    public void addTaggedItem(String string, Object object) {
+        ((DefaultListModel<String>)getModel()).addElement(string);
+        data.add(object);
+    }
+
+    public void replaceTaggedItem(String string, Object object, int index) {
+        ((DefaultListModel<String>)getModel()).set(index, string);
+        data.set(index, object);
+    }
+
+    public void removeTaggedItem(int index) {
+        ((DefaultListModel<String>)getModel()).remove(index);
+        data.remove(index);
+    }
+}
+
+/**
+ * Convenience Principal Classes
+ */
+
+class Prin {
+    public final String CLASS;
+    public final String FULL_CLASS;
+
+    public Prin(String clazz, String fullClass) {
+        this.CLASS = clazz;
+        this.FULL_CLASS = fullClass;
+    }
+}
+
+class KrbPrin extends Prin {
+    public KrbPrin() {
+        super("KerberosPrincipal",
+                "javax.security.auth.kerberos.KerberosPrincipal");
+    }
+}
+
+class X500Prin extends Prin {
+    public X500Prin() {
+        super("X500Principal",
+                "javax.security.auth.x500.X500Principal");
+    }
+}
+
+/**
+ * Convenience Permission Classes
+ */
+
+class Perm {
+    public final String CLASS;
+    public final String FULL_CLASS;
+    public final String[] TARGETS;
+    public final String[] ACTIONS;
+
+    public Perm(String clazz, String fullClass,
+                String[] targets, String[] actions) {
+
+        this.CLASS = clazz;
+        this.FULL_CLASS = fullClass;
+        this.TARGETS = targets;
+        this.ACTIONS = actions;
+    }
+}
+
+class AllPerm extends Perm {
+    public AllPerm() {
+        super("AllPermission", "java.security.AllPermission", null, null);
+    }
+}
+
+class AudioPerm extends Perm {
+    public AudioPerm() {
+        super("AudioPermission",
+        "javax.sound.sampled.AudioPermission",
+        new String[]    {
+                "play",
+                "record"
+                },
+        null);
+    }
+}
+
+class AuthPerm extends Perm {
+    public AuthPerm() {
+    super("AuthPermission",
+        "javax.security.auth.AuthPermission",
+        new String[]    {
+                "doAs",
+                "doAsPrivileged",
+                "getSubject",
+                "getSubjectFromDomainCombiner",
+                "setReadOnly",
+                "modifyPrincipals",
+                "modifyPublicCredentials",
+                "modifyPrivateCredentials",
+                "refreshCredential",
+                "destroyCredential",
+                "createLoginContext.<" + PolicyTool.getMessage("name") + ">",
+                "getLoginConfiguration",
+                "setLoginConfiguration",
+                "createLoginConfiguration.<" +
+                        PolicyTool.getMessage("configuration.type") + ">",
+                "refreshLoginConfiguration"
+                },
+        null);
+    }
+}
+
+class AWTPerm extends Perm {
+    public AWTPerm() {
+    super("AWTPermission",
+        "java.awt.AWTPermission",
+        new String[]    {
+                "accessClipboard",
+                "accessEventQueue",
+                "accessSystemTray",
+                "createRobot",
+                "fullScreenExclusive",
+                "listenToAllAWTEvents",
+                "readDisplayPixels",
+                "replaceKeyboardFocusManager",
+                "setAppletStub",
+                "setWindowAlwaysOnTop",
+                "showWindowWithoutWarningBanner",
+                "toolkitModality",
+                "watchMousePointer"
+        },
+        null);
+    }
+}
+
+class DelegationPerm extends Perm {
+    public DelegationPerm() {
+    super("DelegationPermission",
+        "javax.security.auth.kerberos.DelegationPermission",
+        new String[]    {
+                // allow user input
+                },
+        null);
+    }
+}
+
+class FilePerm extends Perm {
+    public FilePerm() {
+    super("FilePermission",
+        "java.io.FilePermission",
+        new String[]    {
+                "<<ALL FILES>>"
+                },
+        new String[]    {
+                "read",
+                "write",
+                "delete",
+                "execute"
+                });
+    }
+}
+
+class URLPerm extends Perm {
+    public URLPerm() {
+        super("URLPermission",
+                "java.net.URLPermission",
+                new String[]    {
+                    "<"+ PolicyTool.getMessage("url") + ">",
+                },
+                new String[]    {
+                    "<" + PolicyTool.getMessage("method.list") + ">:<"
+                        + PolicyTool.getMessage("request.headers.list") + ">",
+                });
+    }
+}
+
+class InqSecContextPerm extends Perm {
+    public InqSecContextPerm() {
+    super("InquireSecContextPermission",
+        "com.sun.security.jgss.InquireSecContextPermission",
+        new String[]    {
+                "KRB5_GET_SESSION_KEY",
+                "KRB5_GET_TKT_FLAGS",
+                "KRB5_GET_AUTHZ_DATA",
+                "KRB5_GET_AUTHTIME"
+                },
+        null);
+    }
+}
+
+class LogPerm extends Perm {
+    public LogPerm() {
+    super("LoggingPermission",
+        "java.util.logging.LoggingPermission",
+        new String[]    {
+                "control"
+                },
+        null);
+    }
+}
+
+class MgmtPerm extends Perm {
+    public MgmtPerm() {
+    super("ManagementPermission",
+        "java.lang.management.ManagementPermission",
+        new String[]    {
+                "control",
+                "monitor"
+                },
+        null);
+    }
+}
+
+class MBeanPerm extends Perm {
+    public MBeanPerm() {
+    super("MBeanPermission",
+        "javax.management.MBeanPermission",
+        new String[]    {
+                // allow user input
+                },
+        new String[]    {
+                "addNotificationListener",
+                "getAttribute",
+                "getClassLoader",
+                "getClassLoaderFor",
+                "getClassLoaderRepository",
+                "getDomains",
+                "getMBeanInfo",
+                "getObjectInstance",
+                "instantiate",
+                "invoke",
+                "isInstanceOf",
+                "queryMBeans",
+                "queryNames",
+                "registerMBean",
+                "removeNotificationListener",
+                "setAttribute",
+                "unregisterMBean"
+                });
+    }
+}
+
+class MBeanSvrPerm extends Perm {
+    public MBeanSvrPerm() {
+    super("MBeanServerPermission",
+        "javax.management.MBeanServerPermission",
+        new String[]    {
+                "createMBeanServer",
+                "findMBeanServer",
+                "newMBeanServer",
+                "releaseMBeanServer"
+                },
+        null);
+    }
+}
+
+class MBeanTrustPerm extends Perm {
+    public MBeanTrustPerm() {
+    super("MBeanTrustPermission",
+        "javax.management.MBeanTrustPermission",
+        new String[]    {
+                "register"
+                },
+        null);
+    }
+}
+
+class NetPerm extends Perm {
+    public NetPerm() {
+    super("NetPermission",
+        "java.net.NetPermission",
+        new String[]    {
+                "allowHttpTrace",
+                "setDefaultAuthenticator",
+                "requestPasswordAuthentication",
+                "specifyStreamHandler",
+                "getNetworkInformation",
+                "setProxySelector",
+                "getProxySelector",
+                "setCookieHandler",
+                "getCookieHandler",
+                "setResponseCache",
+                "getResponseCache"
+                },
+        null);
+    }
+}
+
+class NetworkPerm extends Perm {
+    public NetworkPerm() {
+    super("NetworkPermission",
+        "jdk.net.NetworkPermission",
+        new String[]    {
+                "setOption.SO_FLOW_SLA",
+                "getOption.SO_FLOW_SLA"
+                },
+        null);
+    }
+}
+
+class PrivCredPerm extends Perm {
+    public PrivCredPerm() {
+    super("PrivateCredentialPermission",
+        "javax.security.auth.PrivateCredentialPermission",
+        new String[]    {
+                // allow user input
+                },
+        new String[]    {
+                "read"
+                });
+    }
+}
+
+class PropPerm extends Perm {
+    public PropPerm() {
+    super("PropertyPermission",
+        "java.util.PropertyPermission",
+        new String[]    {
+                // allow user input
+                },
+        new String[]    {
+                "read",
+                "write"
+                });
+    }
+}
+
+class ReflectPerm extends Perm {
+    public ReflectPerm() {
+    super("ReflectPermission",
+        "java.lang.reflect.ReflectPermission",
+        new String[]    {
+                "suppressAccessChecks"
+                },
+        null);
+    }
+}
+
+class RuntimePerm extends Perm {
+    public RuntimePerm() {
+    super("RuntimePermission",
+        "java.lang.RuntimePermission",
+        new String[]    {
+                "createClassLoader",
+                "getClassLoader",
+                "setContextClassLoader",
+                "enableContextClassLoaderOverride",
+                "setSecurityManager",
+                "createSecurityManager",
+                "getenv.<" +
+                    PolicyTool.getMessage("environment.variable.name") + ">",
+                "exitVM",
+                "shutdownHooks",
+                "setFactory",
+                "setIO",
+                "modifyThread",
+                "stopThread",
+                "modifyThreadGroup",
+                "getProtectionDomain",
+                "readFileDescriptor",
+                "writeFileDescriptor",
+                "loadLibrary.<" +
+                    PolicyTool.getMessage("library.name") + ">",
+                "accessClassInPackage.<" +
+                    PolicyTool.getMessage("package.name")+">",
+                "defineClassInPackage.<" +
+                    PolicyTool.getMessage("package.name")+">",
+                "accessDeclaredMembers",
+                "queuePrintJob",
+                "getStackTrace",
+                "setDefaultUncaughtExceptionHandler",
+                "preferences",
+                "usePolicy",
+                // "inheritedChannel"
+                },
+        null);
+    }
+}
+
+class SecurityPerm extends Perm {
+    public SecurityPerm() {
+    super("SecurityPermission",
+        "java.security.SecurityPermission",
+        new String[]    {
+                "createAccessControlContext",
+                "getDomainCombiner",
+                "getPolicy",
+                "setPolicy",
+                "createPolicy.<" +
+                    PolicyTool.getMessage("policy.type") + ">",
+                "getProperty.<" +
+                    PolicyTool.getMessage("property.name") + ">",
+                "setProperty.<" +
+                    PolicyTool.getMessage("property.name") + ">",
+                "insertProvider.<" +
+                    PolicyTool.getMessage("provider.name") + ">",
+                "removeProvider.<" +
+                    PolicyTool.getMessage("provider.name") + ">",
+                //"setSystemScope",
+                //"setIdentityPublicKey",
+                //"setIdentityInfo",
+                //"addIdentityCertificate",
+                //"removeIdentityCertificate",
+                //"printIdentity",
+                "clearProviderProperties.<" +
+                    PolicyTool.getMessage("provider.name") + ">",
+                "putProviderProperty.<" +
+                    PolicyTool.getMessage("provider.name") + ">",
+                "removeProviderProperty.<" +
+                    PolicyTool.getMessage("provider.name") + ">",
+                //"getSignerPrivateKey",
+                //"setSignerKeyPair"
+                },
+        null);
+    }
+}
+
+class SerialPerm extends Perm {
+    public SerialPerm() {
+    super("SerializablePermission",
+        "java.io.SerializablePermission",
+        new String[]    {
+                "enableSubclassImplementation",
+                "enableSubstitution"
+                },
+        null);
+    }
+}
+
+class ServicePerm extends Perm {
+    public ServicePerm() {
+    super("ServicePermission",
+        "javax.security.auth.kerberos.ServicePermission",
+        new String[]    {
+                // allow user input
+                },
+        new String[]    {
+                "initiate",
+                "accept"
+                });
+    }
+}
+
+class SocketPerm extends Perm {
+    public SocketPerm() {
+    super("SocketPermission",
+        "java.net.SocketPermission",
+        new String[]    {
+                // allow user input
+                },
+        new String[]    {
+                "accept",
+                "connect",
+                "listen",
+                "resolve"
+                });
+    }
+}
+
+class SQLPerm extends Perm {
+    public SQLPerm() {
+    super("SQLPermission",
+        "java.sql.SQLPermission",
+        new String[]    {
+                "setLog",
+                "callAbort",
+                "setSyncFactory",
+                "setNetworkTimeout",
+                },
+        null);
+    }
+}
+
+class SSLPerm extends Perm {
+    public SSLPerm() {
+    super("SSLPermission",
+        "javax.net.ssl.SSLPermission",
+        new String[]    {
+                "setHostnameVerifier",
+                "getSSLSessionContext"
+                },
+        null);
+    }
+}
+
+class SubjDelegPerm extends Perm {
+    public SubjDelegPerm() {
+    super("SubjectDelegationPermission",
+        "javax.management.remote.SubjectDelegationPermission",
+        new String[]    {
+                // allow user input
+                },
+        null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Warning: A public key for alias {0} does not exist.  Make sure a KeyStore is properly configured."},
+        {"Warning.Class.not.found.class", "Warning: Class not found: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Warning: Invalid argument(s) for constructor: {0}"},
+        {"Illegal.Principal.Type.type", "Illegal Principal Type: {0}"},
+        {"Illegal.option.option", "Illegal option: {0}"},
+        {"Usage.policytool.options.", "Usage: policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    policy file location"},
+        {"New", "&New"},
+        {"Open", "&Open..."},
+        {"Save", "&Save"},
+        {"Save.As", "Save &As..."},
+        {"View.Warning.Log", "View &Warning Log"},
+        {"Exit", "E&xit"},
+        {"Add.Policy.Entry", "&Add Policy Entry"},
+        {"Edit.Policy.Entry", "&Edit Policy Entry"},
+        {"Remove.Policy.Entry", "&Remove Policy Entry"},
+        {"Edit", "&Edit"},
+        {"Retain", "Retain"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Warning: File name may include escaped backslash characters. " +
+                        "It is not necessary to escape backslash characters " +
+                        "(the tool escapes characters as necessary when writing " +
+                        "the policy contents to the persistent store).\n\n" +
+                        "Click on Retain to retain the entered name, or click on " +
+                        "Edit to edit the name."},
+
+        {"Add.Public.Key.Alias", "Add Public Key Alias"},
+        {"Remove.Public.Key.Alias", "Remove Public Key Alias"},
+        {"File", "&File"},
+        {"KeyStore", "&KeyStore"},
+        {"Policy.File.", "Policy File:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "Could not open policy file: {0}: {1}"},
+        {"Policy.Tool", "Policy Tool"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Errors have occurred while opening the policy configuration.  View the Warning Log for more information."},
+        {"Error", "Error"},
+        {"OK", "OK"},
+        {"Status", "Status"},
+        {"Warning", "Warning"},
+        {"Permission.",
+                "Permission:                                                       "},
+        {"Principal.Type.", "Principal Type:"},
+        {"Principal.Name.", "Principal Name:"},
+        {"Target.Name.",
+                "Target Name:                                                    "},
+        {"Actions.",
+                "Actions:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "OK to overwrite existing file {0}?"},
+        {"Cancel", "Cancel"},
+        {"CodeBase.", "&CodeBase:"},
+        {"SignedBy.", "&SignedBy:"},
+        {"Add.Principal", "&Add Principal"},
+        {"Edit.Principal", "&Edit Principal"},
+        {"Remove.Principal", "&Remove Principal"},
+        {"Principals.", "&Principals:"},
+        {".Add.Permission", "  A&dd Permission"},
+        {".Edit.Permission", "  Ed&it Permission"},
+        {"Remove.Permission", "Re&move Permission"},
+        {"Done", "Done"},
+        {"KeyStore.URL.", "KeyStore &URL:"},
+        {"KeyStore.Type.", "KeyStore &Type:"},
+        {"KeyStore.Provider.", "KeyStore &Provider:"},
+        {"KeyStore.Password.URL.", "KeyStore Pass&word URL:"},
+        {"Principals", "Principals"},
+        {".Edit.Principal.", "  Edit Principal:"},
+        {".Add.New.Principal.", "  Add New Principal:"},
+        {"Permissions", "Permissions"},
+        {".Edit.Permission.", "  Edit Permission:"},
+        {".Add.New.Permission.", "  Add New Permission:"},
+        {"Signed.By.", "Signed By:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "Cannot Specify Principal with a Wildcard Class without a Wildcard Name"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "Cannot Specify Principal without a Name"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "Permission and Target Name must have a value"},
+        {"Remove.this.Policy.Entry.", "Remove this Policy Entry?"},
+        {"Overwrite.File", "Overwrite File"},
+        {"Policy.successfully.written.to.filename",
+                "Policy successfully written to {0}"},
+        {"null.filename", "null filename"},
+        {"Save.changes.", "Save changes?"},
+        {"Yes", "&Yes"},
+        {"No", "&No"},
+        {"Policy.Entry", "Policy Entry"},
+        {"Save.Changes", "Save Changes"},
+        {"No.Policy.Entry.selected", "No Policy Entry selected"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "Unable to open KeyStore: {0}"},
+        {"No.principal.selected", "No principal selected"},
+        {"No.permission.selected", "No permission selected"},
+        {"name", "name"},
+        {"configuration.type", "configuration type"},
+        {"environment.variable.name", "environment variable name"},
+        {"library.name", "library name"},
+        {"package.name", "package name"},
+        {"policy.type", "policy type"},
+        {"property.name", "property name"},
+        {"provider.name", "provider name"},
+        {"url", "url"},
+        {"method.list", "method list"},
+        {"request.headers.list", "request headers list"},
+        {"Principal.List", "Principal List"},
+        {"Permission.List", "Permission List"},
+        {"Code.Base", "Code Base"},
+        {"KeyStore.U.R.L.", "KeyStore U R L:"},
+        {"KeyStore.Password.U.R.L.", "KeyStore Password U R L:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_de extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Warnung: Kein Public Key f\u00FCr Alias {0} vorhanden. Vergewissern Sie sich, dass der KeyStore ordnungsgem\u00E4\u00DF konfiguriert ist."},
+        {"Warning.Class.not.found.class", "Warnung: Klasse nicht gefunden: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Warnung: Ung\u00FCltige(s) Argument(e) f\u00FCr Constructor: {0}"},
+        {"Illegal.Principal.Type.type", "Ung\u00FCltiger Principal-Typ: {0}"},
+        {"Illegal.option.option", "Ung\u00FCltige Option: {0}"},
+        {"Usage.policytool.options.", "Verwendung: policytool [Optionen]"},
+        {".file.file.policy.file.location",
+                " [-file <Datei>]    Policy-Dateiverzeichnis"},
+        {"New", "Neu"},
+        {"Open", "\u00D6ffnen"},
+        {"Save", "Speichern"},
+        {"Save.As", "Speichern unter"},
+        {"View.Warning.Log", "Warnungslog anzeigen"},
+        {"Exit", "Beenden"},
+        {"Add.Policy.Entry", "Policy-Eintrag hinzuf\u00FCgen"},
+        {"Edit.Policy.Entry", "Policy-Eintrag bearbeiten"},
+        {"Remove.Policy.Entry", "Policy-Eintrag entfernen"},
+        {"Edit", "Bearbeiten"},
+        {"Retain", "Beibehalten"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Warnung: M\u00F6glicherweise enth\u00E4lt der Dateiname Escapezeichen mit Backslash. Es ist nicht notwendig, Backslash-Zeichen zu escapen (das Tool f\u00FChrt dies automatisch beim Schreiben des Policy-Contents in den persistenten Speicher aus).\n\nKlicken Sie auf \"Beibehalten\", um den eingegebenen Namen beizubehalten oder auf \"Bearbeiten\", um den Namen zu bearbeiten."},
+
+        {"Add.Public.Key.Alias", "Public Key-Alias hinzuf\u00FCgen"},
+        {"Remove.Public.Key.Alias", "Public Key-Alias entfernen"},
+        {"File", "Datei"},
+        {"KeyStore", "KeyStore"},
+        {"Policy.File.", "Policy-Datei:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "Policy-Datei konnte nicht ge\u00F6ffnet werden: {0}: {1}"},
+        {"Policy.Tool", "Policy-Tool"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Beim \u00D6ffnen der Policy-Konfiguration sind Fehler aufgetreten. Weitere Informationen finden Sie im Warnungslog."},
+        {"Error", "Fehler"},
+        {"OK", "OK"},
+        {"Status", "Status"},
+        {"Warning", "Warnung"},
+        {"Permission.",
+                "Berechtigung:                                                       "},
+        {"Principal.Type.", "Principal-Typ:"},
+        {"Principal.Name.", "Principal-Name:"},
+        {"Target.Name.",
+                "Zielname:                                                    "},
+        {"Actions.",
+                "Aktionen:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "Vorhandene Datei {0} \u00FCberschreiben?"},
+        {"Cancel", "Abbrechen"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "Principal hinzuf\u00FCgen"},
+        {"Edit.Principal", "Principal bearbeiten"},
+        {"Remove.Principal", "Principal entfernen"},
+        {"Principals.", "Principals:"},
+        {".Add.Permission", "  Berechtigung hinzuf\u00FCgen"},
+        {".Edit.Permission", "  Berechtigung bearbeiten"},
+        {"Remove.Permission", "Berechtigung entfernen"},
+        {"Done", "Fertig"},
+        {"KeyStore.URL.", "KeyStore-URL:"},
+        {"KeyStore.Type.", "KeyStore-Typ:"},
+        {"KeyStore.Provider.", "KeyStore-Provider:"},
+        {"KeyStore.Password.URL.", "KeyStore-Kennwort-URL:"},
+        {"Principals", "Principals"},
+        {".Edit.Principal.", "  Principal bearbeiten:"},
+        {".Add.New.Principal.", "  Neuen Principal hinzuf\u00FCgen:"},
+        {"Permissions", "Berechtigungen"},
+        {".Edit.Permission.", "  Berechtigung bearbeiten:"},
+        {".Add.New.Permission.", "  Neue Berechtigung hinzuf\u00FCgen:"},
+        {"Signed.By.", "Signiert von:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "Principal kann nicht mit einer Platzhalterklasse ohne Platzhalternamen angegeben werden"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "Principal kann nicht ohne einen Namen angegeben werden"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "Berechtigung und Zielname m\u00FCssen einen Wert haben"},
+        {"Remove.this.Policy.Entry.", "Diesen Policy-Eintrag entfernen?"},
+        {"Overwrite.File", "Datei \u00FCberschreiben"},
+        {"Policy.successfully.written.to.filename",
+                "Policy erfolgreich in {0} geschrieben"},
+        {"null.filename", "Null-Dateiname"},
+        {"Save.changes.", "\u00C4nderungen speichern?"},
+        {"Yes", "Ja"},
+        {"No", "Nein"},
+        {"Policy.Entry", "Policy-Eintrag"},
+        {"Save.Changes", "\u00C4nderungen speichern"},
+        {"No.Policy.Entry.selected", "Kein Policy-Eintrag ausgew\u00E4hlt"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "KeyStore kann nicht ge\u00F6ffnet werden: {0}"},
+        {"No.principal.selected", "Kein Principal ausgew\u00E4hlt"},
+        {"No.permission.selected", "Keine Berechtigung ausgew\u00E4hlt"},
+        {"name", "Name"},
+        {"configuration.type", "Konfigurationstyp"},
+        {"environment.variable.name", "Umgebungsvariablenname"},
+        {"library.name", "Library-Name"},
+        {"package.name", "Packagename"},
+        {"policy.type", "Policy-Typ"},
+        {"property.name", "Eigenschaftsname"},
+        {"provider.name", "Providername"},
+        {"url", "URL"},
+        {"method.list", "Methodenliste"},
+        {"request.headers.list", "Headerliste anfordern"},
+        {"Principal.List", "Principal-Liste"},
+        {"Permission.List", "Berechtigungsliste"},
+        {"Code.Base", "Codebase"},
+        {"KeyStore.U.R.L.", "KeyStore-URL:"},
+        {"KeyStore.Password.U.R.L.", "KeyStore-Kennwort-URL:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_es extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Advertencia: no hay clave p\u00FAblica para el alias {0}. Aseg\u00FArese de que se ha configurado correctamente un almac\u00E9n de claves."},
+        {"Warning.Class.not.found.class", "Advertencia: no se ha encontrado la clase: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Advertencia: argumento(s) no v\u00E1lido(s) para el constructor: {0}"},
+        {"Illegal.Principal.Type.type", "Tipo de principal no permitido: {0}"},
+        {"Illegal.option.option", "Opci\u00F3n no permitida: {0}"},
+        {"Usage.policytool.options.", "Sintaxis: policytool [opciones]"},
+        {".file.file.policy.file.location",
+                "  [-file <archivo>]    ubicaci\u00F3n del archivo de normas"},
+        {"New", "Nuevo"},
+        {"Open", "Abrir"},
+        {"Save", "Guardar"},
+        {"Save.As", "Guardar como"},
+        {"View.Warning.Log", "Ver Log de Advertencias"},
+        {"Exit", "Salir"},
+        {"Add.Policy.Entry", "Agregar Entrada de Pol\u00EDtica"},
+        {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"},
+        {"Remove.Policy.Entry", "Eliminar Entrada de Pol\u00EDtica"},
+        {"Edit", "Editar"},
+        {"Retain", "Mantener"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Advertencia: el nombre del archivo puede contener caracteres de barra invertida de escape. No es necesario utilizar barras invertidas de escape (la herramienta aplica caracteres de escape seg\u00FAn sea necesario al escribir el contenido de las pol\u00EDticas en el almac\u00E9n persistente).\n\nHaga clic en Mantener para conservar el nombre introducido o en Editar para modificarlo."},
+
+        {"Add.Public.Key.Alias", "Agregar Alias de Clave P\u00FAblico"},
+        {"Remove.Public.Key.Alias", "Eliminar Alias de Clave P\u00FAblico"},
+        {"File", "Archivo"},
+        {"KeyStore", "Almac\u00E9n de Claves"},
+        {"Policy.File.", "Archivo de Pol\u00EDtica:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "No se ha podido abrir el archivo de pol\u00EDtica: {0}: {1}"},
+        {"Policy.Tool", "Herramienta de Pol\u00EDticas"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Ha habido errores al abrir la configuraci\u00F3n de pol\u00EDticas. V\u00E9ase el log de advertencias para obtener m\u00E1s informaci\u00F3n."},
+        {"Error", "Error"},
+        {"OK", "Aceptar"},
+        {"Status", "Estado"},
+        {"Warning", "Advertencia"},
+        {"Permission.",
+                "Permiso:                                                       "},
+        {"Principal.Type.", "Tipo de Principal:"},
+        {"Principal.Name.", "Nombre de Principal:"},
+        {"Target.Name.",
+                "Nombre de Destino:                                                    "},
+        {"Actions.",
+                "Acciones:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\u00BFSobrescribir el archivo existente {0}?"},
+        {"Cancel", "Cancelar"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "Agregar Principal"},
+        {"Edit.Principal", "Editar Principal"},
+        {"Remove.Principal", "Eliminar Principal"},
+        {"Principals.", "Principales:"},
+        {".Add.Permission", "  Agregar Permiso"},
+        {".Edit.Permission", "  Editar Permiso"},
+        {"Remove.Permission", "Eliminar Permiso"},
+        {"Done", "Listo"},
+        {"KeyStore.URL.", "URL de Almac\u00E9n de Claves:"},
+        {"KeyStore.Type.", "Tipo de Almac\u00E9n de Claves:"},
+        {"KeyStore.Provider.", "Proveedor de Almac\u00E9n de Claves:"},
+        {"KeyStore.Password.URL.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"},
+        {"Principals", "Principales"},
+        {".Edit.Principal.", "  Editar Principal:"},
+        {".Add.New.Principal.", "  Agregar Nuevo Principal:"},
+        {"Permissions", "Permisos"},
+        {".Edit.Permission.", "  Editar Permiso:"},
+        {".Add.New.Permission.", "  Agregar Permiso Nuevo:"},
+        {"Signed.By.", "Firmado Por:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "No se puede especificar un principal con una clase de comod\u00EDn sin un nombre de comod\u00EDn"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "No se puede especificar el principal sin un nombre"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "Permiso y Nombre de Destino deben tener un valor"},
+        {"Remove.this.Policy.Entry.", "\u00BFEliminar esta entrada de pol\u00EDtica?"},
+        {"Overwrite.File", "Sobrescribir Archivo"},
+        {"Policy.successfully.written.to.filename",
+                "Pol\u00EDtica escrita correctamente en {0}"},
+        {"null.filename", "nombre de archivo nulo"},
+        {"Save.changes.", "\u00BFGuardar los cambios?"},
+        {"Yes", "S\u00ED"},
+        {"No", "No"},
+        {"Policy.Entry", "Entrada de Pol\u00EDtica"},
+        {"Save.Changes", "Guardar Cambios"},
+        {"No.Policy.Entry.selected", "No se ha seleccionado la entrada de pol\u00EDtica"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "No se ha podido abrir el almac\u00E9n de claves: {0}"},
+        {"No.principal.selected", "No se ha seleccionado un principal"},
+        {"No.permission.selected", "No se ha seleccionado un permiso"},
+        {"name", "nombre"},
+        {"configuration.type", "tipo de configuraci\u00F3n"},
+        {"environment.variable.name", "nombre de variable de entorno"},
+        {"library.name", "nombre de la biblioteca"},
+        {"package.name", "nombre del paquete"},
+        {"policy.type", "tipo de pol\u00EDtica"},
+        {"property.name", "nombre de la propiedad"},
+        {"provider.name", "nombre del proveedor"},
+        {"url", "url"},
+        {"method.list", "lista de m\u00E9todos"},
+        {"request.headers.list", "lista de cabeceras de solicitudes"},
+        {"Principal.List", "Lista de Principales"},
+        {"Permission.List", "Lista de Permisos"},
+        {"Code.Base", "Base de C\u00F3digo"},
+        {"KeyStore.U.R.L.", "URL de Almac\u00E9n de Claves:"},
+        {"KeyStore.Password.U.R.L.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_fr extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Avertissement\u00A0: il n''existe pas de cl\u00E9 publique pour l''alias {0}. V\u00E9rifiez que le fichier de cl\u00E9s d''acc\u00E8s est correctement configur\u00E9."},
+        {"Warning.Class.not.found.class", "Avertissement : classe introuvable - {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Avertissement\u00A0: arguments non valides pour le constructeur\u00A0- {0}"},
+        {"Illegal.Principal.Type.type", "Type de principal non admis : {0}"},
+        {"Illegal.option.option", "Option non admise : {0}"},
+        {"Usage.policytool.options.", "Syntaxe : policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    emplacement du fichier de r\u00E8gles"},
+        {"New", "Nouveau"},
+        {"Open", "Ouvrir"},
+        {"Save", "Enregistrer"},
+        {"Save.As", "Enregistrer sous"},
+        {"View.Warning.Log", "Afficher le journal des avertissements"},
+        {"Exit", "Quitter"},
+        {"Add.Policy.Entry", "Ajouter une r\u00E8gle"},
+        {"Edit.Policy.Entry", "Modifier une r\u00E8gle"},
+        {"Remove.Policy.Entry", "Enlever une r\u00E8gle"},
+        {"Edit", "Modifier"},
+        {"Retain", "Conserver"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Avertissement : il se peut que le nom de fichier contienne des barres obliques inverses avec caract\u00E8re d'\u00E9chappement. Il n'est pas n\u00E9cessaire d'ajouter un caract\u00E8re d'\u00E9chappement aux barres obliques inverses. L'outil proc\u00E8de \u00E0 l'\u00E9chappement si n\u00E9cessaire lorsqu'il \u00E9crit le contenu des r\u00E8gles dans la zone de stockage persistant).\n\nCliquez sur Conserver pour garder le nom saisi ou sur Modifier pour le remplacer."},
+
+        {"Add.Public.Key.Alias", "Ajouter un alias de cl\u00E9 publique"},
+        {"Remove.Public.Key.Alias", "Enlever un alias de cl\u00E9 publique"},
+        {"File", "Fichier"},
+        {"KeyStore", "Fichier de cl\u00E9s"},
+        {"Policy.File.", "Fichier de r\u00E8gles :"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "Impossible d''ouvrir le fichier de r\u00E8gles\u00A0: {0}: {1}"},
+        {"Policy.Tool", "Policy Tool"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Des erreurs se sont produites \u00E0 l'ouverture de la configuration de r\u00E8gles. Pour plus d'informations, consultez le journal des avertissements."},
+        {"Error", "Erreur"},
+        {"OK", "OK"},
+        {"Status", "Statut"},
+        {"Warning", "Avertissement"},
+        {"Permission.",
+                "Droit :                                                       "},
+        {"Principal.Type.", "Type de principal :"},
+        {"Principal.Name.", "Nom de principal :"},
+        {"Target.Name.",
+                "Nom de cible :                                                    "},
+        {"Actions.",
+                "Actions :                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "Remplacer le fichier existant {0} ?"},
+        {"Cancel", "Annuler"},
+        {"CodeBase.", "Base de code :"},
+        {"SignedBy.", "Sign\u00E9 par :"},
+        {"Add.Principal", "Ajouter un principal"},
+        {"Edit.Principal", "Modifier un principal"},
+        {"Remove.Principal", "Enlever un principal"},
+        {"Principals.", "Principaux :"},
+        {".Add.Permission", "  Ajouter un droit"},
+        {".Edit.Permission", "  Modifier un droit"},
+        {"Remove.Permission", "Enlever un droit"},
+        {"Done", "Termin\u00E9"},
+        {"KeyStore.URL.", "URL du fichier de cl\u00E9s :"},
+        {"KeyStore.Type.", "Type du fichier de cl\u00E9s :"},
+        {"KeyStore.Provider.", "Fournisseur du fichier de cl\u00E9s :"},
+        {"KeyStore.Password.URL.", "URL du mot de passe du fichier de cl\u00E9s :"},
+        {"Principals", "Principaux"},
+        {".Edit.Principal.", "  Modifier un principal :"},
+        {".Add.New.Principal.", "  Ajouter un principal :"},
+        {"Permissions", "Droits"},
+        {".Edit.Permission.", "  Modifier un droit :"},
+        {".Add.New.Permission.", "  Ajouter un droit :"},
+        {"Signed.By.", "Sign\u00E9 par :"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "Impossible de sp\u00E9cifier un principal avec une classe g\u00E9n\u00E9rique sans nom g\u00E9n\u00E9rique"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "Impossible de sp\u00E9cifier un principal sans nom"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "Le droit et le nom de cible doivent avoir une valeur"},
+        {"Remove.this.Policy.Entry.", "Enlever cette r\u00E8gle ?"},
+        {"Overwrite.File", "Remplacer le fichier"},
+        {"Policy.successfully.written.to.filename",
+                "R\u00E8gle \u00E9crite dans {0}"},
+        {"null.filename", "nom de fichier NULL"},
+        {"Save.changes.", "Enregistrer les modifications ?"},
+        {"Yes", "Oui"},
+        {"No", "Non"},
+        {"Policy.Entry", "R\u00E8gle"},
+        {"Save.Changes", "Enregistrer les modifications"},
+        {"No.Policy.Entry.selected", "Aucune r\u00E8gle s\u00E9lectionn\u00E9e"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "Impossible d''ouvrir le fichier de cl\u00E9s d''acc\u00E8s : {0}"},
+        {"No.principal.selected", "Aucun principal s\u00E9lectionn\u00E9"},
+        {"No.permission.selected", "Aucun droit s\u00E9lectionn\u00E9"},
+        {"name", "nom"},
+        {"configuration.type", "type de configuration"},
+        {"environment.variable.name", "Nom de variable d'environnement"},
+        {"library.name", "nom de biblioth\u00E8que"},
+        {"package.name", "nom de package"},
+        {"policy.type", "type de r\u00E8gle"},
+        {"property.name", "nom de propri\u00E9t\u00E9"},
+        {"provider.name", "nom du fournisseur"},
+        {"url", "url"},
+        {"method.list", "liste des m\u00E9thodes"},
+        {"request.headers.list", "liste des en-t\u00EAtes de demande"},
+        {"Principal.List", "Liste de principaux"},
+        {"Permission.List", "Liste de droits"},
+        {"Code.Base", "Base de code"},
+        {"KeyStore.U.R.L.", "URL du fichier de cl\u00E9s :"},
+        {"KeyStore.Password.U.R.L.", "URL du mot de passe du fichier de cl\u00E9s :"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_it extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Avvertenza: non esiste una chiave pubblica per l''alias {0}. Verificare che il keystore sia configurato correttamente."},
+        {"Warning.Class.not.found.class", "Avvertenza: classe non trovata: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Avvertenza: argomento o argomenti non validi per il costruttore {0}"},
+        {"Illegal.Principal.Type.type", "Tipo principal non valido: {0}"},
+        {"Illegal.option.option", "Opzione non valida: {0}"},
+        {"Usage.policytool.options.", "Uso: policytool [opzioni]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    posizione del file dei criteri"},
+        {"New", "Nuovo"},
+        {"Open", "Apri"},
+        {"Save", "Salva"},
+        {"Save.As", "Salva con nome"},
+        {"View.Warning.Log", "Visualizza registro avvertenze"},
+        {"Exit", "Esci"},
+        {"Add.Policy.Entry", "Aggiungi voce dei criteri"},
+        {"Edit.Policy.Entry", "Modifica voce dei criteri"},
+        {"Remove.Policy.Entry", "Rimuovi voce dei criteri"},
+        {"Edit", "Modifica"},
+        {"Retain", "Mantieni"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Avvertenza: il nome file pu\u00F2 includere barre rovesciate con escape. Non \u00E8 necessario eseguire l'escape delle barre rovesciate (se necessario lo strumento esegue l'escape dei caratteri al momento della scrittura del contenuto dei criteri nell'area di memorizzazione persistente).\n\nFare click su Mantieni per conservare il nome immesso, oppure su Modifica per modificare il nome."},
+
+        {"Add.Public.Key.Alias", "Aggiungi alias chiave pubblica"},
+        {"Remove.Public.Key.Alias", "Rimuovi alias chiave pubblica"},
+        {"File", "File"},
+        {"KeyStore", "Keystore"},
+        {"Policy.File.", "File dei criteri:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "Impossibile aprire il file di criteri {0}: {1}"},
+        {"Policy.Tool", "Strumento criteri"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Si sono verificati errori durante l'apertura della configurazione dei criteri. Consultare il registro delle avvertenze per ulteriori informazioni."},
+        {"Error", "Errore"},
+        {"OK", "OK"},
+        {"Status", "Stato"},
+        {"Warning", "Avvertenza"},
+        {"Permission.",
+                "Autorizzazione:                                                       "},
+        {"Principal.Type.", "Tipo principal:"},
+        {"Principal.Name.", "Nome principal:"},
+        {"Target.Name.",
+                "Nome destinazione:                                                    "},
+        {"Actions.",
+                "Azioni:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "OK per sovrascrivere il file {0}?"},
+        {"Cancel", "Annulla"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "Aggiungi principal"},
+        {"Edit.Principal", "Modifica principal"},
+        {"Remove.Principal", "Rimuovi principal"},
+        {"Principals.", "Principal:"},
+        {".Add.Permission", "  Aggiungi autorizzazione"},
+        {".Edit.Permission", "  Modifica autorizzazione"},
+        {"Remove.Permission", "Rimuovi autorizzazione"},
+        {"Done", "Fine"},
+        {"KeyStore.URL.", "URL keystore:"},
+        {"KeyStore.Type.", "Tipo keystore:"},
+        {"KeyStore.Provider.", "Provider keystore:"},
+        {"KeyStore.Password.URL.", "URL password keystore:"},
+        {"Principals", "Principal:"},
+        {".Edit.Principal.", "  Modifica principal:"},
+        {".Add.New.Principal.", "  Aggiungi nuovo principal:"},
+        {"Permissions", "Autorizzazioni"},
+        {".Edit.Permission.", "  Modifica autorizzazione:"},
+        {".Add.New.Permission.", "  Aggiungi nuova autorizzazione:"},
+        {"Signed.By.", "Firmato da:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "Impossibile specificare principal con una classe carattere jolly senza un nome carattere jolly"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "Impossibile specificare principal senza un nome"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "L'autorizzazione e il nome destinazione non possono essere nulli"},
+        {"Remove.this.Policy.Entry.", "Rimuovere questa voce dei criteri?"},
+        {"Overwrite.File", "Sovrascrivi file"},
+        {"Policy.successfully.written.to.filename",
+                "I criteri sono stati scritti in {0}"},
+        {"null.filename", "nome file nullo"},
+        {"Save.changes.", "Salvare le modifiche?"},
+        {"Yes", "S\u00EC"},
+        {"No", "No"},
+        {"Policy.Entry", "Voce dei criteri"},
+        {"Save.Changes", "Salva le modifiche"},
+        {"No.Policy.Entry.selected", "Nessuna voce dei criteri selezionata"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "Impossibile aprire il keystore: {0}"},
+        {"No.principal.selected", "Nessun principal selezionato"},
+        {"No.permission.selected", "Nessuna autorizzazione selezionata"},
+        {"name", "nome"},
+        {"configuration.type", "tipo di configurazione"},
+        {"environment.variable.name", "nome variabile ambiente"},
+        {"library.name", "nome libreria"},
+        {"package.name", "nome package"},
+        {"policy.type", "tipo di criteri"},
+        {"property.name", "nome propriet\u00E0"},
+        {"provider.name", "nome provider"},
+        {"url", "url"},
+        {"method.list", "lista metodi"},
+        {"request.headers.list", "lista intestazioni di richiesta"},
+        {"Principal.List", "Lista principal"},
+        {"Permission.List", "Lista autorizzazioni"},
+        {"Code.Base", "Codebase"},
+        {"KeyStore.U.R.L.", "URL keystore:"},
+        {"KeyStore.Password.U.R.L.", "URL password keystore:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_ja extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "\u8B66\u544A: \u5225\u540D{0}\u306E\u516C\u958B\u9375\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002\u30AD\u30FC\u30B9\u30C8\u30A2\u304C\u6B63\u3057\u304F\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+        {"Warning.Class.not.found.class", "\u8B66\u544A: \u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "\u8B66\u544A: \u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}"},
+        {"Illegal.Principal.Type.type", "\u4E0D\u6B63\u306A\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7: {0}"},
+        {"Illegal.option.option", "\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}"},
+        {"Usage.policytool.options.", "\u4F7F\u7528\u65B9\u6CD5: policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]  \u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240"},
+        {"New", "\u65B0\u898F"},
+        {"Open", "\u958B\u304F"},
+        {"Save", "\u4FDD\u5B58"},
+        {"Save.As", "\u5225\u540D\u4FDD\u5B58"},
+        {"View.Warning.Log", "\u8B66\u544A\u30ED\u30B0\u306E\u8868\u793A"},
+        {"Exit", "\u7D42\u4E86"},
+        {"Add.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0"},
+        {"Edit.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u7DE8\u96C6"},
+        {"Remove.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664"},
+        {"Edit", "\u7DE8\u96C6"},
+        {"Retain", "\u4FDD\u6301"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "\u8B66\u544A: \u30D5\u30A1\u30A4\u30EB\u540D\u306B\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3059\u308B\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093(\u30C4\u30FC\u30EB\u306F\u30DD\u30EA\u30B7\u30FC\u5185\u5BB9\u3092\u6C38\u7D9A\u30B9\u30C8\u30A2\u306B\u66F8\u304D\u8FBC\u3080\u3068\u304D\u306B\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3057\u307E\u3059)\u3002\n\n\u5165\u529B\u6E08\u306E\u540D\u524D\u3092\u4FDD\u6301\u3059\u308B\u306B\u306F\u300C\u4FDD\u6301\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3001\u540D\u524D\u3092\u7DE8\u96C6\u3059\u308B\u306B\u306F\u300C\u7DE8\u96C6\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+
+        {"Add.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u306E\u8FFD\u52A0"},
+        {"Remove.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u3092\u524A\u9664"},
+        {"File", "\u30D5\u30A1\u30A4\u30EB"},
+        {"KeyStore", "\u30AD\u30FC\u30B9\u30C8\u30A2"},
+        {"Policy.File.", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F: {0}: {1}"},
+        {"Policy.Tool", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30C4\u30FC\u30EB"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "\u30DD\u30EA\u30B7\u30FC\u69CB\u6210\u3092\u958B\u304F\u3068\u304D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u8A73\u7D30\u306F\u8B66\u544A\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+        {"Error", "\u30A8\u30E9\u30FC"},
+        {"OK", "OK"},
+        {"Status", "\u72B6\u614B"},
+        {"Warning", "\u8B66\u544A"},
+        {"Permission.",
+                "\u30A2\u30AF\u30BB\u30B9\u6A29:                                                       "},
+        {"Principal.Type.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7:"},
+        {"Principal.Name.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u540D\u524D:"},
+        {"Target.Name.",
+                "\u30BF\u30FC\u30B2\u30C3\u30C8\u540D:                                                    "},
+        {"Actions.",
+                "\u30A2\u30AF\u30B7\u30E7\u30F3:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\u3002"},
+        {"Cancel", "\u53D6\u6D88"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u8FFD\u52A0"},
+        {"Edit.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6"},
+        {"Remove.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u524A\u9664"},
+        {"Principals.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB:"},
+        {".Add.Permission", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0"},
+        {".Edit.Permission", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6"},
+        {"Remove.Permission", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u524A\u9664"},
+        {"Done", "\u5B8C\u4E86"},
+        {"KeyStore.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2URL:"},
+        {"KeyStore.Type.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30BF\u30A4\u30D7:"},
+        {"KeyStore.Provider.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0:"},
+        {"KeyStore.Password.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9URL:"},
+        {"Principals", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB"},
+        {".Edit.Principal.", "  \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6:"},
+        {".Add.New.Principal.", "  \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u65B0\u898F\u8FFD\u52A0:"},
+        {"Permissions", "\u30A2\u30AF\u30BB\u30B9\u6A29"},
+        {".Edit.Permission.", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6:"},
+        {".Add.New.Permission.", "  \u65B0\u898F\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0:"},
+        {"Signed.By.", "\u7F72\u540D\u8005:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u540D\u306E\u306A\u3044\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u30FB\u30AF\u30E9\u30B9\u3092\u4F7F\u7528\u3057\u3066\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "\u540D\u524D\u3092\u4F7F\u7528\u305B\u305A\u306B\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "\u30A2\u30AF\u30BB\u30B9\u6A29\u3068\u30BF\u30FC\u30B2\u30C3\u30C8\u540D\u306F\u3001\u5024\u3092\u4FDD\u6301\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
+        {"Remove.this.Policy.Entry.", "\u3053\u306E\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u3092\u524A\u9664\u3057\u307E\u3059\u304B\u3002"},
+        {"Overwrite.File", "\u30D5\u30A1\u30A4\u30EB\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059"},
+        {"Policy.successfully.written.to.filename",
+                "\u30DD\u30EA\u30B7\u30FC\u306E{0}\u3078\u306E\u66F8\u8FBC\u307F\u306B\u6210\u529F\u3057\u307E\u3057\u305F"},
+        {"null.filename", "\u30D5\u30A1\u30A4\u30EB\u540D\u304Cnull\u3067\u3059"},
+        {"Save.changes.", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\u3002"},
+        {"Yes", "\u306F\u3044"},
+        {"No", "\u3044\u3044\u3048"},
+        {"Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA"},
+        {"Save.Changes", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059"},
+        {"No.Policy.Entry.selected", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "\u30AD\u30FC\u30B9\u30C8\u30A2{0}\u3092\u958B\u3051\u307E\u305B\u3093"},
+        {"No.principal.selected", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
+        {"No.permission.selected", "\u30A2\u30AF\u30BB\u30B9\u6A29\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
+        {"name", "\u540D\u524D"},
+        {"configuration.type", "\u69CB\u6210\u30BF\u30A4\u30D7"},
+        {"environment.variable.name", "\u74B0\u5883\u5909\u6570\u540D"},
+        {"library.name", "\u30E9\u30A4\u30D6\u30E9\u30EA\u540D"},
+        {"package.name", "\u30D1\u30C3\u30B1\u30FC\u30B8\u540D"},
+        {"policy.type", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30BF\u30A4\u30D7"},
+        {"property.name", "\u30D7\u30ED\u30D1\u30C6\u30A3\u540D"},
+        {"provider.name", "\u30D7\u30ED\u30D0\u30A4\u30C0\u540D"},
+        {"url", "URL"},
+        {"method.list", "\u30E1\u30BD\u30C3\u30C9\u30FB\u30EA\u30B9\u30C8"},
+        {"request.headers.list", "\u30EA\u30AF\u30A8\u30B9\u30C8\u30FB\u30D8\u30C3\u30C0\u30FC\u30FB\u30EA\u30B9\u30C8"},
+        {"Principal.List", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30EA\u30B9\u30C8"},
+        {"Permission.List", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u30EA\u30B9\u30C8"},
+        {"Code.Base", "\u30B3\u30FC\u30C9\u30FB\u30D9\u30FC\u30B9"},
+        {"KeyStore.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2U R L:"},
+        {"KeyStore.Password.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9U R L:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_ko extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "\uACBD\uACE0: {0} \uBCC4\uCE6D\uC5D0 \uB300\uD55C \uACF5\uC6A9 \uD0A4\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uD0A4 \uC800\uC7A5\uC18C\uAC00 \uC81C\uB300\uB85C \uAD6C\uC131\uB418\uC5B4 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
+        {"Warning.Class.not.found.class", "\uACBD\uACE0: \uD074\uB798\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "\uACBD\uACE0: \uC0DD\uC131\uC790\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uC778\uC218: {0}"},
+        {"Illegal.Principal.Type.type", "\uC798\uBABB\uB41C \uC8FC\uCCB4 \uC720\uD615: {0}"},
+        {"Illegal.option.option", "\uC798\uBABB\uB41C \uC635\uC158: {0}"},
+        {"Usage.policytool.options.", "\uC0AC\uC6A9\uBC95: policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    \uC815\uCC45 \uD30C\uC77C \uC704\uCE58"},
+        {"New", "\uC0C8\uB85C \uB9CC\uB4E4\uAE30"},
+        {"Open", "\uC5F4\uAE30"},
+        {"Save", "\uC800\uC7A5"},
+        {"Save.As", "\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5"},
+        {"View.Warning.Log", "\uACBD\uACE0 \uB85C\uADF8 \uBCF4\uAE30"},
+        {"Exit", "\uC885\uB8CC"},
+        {"Add.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uCD94\uAC00"},
+        {"Edit.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uD3B8\uC9D1"},
+        {"Remove.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uC81C\uAC70"},
+        {"Edit", "\uD3B8\uC9D1"},
+        {"Retain", "\uC720\uC9C0"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "\uACBD\uACE0: \uD30C\uC77C \uC774\uB984\uC5D0 \uC774\uC2A4\uCF00\uC774\uD504\uB41C \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uAC00 \uD3EC\uD568\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uB294 \uC774\uC2A4\uCF00\uC774\uD504\uD560 \uD544\uC694\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uC601\uAD6C \uC800\uC7A5\uC18C\uC5D0 \uC815\uCC45 \uCF58\uD150\uCE20\uB97C \uC4F8 \uB54C \uD544\uC694\uC5D0 \uB530\uB77C \uC790\uB3D9\uC73C\uB85C \uBB38\uC790\uAC00 \uC774\uC2A4\uCF00\uC774\uD504\uB429\uB2C8\uB2E4.\n\n\uC785\uB825\uB41C \uC774\uB984\uC744 \uADF8\uB300\uB85C \uC720\uC9C0\uD558\uB824\uBA74 [\uC720\uC9C0]\uB97C \uB204\uB974\uACE0, \uC774\uB984\uC744 \uD3B8\uC9D1\uD558\uB824\uBA74 [\uD3B8\uC9D1]\uC744 \uB204\uB974\uC2ED\uC2DC\uC624."},
+
+        {"Add.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uCD94\uAC00"},
+        {"Remove.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uC81C\uAC70"},
+        {"File", "\uD30C\uC77C"},
+        {"KeyStore", "\uD0A4 \uC800\uC7A5\uC18C"},
+        {"Policy.File.", "\uC815\uCC45 \uD30C\uC77C:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "\uC815\uCC45 \uD30C\uC77C\uC744 \uC5F4 \uC218 \uC5C6\uC74C: {0}: {1}"},
+        {"Policy.Tool", "\uC815\uCC45 \uD234"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "\uC815\uCC45 \uAD6C\uC131\uC744 \uC5EC\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 \uACBD\uACE0 \uB85C\uADF8\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
+        {"Error", "\uC624\uB958"},
+        {"OK", "\uD655\uC778"},
+        {"Status", "\uC0C1\uD0DC"},
+        {"Warning", "\uACBD\uACE0"},
+        {"Permission.",
+                "\uAD8C\uD55C:                                                       "},
+        {"Principal.Type.", "\uC8FC\uCCB4 \uC720\uD615:"},
+        {"Principal.Name.", "\uC8FC\uCCB4 \uC774\uB984:"},
+        {"Target.Name.",
+                "\uB300\uC0C1 \uC774\uB984:                                                    "},
+        {"Actions.",
+                "\uC791\uC5C5:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\uAE30\uC874 \uD30C\uC77C {0}\uC744(\uB97C) \uACB9\uCCD0 \uC4F0\uACA0\uC2B5\uB2C8\uAE4C?"},
+        {"Cancel", "\uCDE8\uC18C"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "\uC8FC\uCCB4 \uCD94\uAC00"},
+        {"Edit.Principal", "\uC8FC\uCCB4 \uD3B8\uC9D1"},
+        {"Remove.Principal", "\uC8FC\uCCB4 \uC81C\uAC70"},
+        {"Principals.", "\uC8FC\uCCB4:"},
+        {".Add.Permission", "  \uAD8C\uD55C \uCD94\uAC00"},
+        {".Edit.Permission", "  \uAD8C\uD55C \uD3B8\uC9D1"},
+        {"Remove.Permission", "\uAD8C\uD55C \uC81C\uAC70"},
+        {"Done", "\uC644\uB8CC"},
+        {"KeyStore.URL.", "\uD0A4 \uC800\uC7A5\uC18C URL:"},
+        {"KeyStore.Type.", "\uD0A4 \uC800\uC7A5\uC18C \uC720\uD615:"},
+        {"KeyStore.Provider.", "\uD0A4 \uC800\uC7A5\uC18C \uC81C\uACF5\uC790:"},
+        {"KeyStore.Password.URL.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"},
+        {"Principals", "\uC8FC\uCCB4"},
+        {".Edit.Principal.", "  \uC8FC\uCCB4 \uD3B8\uC9D1:"},
+        {".Add.New.Principal.", "  \uC0C8 \uC8FC\uCCB4 \uCD94\uAC00:"},
+        {"Permissions", "\uAD8C\uD55C"},
+        {".Edit.Permission.", "  \uAD8C\uD55C \uD3B8\uC9D1:"},
+        {".Add.New.Permission.", "  \uC0C8 \uAD8C\uD55C \uCD94\uAC00:"},
+        {"Signed.By.", "\uC11C\uBA85\uC790:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "\uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uC774\uB984 \uC5C6\uC774 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uD074\uB798\uC2A4\uB97C \uC0AC\uC6A9\uD558\uB294 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "\uC774\uB984 \uC5C6\uC774 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "\uAD8C\uD55C\uACFC \uB300\uC0C1 \uC774\uB984\uC758 \uAC12\uC774 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
+        {"Remove.this.Policy.Entry.", "\uC774 \uC815\uCC45 \uD56D\uBAA9\uC744 \uC81C\uAC70\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
+        {"Overwrite.File", "\uD30C\uC77C \uACB9\uCCD0\uC4F0\uAE30"},
+        {"Policy.successfully.written.to.filename",
+                "{0}\uC5D0 \uC131\uACF5\uC801\uC73C\uB85C \uC815\uCC45\uC744 \uC37C\uC2B5\uB2C8\uB2E4."},
+        {"null.filename", "\uB110 \uD30C\uC77C \uC774\uB984"},
+        {"Save.changes.", "\uBCC0\uACBD \uC0AC\uD56D\uC744 \uC800\uC7A5\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
+        {"Yes", "\uC608"},
+        {"No", "\uC544\uB2C8\uC624"},
+        {"Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9"},
+        {"Save.Changes", "\uBCC0\uACBD \uC0AC\uD56D \uC800\uC7A5"},
+        {"No.Policy.Entry.selected", "\uC120\uD0DD\uB41C \uC815\uCC45 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "\uD0A4 \uC800\uC7A5\uC18C\uB97C \uC5F4 \uC218 \uC5C6\uC74C: {0}"},
+        {"No.principal.selected", "\uC120\uD0DD\uB41C \uC8FC\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."},
+        {"No.permission.selected", "\uC120\uD0DD\uB41C \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
+        {"name", "\uC774\uB984"},
+        {"configuration.type", "\uAD6C\uC131 \uC720\uD615"},
+        {"environment.variable.name", "\uD658\uACBD \uBCC0\uC218 \uC774\uB984"},
+        {"library.name", "\uB77C\uC774\uBE0C\uB7EC\uB9AC \uC774\uB984"},
+        {"package.name", "\uD328\uD0A4\uC9C0 \uC774\uB984"},
+        {"policy.type", "\uC815\uCC45 \uC720\uD615"},
+        {"property.name", "\uC18D\uC131 \uC774\uB984"},
+        {"provider.name", "\uC81C\uACF5\uC790 \uC774\uB984"},
+        {"url", "URL"},
+        {"method.list", "\uBA54\uC18C\uB4DC \uBAA9\uB85D"},
+        {"request.headers.list", "\uC694\uCCAD \uD5E4\uB354 \uBAA9\uB85D"},
+        {"Principal.List", "\uC8FC\uCCB4 \uBAA9\uB85D"},
+        {"Permission.List", "\uAD8C\uD55C \uBAA9\uB85D"},
+        {"Code.Base", "\uCF54\uB4DC \uBCA0\uC774\uC2A4"},
+        {"KeyStore.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C URL:"},
+        {"KeyStore.Password.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_pt_BR extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Advert\u00EAncia: N\u00E3o existe uma chave p\u00FAblica para o alias {0}. Certifique-se de que um KeyStore esteja configurado adequadamente."},
+        {"Warning.Class.not.found.class", "Advert\u00EAncia: Classe n\u00E3o encontrada: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Advert\u00EAncia: Argumento(s) inv\u00E1lido(s) para o construtor: {0}"},
+        {"Illegal.Principal.Type.type", "Tipo Principal Inv\u00E1lido: {0}"},
+        {"Illegal.option.option", "Op\u00E7\u00E3o inv\u00E1lida: {0}"},
+        {"Usage.policytool.options.", "Uso: policytool [op\u00E7\u00F5es]"},
+        {".file.file.policy.file.location",
+                "  [-file <arquivo>]    localiza\u00E7\u00E3o do arquivo de pol\u00EDtica"},
+        {"New", "Novo"},
+        {"Open", "Abrir"},
+        {"Save", "Salvar"},
+        {"Save.As", "Salvar Como"},
+        {"View.Warning.Log", "Exibir Log de Advert\u00EAncias"},
+        {"Exit", "Sair"},
+        {"Add.Policy.Entry", "Adicionar Entrada de Pol\u00EDtica"},
+        {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"},
+        {"Remove.Policy.Entry", "Remover Entrada de Pol\u00EDtica"},
+        {"Edit", "Editar"},
+        {"Retain", "Reter"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Advert\u00EAncia: O nome do arquivo pode conter caracteres de escape barra invertida. N\u00E3o \u00E9 necess\u00E1rio fazer o escape dos caracteres de barra invertida (a ferramenta faz o escape dos caracteres conforme necess\u00E1rio ao gravar o conte\u00FAdo da pol\u00EDtica no armazenamento persistente).\n\nClique em Reter para reter o nome da entrada ou clique em Editar para edit\u00E1-lo."},
+
+        {"Add.Public.Key.Alias", "Adicionar Alias de Chave P\u00FAblica"},
+        {"Remove.Public.Key.Alias", "Remover Alias de Chave P\u00FAblica"},
+        {"File", "Arquivo"},
+        {"KeyStore", "KeyStore"},
+        {"Policy.File.", "Arquivo de Pol\u00EDtica:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "N\u00E3o foi poss\u00EDvel abrir o arquivo de pol\u00EDtica: {0}: {1}"},
+        {"Policy.Tool", "Ferramenta de Pol\u00EDtica"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Erros durante a abertura da configura\u00E7\u00E3o da pol\u00EDtica. Consulte o Log de Advert\u00EAncias para obter mais informa\u00E7\u00F5es."},
+        {"Error", "Erro"},
+        {"OK", "OK"},
+        {"Status", "Status"},
+        {"Warning", "Advert\u00EAncia"},
+        {"Permission.",
+                "Permiss\u00E3o:                                                       "},
+        {"Principal.Type.", "Tipo do Principal:"},
+        {"Principal.Name.", "Nome do Principal:"},
+        {"Target.Name.",
+                "Nome do Alvo:                                                    "},
+        {"Actions.",
+                "A\u00E7\u00F5es:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "Est\u00E1 correto substituir o arquivo existente {0}?"},
+        {"Cancel", "Cancelar"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "Adicionar Principal"},
+        {"Edit.Principal", "Editar Principal"},
+        {"Remove.Principal", "Remover Principal"},
+        {"Principals.", "Principais:"},
+        {".Add.Permission", "  Adicionar Permiss\u00E3o"},
+        {".Edit.Permission", "  Editar Permiss\u00E3o"},
+        {"Remove.Permission", "Remover Permiss\u00E3o"},
+        {"Done", "Conclu\u00EDdo"},
+        {"KeyStore.URL.", "URL do KeyStore:"},
+        {"KeyStore.Type.", "Tipo de KeyStore:"},
+        {"KeyStore.Provider.", "Fornecedor de KeyStore:"},
+        {"KeyStore.Password.URL.", "URL da Senha do KeyStore:"},
+        {"Principals", "Principais"},
+        {".Edit.Principal.", "  Editar Principal:"},
+        {".Add.New.Principal.", "  Adicionar Novo Principal:"},
+        {"Permissions", "Permiss\u00F5es"},
+        {".Edit.Permission.", "  Editar Permiss\u00E3o:"},
+        {".Add.New.Permission.", "  Adicionar Nova Permiss\u00E3o:"},
+        {"Signed.By.", "Assinado por:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal com uma Classe de Curinga sem um Nome de Curinga"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal sem um Nome"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "O Nome de Destino e a Permiss\u00E3o devem ter um Valor"},
+        {"Remove.this.Policy.Entry.", "Remover esta Entrada de Pol\u00EDtica?"},
+        {"Overwrite.File", "Substituir Arquivo"},
+        {"Policy.successfully.written.to.filename",
+                "Pol\u00EDtica gravada com \u00EAxito em {0}"},
+        {"null.filename", "nome de arquivo nulo"},
+        {"Save.changes.", "Salvar altera\u00E7\u00F5es?"},
+        {"Yes", "Sim"},
+        {"No", "N\u00E3o"},
+        {"Policy.Entry", "Entrada de Pol\u00EDtica"},
+        {"Save.Changes", "Salvar Altera\u00E7\u00F5es"},
+        {"No.Policy.Entry.selected", "Nenhuma Entrada de Pol\u00EDtica Selecionada"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "N\u00E3o \u00E9 poss\u00EDvel abrir a KeyStore: {0}"},
+        {"No.principal.selected", "Nenhum principal selecionado"},
+        {"No.permission.selected", "Nenhuma permiss\u00E3o selecionada"},
+        {"name", "nome"},
+        {"configuration.type", "tipo de configura\u00E7\u00E3o"},
+        {"environment.variable.name", "nome da vari\u00E1vel de ambiente"},
+        {"library.name", "nome da biblioteca"},
+        {"package.name", "nome do pacote"},
+        {"policy.type", "tipo de pol\u00EDtica"},
+        {"property.name", "nome da propriedade"},
+        {"provider.name", "nome do fornecedor"},
+        {"url", "url"},
+        {"method.list", "lista de m\u00E9todos"},
+        {"request.headers.list", "solicitar lista de cabe\u00E7alhos"},
+        {"Principal.List", "Lista de Principais"},
+        {"Permission.List", "Lista de Permiss\u00F5es"},
+        {"Code.Base", "Base de C\u00F3digo"},
+        {"KeyStore.U.R.L.", "U R L da KeyStore:"},
+        {"KeyStore.Password.U.R.L.", "U R L da Senha do KeyStore:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_sv extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "Varning! Det finns ingen offentlig nyckel f\u00F6r aliaset {0}. Kontrollera att det aktuella nyckellagret \u00E4r korrekt konfigurerat."},
+        {"Warning.Class.not.found.class", "Varning! Klassen hittades inte: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "Varning! Ogiltiga argument f\u00F6r konstruktor: {0}"},
+        {"Illegal.Principal.Type.type", "Otill\u00E5ten identitetshavaretyp: {0}"},
+        {"Illegal.option.option", "Otill\u00E5tet alternativ: {0}"},
+        {"Usage.policytool.options.", "Syntax: policytool [alternativ]"},
+        {".file.file.policy.file.location",
+                "  [-file <fil>]    policyfilens plats"},
+        {"New", "Nytt"},
+        {"Open", "\u00D6ppna"},
+        {"Save", "Spara"},
+        {"Save.As", "Spara som"},
+        {"View.Warning.Log", "Visa varningslogg"},
+        {"Exit", "Avsluta"},
+        {"Add.Policy.Entry", "L\u00E4gg till policypost"},
+        {"Edit.Policy.Entry", "Redigera policypost"},
+        {"Remove.Policy.Entry", "Ta bort policypost"},
+        {"Edit", "Redigera"},
+        {"Retain", "Beh\u00E5ll"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "Varning! Filnamnet kan inneh\u00E5lla omv\u00E4nda snedstreck inom citattecken. Citattecken kr\u00E4vs inte f\u00F6r omv\u00E4nda snedstreck (verktyget hanterar detta n\u00E4r policyinneh\u00E5llet skrivs till det best\u00E4ndiga lagret).\n\nKlicka p\u00E5 Beh\u00E5ll f\u00F6r att beh\u00E5lla det angivna namnet, eller klicka p\u00E5 Redigera f\u00F6r att \u00E4ndra det."},
+
+        {"Add.Public.Key.Alias", "L\u00E4gg till offentligt nyckelalias"},
+        {"Remove.Public.Key.Alias", "Ta bort offentligt nyckelalias"},
+        {"File", "Fil"},
+        {"KeyStore", "Nyckellager"},
+        {"Policy.File.", "Policyfil:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "Kan inte \u00F6ppna policyfilen: {0}: {1}"},
+        {"Policy.Tool", "Policyverktyg"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "Det uppstod ett fel n\u00E4r policykonfigurationen skulle \u00F6ppnas. Se varningsloggen f\u00F6r mer information."},
+        {"Error", "Fel"},
+        {"OK", "OK"},
+        {"Status", "Status"},
+        {"Warning", "Varning"},
+        {"Permission.",
+                "Beh\u00F6righet:                                                       "},
+        {"Principal.Type.", "Identitetshavaretyp:"},
+        {"Principal.Name.", "Identitetshavare:"},
+        {"Target.Name.",
+                "M\u00E5l:                                                    "},
+        {"Actions.",
+                "Funktioner:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "Ska den befintliga filen {0} skrivas \u00F6ver?"},
+        {"Cancel", "Avbryt"},
+        {"CodeBase.", "Kodbas:"},
+        {"SignedBy.", "Signerad av:"},
+        {"Add.Principal", "L\u00E4gg till identitetshavare"},
+        {"Edit.Principal", "Redigera identitetshavare"},
+        {"Remove.Principal", "Ta bort identitetshavare"},
+        {"Principals.", "Identitetshavare:"},
+        {".Add.Permission", "  L\u00E4gg till beh\u00F6righet"},
+        {".Edit.Permission", "  Redigera beh\u00F6righet"},
+        {"Remove.Permission", "Ta bort beh\u00F6righet"},
+        {"Done", "Utf\u00F6rd"},
+        {"KeyStore.URL.", "URL f\u00F6r nyckellager:"},
+        {"KeyStore.Type.", "Nyckellagertyp:"},
+        {"KeyStore.Provider.", "Nyckellagerleverant\u00F6r:"},
+        {"KeyStore.Password.URL.", "URL f\u00F6r l\u00F6senord till nyckellager:"},
+        {"Principals", "Identitetshavare"},
+        {".Edit.Principal.", "  Redigera identitetshavare:"},
+        {".Add.New.Principal.", "  L\u00E4gg till ny identitetshavare:"},
+        {"Permissions", "Beh\u00F6righet"},
+        {".Edit.Permission.", "  Redigera beh\u00F6righet:"},
+        {".Add.New.Permission.", "  L\u00E4gg till ny beh\u00F6righet:"},
+        {"Signed.By.", "Signerad av:"},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "Kan inte specificera identitetshavare med jokerteckenklass utan jokerteckennamn"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "Kan inte specificera identitetshavare utan namn"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "Beh\u00F6righet och m\u00E5lnamn m\u00E5ste ha ett v\u00E4rde"},
+        {"Remove.this.Policy.Entry.", "Vill du ta bort den h\u00E4r policyposten?"},
+        {"Overwrite.File", "Skriv \u00F6ver fil"},
+        {"Policy.successfully.written.to.filename",
+                "Policy har skrivits till {0}"},
+        {"null.filename", "nullfilnamn"},
+        {"Save.changes.", "Vill du spara \u00E4ndringarna?"},
+        {"Yes", "Ja"},
+        {"No", "Nej"},
+        {"Policy.Entry", "Policyfel"},
+        {"Save.Changes", "Spara \u00E4ndringar"},
+        {"No.Policy.Entry.selected", "Ingen policypost har valts"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "Kan inte \u00F6ppna nyckellagret: {0}"},
+        {"No.principal.selected", "Ingen identitetshavare har valts"},
+        {"No.permission.selected", "Ingen beh\u00F6righet har valts"},
+        {"name", "namn"},
+        {"configuration.type", "konfigurationstyp"},
+        {"environment.variable.name", "variabelnamn f\u00F6r milj\u00F6"},
+        {"library.name", "biblioteksnamn"},
+        {"package.name", "paketnamn"},
+        {"policy.type", "policytyp"},
+        {"property.name", "egenskapsnamn"},
+        {"provider.name", "leverant\u00F6rsnamn"},
+        {"url", "url"},
+        {"method.list", "metodlista"},
+        {"request.headers.list", "beg\u00E4ranrubriklista"},
+        {"Principal.List", "Lista \u00F6ver identitetshavare"},
+        {"Permission.List", "Beh\u00F6righetslista"},
+        {"Code.Base", "Kodbas"},
+        {"KeyStore.U.R.L.", "URL f\u00F6r nyckellager:"},
+        {"KeyStore.Password.U.R.L.", "URL f\u00F6r l\u00F6senord till nyckellager:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_zh_CN extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "\u8B66\u544A: \u522B\u540D {0} \u7684\u516C\u5171\u5BC6\u94A5\u4E0D\u5B58\u5728\u3002\u8BF7\u786E\u4FDD\u5DF2\u6B63\u786E\u914D\u7F6E\u5BC6\u94A5\u5E93\u3002"},
+        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u7C7B: {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "\u8B66\u544A: \u6784\u9020\u5668\u7684\u53C2\u6570\u65E0\u6548: {0}"},
+        {"Illegal.Principal.Type.type", "\u975E\u6CD5\u7684\u4E3B\u7528\u6237\u7C7B\u578B: {0}"},
+        {"Illegal.option.option", "\u975E\u6CD5\u9009\u9879: {0}"},
+        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [\u9009\u9879]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    \u7B56\u7565\u6587\u4EF6\u4F4D\u7F6E"},
+        {"New", "\u65B0\u5EFA"},
+        {"Open", "\u6253\u5F00"},
+        {"Save", "\u4FDD\u5B58"},
+        {"Save.As", "\u53E6\u5B58\u4E3A"},
+        {"View.Warning.Log", "\u67E5\u770B\u8B66\u544A\u65E5\u5FD7"},
+        {"Exit", "\u9000\u51FA"},
+        {"Add.Policy.Entry", "\u6DFB\u52A0\u7B56\u7565\u6761\u76EE"},
+        {"Edit.Policy.Entry", "\u7F16\u8F91\u7B56\u7565\u6761\u76EE"},
+        {"Remove.Policy.Entry", "\u5220\u9664\u7B56\u7565\u6761\u76EE"},
+        {"Edit", "\u7F16\u8F91"},
+        {"Retain", "\u4FDD\u7559"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "\u8B66\u544A: \u6587\u4EF6\u540D\u5305\u542B\u8F6C\u4E49\u7684\u53CD\u659C\u6760\u5B57\u7B26\u3002\u4E0D\u9700\u8981\u5BF9\u53CD\u659C\u6760\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49 (\u8BE5\u5DE5\u5177\u5728\u5C06\u7B56\u7565\u5185\u5BB9\u5199\u5165\u6C38\u4E45\u5B58\u50A8\u65F6\u4F1A\u6839\u636E\u9700\u8981\u5BF9\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49)\u3002\n\n\u5355\u51FB\u201C\u4FDD\u7559\u201D\u53EF\u4FDD\u7559\u8F93\u5165\u7684\u540D\u79F0, \u6216\u8005\u5355\u51FB\u201C\u7F16\u8F91\u201D\u53EF\u7F16\u8F91\u8BE5\u540D\u79F0\u3002"},
+
+        {"Add.Public.Key.Alias", "\u6DFB\u52A0\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
+        {"Remove.Public.Key.Alias", "\u5220\u9664\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
+        {"File", "\u6587\u4EF6"},
+        {"KeyStore", "\u5BC6\u94A5\u5E93"},
+        {"Policy.File.", "\u7B56\u7565\u6587\u4EF6:"},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "\u65E0\u6CD5\u6253\u5F00\u7B56\u7565\u6587\u4EF6: {0}: {1}"},
+        {"Policy.Tool", "\u7B56\u7565\u5DE5\u5177"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "\u6253\u5F00\u7B56\u7565\u914D\u7F6E\u65F6\u51FA\u9519\u3002\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u67E5\u770B\u8B66\u544A\u65E5\u5FD7\u3002"},
+        {"Error", "\u9519\u8BEF"},
+        {"OK", "\u786E\u5B9A"},
+        {"Status", "\u72B6\u6001"},
+        {"Warning", "\u8B66\u544A"},
+        {"Permission.",
+                "\u6743\u9650:                                                       "},
+        {"Principal.Type.", "\u4E3B\u7528\u6237\u7C7B\u578B:"},
+        {"Principal.Name.", "\u4E3B\u7528\u6237\u540D\u79F0:"},
+        {"Target.Name.",
+                "\u76EE\u6807\u540D\u79F0:                                                    "},
+        {"Actions.",
+                "\u64CD\u4F5C:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\u786E\u8BA4\u8986\u76D6\u73B0\u6709\u7684\u6587\u4EF6{0}?"},
+        {"Cancel", "\u53D6\u6D88"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "\u6DFB\u52A0\u4E3B\u7528\u6237"},
+        {"Edit.Principal", "\u7F16\u8F91\u4E3B\u7528\u6237"},
+        {"Remove.Principal", "\u5220\u9664\u4E3B\u7528\u6237"},
+        {"Principals.", "\u4E3B\u7528\u6237:"},
+        {".Add.Permission", "  \u6DFB\u52A0\u6743\u9650"},
+        {".Edit.Permission", "  \u7F16\u8F91\u6743\u9650"},
+        {"Remove.Permission", "\u5220\u9664\u6743\u9650"},
+        {"Done", "\u5B8C\u6210"},
+        {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL:"},
+        {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B:"},
+        {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9:"},
+        {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"},
+        {"Principals", "\u4E3B\u7528\u6237"},
+        {".Edit.Principal.", "  \u7F16\u8F91\u4E3B\u7528\u6237:"},
+        {".Add.New.Principal.", "  \u6DFB\u52A0\u65B0\u4E3B\u7528\u6237:"},
+        {"Permissions", "\u6743\u9650"},
+        {".Edit.Permission.", "  \u7F16\u8F91\u6743\u9650:"},
+        {".Add.New.Permission.", "  \u52A0\u5165\u65B0\u7684\u6743\u9650:"},
+        {"Signed.By.", "\u7B7E\u7F72\u4EBA: "},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "\u6CA1\u6709\u901A\u914D\u7B26\u540D\u79F0, \u65E0\u6CD5\u4F7F\u7528\u901A\u914D\u7B26\u7C7B\u6307\u5B9A\u4E3B\u7528\u6237"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "\u6CA1\u6709\u540D\u79F0, \u65E0\u6CD5\u6307\u5B9A\u4E3B\u7528\u6237"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "\u6743\u9650\u53CA\u76EE\u6807\u540D\u5FC5\u987B\u6709\u4E00\u4E2A\u503C"},
+        {"Remove.this.Policy.Entry.", "\u662F\u5426\u5220\u9664\u6B64\u7B56\u7565\u6761\u76EE?"},
+        {"Overwrite.File", "\u8986\u76D6\u6587\u4EF6"},
+        {"Policy.successfully.written.to.filename",
+                "\u7B56\u7565\u5DF2\u6210\u529F\u5199\u5165\u5230{0}"},
+        {"null.filename", "\u7A7A\u6587\u4EF6\u540D"},
+        {"Save.changes.", "\u662F\u5426\u4FDD\u5B58\u6240\u505A\u7684\u66F4\u6539?"},
+        {"Yes", "\u662F"},
+        {"No", "\u5426"},
+        {"Policy.Entry", "\u7B56\u7565\u6761\u76EE"},
+        {"Save.Changes", "\u4FDD\u5B58\u66F4\u6539"},
+        {"No.Policy.Entry.selected", "\u6CA1\u6709\u9009\u62E9\u7B56\u7565\u6761\u76EE"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "\u65E0\u6CD5\u6253\u5F00\u5BC6\u94A5\u5E93: {0}"},
+        {"No.principal.selected", "\u672A\u9009\u62E9\u4E3B\u7528\u6237"},
+        {"No.permission.selected", "\u6CA1\u6709\u9009\u62E9\u6743\u9650"},
+        {"name", "\u540D\u79F0"},
+        {"configuration.type", "\u914D\u7F6E\u7C7B\u578B"},
+        {"environment.variable.name", "\u73AF\u5883\u53D8\u91CF\u540D"},
+        {"library.name", "\u5E93\u540D\u79F0"},
+        {"package.name", "\u7A0B\u5E8F\u5305\u540D\u79F0"},
+        {"policy.type", "\u7B56\u7565\u7C7B\u578B"},
+        {"property.name", "\u5C5E\u6027\u540D\u79F0"},
+        {"provider.name", "\u63D0\u4F9B\u65B9\u540D\u79F0"},
+        {"url", "URL"},
+        {"method.list", "\u65B9\u6CD5\u5217\u8868"},
+        {"request.headers.list", "\u8BF7\u6C42\u6807\u5934\u5217\u8868"},
+        {"Principal.List", "\u4E3B\u7528\u6237\u5217\u8868"},
+        {"Permission.List", "\u6743\u9650\u5217\u8868"},
+        {"Code.Base", "\u4EE3\u7801\u5E93"},
+        {"KeyStore.U.R.L.", "\u5BC6\u94A5\u5E93 URL:"},
+        {"KeyStore.Password.U.R.L.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_zh_HK extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u914D\u7F6E\u6B63\u78BA\u3002"},
+        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
+        {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
+        {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
+        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
+        {"New", "\u65B0\u589E"},
+        {"Open", "\u958B\u555F"},
+        {"Save", "\u5132\u5B58"},
+        {"Save.As", "\u53E6\u5B58\u65B0\u6A94"},
+        {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"},
+        {"Exit", "\u7D50\u675F"},
+        {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"},
+        {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"},
+        {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"},
+        {"Edit", "\u7DE8\u8F2F"},
+        {"Retain", "\u4FDD\u7559"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
+
+        {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
+        {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
+        {"File", "\u6A94\u6848"},
+        {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"},
+        {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
+        {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "\u958B\u555F\u539F\u5247\u8A18\u7F6E\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
+        {"Error", "\u932F\u8AA4"},
+        {"OK", "\u78BA\u5B9A"},
+        {"Status", "\u72C0\u614B"},
+        {"Warning", "\u8B66\u544A"},
+        {"Permission.",
+                "\u6B0A\u9650:                                                       "},
+        {"Principal.Type.", "Principal \u985E\u578B: "},
+        {"Principal.Name.", "Principal \u540D\u7A31: "},
+        {"Target.Name.",
+                "\u76EE\u6A19\u540D\u7A31:                                                    "},
+        {"Actions.",
+                "\u52D5\u4F5C:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
+        {"Cancel", "\u53D6\u6D88"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "\u65B0\u589E Principal"},
+        {"Edit.Principal", "\u7DE8\u8F2F Principal"},
+        {"Remove.Principal", "\u79FB\u9664 Principal"},
+        {"Principals.", "Principal:"},
+        {".Add.Permission", "  \u65B0\u589E\u6B0A\u9650"},
+        {".Edit.Permission", "  \u7DE8\u8F2F\u6B0A\u9650"},
+        {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"},
+        {"Done", "\u5B8C\u6210"},
+        {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "},
+        {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"},
+        {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"},
+        {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "},
+        {"Principals", "Principal"},
+        {".Edit.Principal.", "  \u7DE8\u8F2F Principal: "},
+        {".Add.New.Principal.", "  \u65B0\u589E Principal: "},
+        {"Permissions", "\u6B0A\u9650"},
+        {".Edit.Permission.", "  \u7DE8\u8F2F\u6B0A\u9650:"},
+        {".Add.New.Permission.", "  \u65B0\u589E\u6B0A\u9650:"},
+        {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
+        {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
+        {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
+        {"Policy.successfully.written.to.filename",
+                "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
+        {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
+        {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
+        {"Yes", "\u662F"},
+        {"No", "\u5426"},
+        {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
+        {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
+        {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
+        {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
+        {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
+        {"name", "\u540D\u7A31"},
+        {"configuration.type", "\u7D44\u614B\u985E\u578B"},
+        {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
+        {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
+        {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
+        {"policy.type", "\u539F\u5247\u985E\u578B"},
+        {"property.name", "\u5C6C\u6027\u540D\u7A31"},
+        {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
+        {"Principal.List", "Principal \u6E05\u55AE"},
+        {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
+        {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
+        {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
+        {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.tools.policytool;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for the policytool.
+ *
+ */
+public class Resources_zh_TW extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+        {"NEWLINE", "\n"},
+        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
+                "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u914D\u7F6E\u6B63\u78BA\u3002"},
+        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
+        {"Warning.Invalid.argument.s.for.constructor.arg",
+                "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
+        {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
+        {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
+        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
+        {".file.file.policy.file.location",
+                "  [-file <file>]    \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
+        {"New", "\u65B0\u589E"},
+        {"Open", "\u958B\u555F"},
+        {"Save", "\u5132\u5B58"},
+        {"Save.As", "\u53E6\u5B58\u65B0\u6A94"},
+        {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"},
+        {"Exit", "\u7D50\u675F"},
+        {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"},
+        {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"},
+        {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"},
+        {"Edit", "\u7DE8\u8F2F"},
+        {"Retain", "\u4FDD\u7559"},
+
+        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
+            "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
+
+        {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
+        {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
+        {"File", "\u6A94\u6848"},
+        {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"},
+        {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
+        {"Could.not.open.policy.file.policyFile.e.toString.",
+                "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
+        {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
+        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
+                "\u958B\u555F\u539F\u5247\u8A18\u7F6E\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
+        {"Error", "\u932F\u8AA4"},
+        {"OK", "\u78BA\u5B9A"},
+        {"Status", "\u72C0\u614B"},
+        {"Warning", "\u8B66\u544A"},
+        {"Permission.",
+                "\u6B0A\u9650:                                                       "},
+        {"Principal.Type.", "Principal \u985E\u578B: "},
+        {"Principal.Name.", "Principal \u540D\u7A31: "},
+        {"Target.Name.",
+                "\u76EE\u6A19\u540D\u7A31:                                                    "},
+        {"Actions.",
+                "\u52D5\u4F5C:                                                             "},
+        {"OK.to.overwrite.existing.file.filename.",
+                "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
+        {"Cancel", "\u53D6\u6D88"},
+        {"CodeBase.", "CodeBase:"},
+        {"SignedBy.", "SignedBy:"},
+        {"Add.Principal", "\u65B0\u589E Principal"},
+        {"Edit.Principal", "\u7DE8\u8F2F Principal"},
+        {"Remove.Principal", "\u79FB\u9664 Principal"},
+        {"Principals.", "Principal:"},
+        {".Add.Permission", "  \u65B0\u589E\u6B0A\u9650"},
+        {".Edit.Permission", "  \u7DE8\u8F2F\u6B0A\u9650"},
+        {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"},
+        {"Done", "\u5B8C\u6210"},
+        {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "},
+        {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"},
+        {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"},
+        {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "},
+        {"Principals", "Principal"},
+        {".Edit.Principal.", "  \u7DE8\u8F2F Principal: "},
+        {".Add.New.Principal.", "  \u65B0\u589E Principal: "},
+        {"Permissions", "\u6B0A\u9650"},
+        {".Edit.Permission.", "  \u7DE8\u8F2F\u6B0A\u9650:"},
+        {".Add.New.Permission.", "  \u65B0\u589E\u6B0A\u9650:"},
+        {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
+        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
+            "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
+        {"Cannot.Specify.Principal.without.a.Name",
+            "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
+        {"Permission.and.Target.Name.must.have.a.value",
+                "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
+        {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
+        {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
+        {"Policy.successfully.written.to.filename",
+                "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
+        {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
+        {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
+        {"Yes", "\u662F"},
+        {"No", "\u5426"},
+        {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
+        {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
+        {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
+        {"Unable.to.open.KeyStore.ex.toString.",
+                "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
+        {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
+        {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
+        {"name", "\u540D\u7A31"},
+        {"configuration.type", "\u7D44\u614B\u985E\u578B"},
+        {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
+        {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
+        {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
+        {"policy.type", "\u539F\u5247\u985E\u578B"},
+        {"property.name", "\u5C6C\u6027\u540D\u7A31"},
+        {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
+        {"url", "URL"},
+        {"method.list", "\u65B9\u6CD5\u6E05\u55AE"},
+        {"request.headers.list", "\u8981\u6C42\u6A19\u982D\u6E05\u55AE"},
+        {"Principal.List", "Principal \u6E05\u55AE"},
+        {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
+        {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
+        {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
+        {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
+    };
+
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    @Override
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/Probe.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing;
-
-/**
- * The {@code Probe} interface represents a tracepoint.
- *
- * A {@code Probe} instance is obtained by calling the
- * {@code Provider.getProbe()} method of a provider instance created by
- * {@code ProviderFactory.createProvider()}.  A {@code Probe} can be used to
- * trigger a probe manually (provided the correct arguments are passed to
- * it), or to check a probe to see if anything is currently tracing it.
- * <p>
- * A tracing check can be used to avoid lengthy work that might be
- * needed to set up the probe's arguments.  However, checking
- * whether the probe is enabled generally takes the same amount of time
- * as actually triggering the probe. So, you should only check a probe's status
- * without triggering it if setting up the arguments is very expensive.
- * <p>
- * Users do not need to implement this interface: instances are
- * created automatically by the system when a {@code Provider)} instance is
- * created.
- * <p>
- * @since 1.7
- */
-
-public interface Probe {
-    /**
-     * Checks whether there is an active trace of this probe.
-     *
-     * @return true if an active trace is detected.
-     */
-    boolean isEnabled();
-
-    /**
-     * Determines whether a tracepoint is enabled.
-     *
-     * Typically, users do not need to use this method. It is called
-     * automatically when a Provider's instance method is called. Calls to
-     * this method expect the arguments to match the declared parameters for
-     * the method associated with the probe.
-     *
-     * @param args the parameters to pass to the method.
-     * @throws IllegalArgumentException if the provided parameters do not
-     * match the method declaration for this probe.
-     */
-    void trigger(Object ... args);
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProbeName.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * An annotation used to override the name of a probe.
- * <p>
- * This annotation can be added to a method in a user-defined {@code Provider}
- * interface, to set the name that will be used for the generated probe
- * associated with that method.  Without this annotation, the name will be the
- * name of the method.
- * <p>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface ProbeName {
-    String value();
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/Provider.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing;
-
-/**
- * {@code Provider} is a superinterface for user-defined tracing providers.
- * <p>
- * To define tracepoints, users must extend this interface
- * and then use a {@code ProviderFactory} to create an instance of the
- * newly-defined interface.  Each method in the defined interface represents a
- * tracepoint (or probe), which can be triggered by calling the associated
- * method on the returned instance.
- * <p>
- * This interface also contains a {@code getProbe()} method, which can be
- * used to get direct handles to the {@code Probe} objects themselves.
- * {@code Probe} objects can be triggered manually, or they can be queried to
- * check their state.
- * <p>
- * When an application has finished triggering probes, it should call
- * {@code dispose()} to free up any system resources associated with the
- * Provider.
- * <p>
- * All methods declared in a subclass of this interface should have a
- * {@code void} return type. Methods can have parameters, and when called the
- * values of the arguments will be passed to the tracing implementation.
- * If any methods do not have a {@code void} return type, an
- * {@code java.lang.IllegalArgumentException} will be thrown when the
- * provider is registered.
- * @since 1.7
- */
-
-public interface Provider {
-    /**
-     * Retrieves a reference to a Probe object, which is used to check status
-     * or to trigger the probe manually.
-     *
-     * If the provided method parameter is not a method of the provider
-     * interface,  or if the provider interface has been disposed, then
-     * this returns null
-     *
-     * @param method a method declared in the provider.
-     * @return the specified probe represented by that method, or null.
-     */
-    Probe getProbe(java.lang.reflect.Method method);
-
-    /**
-     * Disposes system resources associated with this provider.
-     *
-     * After calling this method, triggering the probes will have no effect.
-     * Additional calls to this method after the first call are ignored.
-     */
-    void dispose();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProviderFactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-
-package com.sun.tracing;
-
-import java.util.HashSet;
-import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import sun.tracing.NullProviderFactory;
-import sun.tracing.PrintStreamProviderFactory;
-import sun.tracing.MultiplexProviderFactory;
-import sun.tracing.dtrace.DTraceProviderFactory;
-
-/**
- * {@code ProviderFactory} is a factory class used to create instances of
- * providers.
- *
- * To enable tracing in an application, this class must be used to create
- * instances of the provider interfaces defined by users.
- * The system-defined factory is obtained by using the
- * {@code getDefaultFactory()} static method.  The resulting instance can be
- * used to create any number of providers.
- *
- * @since 1.7
- */
-public abstract class ProviderFactory {
-
-    protected ProviderFactory() {}
-
-    /**
-     * Creates an implementation of a Provider interface.
-     *
-     * @param cls the provider interface to be defined.
-     * @return an implementation of {@code cls}, whose methods, when called,
-     * will trigger tracepoints in the application.
-     * @throws NullPointerException if cls is null
-     * @throws IllegalArgumentException if the class definition contains
-     * non-void methods
-     */
-    public abstract <T extends Provider> T createProvider(Class<T> cls);
-
-    /**
-     * Returns an implementation of a {@code ProviderFactory} which
-     * creates instances of Providers.
-     *
-     * The created Provider instances will be linked to all appropriate
-     * and enabled system-defined tracing mechanisms in the JDK.
-     *
-     * @return a {@code ProviderFactory} that is used to create Providers.
-     */
-    public static ProviderFactory getDefaultFactory() {
-        HashSet<ProviderFactory> factories = new HashSet<ProviderFactory>();
-
-        // Try to instantiate a DTraceProviderFactory
-        String prop = AccessController.doPrivileged(
-            (PrivilegedAction<String>) () -> System.getProperty("com.sun.tracing.dtrace"));
-
-        if ( (prop == null || !prop.equals("disable")) &&
-             DTraceProviderFactory.isSupported() ) {
-            factories.add(new DTraceProviderFactory());
-        }
-
-        // Try to instantiate an output stream factory
-        prop = AccessController.doPrivileged(
-            (PrivilegedAction<String>) () -> System.getProperty("sun.tracing.stream"));
-        if (prop != null) {
-            for (String spec : prop.split(",")) {
-                PrintStream ps = getPrintStreamFromSpec(spec);
-                if (ps != null) {
-                    factories.add(new PrintStreamProviderFactory(ps));
-                }
-            }
-        }
-
-        // See how many factories we instantiated, and return an appropriate
-        // factory that encapsulates that.
-        if (factories.size() == 0) {
-            return new NullProviderFactory();
-        } else if (factories.size() == 1) {
-            return factories.toArray(new ProviderFactory[1])[0];
-        } else {
-            return new MultiplexProviderFactory(factories);
-        }
-    }
-
-    private static PrintStream getPrintStreamFromSpec(final String spec) {
-        try {
-            // spec is in the form of <class>.<field>, where <class> is
-            // a fully specified class name, and <field> is a static member
-            // in that class.  The <field> must be a 'PrintStream' or subtype
-            // in order to be used.
-            final int fieldpos = spec.lastIndexOf('.');
-            final Class<?> cls = Class.forName(spec.substring(0, fieldpos));
-
-            Field f = AccessController.doPrivileged(new PrivilegedExceptionAction<Field>() {
-                public Field run() throws NoSuchFieldException {
-                    return cls.getField(spec.substring(fieldpos + 1));
-                }
-            });
-
-            return (PrintStream)f.get(null);
-        } catch (ClassNotFoundException e) {
-            throw new AssertionError(e);
-        } catch (IllegalAccessException e) {
-            throw new AssertionError(e);
-        } catch (PrivilegedActionException e) {
-            throw new AssertionError(e);
-        }
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/ProviderName.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * An annotation used to specify the name of a provider.
- * <p>
- * This annotation can be added to a user-defined {@code Provider}
- * interface, to set the name that will be used
- * for the provider in the generated probes.  Without this annotation,
- * the simple class name of the provider interface is used.
- * <p>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ProviderName {
-    String value();
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ArgsAttributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-
-/**
- * This annotation describes the interface attributes of the probe arguments in
- * a single provider.
- *
- * This annotation can be added to a user-defined {@code Provider} specification
- * interface to set the stability attributes of the probe arguments, for
- * all the probes specified in that provider.
- * <p>
- * If this annotation is not present, the interface attributes for the
- * arguments are Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface ArgsAttributes {
-  Attributes value();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/Attributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-
-/**
- * This annotation describes the interface's field attributes
- * for the probes in a provider.
- *
- * This annotation provides the contents of field-specific annotations
- * that specify the stability attributes and dependency class of a
- * particular field, for the probes in a provider.
- * <p>
- * The default interface attributes for unspecified fields is
- * Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({})
-public @interface Attributes {
-  /**
-   * The stability level of the name.
-   */
-  StabilityLevel name() default StabilityLevel.PRIVATE;
-
-  /**
-   * The stability level of the data.
-   */
-  StabilityLevel data() default StabilityLevel.PRIVATE;
-
-  /**
-   * The interface attribute's dependency class.
-   */
-  DependencyClass dependency()  default DependencyClass.UNKNOWN;
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/DependencyClass.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-/**
- * Enumeration for the DTrace dependency classes.
- *
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide for details, Chapter 39: Stability</a>
- * @since 1.7
- */
-public enum DependencyClass {
-    /**
-     * The interface has an unknown set of architectural dependencies.
-     */
-    UNKNOWN  (0),
-    /**
-     * The interface is specific to the CPU model of the current system.
-     */
-    CPU      (1),
-    /**
-     * The interface is specific to the hardware platform of the current
-     * system.
-     */
-    PLATFORM (2),
-    /**
-     * The interface is specific to the hardware platform group of the
-     * current system.
-     */
-    GROUP    (3),
-    /**
-     * The interface is specific to the instruction set architecture (ISA)
-     * supported by the microprocessors on this system.
-     */
-    ISA      (4),
-    /**
-     * The interface is common to all Solaris systems regardless of the
-     * underlying hardware.
-     */
-    COMMON   (5);
-
-    public String toDisplayString() {
-        return toString().substring(0,1) +
-               toString().substring(1).toLowerCase();
-    }
-
-    public int getEncoding() { return encoding; }
-
-    private int encoding;
-
-    private DependencyClass(int encoding) {
-        this.encoding = encoding;
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/FunctionAttributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * This annotation describes the interface attributes of the
- * {@code function} field for a single provider.
- *
- * This annotation can be added to a user-defined {@code Provider} specification
- * interface to set the stability attributes of the {@code function} field for
- * all probes specified in that provider.
- * <p>
- * If this annotation is not present, the interface attributes for the
- * {@code function} field are Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface FunctionAttributes {
-    Attributes value();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/FunctionName.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * An annotation used to specify the {@code function} field for a DTrace probe.
- *
- * This annotation can be added to a method in a user-defined Provider
- * specification interface to set the {@code function} field that is used
- * for the generated DTrace probe associated with that method.
- * <p>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface FunctionName {
-    String value();
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ModuleAttributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * This annotation is used to describe the interface attributes of the
- * {@code module} field for a single provider.
- *
- * This annotation can be added to a user-defined Provider specification
- * interface to set the stability attributes of the {@code module} field for
- * all probes specified in that provider.
- * <p>
- * If this annotation is not present, the interface attributes for the
- * {@code module} field is Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface ModuleAttributes {
-    Attributes value();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ModuleName.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * An annotation used to specify the {@code module} field for a DTrace probe.
- *
- * This annotation can be added to a method in a user-defined Provider
- * specification interface to set the {@code module} field that will be used
- * for the generated DTrace probe associated with that method.
- * <p>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ModuleName {
-    String value();
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/NameAttributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * This annotation describes the interface attributes of the
- * {@code name} field for a single provider.
- *
- * This annotation can be added to a user-defined Provider specification
- * interface to set the stability attributes of the {@code name} field for
- * all probes specified in that provider.
- * <p>
- * If this annotation is not present, the interface attributes for the
- * {@code name} field will be Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface NameAttributes {
-    Attributes value();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/ProviderAttributes.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-
-/**
- * This annotation is used to describe the interface attributes of the
- * {@code provider} field for a single provider.
- *
- * This annotation can be added to a user-defined Provider specification
- * interface to set the stability attributes of the {@code provider} field for
- * all probes specified in that provider.
- * <p>
- * If this annotation is not present, the interface attributes for the
- * {@code provider} field will be Private/Private/Unknown.
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
-public @interface ProviderAttributes {
-    Attributes value();
-}
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/StabilityLevel.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2008, 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.tracing.dtrace;
-
-/**
- * Enumeration for the DTrace stability levels.
- *
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- * @since 1.7
- */
-public enum StabilityLevel {
-    /**
-     * The interface is private to DTrace and represents an implementation
-     * detail of DTrace.
-     */
-    INTERNAL  (0),
-    /**
-     * The interface is private to Sun for use by other Sun products. It is
-     * not yet publicly documented for use by customers and ISVs.
-     */
-    PRIVATE  (1),
-    /**
-     * The interface is supported in the current release but is scheduled
-     * to be removed, most likely in a future minor release.
-     */
-    OBSOLETE (2),
-    /**
-     * The interface is controlled by an entity other than Sun.
-     */
-    EXTERNAL (3),
-    /**
-     * The interface gives developers early access to new or
-     * rapidly changing technology or to an implementation artifact that is
-     * essential for observing or debugging system behavior. A more
-     * stable solution is anticipated in the future.
-     */
-    UNSTABLE (4),
-    /**
-     * The interface might eventually become Standard or Stable but is
-     * still in transition.
-     */
-    EVOLVING (5),
-    /**
-     * The interface is a mature interface under Sun's control.
-     */
-    STABLE   (6),
-    /**
-     * The interface complies with an industry standard.
-     */
-    STANDARD (7);
-
-    String toDisplayString() {
-        return toString().substring(0,1) +
-               toString().substring(1).toLowerCase();
-    }
-
-    public int getEncoding() { return encoding; }
-
-    private int encoding;
-
-    private StabilityLevel(int encoding) {
-        this.encoding = encoding;
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/dtrace/package-info.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-/**
- * This package contains annotations and enumerations that are used to
- * add DTrace-specific information to a tracing provider.
- * <p>
- * The DTrace-specific annotations modify the attributes of a DTrace provider
- * implementation when it is used by the tracing subsystem.  The annotations are
- * added to a {@code com.sun.tracing} provider specification to control
- * specific attributes of the provider as it relates to DTrace.
- * <p>
- * Any other tracing subsystems supported by the system will ignore these
- * annotations.
- * <p>
- * DTrace probes have additional fields and stability attributes that are
- * not accounted for in the generic tracing package.  If unspecified, the
- * default values are used for the stability and dependency attributes of
- * probes, as well as for the module and field names of the generated probes.
- * The values can be specified by adding the appropriate annotations to the
- * provider specification.
- * <p>
- * The {@code FunctionName} annotation is used to annotate the tracepoint
- * methods defined in the provider specification.  The value of this annotation
- * is used as the {@code function} field in the generated DTrace probes. It
- * is typically set to the name of the enclosing function where the
- * tracepoint is triggered.
- * <p>
- * The {@code ModuleName} annotation is used to annotate the provider
- * specification itself and applies to all the probes in the provider.  It
- * sets the value of the {@code module} field in the generated DTrace probes.
- * <p>
- * The remaining annotations, are also applied to the provider itself, and
- * are used to set the stability and dependency attributes of all probes in
- * that provider.  Each probe field and the probe arguments can be
- * independently assigned interface attributes to control the stability
- * ratings of the probes.
- * <p>
- * Here is an example of how to declare a provider, specifying additional DTrace
- * data:
-<PRE>
-    &#064;ProviderName("my_app_provider")
-    &#064;ModuleName("app.jar")
-    &#064;ProviderAttributes(&#064;Attributes={
-        name=StabilityLevel.STABLE,data=StabilityLevel.STABLE,
-        dependency=DependencyClass.COMMON})
-    &#064;ProbeAttributes(&#064;Attributes={
-        name=StabilityLevel.STABLE,data=StabilityLevel.STABLE,
-        dependency=DependencyClass.COMMON})
-    &#064;ModuleAttributes(&#064;Attributes={name=StabilityLevel.UNSTABLE})
-    public class MyProvider {
-        &#064;FunctionName("main") void startProbe();
-    }
-</PRE>
- * <p>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view">Solaris Dynamic Tracing Guide, Chapter 34: Statically Defined Tracing for User Applications</a>
- * @see <a href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlnp?a=view">Solaris Dynamic Tracing Guide, Chapter 39: Stability</a>
- */
-
-package com.sun.tracing.dtrace;
--- a/jdk/src/jdk.runtime/share/classes/com/sun/tracing/package-info.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-/**
- * This package provides a mechanism for defining and
- * inserting tracepoints into Java-technology based applications, which
- * can then be monitored by the tracing tools available on the system.
- * <p>
- * To add tracepoints to a program, you must first decide where to place the
- * tracepoints, what the logical names are for these points, what information
- * will be available to the tracing mechanisms at each point, and decide upon
- * any logical grouping.
- * <p>
- * You add instrumentation to a program in three steps:
- * <ul>
- * <li>First, declare tracepoints by creating interfaces to define
- * them, and include these interfaces in the program definition.
- * The declared interfaces are standard Java technology-based
- * interfaces and are compiled with the program.</li>
- * <li>Second, add code in the application to create an instance of the
- * interface at some point during the initialization of the application,
- * using a factory class provided by the system. The reference to the
- * instance can be stored as a global static, or passed as context to all
- * the places where it is needed.</li>
- * <li>Finally, add the actual tracepoints to the desired locations in the
- * application by inserting a call to one of the methods defined in the
- * interface, via the factory-created reference.</li>
- * </ul>
- * <p>
- * The method calls representing the tracepoints have no logical
- * impact on the program.  The side effect of the call is that any
- * activated tracing mechanisms will be notified that the tracepoint has
- * been hit, and will take whatever actions are appropriate (for example,
- * logging  the tracepoint, or triggering a DTrace probe, etc.).  In most
- * cases, the impact on performance of adding tracepoints to the application
- * will be minimal.
- * <p>
- * Each logical grouping of tracepoints should be defined in a common
- * interface, called a <i>provider</i>.  An application can have one or many
- * providers.  Each provider is independent and can be created whenever
- * it is appropriate for that provider, for example, when a subsytem is
- * initialized.  Providers should be disposed of when they are no longer
- * needed, to free up any associated system resources.  Each tracepoint
- * in a provider is represented by a method in that interface.  These methods
- * are referred to as <i>probes</i>.  The method signature determines the probe
- * parameters.  A call to the method with the specified parameters triggers
- * the probe and makes its parameter values visible to any associated tracing
- * mechanism.
- * <p>
- * User-defined interfaces which represent providers must extend the
- * {@code Provider} interface.  To activate the system-defined
- * tracing mechanisms, you must obtain an instance of the
- * {@code ProviderFactory} class, and pass the class of the provider to
- * the {@code createProvider()} method.  The returned instance is then used to
- * trigger the probes later in the application.
- * <p>
- * In addition to triggering the probes, the provider instance can be used
- * to obtain direct references to the {@code Probe} objects, which can be used
- * directly for triggering, or can be queried to determine whether the probe is
- * currently being traced.  The {@code Provider} interface also defines a
- * {@code Provider.dispose()} method which is used to free up any resources
- * that might be associated with that provider.
- * <p>
- * When a probe is triggered, any activated tracing system will be given
- * the provider name, the probe name, and the values of the probe arguments.
- * The tracing system is free to consume this data is whatever way is
- * appropriate.
- * By default, the provider name is the same as the class name of the interface
- * that defines the provider. Similarly, the probe name is
- * the name of the method that defines the probe. These default values
- * can be over-ridden by annotations.  The provider definition can be
- * annotated with the {@code @ProviderName} annotation, whose value will
- * indicate the provider name that the tracing system will use.  Similarly,
- * the {@code @ProbeName} annotation annotates a declared method and
- * indicates the probe name that should be used in the place of the
- * method name.  These annotations can be used to define providers and
- * probes with the same name, in cases where the semantics of the Java language
- * may prevent this.
- * <p>
- * Here is a very small and simple usage example:
- * <p>
- *
-<PRE>
-   import com.sun.tracing.Provider;
-   import com.sun.tracing.ProviderFactory;
-
-   interface MyProvider extends Provider {
-       void startProbe();
-       void finishProbe(int value);
-   }
-
-   public class MyApplication {
-       public static void main(String argv[]) {
-           ProviderFactory factory = ProviderFactory.getDefaultFactory();
-           MyProvider trace = factory.createProvider(MyProvider.class);
-
-           trace.startProbe();
-           int result = foo();
-           trace.finishProbe(result);
-
-           trace.dispose();
-       }
-   }
-</PRE>
- * <p>
- * The Java Development Kit (JDK) currently only includes one system-defined
- * tracing framework: DTrace. DTrace is enabled automatically whenever an
- * application is run on a system and a JDK release that supports it. When
- * DTrace is enabled, probes are made available for listing and matching by
- * DTrace scripts as soon as the provider is created. At the tracepoint, an
- * associated DTrace script is informed of the creation of the provider, and
- * it takes whatever action it is designed to take. Tracepoints in the
- * program have the following DTrace probe names:<br>
- *   {@code <provider><pid>:<module>:<function>:<probe>}
- * Where:
- * <ul>
- * <li>{@code <provider>} the provider name as specified by the application</li>
- * <li>{@code <pid>} the operating system process ID</li>
- * <li>{@code <module>} undefined, unless specified by the application</li>
- * <li>{@code <function>} undefined, unless specified by the application</li>
- * <li>{@code <probe>} the probe name as specified by the application</li>
- * </ul>
- * <p>
- * The {@code com.sun.tracing.dtrace} package contains additional
- * annotations that can be used to control the names used for the
- * <code>module</code> and <code>function</code> fields, as well as annotations
- * that can be added to the provider to control probe stability and dependency
- * attributes.
- * <p>
- * Integer, float and string probe parameters are made available to DTrace
- * using
- * the built-in argument variables, {@code arg0 ... arg_n}.  Integer-types
- * are passed by value (boxed values are unboxed), floating-point types are
- * passed as encoded integer
- * arguments, and {@code java.lang.String} objects are converted
- * to UTF8 strings, so they can be read into the DTrace script using the
- * {@code copyinstr()} intrinsic.  Non-string and non-boxed primitive
- * reference arguments are only
- * placeholders and have no value.
- * <p>
- * Using the example above, with a theoretical process ID of 123, these are
- * the probes that can be traced from DTrace:
-<PRE>
-    MyProvider123:::startProbe
-    MyProvider123:::finishProbe
-</PRE>
- * When {@code finishProbe} executes, {@code arg0} will contain the
- * value of {@code result}.
- * <p>
- * The DTrace tracing mechanism is enabled for all providers, apart from in the
- * following circumstances:
- * <ul>
- * <li>DTrace is not supported on the underlying system.</li>
- * <li>The property {@code com.sun.tracing.dtrace} is set to "disable".</li>
- * <li>The RuntimePermission {@code com.sun.tracing.dtrace.createProvider}
- * is denied to the process.</li>
- * </ul>
- * <p>
- */
-
-package com.sun.tracing;
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4554 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-import java.io.*;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.lang.reflect.*;
-import java.text.Collator;
-import java.text.MessageFormat;
-import sun.security.util.PropertyExpander;
-import sun.security.util.PropertyExpander.ExpandException;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.FileDialog;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.event.*;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.*;
-import sun.security.provider.*;
-import sun.security.util.PolicyUtil;
-import javax.security.auth.x500.X500Principal;
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-
-/**
- * PolicyTool may be used by users and administrators to configure the
- * overall java security policy (currently stored in the policy file).
- * Using PolicyTool administrators may add and remove policies from
- * the policy file. <p>
- *
- * @see java.security.Policy
- * @since   1.2
- */
-
-public class PolicyTool {
-
-    // for i18n
-    static final java.util.ResourceBundle rb =
-        java.util.ResourceBundle.getBundle(
-            "sun.security.tools.policytool.Resources");
-    static final Collator collator = Collator.getInstance();
-    static {
-        // this is for case insensitive string comparisons
-        collator.setStrength(Collator.PRIMARY);
-
-        // Support for Apple menu bar
-        if (System.getProperty("apple.laf.useScreenMenuBar") == null) {
-            System.setProperty("apple.laf.useScreenMenuBar", "true");
-        }
-        System.setProperty("apple.awt.application.name", getMessage("Policy.Tool"));
-
-        // Apply the system L&F if not specified with a system property.
-        if (System.getProperty("swing.defaultlaf") == null) {
-            try {
-                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    // anyone can add warnings
-    Vector<String> warnings;
-    boolean newWarning = false;
-
-    // set to true if policy modified.
-    // this way upon exit we know if to ask the user to save changes
-    boolean modified = false;
-
-    private static final boolean testing = false;
-    private static final Class<?>[] TWOPARAMS = { String.class, String.class };
-    private static final Class<?>[] ONEPARAMS = { String.class };
-    private static final Class<?>[] NOPARAMS  = {};
-    /*
-     * All of the policy entries are read in from the
-     * policy file and stored here.  Updates to the policy entries
-     * using addEntry() and removeEntry() are made here.  To ultimately save
-     * the policy entries back to the policy file, the SavePolicy button
-     * must be clicked.
-     **/
-    private static String policyFileName = null;
-    private Vector<PolicyEntry> policyEntries = null;
-    private PolicyParser parser = null;
-
-    /* The public key alias information is stored here.  */
-    private KeyStore keyStore = null;
-    private String keyStoreName = " ";
-    private String keyStoreType = " ";
-    private String keyStoreProvider = " ";
-    private String keyStorePwdURL = " ";
-
-    /* standard PKCS11 KeyStore type */
-    private static final String P11KEYSTORE = "PKCS11";
-
-    /* reserved word for PKCS11 KeyStores */
-    private static final String NONE = "NONE";
-
-    /**
-     * default constructor
-     */
-    private PolicyTool() {
-        policyEntries = new Vector<PolicyEntry>();
-        parser = new PolicyParser();
-        warnings = new Vector<String>();
-    }
-
-    /**
-     * get the PolicyFileName
-     */
-    String getPolicyFileName() {
-        return policyFileName;
-    }
-
-    /**
-     * set the PolicyFileName
-     */
-    void setPolicyFileName(String policyFileName) {
-        PolicyTool.policyFileName = policyFileName;
-    }
-
-   /**
-    * clear keyStore info
-    */
-    void clearKeyStoreInfo() {
-        this.keyStoreName = null;
-        this.keyStoreType = null;
-        this.keyStoreProvider = null;
-        this.keyStorePwdURL = null;
-
-        this.keyStore = null;
-    }
-
-    /**
-     * get the keyStore URL name
-     */
-    String getKeyStoreName() {
-        return keyStoreName;
-    }
-
-    /**
-     * get the keyStore Type
-     */
-    String getKeyStoreType() {
-        return keyStoreType;
-    }
-
-    /**
-     * get the keyStore Provider
-     */
-    String getKeyStoreProvider() {
-        return keyStoreProvider;
-    }
-
-    /**
-     * get the keyStore password URL
-     */
-    String getKeyStorePwdURL() {
-        return keyStorePwdURL;
-    }
-
-    /**
-     * Open and read a policy file
-     */
-    void openPolicy(String filename) throws FileNotFoundException,
-                                        PolicyParser.ParsingException,
-                                        KeyStoreException,
-                                        CertificateException,
-                                        InstantiationException,
-                                        MalformedURLException,
-                                        IOException,
-                                        NoSuchAlgorithmException,
-                                        IllegalAccessException,
-                                        NoSuchMethodException,
-                                        UnrecoverableKeyException,
-                                        NoSuchProviderException,
-                                        ClassNotFoundException,
-                                        PropertyExpander.ExpandException,
-                                        InvocationTargetException {
-
-        newWarning = false;
-
-        // start fresh - blow away the current state
-        policyEntries = new Vector<PolicyEntry>();
-        parser = new PolicyParser();
-        warnings = new Vector<String>();
-        setPolicyFileName(null);
-        clearKeyStoreInfo();
-
-        // see if user is opening a NEW policy file
-        if (filename == null) {
-            modified = false;
-            return;
-        }
-
-        // Read in the policy entries from the file and
-        // populate the parser vector table.  The parser vector
-        // table only holds the entries as strings, so it only
-        // guarantees that the policies are syntactically
-        // correct.
-        setPolicyFileName(filename);
-        parser.read(new FileReader(filename));
-
-        // open the keystore
-        openKeyStore(parser.getKeyStoreUrl(), parser.getKeyStoreType(),
-                parser.getKeyStoreProvider(), parser.getStorePassURL());
-
-        // Update the local vector with the same policy entries.
-        // This guarantees that the policy entries are not only
-        // syntactically correct, but semantically valid as well.
-        Enumeration<PolicyParser.GrantEntry> enum_ = parser.grantElements();
-        while (enum_.hasMoreElements()) {
-            PolicyParser.GrantEntry ge = enum_.nextElement();
-
-            // see if all the signers have public keys
-            if (ge.signedBy != null) {
-
-                String signers[] = parseSigners(ge.signedBy);
-                for (int i = 0; i < signers.length; i++) {
-                    PublicKey pubKey = getPublicKeyAlias(signers[i]);
-                    if (pubKey == null) {
-                        newWarning = true;
-                        MessageFormat form = new MessageFormat(getMessage
-                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
-                        Object[] source = {signers[i]};
-                        warnings.addElement(form.format(source));
-                    }
-                }
-            }
-
-            // check to see if the Principals are valid
-            ListIterator<PolicyParser.PrincipalEntry> prinList =
-                                                ge.principals.listIterator(0);
-            while (prinList.hasNext()) {
-                PolicyParser.PrincipalEntry pe = prinList.next();
-                try {
-                    verifyPrincipal(pe.getPrincipalClass(),
-                                pe.getPrincipalName());
-                } catch (ClassNotFoundException fnfe) {
-                    newWarning = true;
-                    MessageFormat form = new MessageFormat(getMessage
-                                ("Warning.Class.not.found.class"));
-                    Object[] source = {pe.getPrincipalClass()};
-                    warnings.addElement(form.format(source));
-                }
-            }
-
-            // check to see if the Permissions are valid
-            Enumeration<PolicyParser.PermissionEntry> perms =
-                                                ge.permissionElements();
-            while (perms.hasMoreElements()) {
-                PolicyParser.PermissionEntry pe = perms.nextElement();
-                try {
-                    verifyPermission(pe.permission, pe.name, pe.action);
-                } catch (ClassNotFoundException fnfe) {
-                    newWarning = true;
-                    MessageFormat form = new MessageFormat(getMessage
-                                ("Warning.Class.not.found.class"));
-                    Object[] source = {pe.permission};
-                    warnings.addElement(form.format(source));
-                } catch (InvocationTargetException ite) {
-                    newWarning = true;
-                    MessageFormat form = new MessageFormat(getMessage
-                        ("Warning.Invalid.argument.s.for.constructor.arg"));
-                    Object[] source = {pe.permission};
-                    warnings.addElement(form.format(source));
-                }
-
-                // see if all the permission signers have public keys
-                if (pe.signedBy != null) {
-
-                    String signers[] = parseSigners(pe.signedBy);
-
-                    for (int i = 0; i < signers.length; i++) {
-                        PublicKey pubKey = getPublicKeyAlias(signers[i]);
-                        if (pubKey == null) {
-                            newWarning = true;
-                            MessageFormat form = new MessageFormat(getMessage
-                                ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
-                            Object[] source = {signers[i]};
-                            warnings.addElement(form.format(source));
-                        }
-                    }
-                }
-            }
-            PolicyEntry pEntry = new PolicyEntry(this, ge);
-            policyEntries.addElement(pEntry);
-        }
-
-        // just read in the policy -- nothing has been modified yet
-        modified = false;
-    }
-
-
-    /**
-     * Save a policy to a file
-     */
-    void savePolicy(String filename)
-    throws FileNotFoundException, IOException {
-        // save the policy entries to a file
-        parser.setKeyStoreUrl(keyStoreName);
-        parser.setKeyStoreType(keyStoreType);
-        parser.setKeyStoreProvider(keyStoreProvider);
-        parser.setStorePassURL(keyStorePwdURL);
-        parser.write(new FileWriter(filename));
-        modified = false;
-    }
-
-    /**
-     * Open the KeyStore
-     */
-    void openKeyStore(String name,
-                String type,
-                String provider,
-                String pwdURL) throws   KeyStoreException,
-                                        NoSuchAlgorithmException,
-                                        UnrecoverableKeyException,
-                                        IOException,
-                                        CertificateException,
-                                        NoSuchProviderException,
-                                        ExpandException {
-
-        if (name == null && type == null &&
-            provider == null && pwdURL == null) {
-
-            // policy did not specify a keystore during open
-            // or use wants to reset keystore values
-
-            this.keyStoreName = null;
-            this.keyStoreType = null;
-            this.keyStoreProvider = null;
-            this.keyStorePwdURL = null;
-
-            // caller will set (tool.modified = true) if appropriate
-
-            return;
-        }
-
-        URL policyURL = null;
-        if (policyFileName != null) {
-            File pfile = new File(policyFileName);
-            policyURL = new URL("file:" + pfile.getCanonicalPath());
-        }
-
-        // although PolicyUtil.getKeyStore may properly handle
-        // defaults and property expansion, we do it here so that
-        // if the call is successful, we can set the proper values
-        // (PolicyUtil.getKeyStore does not return expanded values)
-
-        if (name != null && name.length() > 0) {
-            name = PropertyExpander.expand(name).replace
-                                        (File.separatorChar, '/');
-        }
-        if (type == null || type.length() == 0) {
-            type = KeyStore.getDefaultType();
-        }
-        if (pwdURL != null && pwdURL.length() > 0) {
-            pwdURL = PropertyExpander.expand(pwdURL).replace
-                                        (File.separatorChar, '/');
-        }
-
-        try {
-            this.keyStore = PolicyUtil.getKeyStore(policyURL,
-                                                name,
-                                                type,
-                                                provider,
-                                                pwdURL,
-                                                null);
-        } catch (IOException ioe) {
-
-            // copied from sun.security.pkcs11.SunPKCS11
-            String MSG = "no password provided, and no callback handler " +
-                        "available for retrieving password";
-
-            Throwable cause = ioe.getCause();
-            if (cause != null &&
-                cause instanceof javax.security.auth.login.LoginException &&
-                MSG.equals(cause.getMessage())) {
-
-                // throw a more friendly exception message
-                throw new IOException(MSG);
-            } else {
-                throw ioe;
-            }
-        }
-
-        this.keyStoreName = name;
-        this.keyStoreType = type;
-        this.keyStoreProvider = provider;
-        this.keyStorePwdURL = pwdURL;
-
-        // caller will set (tool.modified = true)
-    }
-
-    /**
-     * Add a Grant entry to the overall policy at the specified index.
-     * A policy entry consists of a CodeSource.
-     */
-    boolean addEntry(PolicyEntry pe, int index) {
-
-        if (index < 0) {
-            // new entry -- just add it to the end
-            policyEntries.addElement(pe);
-            parser.add(pe.getGrantEntry());
-        } else {
-            // existing entry -- replace old one
-            PolicyEntry origPe = policyEntries.elementAt(index);
-            parser.replace(origPe.getGrantEntry(), pe.getGrantEntry());
-            policyEntries.setElementAt(pe, index);
-        }
-        return true;
-    }
-
-    /**
-     * Add a Principal entry to an existing PolicyEntry at the specified index.
-     * A Principal entry consists of a class, and name.
-     *
-     * If the principal already exists, it is not added again.
-     */
-    boolean addPrinEntry(PolicyEntry pe,
-                        PolicyParser.PrincipalEntry newPrin,
-                        int index) {
-
-        // first add the principal to the Policy Parser entry
-        PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
-        if (grantEntry.contains(newPrin) == true)
-            return false;
-
-        LinkedList<PolicyParser.PrincipalEntry> prinList =
-                                                grantEntry.principals;
-        if (index != -1)
-            prinList.set(index, newPrin);
-        else
-            prinList.add(newPrin);
-
-        modified = true;
-        return true;
-    }
-
-    /**
-     * Add a Permission entry to an existing PolicyEntry at the specified index.
-     * A Permission entry consists of a permission, name, and actions.
-     *
-     * If the permission already exists, it is not added again.
-     */
-    boolean addPermEntry(PolicyEntry pe,
-                        PolicyParser.PermissionEntry newPerm,
-                        int index) {
-
-        // first add the permission to the Policy Parser Vector
-        PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
-        if (grantEntry.contains(newPerm) == true)
-            return false;
-
-        Vector<PolicyParser.PermissionEntry> permList =
-                                                grantEntry.permissionEntries;
-        if (index != -1)
-            permList.setElementAt(newPerm, index);
-        else
-            permList.addElement(newPerm);
-
-        modified = true;
-        return true;
-    }
-
-    /**
-     * Remove a Permission entry from an existing PolicyEntry.
-     */
-    boolean removePermEntry(PolicyEntry pe,
-                        PolicyParser.PermissionEntry perm) {
-
-        // remove the Permission from the GrantEntry
-        PolicyParser.GrantEntry ppge = pe.getGrantEntry();
-        modified = ppge.remove(perm);
-        return modified;
-    }
-
-    /**
-     * remove an entry from the overall policy
-     */
-    boolean removeEntry(PolicyEntry pe) {
-
-        parser.remove(pe.getGrantEntry());
-        modified = true;
-        return (policyEntries.removeElement(pe));
-    }
-
-    /**
-     * retrieve all Policy Entries
-     */
-    PolicyEntry[] getEntry() {
-
-        if (policyEntries.size() > 0) {
-            PolicyEntry entries[] = new PolicyEntry[policyEntries.size()];
-            for (int i = 0; i < policyEntries.size(); i++)
-                entries[i] = policyEntries.elementAt(i);
-            return entries;
-        }
-        return null;
-    }
-
-    /**
-     * Retrieve the public key mapped to a particular name.
-     * If the key has expired, a KeyException is thrown.
-     */
-    PublicKey getPublicKeyAlias(String name) throws KeyStoreException {
-        if (keyStore == null) {
-            return null;
-        }
-
-        Certificate cert = keyStore.getCertificate(name);
-        if (cert == null) {
-            return null;
-        }
-        PublicKey pubKey = cert.getPublicKey();
-        return pubKey;
-    }
-
-    /**
-     * Retrieve all the alias names stored in the certificate database
-     */
-    String[] getPublicKeyAlias() throws KeyStoreException {
-
-        int numAliases = 0;
-        String aliases[] = null;
-
-        if (keyStore == null) {
-            return null;
-        }
-        Enumeration<String> enum_ = keyStore.aliases();
-
-        // first count the number of elements
-        while (enum_.hasMoreElements()) {
-            enum_.nextElement();
-            numAliases++;
-        }
-
-        if (numAliases > 0) {
-            // now copy them into an array
-            aliases = new String[numAliases];
-            numAliases = 0;
-            enum_ = keyStore.aliases();
-            while (enum_.hasMoreElements()) {
-                aliases[numAliases] = new String(enum_.nextElement());
-                numAliases++;
-            }
-        }
-        return aliases;
-    }
-
-    /**
-     * This method parses a single string of signers separated by commas
-     * ("jordan, duke, pippen") into an array of individual strings.
-     */
-    String[] parseSigners(String signedBy) {
-
-        String signers[] = null;
-        int numSigners = 1;
-        int signedByIndex = 0;
-        int commaIndex = 0;
-        int signerNum = 0;
-
-        // first pass thru "signedBy" counts the number of signers
-        while (commaIndex >= 0) {
-            commaIndex = signedBy.indexOf(',', signedByIndex);
-            if (commaIndex >= 0) {
-                numSigners++;
-                signedByIndex = commaIndex + 1;
-            }
-        }
-        signers = new String[numSigners];
-
-        // second pass thru "signedBy" transfers signers to array
-        commaIndex = 0;
-        signedByIndex = 0;
-        while (commaIndex >= 0) {
-            if ((commaIndex = signedBy.indexOf(',', signedByIndex)) >= 0) {
-                // transfer signer and ignore trailing part of the string
-                signers[signerNum] =
-                        signedBy.substring(signedByIndex, commaIndex).trim();
-                signerNum++;
-                signedByIndex = commaIndex + 1;
-            } else {
-                // we are at the end of the string -- transfer signer
-                signers[signerNum] = signedBy.substring(signedByIndex).trim();
-            }
-        }
-        return signers;
-    }
-
-    /**
-     * Check to see if the Principal contents are OK
-     */
-    void verifyPrincipal(String type, String name)
-        throws ClassNotFoundException,
-               InstantiationException
-    {
-        if (type.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
-            type.equals(PolicyParser.PrincipalEntry.REPLACE_NAME)) {
-            return;
-        }
-        Class<?> PRIN = Class.forName("java.security.Principal");
-        Class<?> pc = Class.forName(type, true,
-                Thread.currentThread().getContextClassLoader());
-        if (!PRIN.isAssignableFrom(pc)) {
-            MessageFormat form = new MessageFormat(getMessage
-                        ("Illegal.Principal.Type.type"));
-            Object[] source = {type};
-            throw new InstantiationException(form.format(source));
-        }
-
-        if (ToolDialog.X500_PRIN_CLASS.equals(pc.getName())) {
-            // PolicyParser checks validity of X500Principal name
-            // - PolicyTool needs to as well so that it doesn't store
-            //   an invalid name that can't be read in later
-            //
-            // this can throw an IllegalArgumentException
-            X500Principal newP = new X500Principal(name);
-        }
-    }
-
-    /**
-     * Check to see if the Permission contents are OK
-     */
-    @SuppressWarnings("fallthrough")
-    void verifyPermission(String type,
-                                    String name,
-                                    String actions)
-        throws ClassNotFoundException,
-               InstantiationException,
-               IllegalAccessException,
-               NoSuchMethodException,
-               InvocationTargetException
-    {
-
-        //XXX we might want to keep a hash of created factories...
-        Class<?> pc = Class.forName(type, true,
-                Thread.currentThread().getContextClassLoader());
-        Constructor<?> c = null;
-        Vector<String> objects = new Vector<>(2);
-        if (name != null) objects.add(name);
-        if (actions != null) objects.add(actions);
-        switch (objects.size()) {
-        case 0:
-            try {
-                c = pc.getConstructor(NOPARAMS);
-                break;
-            } catch (NoSuchMethodException ex) {
-                // proceed to the one-param constructor
-                objects.add(null);
-            }
-            /* fall through */
-        case 1:
-            try {
-                c = pc.getConstructor(ONEPARAMS);
-                break;
-            } catch (NoSuchMethodException ex) {
-                // proceed to the two-param constructor
-                objects.add(null);
-            }
-            /* fall through */
-        case 2:
-            c = pc.getConstructor(TWOPARAMS);
-            break;
-        }
-        Object parameters[] = objects.toArray();
-        Permission p = (Permission)c.newInstance(parameters);
-    }
-
-    /*
-     * Parse command line arguments.
-     */
-    static void parseArgs(String args[]) {
-        /* parse flags */
-        int n = 0;
-
-        for (n=0; (n < args.length) && args[n].startsWith("-"); n++) {
-
-            String flags = args[n];
-
-            if (collator.compare(flags, "-file") == 0) {
-                if (++n == args.length) usage();
-                policyFileName = args[n];
-            } else {
-                MessageFormat form = new MessageFormat(getMessage
-                                ("Illegal.option.option"));
-                Object[] source = { flags };
-                System.err.println(form.format(source));
-                usage();
-            }
-        }
-    }
-
-    static void usage() {
-        System.out.println(getMessage("Usage.policytool.options."));
-        System.out.println();
-        System.out.println(getMessage
-                (".file.file.policy.file.location"));
-        System.out.println();
-
-        System.exit(1);
-    }
-
-    /**
-     * run the PolicyTool
-     */
-    public static void main(String args[]) {
-        parseArgs(args);
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                ToolWindow tw = new ToolWindow(new PolicyTool());
-                tw.displayToolWindow(args);
-            }
-        });
-    }
-
-    // split instr to words according to capitalization,
-    // like, AWTControl -> A W T Control
-    // this method is for easy pronounciation
-    static String splitToWords(String instr) {
-        return instr.replaceAll("([A-Z])", " $1");
-    }
-
-    /**
-     * Returns the message corresponding to the key in the bundle.
-     * This is preferred over {@link #getString} because it removes
-     * any mnemonic '&' character in the string.
-     *
-     * @param key the key
-     *
-     * @return the message
-     */
-    static String getMessage(String key) {
-        return removeMnemonicAmpersand(rb.getString(key));
-    }
-
-
-    /**
-     * Returns the mnemonic for a message.
-     *
-     * @param key the key
-     *
-     * @return the mnemonic <code>int</code>
-     */
-    static int getMnemonicInt(String key) {
-        String message = rb.getString(key);
-        return (findMnemonicInt(message));
-    }
-
-    /**
-     * Returns the mnemonic display index for a message.
-     *
-     * @param key the key
-     *
-     * @return the mnemonic display index
-     */
-    static int getDisplayedMnemonicIndex(String key) {
-        String message = rb.getString(key);
-        return (findMnemonicIndex(message));
-    }
-
-    /**
-     * Finds the mnemonic character in a message.
-     *
-     * The mnemonic character is the first character followed by the first
-     * <code>&</code> that is not followed by another <code>&</code>.
-     *
-     * @return the mnemonic as an <code>int</code>, or <code>0</code> if it
-     *         can't be found.
-     */
-    private static int findMnemonicInt(String s) {
-        for (int i = 0; i < s.length() - 1; i++) {
-            if (s.charAt(i) == '&') {
-                if (s.charAt(i + 1) != '&') {
-                    return KeyEvent.getExtendedKeyCodeForChar(s.charAt(i + 1));
-                } else {
-                    i++;
-                }
-            }
-        }
-        return 0;
-    }
-
-    /**
-     * Finds the index of the mnemonic character in a message.
-     *
-     * The mnemonic character is the first character followed by the first
-     * <code>&</code> that is not followed by another <code>&</code>.
-     *
-     * @return the mnemonic character index as an <code>int</code>, or <code>-1</code> if it
-     *         can't be found.
-     */
-    private static int findMnemonicIndex(String s) {
-        for (int i = 0; i < s.length() - 1; i++) {
-            if (s.charAt(i) == '&') {
-                if (s.charAt(i + 1) != '&') {
-                    // Return the index of the '&' since it will be removed
-                    return i;
-                } else {
-                    i++;
-                }
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Removes the mnemonic identifier (<code>&</code>) from a string unless
-     * it's escaped by <code>&&</code> or placed at the end.
-     *
-     * @param message the message
-     *
-     * @return a message with the mnemonic identifier removed
-     */
-    private static String removeMnemonicAmpersand(String message) {
-        StringBuilder s = new StringBuilder();
-        for (int i = 0; i < message.length(); i++) {
-            char current = message.charAt(i);
-            if (current != '&' || i == message.length() - 1
-                    || message.charAt(i + 1) == '&') {
-                s.append(current);
-            }
-        }
-        return s.toString();
-    }
-}
-
-/**
- * Each entry in the policy configuration file is represented by a
- * PolicyEntry object.
- *
- * A PolicyEntry is a (CodeSource,Permission) pair.  The
- * CodeSource contains the (URL, PublicKey) that together identify
- * where the Java bytecodes come from and who (if anyone) signed
- * them.  The URL could refer to localhost.  The URL could also be
- * null, meaning that this policy entry is given to all comers, as
- * long as they match the signer field.  The signer could be null,
- * meaning the code is not signed.
- *
- * The Permission contains the (Type, Name, Action) triplet.
- *
- */
-class PolicyEntry {
-
-    private CodeSource codesource;
-    private PolicyTool tool;
-    private PolicyParser.GrantEntry grantEntry;
-    private boolean testing = false;
-
-    /**
-     * Create a PolicyEntry object from the information read in
-     * from a policy file.
-     */
-    PolicyEntry(PolicyTool tool, PolicyParser.GrantEntry ge)
-    throws MalformedURLException, NoSuchMethodException,
-    ClassNotFoundException, InstantiationException, IllegalAccessException,
-    InvocationTargetException, CertificateException,
-    IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
-
-        this.tool = tool;
-
-        URL location = null;
-
-        // construct the CodeSource
-        if (ge.codeBase != null)
-            location = new URL(ge.codeBase);
-        this.codesource = new CodeSource(location,
-            (java.security.cert.Certificate[]) null);
-
-        if (testing) {
-            System.out.println("Adding Policy Entry:");
-            System.out.println("    CodeBase = " + location);
-            System.out.println("    Signers = " + ge.signedBy);
-            System.out.println("    with " + ge.principals.size() +
-                    " Principals");
-        }
-
-        this.grantEntry = ge;
-    }
-
-    /**
-     * get the codesource associated with this PolicyEntry
-     */
-    CodeSource getCodeSource() {
-        return codesource;
-    }
-
-    /**
-     * get the GrantEntry associated with this PolicyEntry
-     */
-    PolicyParser.GrantEntry getGrantEntry() {
-        return grantEntry;
-    }
-
-    /**
-     * convert the header portion, i.e. codebase, signer, principals, of
-     * this policy entry into a string
-     */
-    String headerToString() {
-        String pString = principalsToString();
-        if (pString.length() == 0) {
-            return codebaseToString();
-        } else {
-            return codebaseToString() + ", " + pString;
-        }
-    }
-
-    /**
-     * convert the Codebase/signer portion of this policy entry into a string
-     */
-    String codebaseToString() {
-
-        String stringEntry = new String();
-
-        if (grantEntry.codeBase != null &&
-            grantEntry.codeBase.equals("") == false)
-            stringEntry = stringEntry.concat
-                                ("CodeBase \"" +
-                                grantEntry.codeBase +
-                                "\"");
-
-        if (grantEntry.signedBy != null &&
-            grantEntry.signedBy.equals("") == false)
-            stringEntry = ((stringEntry.length() > 0) ?
-                stringEntry.concat(", SignedBy \"" +
-                                grantEntry.signedBy +
-                                "\"") :
-                stringEntry.concat("SignedBy \"" +
-                                grantEntry.signedBy +
-                                "\""));
-
-        if (stringEntry.length() == 0)
-            return new String("CodeBase <ALL>");
-        return stringEntry;
-    }
-
-    /**
-     * convert the Principals portion of this policy entry into a string
-     */
-    String principalsToString() {
-        String result = "";
-        if ((grantEntry.principals != null) &&
-            (!grantEntry.principals.isEmpty())) {
-            StringBuilder sb = new StringBuilder(200);
-            ListIterator<PolicyParser.PrincipalEntry> list =
-                                grantEntry.principals.listIterator();
-            while (list.hasNext()) {
-                PolicyParser.PrincipalEntry pppe = list.next();
-                sb.append(" Principal ").append(pppe.getDisplayClass())
-                        .append(' ')
-                        .append(pppe.getDisplayName(true));
-                if (list.hasNext()) sb.append(", ");
-            }
-            result = sb.toString();
-        }
-        return result;
-    }
-
-    /**
-     * convert this policy entry into a PolicyParser.PermissionEntry
-     */
-    PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
-
-        String actions = null;
-
-        // get the actions
-        if (perm.getActions() != null &&
-            perm.getActions().trim() != "")
-                actions = perm.getActions();
-
-        PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry
-                        (perm.getClass().getName(),
-                        perm.getName(),
-                        actions);
-        return pe;
-    }
-}
-
-/**
- * The main window for the PolicyTool
- */
-class ToolWindow extends JFrame {
-    // use serialVersionUID from JDK 1.2.2 for interoperability
-    private static final long serialVersionUID = 5682568601210376777L;
-
-    /* ESCAPE key */
-    static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
-
-    /* external paddings */
-    public static final Insets TOP_PADDING = new Insets(25,0,0,0);
-    public static final Insets BOTTOM_PADDING = new Insets(0,0,25,0);
-    public static final Insets LITE_BOTTOM_PADDING = new Insets(0,0,10,0);
-    public static final Insets LR_PADDING = new Insets(0,10,0,10);
-    public static final Insets TOP_BOTTOM_PADDING = new Insets(15, 0, 15, 0);
-    public static final Insets L_TOP_BOTTOM_PADDING = new Insets(5,10,15,0);
-    public static final Insets LR_TOP_BOTTOM_PADDING = new Insets(15, 4, 15, 4);
-    public static final Insets LR_BOTTOM_PADDING = new Insets(0,10,5,10);
-    public static final Insets L_BOTTOM_PADDING = new Insets(0,10,5,0);
-    public static final Insets R_BOTTOM_PADDING = new Insets(0, 0, 25, 5);
-    public static final Insets R_PADDING = new Insets(0, 0, 0, 5);
-
-    /* buttons and menus */
-    public static final String NEW_POLICY_FILE          = "New";
-    public static final String OPEN_POLICY_FILE         = "Open";
-    public static final String SAVE_POLICY_FILE         = "Save";
-    public static final String SAVE_AS_POLICY_FILE      = "Save.As";
-    public static final String VIEW_WARNINGS            = "View.Warning.Log";
-    public static final String QUIT                     = "Exit";
-    public static final String ADD_POLICY_ENTRY         = "Add.Policy.Entry";
-    public static final String EDIT_POLICY_ENTRY        = "Edit.Policy.Entry";
-    public static final String REMOVE_POLICY_ENTRY      = "Remove.Policy.Entry";
-    public static final String EDIT_KEYSTORE            = "Edit";
-    public static final String ADD_PUBKEY_ALIAS         = "Add.Public.Key.Alias";
-    public static final String REMOVE_PUBKEY_ALIAS      = "Remove.Public.Key.Alias";
-
-    /* gridbag index for components in the main window (MW) */
-    public static final int MW_FILENAME_LABEL           = 0;
-    public static final int MW_FILENAME_TEXTFIELD       = 1;
-    public static final int MW_PANEL                    = 2;
-    public static final int MW_ADD_BUTTON               = 0;
-    public static final int MW_EDIT_BUTTON              = 1;
-    public static final int MW_REMOVE_BUTTON            = 2;
-    public static final int MW_POLICY_LIST              = 3; // follows MW_PANEL
-
-    /* The preferred height of JTextField should match JComboBox. */
-    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
-
-    private PolicyTool tool;
-
-    /**
-     * Constructor
-     */
-    ToolWindow(PolicyTool tool) {
-        this.tool = tool;
-    }
-
-    /**
-     * Don't call getComponent directly on the window
-     */
-    public Component getComponent(int n) {
-        Component c = getContentPane().getComponent(n);
-        if (c instanceof JScrollPane) {
-            c = ((JScrollPane)c).getViewport().getView();
-        }
-        return c;
-    }
-
-    /**
-     * Initialize the PolicyTool window with the necessary components
-     */
-    private void initWindow() {
-        // The ToolWindowListener will handle closing the window.
-        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-
-        // create the top menu bar
-        JMenuBar menuBar = new JMenuBar();
-
-        // create a File menu
-        JMenu menu = new JMenu();
-        configureButton(menu, "File");
-        ActionListener actionListener = new FileMenuListener(tool, this);
-        addMenuItem(menu, NEW_POLICY_FILE, actionListener, "N");
-        addMenuItem(menu, OPEN_POLICY_FILE, actionListener, "O");
-        addMenuItem(menu, SAVE_POLICY_FILE, actionListener, "S");
-        addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener, null);
-        addMenuItem(menu, VIEW_WARNINGS, actionListener, null);
-        addMenuItem(menu, QUIT, actionListener, null);
-        menuBar.add(menu);
-
-        // create a KeyStore menu
-        menu = new JMenu();
-        configureButton(menu, "KeyStore");
-        actionListener = new MainWindowListener(tool, this);
-        addMenuItem(menu, EDIT_KEYSTORE, actionListener, null);
-        menuBar.add(menu);
-        setJMenuBar(menuBar);
-
-        // Create some space around components
-        ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
-
-        // policy entry listing
-        JLabel label = new JLabel(PolicyTool.getMessage("Policy.File."));
-        addNewComponent(this, label, MW_FILENAME_LABEL,
-                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        LR_TOP_BOTTOM_PADDING);
-        JTextField tf = new JTextField(50);
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Policy.File."));
-        tf.setEditable(false);
-        addNewComponent(this, tf, MW_FILENAME_TEXTFIELD,
-                        1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        LR_TOP_BOTTOM_PADDING);
-
-
-        // add ADD/REMOVE/EDIT buttons in a new panel
-        JPanel panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        JButton button = new JButton();
-        configureButton(button, ADD_POLICY_ENTRY);
-        button.addActionListener(new MainWindowListener(tool, this));
-        addNewComponent(panel, button, MW_ADD_BUTTON,
-                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        LR_PADDING);
-
-        button = new JButton();
-        configureButton(button, EDIT_POLICY_ENTRY);
-        button.addActionListener(new MainWindowListener(tool, this));
-        addNewComponent(panel, button, MW_EDIT_BUTTON,
-                        1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        LR_PADDING);
-
-        button = new JButton();
-        configureButton(button, REMOVE_POLICY_ENTRY);
-        button.addActionListener(new MainWindowListener(tool, this));
-        addNewComponent(panel, button, MW_REMOVE_BUTTON,
-                        2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        LR_PADDING);
-
-        addNewComponent(this, panel, MW_PANEL,
-                        0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        BOTTOM_PADDING);
-
-
-        String policyFile = tool.getPolicyFileName();
-        if (policyFile == null) {
-            String userHome;
-            userHome = java.security.AccessController.doPrivileged(
-                (PrivilegedAction<String>) () -> System.getProperty("user.home"));
-            policyFile = userHome + File.separatorChar + ".java.policy";
-        }
-
-        try {
-            // open the policy file
-            tool.openPolicy(policyFile);
-
-            // display the policy entries via the policy list textarea
-            DefaultListModel<String> listModel = new DefaultListModel<>();
-            JList<String> list = new JList<>(listModel);
-            list.setVisibleRowCount(15);
-            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-            list.addMouseListener(new PolicyListListener(tool, this));
-            PolicyEntry entries[] = tool.getEntry();
-            if (entries != null) {
-                for (int i = 0; i < entries.length; i++) {
-                    listModel.addElement(entries[i].headerToString());
-                }
-            }
-            JTextField newFilename = (JTextField)
-                                getComponent(MW_FILENAME_TEXTFIELD);
-            newFilename.setText(policyFile);
-            initPolicyList(list);
-
-        } catch (FileNotFoundException fnfe) {
-            // add blank policy listing
-            JList<String> list = new JList<>(new DefaultListModel<>());
-            list.setVisibleRowCount(15);
-            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-            list.addMouseListener(new PolicyListListener(tool, this));
-            initPolicyList(list);
-            tool.setPolicyFileName(null);
-            tool.modified = false;
-
-            // just add warning
-            tool.warnings.addElement(fnfe.toString());
-
-        } catch (Exception e) {
-            // add blank policy listing
-            JList<String> list = new JList<>(new DefaultListModel<>());
-            list.setVisibleRowCount(15);
-            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-            list.addMouseListener(new PolicyListListener(tool, this));
-            initPolicyList(list);
-            tool.setPolicyFileName(null);
-            tool.modified = false;
-
-            // display the error
-            MessageFormat form = new MessageFormat(PolicyTool.getMessage
-                ("Could.not.open.policy.file.policyFile.e.toString."));
-            Object[] source = {policyFile, e.toString()};
-            displayErrorDialog(null, form.format(source));
-        }
-    }
-
-
-    // Platform specific modifier (control / command).
-    private int shortCutModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
-
-    private void addMenuItem(JMenu menu, String key, ActionListener actionListener, String accelerator) {
-        JMenuItem menuItem = new JMenuItem();
-        configureButton(menuItem, key);
-
-        if (PolicyTool.rb.containsKey(key + ".accelerator")) {
-            // Accelerator from resources takes precedence
-            accelerator = PolicyTool.getMessage(key + ".accelerator");
-        }
-
-        if (accelerator != null && !accelerator.isEmpty()) {
-            KeyStroke keyStroke;
-            if (accelerator.length() == 1) {
-                keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(0)),
-                                                   shortCutModifier);
-            } else {
-                keyStroke = KeyStroke.getKeyStroke(accelerator);
-            }
-            menuItem.setAccelerator(keyStroke);
-        }
-
-        menuItem.addActionListener(actionListener);
-        menu.add(menuItem);
-    }
-
-    static void configureButton(AbstractButton button, String key) {
-        button.setText(PolicyTool.getMessage(key));
-        button.setActionCommand(key);
-
-        int mnemonicInt = PolicyTool.getMnemonicInt(key);
-        if (mnemonicInt > 0) {
-            button.setMnemonic(mnemonicInt);
-            button.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
-         }
-    }
-
-    static void configureLabelFor(JLabel label, JComponent component, String key) {
-        label.setText(PolicyTool.getMessage(key));
-        label.setLabelFor(component);
-
-        int mnemonicInt = PolicyTool.getMnemonicInt(key);
-        if (mnemonicInt > 0) {
-            label.setDisplayedMnemonic(mnemonicInt);
-            label.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
-         }
-    }
-
-
-    /**
-     * Add a component to the PolicyTool window
-     */
-    void addNewComponent(Container container, JComponent component,
-        int index, int gridx, int gridy, int gridwidth, int gridheight,
-        double weightx, double weighty, int fill, Insets is) {
-
-        if (container instanceof JFrame) {
-            container = ((JFrame)container).getContentPane();
-        } else if (container instanceof JDialog) {
-            container = ((JDialog)container).getContentPane();
-        }
-
-        // add the component at the specified gridbag index
-        container.add(component, index);
-
-        // set the constraints
-        GridBagLayout gbl = (GridBagLayout)container.getLayout();
-        GridBagConstraints gbc = new GridBagConstraints();
-        gbc.gridx = gridx;
-        gbc.gridy = gridy;
-        gbc.gridwidth = gridwidth;
-        gbc.gridheight = gridheight;
-        gbc.weightx = weightx;
-        gbc.weighty = weighty;
-        gbc.fill = fill;
-        if (is != null) gbc.insets = is;
-        gbl.setConstraints(component, gbc);
-    }
-
-
-    /**
-     * Add a component to the PolicyTool window without external padding
-     */
-    void addNewComponent(Container container, JComponent component,
-        int index, int gridx, int gridy, int gridwidth, int gridheight,
-        double weightx, double weighty, int fill) {
-
-        // delegate with "null" external padding
-        addNewComponent(container, component, index, gridx, gridy,
-                        gridwidth, gridheight, weightx, weighty,
-                        fill, null);
-    }
-
-
-    /**
-     * Init the policy_entry_list TEXTAREA component in the
-     * PolicyTool window
-     */
-    void initPolicyList(JList<String> policyList) {
-
-        // add the policy list to the window
-        //policyList.setPreferredSize(new Dimension(500, 350));
-        JScrollPane scrollPane = new JScrollPane(policyList);
-        addNewComponent(this, scrollPane, MW_POLICY_LIST,
-                        0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH);
-    }
-
-    /**
-     * Replace the policy_entry_list TEXTAREA component in the
-     * PolicyTool window with an updated one.
-     */
-    void replacePolicyList(JList<String> policyList) {
-
-        // remove the original list of Policy Entries
-        // and add the new list of entries
-        @SuppressWarnings("unchecked")
-        JList<String> list = (JList<String>)getComponent(MW_POLICY_LIST);
-        list.setModel(policyList.getModel());
-    }
-
-    /**
-     * display the main PolicyTool window
-     */
-    void displayToolWindow(String args[]) {
-
-        setTitle(PolicyTool.getMessage("Policy.Tool"));
-        setResizable(true);
-        addWindowListener(new ToolWindowListener(tool, this));
-        //setBounds(135, 80, 500, 500);
-        getContentPane().setLayout(new GridBagLayout());
-
-        initWindow();
-        pack();
-        setLocationRelativeTo(null);
-
-        // display it
-        setVisible(true);
-
-        if (tool.newWarning == true) {
-            displayStatusDialog(this, PolicyTool.getMessage
-                ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
-        }
-    }
-
-    /**
-     * displays a dialog box describing an error which occurred.
-     */
-    void displayErrorDialog(Window w, String error) {
-        ToolDialog ed = new ToolDialog
-                (PolicyTool.getMessage("Error"), tool, this, true);
-
-        // find where the PolicyTool gui is
-        Point location = ((w == null) ?
-                getLocationOnScreen() : w.getLocationOnScreen());
-        //ed.setBounds(location.x + 50, location.y + 50, 600, 100);
-        ed.setLayout(new GridBagLayout());
-
-        JLabel label = new JLabel(error);
-        addNewComponent(ed, label, 0,
-                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        ActionListener okListener = new ErrorOKButtonListener(ed);
-        okButton.addActionListener(okListener);
-        addNewComponent(ed, okButton, 1,
-                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-        ed.getRootPane().setDefaultButton(okButton);
-        ed.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        ed.pack();
-        ed.setLocationRelativeTo(w);
-        ed.setVisible(true);
-    }
-
-    /**
-     * displays a dialog box describing an error which occurred.
-     */
-    void displayErrorDialog(Window w, Throwable t) {
-        if (t instanceof NoDisplayException) {
-            return;
-        }
-        if (t.getClass() == Exception.class) {
-            // Exception is usually thrown inside policytool for user
-            // interaction error. There is no need to show the type.
-            displayErrorDialog(w, t.getLocalizedMessage());
-        } else {
-            displayErrorDialog(w, t.toString());
-        }
-    }
-
-    /**
-     * displays a dialog box describing the status of an event
-     */
-    void displayStatusDialog(Window w, String status) {
-        ToolDialog sd = new ToolDialog
-                (PolicyTool.getMessage("Status"), tool, this, true);
-
-        // find the location of the PolicyTool gui
-        Point location = ((w == null) ?
-                getLocationOnScreen() : w.getLocationOnScreen());
-        //sd.setBounds(location.x + 50, location.y + 50, 500, 100);
-        sd.setLayout(new GridBagLayout());
-
-        JLabel label = new JLabel(status);
-        addNewComponent(sd, label, 0,
-                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        ActionListener okListener = new StatusOKButtonListener(sd);
-        okButton.addActionListener(okListener);
-        addNewComponent(sd, okButton, 1,
-                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-        sd.getRootPane().setDefaultButton(okButton);
-        sd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        sd.pack();
-        sd.setLocationRelativeTo(w);
-        sd.setVisible(true);
-    }
-
-    /**
-     * display the warning log
-     */
-    void displayWarningLog(Window w) {
-
-        ToolDialog wd = new ToolDialog
-                (PolicyTool.getMessage("Warning"), tool, this, true);
-
-        // find the location of the PolicyTool gui
-        Point location = ((w == null) ?
-                getLocationOnScreen() : w.getLocationOnScreen());
-        //wd.setBounds(location.x + 50, location.y + 50, 500, 100);
-        wd.setLayout(new GridBagLayout());
-
-        JTextArea ta = new JTextArea();
-        ta.setEditable(false);
-        for (int i = 0; i < tool.warnings.size(); i++) {
-            ta.append(tool.warnings.elementAt(i));
-            ta.append(PolicyTool.getMessage("NEWLINE"));
-        }
-        addNewComponent(wd, ta, 0,
-                        0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                        BOTTOM_PADDING);
-        ta.setFocusable(false);
-
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        ActionListener okListener = new CancelButtonListener(wd);
-        okButton.addActionListener(okListener);
-        addNewComponent(wd, okButton, 1,
-                        0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                        LR_PADDING);
-
-        wd.getRootPane().setDefaultButton(okButton);
-        wd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        wd.pack();
-        wd.setLocationRelativeTo(w);
-        wd.setVisible(true);
-    }
-
-    char displayYesNoDialog(Window w, String title, String prompt, String yes, String no) {
-
-        final ToolDialog tw = new ToolDialog
-                (title, tool, this, true);
-        Point location = ((w == null) ?
-                getLocationOnScreen() : w.getLocationOnScreen());
-        //tw.setBounds(location.x + 75, location.y + 100, 400, 150);
-        tw.setLayout(new GridBagLayout());
-
-        JTextArea ta = new JTextArea(prompt, 10, 50);
-        ta.setEditable(false);
-        ta.setLineWrap(true);
-        ta.setWrapStyleWord(true);
-        JScrollPane scrollPane = new JScrollPane(ta,
-                                                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
-                                                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-        addNewComponent(tw, scrollPane, 0,
-                0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-        ta.setFocusable(false);
-
-        JPanel panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        // StringBuffer to store button press. Must be final.
-        final StringBuffer chooseResult = new StringBuffer();
-
-        JButton button = new JButton(yes);
-        button.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                chooseResult.append('Y');
-                tw.setVisible(false);
-                tw.dispose();
-            }
-        });
-        addNewComponent(panel, button, 0,
-                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           LR_PADDING);
-
-        button = new JButton(no);
-        button.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                chooseResult.append('N');
-                tw.setVisible(false);
-                tw.dispose();
-            }
-        });
-        addNewComponent(panel, button, 1,
-                           1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           LR_PADDING);
-
-        addNewComponent(tw, panel, 1,
-                0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-        tw.pack();
-        tw.setLocationRelativeTo(w);
-        tw.setVisible(true);
-        if (chooseResult.length() > 0) {
-            return chooseResult.charAt(0);
-        } else {
-            // I did encounter this once, don't why.
-            return 'N';
-        }
-    }
-
-}
-
-/**
- * General dialog window
- */
-class ToolDialog extends JDialog {
-    // use serialVersionUID from JDK 1.2.2 for interoperability
-    private static final long serialVersionUID = -372244357011301190L;
-
-    /* ESCAPE key */
-    static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
-
-    /* necessary constants */
-    public static final int NOACTION            = 0;
-    public static final int QUIT                = 1;
-    public static final int NEW                 = 2;
-    public static final int OPEN                = 3;
-
-    public static final String ALL_PERM_CLASS   =
-                "java.security.AllPermission";
-    public static final String FILE_PERM_CLASS  =
-                "java.io.FilePermission";
-
-    public static final String X500_PRIN_CLASS         =
-                "javax.security.auth.x500.X500Principal";
-
-    /* popup menus */
-    public static final String PERM             =
-        PolicyTool.getMessage
-        ("Permission.");
-
-    public static final String PRIN_TYPE        =
-        PolicyTool.getMessage("Principal.Type.");
-    public static final String PRIN_NAME        =
-        PolicyTool.getMessage("Principal.Name.");
-
-    /* more popu menus */
-    public static final String PERM_NAME        =
-        PolicyTool.getMessage
-        ("Target.Name.");
-
-    /* and more popup menus */
-    public static final String PERM_ACTIONS             =
-      PolicyTool.getMessage
-      ("Actions.");
-
-    /* gridbag index for display PolicyEntry (PE) components */
-    public static final int PE_CODEBASE_LABEL           = 0;
-    public static final int PE_CODEBASE_TEXTFIELD       = 1;
-    public static final int PE_SIGNEDBY_LABEL           = 2;
-    public static final int PE_SIGNEDBY_TEXTFIELD       = 3;
-
-    public static final int PE_PANEL0                   = 4;
-    public static final int PE_ADD_PRIN_BUTTON          = 0;
-    public static final int PE_EDIT_PRIN_BUTTON         = 1;
-    public static final int PE_REMOVE_PRIN_BUTTON       = 2;
-
-    public static final int PE_PRIN_LABEL               = 5;
-    public static final int PE_PRIN_LIST                = 6;
-
-    public static final int PE_PANEL1                   = 7;
-    public static final int PE_ADD_PERM_BUTTON          = 0;
-    public static final int PE_EDIT_PERM_BUTTON         = 1;
-    public static final int PE_REMOVE_PERM_BUTTON       = 2;
-
-    public static final int PE_PERM_LIST                = 8;
-
-    public static final int PE_PANEL2                   = 9;
-    public static final int PE_CANCEL_BUTTON            = 1;
-    public static final int PE_DONE_BUTTON              = 0;
-
-    /* the gridbag index for components in the Principal Dialog (PRD) */
-    public static final int PRD_DESC_LABEL              = 0;
-    public static final int PRD_PRIN_CHOICE             = 1;
-    public static final int PRD_PRIN_TEXTFIELD          = 2;
-    public static final int PRD_NAME_LABEL              = 3;
-    public static final int PRD_NAME_TEXTFIELD          = 4;
-    public static final int PRD_CANCEL_BUTTON           = 6;
-    public static final int PRD_OK_BUTTON               = 5;
-
-    /* the gridbag index for components in the Permission Dialog (PD) */
-    public static final int PD_DESC_LABEL               = 0;
-    public static final int PD_PERM_CHOICE              = 1;
-    public static final int PD_PERM_TEXTFIELD           = 2;
-    public static final int PD_NAME_CHOICE              = 3;
-    public static final int PD_NAME_TEXTFIELD           = 4;
-    public static final int PD_ACTIONS_CHOICE           = 5;
-    public static final int PD_ACTIONS_TEXTFIELD        = 6;
-    public static final int PD_SIGNEDBY_LABEL           = 7;
-    public static final int PD_SIGNEDBY_TEXTFIELD       = 8;
-    public static final int PD_CANCEL_BUTTON            = 10;
-    public static final int PD_OK_BUTTON                = 9;
-
-    /* modes for KeyStore */
-    public static final int EDIT_KEYSTORE               = 0;
-
-    /* the gridbag index for components in the Change KeyStore Dialog (KSD) */
-    public static final int KSD_NAME_LABEL              = 0;
-    public static final int KSD_NAME_TEXTFIELD          = 1;
-    public static final int KSD_TYPE_LABEL              = 2;
-    public static final int KSD_TYPE_TEXTFIELD          = 3;
-    public static final int KSD_PROVIDER_LABEL          = 4;
-    public static final int KSD_PROVIDER_TEXTFIELD      = 5;
-    public static final int KSD_PWD_URL_LABEL           = 6;
-    public static final int KSD_PWD_URL_TEXTFIELD       = 7;
-    public static final int KSD_CANCEL_BUTTON           = 9;
-    public static final int KSD_OK_BUTTON               = 8;
-
-    /* the gridbag index for components in the User Save Changes Dialog (USC) */
-    public static final int USC_LABEL                   = 0;
-    public static final int USC_PANEL                   = 1;
-    public static final int USC_YES_BUTTON              = 0;
-    public static final int USC_NO_BUTTON               = 1;
-    public static final int USC_CANCEL_BUTTON           = 2;
-
-    /* gridbag index for the ConfirmRemovePolicyEntryDialog (CRPE) */
-    public static final int CRPE_LABEL1                 = 0;
-    public static final int CRPE_LABEL2                 = 1;
-    public static final int CRPE_PANEL                  = 2;
-    public static final int CRPE_PANEL_OK               = 0;
-    public static final int CRPE_PANEL_CANCEL           = 1;
-
-    /* some private static finals */
-    private static final int PERMISSION                 = 0;
-    private static final int PERMISSION_NAME            = 1;
-    private static final int PERMISSION_ACTIONS         = 2;
-    private static final int PERMISSION_SIGNEDBY        = 3;
-    private static final int PRINCIPAL_TYPE             = 4;
-    private static final int PRINCIPAL_NAME             = 5;
-
-    /* The preferred height of JTextField should match JComboBox. */
-    static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
-
-    public static java.util.ArrayList<Perm> PERM_ARRAY;
-    public static java.util.ArrayList<Prin> PRIN_ARRAY;
-    PolicyTool tool;
-    ToolWindow tw;
-
-    static {
-
-        // set up permission objects
-
-        PERM_ARRAY = new java.util.ArrayList<Perm>();
-        PERM_ARRAY.add(new AllPerm());
-        PERM_ARRAY.add(new AudioPerm());
-        PERM_ARRAY.add(new AuthPerm());
-        PERM_ARRAY.add(new AWTPerm());
-        PERM_ARRAY.add(new DelegationPerm());
-        PERM_ARRAY.add(new FilePerm());
-        PERM_ARRAY.add(new URLPerm());
-        PERM_ARRAY.add(new InqSecContextPerm());
-        PERM_ARRAY.add(new LogPerm());
-        PERM_ARRAY.add(new MgmtPerm());
-        PERM_ARRAY.add(new MBeanPerm());
-        PERM_ARRAY.add(new MBeanSvrPerm());
-        PERM_ARRAY.add(new MBeanTrustPerm());
-        PERM_ARRAY.add(new NetPerm());
-        PERM_ARRAY.add(new NetworkPerm());
-        PERM_ARRAY.add(new PrivCredPerm());
-        PERM_ARRAY.add(new PropPerm());
-        PERM_ARRAY.add(new ReflectPerm());
-        PERM_ARRAY.add(new RuntimePerm());
-        PERM_ARRAY.add(new SecurityPerm());
-        PERM_ARRAY.add(new SerialPerm());
-        PERM_ARRAY.add(new ServicePerm());
-        PERM_ARRAY.add(new SocketPerm());
-        PERM_ARRAY.add(new SQLPerm());
-        PERM_ARRAY.add(new SSLPerm());
-        PERM_ARRAY.add(new SubjDelegPerm());
-
-        // set up principal objects
-
-        PRIN_ARRAY = new java.util.ArrayList<Prin>();
-        PRIN_ARRAY.add(new KrbPrin());
-        PRIN_ARRAY.add(new X500Prin());
-    }
-
-    ToolDialog(String title, PolicyTool tool, ToolWindow tw, boolean modal) {
-        super(tw, modal);
-        setTitle(title);
-        this.tool = tool;
-        this.tw = tw;
-        addWindowListener(new ChildWindowListener(this));
-
-        // Create some space around components
-        ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
-    }
-
-    /**
-     * Don't call getComponent directly on the window
-     */
-    public Component getComponent(int n) {
-        Component c = getContentPane().getComponent(n);
-        if (c instanceof JScrollPane) {
-            c = ((JScrollPane)c).getViewport().getView();
-        }
-        return c;
-    }
-
-    /**
-     * get the Perm instance based on either the (shortened) class name
-     * or the fully qualified class name
-     */
-    static Perm getPerm(String clazz, boolean fullClassName) {
-        for (int i = 0; i < PERM_ARRAY.size(); i++) {
-            Perm next = PERM_ARRAY.get(i);
-            if (fullClassName) {
-                if (next.FULL_CLASS.equals(clazz)) {
-                    return next;
-                }
-            } else {
-                if (next.CLASS.equals(clazz)) {
-                    return next;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * get the Prin instance based on either the (shortened) class name
-     * or the fully qualified class name
-     */
-    static Prin getPrin(String clazz, boolean fullClassName) {
-        for (int i = 0; i < PRIN_ARRAY.size(); i++) {
-            Prin next = PRIN_ARRAY.get(i);
-            if (fullClassName) {
-                if (next.FULL_CLASS.equals(clazz)) {
-                    return next;
-                }
-            } else {
-                if (next.CLASS.equals(clazz)) {
-                    return next;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * pop up a dialog so the user can enter info to add a new PolicyEntry
-     * - if edit is TRUE, then the user is editing an existing entry
-     *   and we should display the original info as well.
-     *
-     * - the other reason we need the 'edit' boolean is we need to know
-     *   when we are adding a NEW policy entry.  in this case, we can
-     *   not simply update the existing entry, because it doesn't exist.
-     *   we ONLY update the GUI listing/info, and then when the user
-     *   finally clicks 'OK' or 'DONE', then we can collect that info
-     *   and add it to the policy.
-     */
-    void displayPolicyEntryDialog(boolean edit) {
-
-        int listIndex = 0;
-        PolicyEntry entries[] = null;
-        TaggedList prinList = new TaggedList(3, false);
-        prinList.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Principal.List"));
-        prinList.addMouseListener
-                (new EditPrinButtonListener(tool, tw, this, edit));
-        TaggedList permList = new TaggedList(10, false);
-        permList.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Permission.List"));
-        permList.addMouseListener
-                (new EditPermButtonListener(tool, tw, this, edit));
-
-        // find where the PolicyTool gui is
-        Point location = tw.getLocationOnScreen();
-        //setBounds(location.x + 75, location.y + 200, 650, 500);
-        setLayout(new GridBagLayout());
-        setResizable(true);
-
-        if (edit) {
-            // get the selected item
-            entries = tool.getEntry();
-            @SuppressWarnings("unchecked")
-            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-            listIndex = policyList.getSelectedIndex();
-
-            // get principal list
-            LinkedList<PolicyParser.PrincipalEntry> principals =
-                entries[listIndex].getGrantEntry().principals;
-            for (int i = 0; i < principals.size(); i++) {
-                String prinString = null;
-                PolicyParser.PrincipalEntry nextPrin = principals.get(i);
-                prinList.addTaggedItem(PrincipalEntryToUserFriendlyString(nextPrin), nextPrin);
-            }
-
-            // get permission list
-            Vector<PolicyParser.PermissionEntry> permissions =
-                entries[listIndex].getGrantEntry().permissionEntries;
-            for (int i = 0; i < permissions.size(); i++) {
-                String permString = null;
-                PolicyParser.PermissionEntry nextPerm =
-                                                permissions.elementAt(i);
-                permList.addTaggedItem(ToolDialog.PermissionEntryToUserFriendlyString(nextPerm), nextPerm);
-            }
-        }
-
-        // codebase label and textfield
-        JLabel label = new JLabel();
-        tw.addNewComponent(this, label, PE_CODEBASE_LABEL,
-                0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                ToolWindow.R_PADDING);
-        JTextField tf;
-        tf = (edit ?
-                new JTextField(entries[listIndex].getGrantEntry().codeBase) :
-                new JTextField());
-        ToolWindow.configureLabelFor(label, tf, "CodeBase.");
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Code.Base"));
-        tw.addNewComponent(this, tf, PE_CODEBASE_TEXTFIELD,
-                1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
-
-        // signedby label and textfield
-        label = new JLabel();
-        tw.addNewComponent(this, label, PE_SIGNEDBY_LABEL,
-                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.R_PADDING);
-        tf = (edit ?
-                new JTextField(entries[listIndex].getGrantEntry().signedBy) :
-                new JTextField());
-        ToolWindow.configureLabelFor(label, tf, "SignedBy.");
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Signed.By."));
-        tw.addNewComponent(this, tf, PE_SIGNEDBY_TEXTFIELD,
-                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
-
-        // panel for principal buttons
-        JPanel panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        JButton button = new JButton();
-        ToolWindow.configureButton(button, "Add.Principal");
-        button.addActionListener
-                (new AddPrinButtonListener(tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_ADD_PRIN_BUTTON,
-                0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-        button = new JButton();
-        ToolWindow.configureButton(button, "Edit.Principal");
-        button.addActionListener(new EditPrinButtonListener
-                                                (tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_EDIT_PRIN_BUTTON,
-                1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-        button = new JButton();
-        ToolWindow.configureButton(button, "Remove.Principal");
-        button.addActionListener(new RemovePrinButtonListener
-                                        (tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_REMOVE_PRIN_BUTTON,
-                2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-        tw.addNewComponent(this, panel, PE_PANEL0,
-                1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
-                           ToolWindow.LITE_BOTTOM_PADDING);
-
-        // principal label and list
-        label = new JLabel();
-        tw.addNewComponent(this, label, PE_PRIN_LABEL,
-                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.R_BOTTOM_PADDING);
-        JScrollPane scrollPane = new JScrollPane(prinList);
-        ToolWindow.configureLabelFor(label, scrollPane, "Principals.");
-        tw.addNewComponent(this, scrollPane, PE_PRIN_LIST,
-                           1, 3, 3, 1, 0.0, prinList.getVisibleRowCount(), GridBagConstraints.BOTH,
-                           ToolWindow.BOTTOM_PADDING);
-
-        // panel for permission buttons
-        panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        button = new JButton();
-        ToolWindow.configureButton(button, ".Add.Permission");
-        button.addActionListener(new AddPermButtonListener
-                                                (tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_ADD_PERM_BUTTON,
-                0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-        button = new JButton();
-        ToolWindow.configureButton(button, ".Edit.Permission");
-        button.addActionListener(new EditPermButtonListener
-                                                (tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_EDIT_PERM_BUTTON,
-                1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-
-        button = new JButton();
-        ToolWindow.configureButton(button, "Remove.Permission");
-        button.addActionListener(new RemovePermButtonListener
-                                        (tool, tw, this, edit));
-        tw.addNewComponent(panel, button, PE_REMOVE_PERM_BUTTON,
-                2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-        tw.addNewComponent(this, panel, PE_PANEL1,
-                0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
-                ToolWindow.LITE_BOTTOM_PADDING);
-
-        // permission list
-        scrollPane = new JScrollPane(permList);
-        tw.addNewComponent(this, scrollPane, PE_PERM_LIST,
-                           0, 5, 3, 1, 0.0, permList.getVisibleRowCount(), GridBagConstraints.BOTH,
-                           ToolWindow.BOTTOM_PADDING);
-
-
-        // panel for Done and Cancel buttons
-        panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        // Done Button
-        JButton okButton = new JButton(PolicyTool.getMessage("Done"));
-        okButton.addActionListener
-                (new AddEntryDoneButtonListener(tool, tw, this, edit));
-        tw.addNewComponent(panel, okButton, PE_DONE_BUTTON,
-                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.LR_PADDING);
-
-        // Cancel Button
-        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
-        ActionListener cancelListener = new CancelButtonListener(this);
-        cancelButton.addActionListener(cancelListener);
-        tw.addNewComponent(panel, cancelButton, PE_CANCEL_BUTTON,
-                           1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.LR_PADDING);
-
-        // add the panel
-        tw.addNewComponent(this, panel, PE_PANEL2,
-                0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-        getRootPane().setDefaultButton(okButton);
-        getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        pack();
-        setLocationRelativeTo(tw);
-        setVisible(true);
-    }
-
-    /**
-     * Read all the Policy information data in the dialog box
-     * and construct a PolicyEntry object with it.
-     */
-    PolicyEntry getPolicyEntryFromDialog()
-        throws InvalidParameterException, MalformedURLException,
-        NoSuchMethodException, ClassNotFoundException, InstantiationException,
-        IllegalAccessException, InvocationTargetException,
-        CertificateException, IOException, Exception {
-
-        // get the Codebase
-        JTextField tf = (JTextField)getComponent(PE_CODEBASE_TEXTFIELD);
-        String codebase = null;
-        if (tf.getText().trim().equals("") == false)
-                codebase = new String(tf.getText().trim());
-
-        // get the SignedBy
-        tf = (JTextField)getComponent(PE_SIGNEDBY_TEXTFIELD);
-        String signedby = null;
-        if (tf.getText().trim().equals("") == false)
-                signedby = new String(tf.getText().trim());
-
-        // construct a new GrantEntry
-        PolicyParser.GrantEntry ge =
-                        new PolicyParser.GrantEntry(signedby, codebase);
-
-        // get the new Principals
-        LinkedList<PolicyParser.PrincipalEntry> prins = new LinkedList<>();
-        TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
-        for (int i = 0; i < prinList.getModel().getSize(); i++) {
-            prins.add((PolicyParser.PrincipalEntry)prinList.getObject(i));
-        }
-        ge.principals = prins;
-
-        // get the new Permissions
-        Vector<PolicyParser.PermissionEntry> perms = new Vector<>();
-        TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
-        for (int i = 0; i < permList.getModel().getSize(); i++) {
-            perms.addElement((PolicyParser.PermissionEntry)permList.getObject(i));
-        }
-        ge.permissionEntries = perms;
-
-        // construct a new PolicyEntry object
-        PolicyEntry entry = new PolicyEntry(tool, ge);
-
-        return entry;
-    }
-
-    /**
-     * display a dialog box for the user to enter KeyStore information
-     */
-    void keyStoreDialog(int mode) {
-
-        // find where the PolicyTool gui is
-        Point location = tw.getLocationOnScreen();
-        //setBounds(location.x + 25, location.y + 100, 500, 300);
-        setLayout(new GridBagLayout());
-
-        if (mode == EDIT_KEYSTORE) {
-
-            // KeyStore label and textfield
-            JLabel label = new JLabel();
-            tw.addNewComponent(this, label, KSD_NAME_LABEL,
-                               0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.R_BOTTOM_PADDING);
-            JTextField tf = new JTextField(tool.getKeyStoreName(), 30);
-            ToolWindow.configureLabelFor(label, tf, "KeyStore.URL.");
-            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-
-            // URL to U R L, so that accessibility reader will pronounce well
-            tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("KeyStore.U.R.L."));
-            tw.addNewComponent(this, tf, KSD_NAME_TEXTFIELD,
-                               1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.BOTTOM_PADDING);
-
-            // KeyStore type and textfield
-            label = new JLabel();
-            tw.addNewComponent(this, label, KSD_TYPE_LABEL,
-                               0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.R_BOTTOM_PADDING);
-            tf = new JTextField(tool.getKeyStoreType(), 30);
-            ToolWindow.configureLabelFor(label, tf, "KeyStore.Type.");
-            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-            tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("KeyStore.Type."));
-            tw.addNewComponent(this, tf, KSD_TYPE_TEXTFIELD,
-                               1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.BOTTOM_PADDING);
-
-            // KeyStore provider and textfield
-            label = new JLabel();
-            tw.addNewComponent(this, label, KSD_PROVIDER_LABEL,
-                               0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.R_BOTTOM_PADDING);
-            tf = new JTextField(tool.getKeyStoreProvider(), 30);
-            ToolWindow.configureLabelFor(label, tf, "KeyStore.Provider.");
-            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-            tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("KeyStore.Provider."));
-            tw.addNewComponent(this, tf, KSD_PROVIDER_TEXTFIELD,
-                               1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.BOTTOM_PADDING);
-
-            // KeyStore password URL and textfield
-            label = new JLabel();
-            tw.addNewComponent(this, label, KSD_PWD_URL_LABEL,
-                               0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.R_BOTTOM_PADDING);
-            tf = new JTextField(tool.getKeyStorePwdURL(), 30);
-            ToolWindow.configureLabelFor(label, tf, "KeyStore.Password.URL.");
-            tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-            tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("KeyStore.Password.U.R.L."));
-            tw.addNewComponent(this, tf, KSD_PWD_URL_TEXTFIELD,
-                               1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.BOTTOM_PADDING);
-
-            // OK button
-            JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-            okButton.addActionListener
-                        (new ChangeKeyStoreOKButtonListener(tool, tw, this));
-            tw.addNewComponent(this, okButton, KSD_OK_BUTTON,
-                        0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-            // cancel button
-            JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
-            ActionListener cancelListener = new CancelButtonListener(this);
-            cancelButton.addActionListener(cancelListener);
-            tw.addNewComponent(this, cancelButton, KSD_CANCEL_BUTTON,
-                        1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
-            getRootPane().setDefaultButton(okButton);
-            getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-        }
-
-        pack();
-        setLocationRelativeTo(tw);
-        setVisible(true);
-    }
-
-    /**
-     * display a dialog box for the user to input Principal info
-     *
-     * if editPolicyEntry is false, then we are adding Principals to
-     * a new PolicyEntry, and we only update the GUI listing
-     * with the new Principal.
-     *
-     * if edit is true, then we are editing an existing Policy entry.
-     */
-    void displayPrincipalDialog(boolean editPolicyEntry, boolean edit) {
-
-        PolicyParser.PrincipalEntry editMe = null;
-
-        // get the Principal selected from the Principal List
-        TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
-        int prinIndex = prinList.getSelectedIndex();
-
-        if (edit) {
-            editMe = (PolicyParser.PrincipalEntry)prinList.getObject(prinIndex);
-        }
-
-        ToolDialog newTD = new ToolDialog
-                (PolicyTool.getMessage("Principals"), tool, tw, true);
-        newTD.addWindowListener(new ChildWindowListener(newTD));
-
-        // find where the PolicyTool gui is
-        Point location = getLocationOnScreen();
-        //newTD.setBounds(location.x + 50, location.y + 100, 650, 190);
-        newTD.setLayout(new GridBagLayout());
-        newTD.setResizable(true);
-
-        // description label
-        JLabel label = (edit ?
-                new JLabel(PolicyTool.getMessage(".Edit.Principal.")) :
-                new JLabel(PolicyTool.getMessage(".Add.New.Principal.")));
-        tw.addNewComponent(newTD, label, PRD_DESC_LABEL,
-                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-
-        // principal choice
-        JComboBox<String> choice = new JComboBox<>();
-        choice.addItem(PRIN_TYPE);
-        choice.getAccessibleContext().setAccessibleName(PRIN_TYPE);
-        for (int i = 0; i < PRIN_ARRAY.size(); i++) {
-            Prin next = PRIN_ARRAY.get(i);
-            choice.addItem(next.CLASS);
-        }
-
-        if (edit) {
-            if (PolicyParser.PrincipalEntry.WILDCARD_CLASS.equals
-                                (editMe.getPrincipalClass())) {
-                choice.setSelectedItem(PRIN_TYPE);
-            } else {
-                Prin inputPrin = getPrin(editMe.getPrincipalClass(), true);
-                if (inputPrin != null) {
-                    choice.setSelectedItem(inputPrin.CLASS);
-                }
-            }
-        }
-        // Add listener after selected item is set
-        choice.addItemListener(new PrincipalTypeMenuListener(newTD));
-
-        tw.addNewComponent(newTD, choice, PRD_PRIN_CHOICE,
-                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_PADDING);
-
-        // principal textfield
-        JTextField tf;
-        tf = (edit ?
-                new JTextField(editMe.getDisplayClass(), 30) :
-                new JTextField(30));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(PRIN_TYPE);
-        tw.addNewComponent(newTD, tf, PRD_PRIN_TEXTFIELD,
-                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_PADDING);
-
-        // name label and textfield
-        label = new JLabel(PRIN_NAME);
-        tf = (edit ?
-                new JTextField(editMe.getDisplayName(), 40) :
-                new JTextField(40));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(PRIN_NAME);
-
-        tw.addNewComponent(newTD, label, PRD_NAME_LABEL,
-                           0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_PADDING);
-        tw.addNewComponent(newTD, tf, PRD_NAME_TEXTFIELD,
-                           1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_PADDING);
-
-        // OK button
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        okButton.addActionListener(
-            new NewPolicyPrinOKButtonListener
-                                        (tool, tw, this, newTD, edit));
-        tw.addNewComponent(newTD, okButton, PRD_OK_BUTTON,
-                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-        // cancel button
-        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
-        ActionListener cancelListener = new CancelButtonListener(newTD);
-        cancelButton.addActionListener(cancelListener);
-        tw.addNewComponent(newTD, cancelButton, PRD_CANCEL_BUTTON,
-                           1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-
-        newTD.getRootPane().setDefaultButton(okButton);
-        newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        newTD.pack();
-        newTD.setLocationRelativeTo(tw);
-        newTD.setVisible(true);
-    }
-
-    /**
-     * display a dialog box for the user to input Permission info
-     *
-     * if editPolicyEntry is false, then we are adding Permissions to
-     * a new PolicyEntry, and we only update the GUI listing
-     * with the new Permission.
-     *
-     * if edit is true, then we are editing an existing Permission entry.
-     */
-    void displayPermissionDialog(boolean editPolicyEntry, boolean edit) {
-
-        PolicyParser.PermissionEntry editMe = null;
-
-        // get the Permission selected from the Permission List
-        TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
-        int permIndex = permList.getSelectedIndex();
-
-        if (edit) {
-            editMe = (PolicyParser.PermissionEntry)permList.getObject(permIndex);
-        }
-
-        ToolDialog newTD = new ToolDialog
-                (PolicyTool.getMessage("Permissions"), tool, tw, true);
-        newTD.addWindowListener(new ChildWindowListener(newTD));
-
-        // find where the PolicyTool gui is
-        Point location = getLocationOnScreen();
-        //newTD.setBounds(location.x + 50, location.y + 100, 700, 250);
-        newTD.setLayout(new GridBagLayout());
-        newTD.setResizable(true);
-
-        // description label
-        JLabel label = (edit ?
-                new JLabel(PolicyTool.getMessage(".Edit.Permission.")) :
-                new JLabel(PolicyTool.getMessage(".Add.New.Permission.")));
-        tw.addNewComponent(newTD, label, PD_DESC_LABEL,
-                           0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-
-        // permission choice (added in alphabetical order)
-        JComboBox<String> choice = new JComboBox<>();
-        choice.addItem(PERM);
-        choice.getAccessibleContext().setAccessibleName(PERM);
-        for (int i = 0; i < PERM_ARRAY.size(); i++) {
-            Perm next = PERM_ARRAY.get(i);
-            choice.addItem(next.CLASS);
-        }
-        tw.addNewComponent(newTD, choice, PD_PERM_CHOICE,
-                           0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-
-        // permission textfield
-        JTextField tf;
-        tf = (edit ? new JTextField(editMe.permission, 30) : new JTextField(30));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(PERM);
-        if (edit) {
-            Perm inputPerm = getPerm(editMe.permission, true);
-            if (inputPerm != null) {
-                choice.setSelectedItem(inputPerm.CLASS);
-            }
-        }
-        tw.addNewComponent(newTD, tf, PD_PERM_TEXTFIELD,
-                           1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        choice.addItemListener(new PermissionMenuListener(newTD));
-
-        // name label and textfield
-        choice = new JComboBox<>();
-        choice.addItem(PERM_NAME);
-        choice.getAccessibleContext().setAccessibleName(PERM_NAME);
-        tf = (edit ? new JTextField(editMe.name, 40) : new JTextField(40));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(PERM_NAME);
-        if (edit) {
-            setPermissionNames(getPerm(editMe.permission, true), choice, tf);
-        }
-        tw.addNewComponent(newTD, choice, PD_NAME_CHOICE,
-                           0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        tw.addNewComponent(newTD, tf, PD_NAME_TEXTFIELD,
-                           1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        choice.addItemListener(new PermissionNameMenuListener(newTD));
-
-        // actions label and textfield
-        choice = new JComboBox<>();
-        choice.addItem(PERM_ACTIONS);
-        choice.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
-        tf = (edit ? new JTextField(editMe.action, 40) : new JTextField(40));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
-        if (edit) {
-            setPermissionActions(getPerm(editMe.permission, true), choice, tf);
-        }
-        tw.addNewComponent(newTD, choice, PD_ACTIONS_CHOICE,
-                           0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        tw.addNewComponent(newTD, tf, PD_ACTIONS_TEXTFIELD,
-                           1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        choice.addItemListener(new PermissionActionsMenuListener(newTD));
-
-        // signedby label and textfield
-        label = new JLabel(PolicyTool.getMessage("Signed.By."));
-        tw.addNewComponent(newTD, label, PD_SIGNEDBY_LABEL,
-                           0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-        tf = (edit ? new JTextField(editMe.signedBy, 40) : new JTextField(40));
-        tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-        tf.getAccessibleContext().setAccessibleName(
-                PolicyTool.getMessage("Signed.By."));
-        tw.addNewComponent(newTD, tf, PD_SIGNEDBY_TEXTFIELD,
-                           1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.LR_BOTTOM_PADDING);
-
-        // OK button
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        okButton.addActionListener(
-            new NewPolicyPermOKButtonListener
-                                    (tool, tw, this, newTD, edit));
-        tw.addNewComponent(newTD, okButton, PD_OK_BUTTON,
-                           0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-
-        // cancel button
-        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
-        ActionListener cancelListener = new CancelButtonListener(newTD);
-        cancelButton.addActionListener(cancelListener);
-        tw.addNewComponent(newTD, cancelButton, PD_CANCEL_BUTTON,
-                           1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
-                           ToolWindow.TOP_BOTTOM_PADDING);
-
-        newTD.getRootPane().setDefaultButton(okButton);
-        newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        newTD.pack();
-        newTD.setLocationRelativeTo(tw);
-        newTD.setVisible(true);
-    }
-
-    /**
-     * construct a Principal object from the Principal Info Dialog Box
-     */
-    PolicyParser.PrincipalEntry getPrinFromDialog() throws Exception {
-
-        JTextField tf = (JTextField)getComponent(PRD_PRIN_TEXTFIELD);
-        String pclass = new String(tf.getText().trim());
-        tf = (JTextField)getComponent(PRD_NAME_TEXTFIELD);
-        String pname = new String(tf.getText().trim());
-        if (pclass.equals("*")) {
-            pclass = PolicyParser.PrincipalEntry.WILDCARD_CLASS;
-        }
-        if (pname.equals("*")) {
-            pname = PolicyParser.PrincipalEntry.WILDCARD_NAME;
-        }
-
-        PolicyParser.PrincipalEntry pppe = null;
-
-        if ((pclass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS)) &&
-            (!pname.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME))) {
-            throw new Exception
-                        (PolicyTool.getMessage("Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name"));
-        } else if (pname.equals("")) {
-            throw new Exception
-                        (PolicyTool.getMessage("Cannot.Specify.Principal.without.a.Name"));
-        } else if (pclass.equals("")) {
-            // make this consistent with what PolicyParser does
-            // when it sees an empty principal class
-            pclass = PolicyParser.PrincipalEntry.REPLACE_NAME;
-            tool.warnings.addElement(
-                        "Warning: Principal name '" + pname +
-                                "' specified without a Principal class.\n" +
-                        "\t'" + pname + "' will be interpreted " +
-                                "as a key store alias.\n" +
-                        "\tThe final principal class will be " +
-                                ToolDialog.X500_PRIN_CLASS + ".\n" +
-                        "\tThe final principal name will be " +
-                                "determined by the following:\n" +
-                        "\n" +
-                        "\tIf the key store entry identified by '"
-                                + pname + "'\n" +
-                        "\tis a key entry, then the principal name will be\n" +
-                        "\tthe subject distinguished name from the first\n" +
-                        "\tcertificate in the entry's certificate chain.\n" +
-                        "\n" +
-                        "\tIf the key store entry identified by '" +
-                                pname + "'\n" +
-                        "\tis a trusted certificate entry, then the\n" +
-                        "\tprincipal name will be the subject distinguished\n" +
-                        "\tname from the trusted public key certificate.");
-            tw.displayStatusDialog(this,
-                        "'" + pname + "' will be interpreted as a key " +
-                        "store alias.  View Warning Log for details.");
-        }
-        return new PolicyParser.PrincipalEntry(pclass, pname);
-    }
-
-
-    /**
-     * construct a Permission object from the Permission Info Dialog Box
-     */
-    PolicyParser.PermissionEntry getPermFromDialog() {
-
-        JTextField tf = (JTextField)getComponent(PD_PERM_TEXTFIELD);
-        String permission = new String(tf.getText().trim());
-        tf = (JTextField)getComponent(PD_NAME_TEXTFIELD);
-        String name = null;
-        if (tf.getText().trim().equals("") == false)
-            name = new String(tf.getText().trim());
-        if (permission.equals("") ||
-            (!permission.equals(ALL_PERM_CLASS) && name == null)) {
-            throw new InvalidParameterException(PolicyTool.getMessage
-                ("Permission.and.Target.Name.must.have.a.value"));
-        }
-
-        // When the permission is FilePermission, we need to check the name
-        // to make sure it's not escaped. We believe --
-        //
-        // String             name.lastIndexOf("\\\\")
-        // ----------------   ------------------------
-        // c:\foo\bar         -1, legal
-        // c:\\foo\\bar       2, illegal
-        // \\server\share     0, legal
-        // \\\\server\share   2, illegal
-
-        if (permission.equals(FILE_PERM_CLASS) && name.lastIndexOf("\\\\") > 0) {
-            char result = tw.displayYesNoDialog(this,
-                    PolicyTool.getMessage("Warning"),
-                    PolicyTool.getMessage(
-                        "Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes"),
-                    PolicyTool.getMessage("Retain"),
-                    PolicyTool.getMessage("Edit")
-                    );
-            if (result != 'Y') {
-                // an invisible exception
-                throw new NoDisplayException();
-            }
-        }
-        // get the Actions
-        tf = (JTextField)getComponent(PD_ACTIONS_TEXTFIELD);
-        String actions = null;
-        if (tf.getText().trim().equals("") == false)
-            actions = new String(tf.getText().trim());
-
-        // get the Signed By
-        tf = (JTextField)getComponent(PD_SIGNEDBY_TEXTFIELD);
-        String signedBy = null;
-        if (tf.getText().trim().equals("") == false)
-            signedBy = new String(tf.getText().trim());
-
-        PolicyParser.PermissionEntry pppe = new PolicyParser.PermissionEntry
-                                (permission, name, actions);
-        pppe.signedBy = signedBy;
-
-        // see if the signers have public keys
-        if (signedBy != null) {
-                String signers[] = tool.parseSigners(pppe.signedBy);
-                for (int i = 0; i < signers.length; i++) {
-                try {
-                    PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
-                    if (pubKey == null) {
-                        MessageFormat form = new MessageFormat
-                            (PolicyTool.getMessage
-                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
-                        Object[] source = {signers[i]};
-                        tool.warnings.addElement(form.format(source));
-                        tw.displayStatusDialog(this, form.format(source));
-                    }
-                } catch (Exception e) {
-                    tw.displayErrorDialog(this, e);
-                }
-            }
-        }
-        return pppe;
-    }
-
-    /**
-     * confirm that the user REALLY wants to remove the Policy Entry
-     */
-    void displayConfirmRemovePolicyEntry() {
-
-        // find the entry to be removed
-        @SuppressWarnings("unchecked")
-        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-        int index = list.getSelectedIndex();
-        PolicyEntry entries[] = tool.getEntry();
-
-        // find where the PolicyTool gui is
-        Point location = tw.getLocationOnScreen();
-        //setBounds(location.x + 25, location.y + 100, 600, 400);
-        setLayout(new GridBagLayout());
-
-        // ask the user do they really want to do this?
-        JLabel label = new JLabel
-                (PolicyTool.getMessage("Remove.this.Policy.Entry."));
-        tw.addNewComponent(this, label, CRPE_LABEL1,
-                           0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                           ToolWindow.BOTTOM_PADDING);
-
-        // display the policy entry
-        label = new JLabel(entries[index].codebaseToString());
-        tw.addNewComponent(this, label, CRPE_LABEL2,
-                        0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-        label = new JLabel(entries[index].principalsToString().trim());
-        tw.addNewComponent(this, label, CRPE_LABEL2+1,
-                        0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-        Vector<PolicyParser.PermissionEntry> perms =
-                        entries[index].getGrantEntry().permissionEntries;
-        for (int i = 0; i < perms.size(); i++) {
-            PolicyParser.PermissionEntry nextPerm = perms.elementAt(i);
-            String permString = ToolDialog.PermissionEntryToUserFriendlyString(nextPerm);
-            label = new JLabel("    " + permString);
-            if (i == (perms.size()-1)) {
-                tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
-                                 1, 3 + i, 1, 1, 0.0, 0.0,
-                                 GridBagConstraints.BOTH,
-                                 ToolWindow.BOTTOM_PADDING);
-            } else {
-                tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
-                                 1, 3 + i, 1, 1, 0.0, 0.0,
-                                 GridBagConstraints.BOTH);
-            }
-        }
-
-
-        // add OK/CANCEL buttons in a new panel
-        JPanel panel = new JPanel();
-        panel.setLayout(new GridBagLayout());
-
-        // OK button
-        JButton okButton = new JButton(PolicyTool.getMessage("OK"));
-        okButton.addActionListener
-                (new ConfirmRemovePolicyEntryOKButtonListener(tool, tw, this));
-        tw.addNewComponent(panel, okButton, CRPE_PANEL_OK,
-                           0, 0, 1, 1, 0.0, 0.0,
-                           GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
-
-        // cancel button
-        JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
-        ActionListener cancelListener = new CancelButtonListener(this);
-        cancelButton.addActionListener(cancelListener);
-        tw.addNewComponent(panel, cancelButton, CRPE_PANEL_CANCEL,
-                           1, 0, 1, 1, 0.0, 0.0,
-                           GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
-
-        tw.addNewComponent(this, panel, CRPE_LABEL2 + 2 + perms.size(),
-                           0, 3 + perms.size(), 2, 1, 0.0, 0.0,
-                           GridBagConstraints.VERTICAL, ToolWindow.TOP_BOTTOM_PADDING);
-
-        getRootPane().setDefaultButton(okButton);
-        getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-        pack();
-        setLocationRelativeTo(tw);
-        setVisible(true);
-    }
-
-    /**
-     * perform SAVE AS
-     */
-    void displaySaveAsDialog(int nextEvent) {
-
-        // pop up a dialog box for the user to enter a filename.
-        FileDialog fd = new FileDialog
-                (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE);
-        fd.addWindowListener(new WindowAdapter() {
-            public void windowClosing(WindowEvent e) {
-                e.getWindow().setVisible(false);
-            }
-        });
-        fd.setVisible(true);
-
-        // see if the user hit cancel
-        if (fd.getFile() == null ||
-            fd.getFile().equals(""))
-            return;
-
-        // get the entered filename
-        File saveAsFile = new File(fd.getDirectory(), fd.getFile());
-        String filename = saveAsFile.getPath();
-        fd.dispose();
-
-        try {
-            // save the policy entries to a file
-            tool.savePolicy(filename);
-
-            // display status
-            MessageFormat form = new MessageFormat(PolicyTool.getMessage
-                    ("Policy.successfully.written.to.filename"));
-            Object[] source = {filename};
-            tw.displayStatusDialog(null, form.format(source));
-
-            // display the new policy filename
-            JTextField newFilename = (JTextField)tw.getComponent
-                            (ToolWindow.MW_FILENAME_TEXTFIELD);
-            newFilename.setText(filename);
-            tw.setVisible(true);
-
-            // now continue with the originally requested command
-            // (QUIT, NEW, or OPEN)
-            userSaveContinue(tool, tw, this, nextEvent);
-
-        } catch (FileNotFoundException fnfe) {
-            if (filename == null || filename.equals("")) {
-                tw.displayErrorDialog(null, new FileNotFoundException
-                            (PolicyTool.getMessage("null.filename")));
-            } else {
-                tw.displayErrorDialog(null, fnfe);
-            }
-        } catch (Exception ee) {
-            tw.displayErrorDialog(null, ee);
-        }
-    }
-
-    /**
-     * ask user if they want to save changes
-     */
-    void displayUserSave(int select) {
-
-        if (tool.modified == true) {
-
-            // find where the PolicyTool gui is
-            Point location = tw.getLocationOnScreen();
-            //setBounds(location.x + 75, location.y + 100, 400, 150);
-            setLayout(new GridBagLayout());
-
-            JLabel label = new JLabel
-                (PolicyTool.getMessage("Save.changes."));
-            tw.addNewComponent(this, label, USC_LABEL,
-                               0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
-                               ToolWindow.L_TOP_BOTTOM_PADDING);
-
-            JPanel panel = new JPanel();
-            panel.setLayout(new GridBagLayout());
-
-            JButton yesButton = new JButton();
-            ToolWindow.configureButton(yesButton, "Yes");
-            yesButton.addActionListener
-                        (new UserSaveYesButtonListener(this, tool, tw, select));
-            tw.addNewComponent(panel, yesButton, USC_YES_BUTTON,
-                               0, 0, 1, 1, 0.0, 0.0,
-                               GridBagConstraints.VERTICAL,
-                               ToolWindow.LR_BOTTOM_PADDING);
-            JButton noButton = new JButton();
-            ToolWindow.configureButton(noButton, "No");
-            noButton.addActionListener
-                        (new UserSaveNoButtonListener(this, tool, tw, select));
-            tw.addNewComponent(panel, noButton, USC_NO_BUTTON,
-                               1, 0, 1, 1, 0.0, 0.0,
-                               GridBagConstraints.VERTICAL,
-                               ToolWindow.LR_BOTTOM_PADDING);
-            JButton cancelButton = new JButton();
-            ToolWindow.configureButton(cancelButton, "Cancel");
-            ActionListener cancelListener = new CancelButtonListener(this);
-            cancelButton.addActionListener(cancelListener);
-            tw.addNewComponent(panel, cancelButton, USC_CANCEL_BUTTON,
-                               2, 0, 1, 1, 0.0, 0.0,
-                               GridBagConstraints.VERTICAL,
-                               ToolWindow.LR_BOTTOM_PADDING);
-
-            tw.addNewComponent(this, panel, USC_PANEL,
-                               0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
-            getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-            pack();
-            setLocationRelativeTo(tw);
-            setVisible(true);
-        } else {
-            // just do the original request (QUIT, NEW, or OPEN)
-            userSaveContinue(tool, tw, this, select);
-        }
-    }
-
-    /**
-     * when the user sees the 'YES', 'NO', 'CANCEL' buttons on the
-     * displayUserSave dialog, and the click on one of them,
-     * we need to continue the originally requested action
-     * (either QUITting, opening NEW policy file, or OPENing an existing
-     * policy file.  do that now.
-     */
-    @SuppressWarnings("fallthrough")
-    void userSaveContinue(PolicyTool tool, ToolWindow tw,
-                        ToolDialog us, int select) {
-
-        // now either QUIT, open a NEW policy file, or OPEN an existing policy
-        switch(select) {
-        case ToolDialog.QUIT:
-
-            tw.setVisible(false);
-            tw.dispose();
-            System.exit(0);
-
-        case ToolDialog.NEW:
-
-            try {
-                tool.openPolicy(null);
-            } catch (Exception ee) {
-                tool.modified = false;
-                tw.displayErrorDialog(null, ee);
-            }
-
-            // display the policy entries via the policy list textarea
-            JList<String> list = new JList<>(new DefaultListModel<>());
-            list.setVisibleRowCount(15);
-            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-            list.addMouseListener(new PolicyListListener(tool, tw));
-            tw.replacePolicyList(list);
-
-            // display null policy filename and keystore
-            JTextField newFilename = (JTextField)tw.getComponent(
-                    ToolWindow.MW_FILENAME_TEXTFIELD);
-            newFilename.setText("");
-            tw.setVisible(true);
-            break;
-
-        case ToolDialog.OPEN:
-
-            // pop up a dialog box for the user to enter a filename.
-            FileDialog fd = new FileDialog
-                (tw, PolicyTool.getMessage("Open"), FileDialog.LOAD);
-            fd.addWindowListener(new WindowAdapter() {
-                public void windowClosing(WindowEvent e) {
-                    e.getWindow().setVisible(false);
-                }
-            });
-            fd.setVisible(true);
-
-            // see if the user hit 'cancel'
-            if (fd.getFile() == null ||
-                fd.getFile().equals(""))
-                return;
-
-            // get the entered filename
-            String policyFile = new File(fd.getDirectory(), fd.getFile()).getPath();
-
-            try {
-                // open the policy file
-                tool.openPolicy(policyFile);
-
-                // display the policy entries via the policy list textarea
-                DefaultListModel<String> listModel = new DefaultListModel<>();
-                list = new JList<>(listModel);
-                list.setVisibleRowCount(15);
-                list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-                list.addMouseListener(new PolicyListListener(tool, tw));
-                PolicyEntry entries[] = tool.getEntry();
-                if (entries != null) {
-                    for (int i = 0; i < entries.length; i++) {
-                        listModel.addElement(entries[i].headerToString());
-                    }
-                }
-                tw.replacePolicyList(list);
-                tool.modified = false;
-
-                // display the new policy filename
-                newFilename = (JTextField)tw.getComponent(
-                        ToolWindow.MW_FILENAME_TEXTFIELD);
-                newFilename.setText(policyFile);
-                tw.setVisible(true);
-
-                // inform user of warnings
-                if (tool.newWarning == true) {
-                    tw.displayStatusDialog(null, PolicyTool.getMessage
-                        ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
-                }
-
-            } catch (Exception e) {
-                // add blank policy listing
-                list = new JList<>(new DefaultListModel<>());
-                list.setVisibleRowCount(15);
-                list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-                list.addMouseListener(new PolicyListListener(tool, tw));
-                tw.replacePolicyList(list);
-                tool.setPolicyFileName(null);
-                tool.modified = false;
-
-                // display a null policy filename
-                newFilename = (JTextField)tw.getComponent(
-                        ToolWindow.MW_FILENAME_TEXTFIELD);
-                newFilename.setText("");
-                tw.setVisible(true);
-
-                // display the error
-                MessageFormat form = new MessageFormat(PolicyTool.getMessage
-                    ("Could.not.open.policy.file.policyFile.e.toString."));
-                Object[] source = {policyFile, e.toString()};
-                tw.displayErrorDialog(null, form.format(source));
-            }
-            break;
-        }
-    }
-
-    /**
-     * Return a Menu list of names for a given permission
-     *
-     * If inputPerm's TARGETS are null, then this means TARGETS are
-     * not allowed to be entered (and the TextField is set to be
-     * non-editable).
-     *
-     * If TARGETS are valid but there are no standard ones
-     * (user must enter them by hand) then the TARGETS array may be empty
-     * (and of course non-null).
-     */
-    void setPermissionNames(Perm inputPerm, JComboBox<String> names, JTextField field) {
-        names.removeAllItems();
-        names.addItem(PERM_NAME);
-
-        if (inputPerm == null) {
-            // custom permission
-            field.setEditable(true);
-        } else if (inputPerm.TARGETS == null) {
-            // standard permission with no targets
-            field.setEditable(false);
-        } else {
-            // standard permission with standard targets
-            field.setEditable(true);
-            for (int i = 0; i < inputPerm.TARGETS.length; i++) {
-                names.addItem(inputPerm.TARGETS[i]);
-            }
-        }
-    }
-
-    /**
-     * Return a Menu list of actions for a given permission
-     *
-     * If inputPerm's ACTIONS are null, then this means ACTIONS are
-     * not allowed to be entered (and the TextField is set to be
-     * non-editable).  This is typically true for BasicPermissions.
-     *
-     * If ACTIONS are valid but there are no standard ones
-     * (user must enter them by hand) then the ACTIONS array may be empty
-     * (and of course non-null).
-     */
-    void setPermissionActions(Perm inputPerm, JComboBox<String> actions, JTextField field) {
-        actions.removeAllItems();
-        actions.addItem(PERM_ACTIONS);
-
-        if (inputPerm == null) {
-            // custom permission
-            field.setEditable(true);
-        } else if (inputPerm.ACTIONS == null) {
-            // standard permission with no actions
-            field.setEditable(false);
-        } else {
-            // standard permission with standard actions
-            field.setEditable(true);
-            for (int i = 0; i < inputPerm.ACTIONS.length; i++) {
-                actions.addItem(inputPerm.ACTIONS[i]);
-            }
-        }
-    }
-
-    static String PermissionEntryToUserFriendlyString(PolicyParser.PermissionEntry pppe) {
-        String result = pppe.permission;
-        if (pppe.name != null) {
-            result += " " + pppe.name;
-        }
-        if (pppe.action != null) {
-            result += ", \"" + pppe.action + "\"";
-        }
-        if (pppe.signedBy != null) {
-            result += ", signedBy " + pppe.signedBy;
-        }
-        return result;
-    }
-
-    static String PrincipalEntryToUserFriendlyString(PolicyParser.PrincipalEntry pppe) {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        pppe.write(pw);
-        return sw.toString();
-    }
-}
-
-/**
- * Event handler for the PolicyTool window
- */
-class ToolWindowListener implements WindowListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-
-    ToolWindowListener(PolicyTool tool, ToolWindow tw) {
-        this.tool = tool;
-        this.tw = tw;
-    }
-
-    public void windowOpened(WindowEvent we) {
-    }
-
-    public void windowClosing(WindowEvent we) {
-        // Closing the window acts the same as choosing Menu->Exit.
-
-        // ask user if they want to save changes
-        ToolDialog td = new ToolDialog(PolicyTool.getMessage("Save.Changes"), tool, tw, true);
-        td.displayUserSave(ToolDialog.QUIT);
-
-        // the above method will perform the QUIT as long as the
-        // user does not CANCEL the request
-    }
-
-    public void windowClosed(WindowEvent we) {
-        System.exit(0);
-    }
-
-    public void windowIconified(WindowEvent we) {
-    }
-
-    public void windowDeiconified(WindowEvent we) {
-    }
-
-    public void windowActivated(WindowEvent we) {
-    }
-
-    public void windowDeactivated(WindowEvent we) {
-    }
-}
-
-/**
- * Event handler for the Policy List
- */
-class PolicyListListener extends MouseAdapter implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-
-    PolicyListListener(PolicyTool tool, ToolWindow tw) {
-        this.tool = tool;
-        this.tw = tw;
-
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // display the permission list for a policy entry
-        ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
-        td.displayPolicyEntryDialog(true);
-    }
-
-    public void mouseClicked(MouseEvent evt) {
-        if (evt.getClickCount() == 2) {
-            actionPerformed(null);
-        }
-    }
-}
-
-/**
- * Event handler for the File Menu
- */
-class FileMenuListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-
-    FileMenuListener(PolicyTool tool, ToolWindow tw) {
-        this.tool = tool;
-        this.tw = tw;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        if (PolicyTool.collator.compare(e.getActionCommand(),
-                                       ToolWindow.QUIT) == 0) {
-
-            // ask user if they want to save changes
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
-            td.displayUserSave(ToolDialog.QUIT);
-
-            // the above method will perform the QUIT as long as the
-            // user does not CANCEL the request
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                   ToolWindow.NEW_POLICY_FILE) == 0) {
-
-            // ask user if they want to save changes
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
-            td.displayUserSave(ToolDialog.NEW);
-
-            // the above method will perform the NEW as long as the
-            // user does not CANCEL the request
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                  ToolWindow.OPEN_POLICY_FILE) == 0) {
-
-            // ask user if they want to save changes
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
-            td.displayUserSave(ToolDialog.OPEN);
-
-            // the above method will perform the OPEN as long as the
-            // user does not CANCEL the request
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                  ToolWindow.SAVE_POLICY_FILE) == 0) {
-
-            // get the previously entered filename
-            String filename = ((JTextField)tw.getComponent(
-                    ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
-
-            // if there is no filename, do a SAVE_AS
-            if (filename == null || filename.length() == 0) {
-                // user wants to SAVE AS
-                ToolDialog td = new ToolDialog
-                        (PolicyTool.getMessage("Save.As"), tool, tw, true);
-                td.displaySaveAsDialog(ToolDialog.NOACTION);
-            } else {
-                try {
-                    // save the policy entries to a file
-                    tool.savePolicy(filename);
-
-                    // display status
-                    MessageFormat form = new MessageFormat
-                        (PolicyTool.getMessage
-                        ("Policy.successfully.written.to.filename"));
-                    Object[] source = {filename};
-                    tw.displayStatusDialog(null, form.format(source));
-                } catch (FileNotFoundException fnfe) {
-                    if (filename == null || filename.equals("")) {
-                        tw.displayErrorDialog(null, new FileNotFoundException
-                                (PolicyTool.getMessage("null.filename")));
-                    } else {
-                        tw.displayErrorDialog(null, fnfe);
-                    }
-                } catch (Exception ee) {
-                    tw.displayErrorDialog(null, ee);
-                }
-            }
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                               ToolWindow.SAVE_AS_POLICY_FILE) == 0) {
-
-            // user wants to SAVE AS
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Save.As"), tool, tw, true);
-            td.displaySaveAsDialog(ToolDialog.NOACTION);
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                     ToolWindow.VIEW_WARNINGS) == 0) {
-            tw.displayWarningLog(null);
-        }
-    }
-}
-
-/**
- * Event handler for the main window buttons and Edit Menu
- */
-class MainWindowListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-
-    MainWindowListener(PolicyTool tool, ToolWindow tw) {
-        this.tool = tool;
-        this.tw = tw;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        if (PolicyTool.collator.compare(e.getActionCommand(),
-                           ToolWindow.ADD_POLICY_ENTRY) == 0) {
-
-            // display a dialog box for the user to enter policy info
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
-            td.displayPolicyEntryDialog(false);
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                               ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
-
-            // get the selected entry
-            @SuppressWarnings("unchecked")
-            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-            int index = list.getSelectedIndex();
-            if (index < 0) {
-                tw.displayErrorDialog(null, new Exception
-                        (PolicyTool.getMessage("No.Policy.Entry.selected")));
-                return;
-            }
-
-            // ask the user if they really want to remove the policy entry
-            ToolDialog td = new ToolDialog(PolicyTool.getMessage
-                ("Remove.Policy.Entry"), tool, tw, true);
-            td.displayConfirmRemovePolicyEntry();
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                 ToolWindow.EDIT_POLICY_ENTRY) == 0) {
-
-            // get the selected entry
-            @SuppressWarnings("unchecked")
-            JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-            int index = list.getSelectedIndex();
-            if (index < 0) {
-                tw.displayErrorDialog(null, new Exception
-                        (PolicyTool.getMessage("No.Policy.Entry.selected")));
-                return;
-            }
-
-            // display the permission list for a policy entry
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
-            td.displayPolicyEntryDialog(true);
-
-        } else if (PolicyTool.collator.compare(e.getActionCommand(),
-                                     ToolWindow.EDIT_KEYSTORE) == 0) {
-
-            // display a dialog box for the user to enter keystore info
-            ToolDialog td = new ToolDialog
-                (PolicyTool.getMessage("KeyStore"), tool, tw, true);
-            td.keyStoreDialog(ToolDialog.EDIT_KEYSTORE);
-        }
-    }
-}
-
-/**
- * Event handler for AddEntryDoneButton button
- *
- * -- if edit is TRUE, then we are EDITing an existing PolicyEntry
- *    and we need to update both the policy and the GUI listing.
- *    if edit is FALSE, then we are ADDing a new PolicyEntry,
- *    so we only need to update the GUI listing.
- */
-class AddEntryDoneButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean edit;
-
-    AddEntryDoneButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean edit) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.edit = edit;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        try {
-            // get a PolicyEntry object from the dialog policy info
-            PolicyEntry newEntry = td.getPolicyEntryFromDialog();
-            PolicyParser.GrantEntry newGe = newEntry.getGrantEntry();
-
-            // see if all the signers have public keys
-            if (newGe.signedBy != null) {
-                String signers[] = tool.parseSigners(newGe.signedBy);
-                for (int i = 0; i < signers.length; i++) {
-                    PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
-                    if (pubKey == null) {
-                        MessageFormat form = new MessageFormat
-                            (PolicyTool.getMessage
-                            ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
-                        Object[] source = {signers[i]};
-                        tool.warnings.addElement(form.format(source));
-                        tw.displayStatusDialog(td, form.format(source));
-                    }
-                }
-            }
-
-            // add the entry
-            @SuppressWarnings("unchecked")
-            JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-            if (edit) {
-                int listIndex = policyList.getSelectedIndex();
-                tool.addEntry(newEntry, listIndex);
-                String newCodeBaseStr = newEntry.headerToString();
-                if (PolicyTool.collator.compare
-                        (newCodeBaseStr, policyList.getModel().getElementAt(listIndex)) != 0)
-                    tool.modified = true;
-                ((DefaultListModel<String>)policyList.getModel()).set(listIndex, newCodeBaseStr);
-            } else {
-                tool.addEntry(newEntry, -1);
-                ((DefaultListModel<String>)policyList.getModel()).addElement(newEntry.headerToString());
-                tool.modified = true;
-            }
-            td.setVisible(false);
-            td.dispose();
-
-        } catch (Exception eee) {
-            tw.displayErrorDialog(td, eee);
-        }
-    }
-}
-
-/**
- * Event handler for ChangeKeyStoreOKButton button
- */
-class ChangeKeyStoreOKButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-
-    ChangeKeyStoreOKButtonListener(PolicyTool tool, ToolWindow tw,
-                ToolDialog td) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        String URLString = ((JTextField)td.getComponent(
-                ToolDialog.KSD_NAME_TEXTFIELD)).getText().trim();
-        String type = ((JTextField)td.getComponent(
-                ToolDialog.KSD_TYPE_TEXTFIELD)).getText().trim();
-        String provider = ((JTextField)td.getComponent(
-                ToolDialog.KSD_PROVIDER_TEXTFIELD)).getText().trim();
-        String pwdURL = ((JTextField)td.getComponent(
-                ToolDialog.KSD_PWD_URL_TEXTFIELD)).getText().trim();
-
-        try {
-            tool.openKeyStore
-                        ((URLString.length() == 0 ? null : URLString),
-                        (type.length() == 0 ? null : type),
-                        (provider.length() == 0 ? null : provider),
-                        (pwdURL.length() == 0 ? null : pwdURL));
-            tool.modified = true;
-        } catch (Exception ex) {
-            MessageFormat form = new MessageFormat(PolicyTool.getMessage
-                ("Unable.to.open.KeyStore.ex.toString."));
-            Object[] source = {ex.toString()};
-            tw.displayErrorDialog(td, form.format(source));
-            return;
-        }
-
-        td.dispose();
-    }
-}
-
-/**
- * Event handler for AddPrinButton button
- */
-class AddPrinButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean editPolicyEntry;
-
-    AddPrinButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean editPolicyEntry) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.editPolicyEntry = editPolicyEntry;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // display a dialog box for the user to enter principal info
-        td.displayPrincipalDialog(editPolicyEntry, false);
-    }
-}
-
-/**
- * Event handler for AddPermButton button
- */
-class AddPermButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean editPolicyEntry;
-
-    AddPermButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean editPolicyEntry) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.editPolicyEntry = editPolicyEntry;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // display a dialog box for the user to enter permission info
-        td.displayPermissionDialog(editPolicyEntry, false);
-    }
-}
-
-/**
- * Event handler for AddPrinOKButton button
- */
-class NewPolicyPrinOKButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog listDialog;
-    private ToolDialog infoDialog;
-    private boolean edit;
-
-    NewPolicyPrinOKButtonListener(PolicyTool tool,
-                                ToolWindow tw,
-                                ToolDialog listDialog,
-                                ToolDialog infoDialog,
-                                boolean edit) {
-        this.tool = tool;
-        this.tw = tw;
-        this.listDialog = listDialog;
-        this.infoDialog = infoDialog;
-        this.edit = edit;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        try {
-            // read in the new principal info from Dialog Box
-            PolicyParser.PrincipalEntry pppe =
-                        infoDialog.getPrinFromDialog();
-            if (pppe != null) {
-                try {
-                    tool.verifyPrincipal(pppe.getPrincipalClass(),
-                                        pppe.getPrincipalName());
-                } catch (ClassNotFoundException cnfe) {
-                    MessageFormat form = new MessageFormat
-                                (PolicyTool.getMessage
-                                ("Warning.Class.not.found.class"));
-                    Object[] source = {pppe.getPrincipalClass()};
-                    tool.warnings.addElement(form.format(source));
-                    tw.displayStatusDialog(infoDialog, form.format(source));
-                }
-
-                // add the principal to the GUI principal list
-                TaggedList prinList =
-                    (TaggedList)listDialog.getComponent(ToolDialog.PE_PRIN_LIST);
-
-                String prinString = ToolDialog.PrincipalEntryToUserFriendlyString(pppe);
-                if (edit) {
-                    // if editing, replace the original principal
-                    int index = prinList.getSelectedIndex();
-                    prinList.replaceTaggedItem(prinString, pppe, index);
-                } else {
-                    // if adding, just add it to the end
-                    prinList.addTaggedItem(prinString, pppe);
-                }
-            }
-            infoDialog.dispose();
-        } catch (Exception ee) {
-            tw.displayErrorDialog(infoDialog, ee);
-        }
-    }
-}
-
-/**
- * Event handler for AddPermOKButton button
- */
-class NewPolicyPermOKButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog listDialog;
-    private ToolDialog infoDialog;
-    private boolean edit;
-
-    NewPolicyPermOKButtonListener(PolicyTool tool,
-                                ToolWindow tw,
-                                ToolDialog listDialog,
-                                ToolDialog infoDialog,
-                                boolean edit) {
-        this.tool = tool;
-        this.tw = tw;
-        this.listDialog = listDialog;
-        this.infoDialog = infoDialog;
-        this.edit = edit;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        try {
-            // read in the new permission info from Dialog Box
-            PolicyParser.PermissionEntry pppe =
-                        infoDialog.getPermFromDialog();
-
-            try {
-                tool.verifyPermission(pppe.permission, pppe.name, pppe.action);
-            } catch (ClassNotFoundException cnfe) {
-                MessageFormat form = new MessageFormat(PolicyTool.getMessage
-                                ("Warning.Class.not.found.class"));
-                Object[] source = {pppe.permission};
-                tool.warnings.addElement(form.format(source));
-                tw.displayStatusDialog(infoDialog, form.format(source));
-            }
-
-            // add the permission to the GUI permission list
-            TaggedList permList =
-                (TaggedList)listDialog.getComponent(ToolDialog.PE_PERM_LIST);
-
-            String permString = ToolDialog.PermissionEntryToUserFriendlyString(pppe);
-            if (edit) {
-                // if editing, replace the original permission
-                int which = permList.getSelectedIndex();
-                permList.replaceTaggedItem(permString, pppe, which);
-            } else {
-                // if adding, just add it to the end
-                permList.addTaggedItem(permString, pppe);
-            }
-            infoDialog.dispose();
-
-        } catch (InvocationTargetException ite) {
-            tw.displayErrorDialog(infoDialog, ite.getTargetException());
-        } catch (Exception ee) {
-            tw.displayErrorDialog(infoDialog, ee);
-        }
-    }
-}
-
-/**
- * Event handler for RemovePrinButton button
- */
-class RemovePrinButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean edit;
-
-    RemovePrinButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean edit) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.edit = edit;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // get the Principal selected from the Principal List
-        TaggedList prinList = (TaggedList)td.getComponent(
-                ToolDialog.PE_PRIN_LIST);
-        int prinIndex = prinList.getSelectedIndex();
-
-        if (prinIndex < 0) {
-            tw.displayErrorDialog(td, new Exception
-                (PolicyTool.getMessage("No.principal.selected")));
-            return;
-        }
-        // remove the principal from the display
-        prinList.removeTaggedItem(prinIndex);
-    }
-}
-
-/**
- * Event handler for RemovePermButton button
- */
-class RemovePermButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean edit;
-
-    RemovePermButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean edit) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.edit = edit;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // get the Permission selected from the Permission List
-        TaggedList permList = (TaggedList)td.getComponent(
-                ToolDialog.PE_PERM_LIST);
-        int permIndex = permList.getSelectedIndex();
-
-        if (permIndex < 0) {
-            tw.displayErrorDialog(td, new Exception
-                (PolicyTool.getMessage("No.permission.selected")));
-            return;
-        }
-        // remove the permission from the display
-        permList.removeTaggedItem(permIndex);
-
-    }
-}
-
-/**
- * Event handler for Edit Principal button
- *
- * We need the editPolicyEntry boolean to tell us if the user is
- * adding a new PolicyEntry at this time, or editing an existing entry.
- * If the user is adding a new PolicyEntry, we ONLY update the
- * GUI listing.  If the user is editing an existing PolicyEntry, we
- * update both the GUI listing and the actual PolicyEntry.
- */
-class EditPrinButtonListener extends MouseAdapter implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean editPolicyEntry;
-
-    EditPrinButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean editPolicyEntry) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.editPolicyEntry = editPolicyEntry;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // get the Principal selected from the Principal List
-        TaggedList list = (TaggedList)td.getComponent(
-                ToolDialog.PE_PRIN_LIST);
-        int prinIndex = list.getSelectedIndex();
-
-        if (prinIndex < 0) {
-            tw.displayErrorDialog(td, new Exception
-                (PolicyTool.getMessage("No.principal.selected")));
-            return;
-        }
-        td.displayPrincipalDialog(editPolicyEntry, true);
-    }
-
-    public void mouseClicked(MouseEvent evt) {
-        if (evt.getClickCount() == 2) {
-            actionPerformed(null);
-        }
-    }
-}
-
-/**
- * Event handler for Edit Permission button
- *
- * We need the editPolicyEntry boolean to tell us if the user is
- * adding a new PolicyEntry at this time, or editing an existing entry.
- * If the user is adding a new PolicyEntry, we ONLY update the
- * GUI listing.  If the user is editing an existing PolicyEntry, we
- * update both the GUI listing and the actual PolicyEntry.
- */
-class EditPermButtonListener extends MouseAdapter implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog td;
-    private boolean editPolicyEntry;
-
-    EditPermButtonListener(PolicyTool tool, ToolWindow tw,
-                                ToolDialog td, boolean editPolicyEntry) {
-        this.tool = tool;
-        this.tw = tw;
-        this.td = td;
-        this.editPolicyEntry = editPolicyEntry;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // get the Permission selected from the Permission List
-        @SuppressWarnings("unchecked")
-        JList<String> list = (JList<String>)td.getComponent(ToolDialog.PE_PERM_LIST);
-        int permIndex = list.getSelectedIndex();
-
-        if (permIndex < 0) {
-            tw.displayErrorDialog(td, new Exception
-                (PolicyTool.getMessage("No.permission.selected")));
-            return;
-        }
-        td.displayPermissionDialog(editPolicyEntry, true);
-    }
-
-    public void mouseClicked(MouseEvent evt) {
-        if (evt.getClickCount() == 2) {
-            actionPerformed(null);
-        }
-    }
-}
-
-/**
- * Event handler for Principal Popup Menu
- */
-class PrincipalTypeMenuListener implements ItemListener {
-
-    private ToolDialog td;
-
-    PrincipalTypeMenuListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void itemStateChanged(ItemEvent e) {
-        if (e.getStateChange() == ItemEvent.DESELECTED) {
-            // We're only interested in SELECTED events
-            return;
-        }
-
-        @SuppressWarnings("unchecked")
-        JComboBox<String> prin = (JComboBox<String>)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
-        JTextField prinField = (JTextField)td.getComponent(
-                ToolDialog.PRD_PRIN_TEXTFIELD);
-        JTextField nameField = (JTextField)td.getComponent(
-                ToolDialog.PRD_NAME_TEXTFIELD);
-
-        prin.getAccessibleContext().setAccessibleName(
-            PolicyTool.splitToWords((String)e.getItem()));
-        if (((String)e.getItem()).equals(ToolDialog.PRIN_TYPE)) {
-            // ignore if they choose "Principal Type:" item
-            if (prinField.getText() != null &&
-                prinField.getText().length() > 0) {
-                Prin inputPrin = ToolDialog.getPrin(prinField.getText(), true);
-                prin.setSelectedItem(inputPrin.CLASS);
-            }
-            return;
-        }
-
-        // if you change the principal, clear the name
-        if (prinField.getText().indexOf((String)e.getItem()) == -1) {
-            nameField.setText("");
-        }
-
-        // set the text in the textfield and also modify the
-        // pull-down choice menus to reflect the correct possible
-        // set of names and actions
-        Prin inputPrin = ToolDialog.getPrin((String)e.getItem(), false);
-        if (inputPrin != null) {
-            prinField.setText(inputPrin.FULL_CLASS);
-        }
-    }
-}
-
-/**
- * Event handler for Permission Popup Menu
- */
-class PermissionMenuListener implements ItemListener {
-
-    private ToolDialog td;
-
-    PermissionMenuListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void itemStateChanged(ItemEvent e) {
-        if (e.getStateChange() == ItemEvent.DESELECTED) {
-            // We're only interested in SELECTED events
-            return;
-        }
-
-        @SuppressWarnings("unchecked")
-        JComboBox<String> perms = (JComboBox<String>)td.getComponent(
-                ToolDialog.PD_PERM_CHOICE);
-        @SuppressWarnings("unchecked")
-        JComboBox<String> names = (JComboBox<String>)td.getComponent(
-                ToolDialog.PD_NAME_CHOICE);
-        @SuppressWarnings("unchecked")
-        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
-                ToolDialog.PD_ACTIONS_CHOICE);
-        JTextField nameField = (JTextField)td.getComponent(
-                ToolDialog.PD_NAME_TEXTFIELD);
-        JTextField actionsField = (JTextField)td.getComponent(
-                ToolDialog.PD_ACTIONS_TEXTFIELD);
-        JTextField permField = (JTextField)td.getComponent(
-                ToolDialog.PD_PERM_TEXTFIELD);
-        JTextField signedbyField = (JTextField)td.getComponent(
-                ToolDialog.PD_SIGNEDBY_TEXTFIELD);
-
-        perms.getAccessibleContext().setAccessibleName(
-            PolicyTool.splitToWords((String)e.getItem()));
-
-        // ignore if they choose the 'Permission:' item
-        if (PolicyTool.collator.compare((String)e.getItem(),
-                                      ToolDialog.PERM) == 0) {
-            if (permField.getText() != null &&
-                permField.getText().length() > 0) {
-
-                Perm inputPerm = ToolDialog.getPerm(permField.getText(), true);
-                if (inputPerm != null) {
-                    perms.setSelectedItem(inputPerm.CLASS);
-                }
-            }
-            return;
-        }
-
-        // if you change the permission, clear the name, actions, and signedBy
-        if (permField.getText().indexOf((String)e.getItem()) == -1) {
-            nameField.setText("");
-            actionsField.setText("");
-            signedbyField.setText("");
-        }
-
-        // set the text in the textfield and also modify the
-        // pull-down choice menus to reflect the correct possible
-        // set of names and actions
-
-        Perm inputPerm = ToolDialog.getPerm((String)e.getItem(), false);
-        if (inputPerm == null) {
-            permField.setText("");
-        } else {
-            permField.setText(inputPerm.FULL_CLASS);
-        }
-        td.setPermissionNames(inputPerm, names, nameField);
-        td.setPermissionActions(inputPerm, actions, actionsField);
-    }
-}
-
-/**
- * Event handler for Permission Name Popup Menu
- */
-class PermissionNameMenuListener implements ItemListener {
-
-    private ToolDialog td;
-
-    PermissionNameMenuListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void itemStateChanged(ItemEvent e) {
-        if (e.getStateChange() == ItemEvent.DESELECTED) {
-            // We're only interested in SELECTED events
-            return;
-        }
-
-        @SuppressWarnings("unchecked")
-        JComboBox<String> names = (JComboBox<String>)td.getComponent(ToolDialog.PD_NAME_CHOICE);
-        names.getAccessibleContext().setAccessibleName(
-            PolicyTool.splitToWords((String)e.getItem()));
-
-        if (((String)e.getItem()).indexOf(ToolDialog.PERM_NAME) != -1)
-            return;
-
-        JTextField tf = (JTextField)td.getComponent(ToolDialog.PD_NAME_TEXTFIELD);
-        tf.setText((String)e.getItem());
-    }
-}
-
-/**
- * Event handler for Permission Actions Popup Menu
- */
-class PermissionActionsMenuListener implements ItemListener {
-
-    private ToolDialog td;
-
-    PermissionActionsMenuListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void itemStateChanged(ItemEvent e) {
-        if (e.getStateChange() == ItemEvent.DESELECTED) {
-            // We're only interested in SELECTED events
-            return;
-        }
-
-        @SuppressWarnings("unchecked")
-        JComboBox<String> actions = (JComboBox<String>)td.getComponent(
-                ToolDialog.PD_ACTIONS_CHOICE);
-        actions.getAccessibleContext().setAccessibleName((String)e.getItem());
-
-        if (((String)e.getItem()).indexOf(ToolDialog.PERM_ACTIONS) != -1)
-            return;
-
-        JTextField tf = (JTextField)td.getComponent(
-                ToolDialog.PD_ACTIONS_TEXTFIELD);
-        if (tf.getText() == null || tf.getText().equals("")) {
-            tf.setText((String)e.getItem());
-        } else {
-            if (tf.getText().indexOf((String)e.getItem()) == -1)
-                tf.setText(tf.getText() + ", " + (String)e.getItem());
-        }
-    }
-}
-
-/**
- * Event handler for all the children dialogs/windows
- */
-class ChildWindowListener implements WindowListener {
-
-    private ToolDialog td;
-
-    ChildWindowListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void windowOpened(WindowEvent we) {
-    }
-
-    public void windowClosing(WindowEvent we) {
-        // same as pressing the "cancel" button
-        td.setVisible(false);
-        td.dispose();
-    }
-
-    public void windowClosed(WindowEvent we) {
-    }
-
-    public void windowIconified(WindowEvent we) {
-    }
-
-    public void windowDeiconified(WindowEvent we) {
-    }
-
-    public void windowActivated(WindowEvent we) {
-    }
-
-    public void windowDeactivated(WindowEvent we) {
-    }
-}
-
-/**
- * Event handler for CancelButton button
- */
-class CancelButtonListener implements ActionListener {
-
-    private ToolDialog td;
-
-    CancelButtonListener(ToolDialog td) {
-        this.td = td;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        td.setVisible(false);
-        td.dispose();
-    }
-}
-
-/**
- * Event handler for ErrorOKButton button
- */
-class ErrorOKButtonListener implements ActionListener {
-
-    private ToolDialog ed;
-
-    ErrorOKButtonListener(ToolDialog ed) {
-        this.ed = ed;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        ed.setVisible(false);
-        ed.dispose();
-    }
-}
-
-/**
- * Event handler for StatusOKButton button
- */
-class StatusOKButtonListener implements ActionListener {
-
-    private ToolDialog sd;
-
-    StatusOKButtonListener(ToolDialog sd) {
-        this.sd = sd;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        sd.setVisible(false);
-        sd.dispose();
-    }
-}
-
-/**
- * Event handler for UserSaveYes button
- */
-class UserSaveYesButtonListener implements ActionListener {
-
-    private ToolDialog us;
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private int select;
-
-    UserSaveYesButtonListener(ToolDialog us, PolicyTool tool,
-                        ToolWindow tw, int select) {
-        this.us = us;
-        this.tool = tool;
-        this.tw = tw;
-        this.select = select;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-
-        // first get rid of the window
-        us.setVisible(false);
-        us.dispose();
-
-        try {
-            String filename = ((JTextField)tw.getComponent(
-                    ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
-            if (filename == null || filename.equals("")) {
-                us.displaySaveAsDialog(select);
-
-                // the above dialog will continue with the originally
-                // requested command if necessary
-            } else {
-                // save the policy entries to a file
-                tool.savePolicy(filename);
-
-                // display status
-                MessageFormat form = new MessageFormat
-                        (PolicyTool.getMessage
-                        ("Policy.successfully.written.to.filename"));
-                Object[] source = {filename};
-                tw.displayStatusDialog(null, form.format(source));
-
-                // now continue with the originally requested command
-                // (QUIT, NEW, or OPEN)
-                us.userSaveContinue(tool, tw, us, select);
-            }
-        } catch (Exception ee) {
-            // error -- just report it and bail
-            tw.displayErrorDialog(null, ee);
-        }
-    }
-}
-
-/**
- * Event handler for UserSaveNoButton
- */
-class UserSaveNoButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog us;
-    private int select;
-
-    UserSaveNoButtonListener(ToolDialog us, PolicyTool tool,
-                        ToolWindow tw, int select) {
-        this.us = us;
-        this.tool = tool;
-        this.tw = tw;
-        this.select = select;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        us.setVisible(false);
-        us.dispose();
-
-        // now continue with the originally requested command
-        // (QUIT, NEW, or OPEN)
-        us.userSaveContinue(tool, tw, us, select);
-    }
-}
-
-/**
- * Event handler for UserSaveCancelButton
- */
-class UserSaveCancelButtonListener implements ActionListener {
-
-    private ToolDialog us;
-
-    UserSaveCancelButtonListener(ToolDialog us) {
-        this.us = us;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        us.setVisible(false);
-        us.dispose();
-
-        // do NOT continue with the originally requested command
-        // (QUIT, NEW, or OPEN)
-    }
-}
-
-/**
- * Event handler for ConfirmRemovePolicyEntryOKButtonListener
- */
-class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener {
-
-    private PolicyTool tool;
-    private ToolWindow tw;
-    private ToolDialog us;
-
-    ConfirmRemovePolicyEntryOKButtonListener(PolicyTool tool,
-                                ToolWindow tw, ToolDialog us) {
-        this.tool = tool;
-        this.tw = tw;
-        this.us = us;
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        // remove the entry
-        @SuppressWarnings("unchecked")
-        JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
-        int index = list.getSelectedIndex();
-        PolicyEntry entries[] = tool.getEntry();
-        tool.removeEntry(entries[index]);
-
-        // redraw the window listing
-        DefaultListModel<String> listModel = new DefaultListModel<>();
-        list = new JList<>(listModel);
-        list.setVisibleRowCount(15);
-        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        list.addMouseListener(new PolicyListListener(tool, tw));
-        entries = tool.getEntry();
-        if (entries != null) {
-                for (int i = 0; i < entries.length; i++) {
-                    listModel.addElement(entries[i].headerToString());
-                }
-        }
-        tw.replacePolicyList(list);
-        us.setVisible(false);
-        us.dispose();
-    }
-}
-
-/**
- * Just a special name, so that the codes dealing with this exception knows
- * it's special, and does not pop out a warning box.
- */
-class NoDisplayException extends RuntimeException {
-    private static final long serialVersionUID = -4611761427108719794L;
-}
-
-/**
- * This is a java.awt.List that bind an Object to each String it holds.
- */
-class TaggedList extends JList<String> {
-    private static final long serialVersionUID = -5676238110427785853L;
-
-    private java.util.List<Object> data = new LinkedList<>();
-    public TaggedList(int i, boolean b) {
-        super(new DefaultListModel<>());
-        setVisibleRowCount(i);
-        setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
-    }
-
-    public Object getObject(int index) {
-        return data.get(index);
-    }
-
-    public void addTaggedItem(String string, Object object) {
-        ((DefaultListModel<String>)getModel()).addElement(string);
-        data.add(object);
-    }
-
-    public void replaceTaggedItem(String string, Object object, int index) {
-        ((DefaultListModel<String>)getModel()).set(index, string);
-        data.set(index, object);
-    }
-
-    public void removeTaggedItem(int index) {
-        ((DefaultListModel<String>)getModel()).remove(index);
-        data.remove(index);
-    }
-}
-
-/**
- * Convenience Principal Classes
- */
-
-class Prin {
-    public final String CLASS;
-    public final String FULL_CLASS;
-
-    public Prin(String clazz, String fullClass) {
-        this.CLASS = clazz;
-        this.FULL_CLASS = fullClass;
-    }
-}
-
-class KrbPrin extends Prin {
-    public KrbPrin() {
-        super("KerberosPrincipal",
-                "javax.security.auth.kerberos.KerberosPrincipal");
-    }
-}
-
-class X500Prin extends Prin {
-    public X500Prin() {
-        super("X500Principal",
-                "javax.security.auth.x500.X500Principal");
-    }
-}
-
-/**
- * Convenience Permission Classes
- */
-
-class Perm {
-    public final String CLASS;
-    public final String FULL_CLASS;
-    public final String[] TARGETS;
-    public final String[] ACTIONS;
-
-    public Perm(String clazz, String fullClass,
-                String[] targets, String[] actions) {
-
-        this.CLASS = clazz;
-        this.FULL_CLASS = fullClass;
-        this.TARGETS = targets;
-        this.ACTIONS = actions;
-    }
-}
-
-class AllPerm extends Perm {
-    public AllPerm() {
-        super("AllPermission", "java.security.AllPermission", null, null);
-    }
-}
-
-class AudioPerm extends Perm {
-    public AudioPerm() {
-        super("AudioPermission",
-        "javax.sound.sampled.AudioPermission",
-        new String[]    {
-                "play",
-                "record"
-                },
-        null);
-    }
-}
-
-class AuthPerm extends Perm {
-    public AuthPerm() {
-    super("AuthPermission",
-        "javax.security.auth.AuthPermission",
-        new String[]    {
-                "doAs",
-                "doAsPrivileged",
-                "getSubject",
-                "getSubjectFromDomainCombiner",
-                "setReadOnly",
-                "modifyPrincipals",
-                "modifyPublicCredentials",
-                "modifyPrivateCredentials",
-                "refreshCredential",
-                "destroyCredential",
-                "createLoginContext.<" + PolicyTool.getMessage("name") + ">",
-                "getLoginConfiguration",
-                "setLoginConfiguration",
-                "createLoginConfiguration.<" +
-                        PolicyTool.getMessage("configuration.type") + ">",
-                "refreshLoginConfiguration"
-                },
-        null);
-    }
-}
-
-class AWTPerm extends Perm {
-    public AWTPerm() {
-    super("AWTPermission",
-        "java.awt.AWTPermission",
-        new String[]    {
-                "accessClipboard",
-                "accessEventQueue",
-                "accessSystemTray",
-                "createRobot",
-                "fullScreenExclusive",
-                "listenToAllAWTEvents",
-                "readDisplayPixels",
-                "replaceKeyboardFocusManager",
-                "setAppletStub",
-                "setWindowAlwaysOnTop",
-                "showWindowWithoutWarningBanner",
-                "toolkitModality",
-                "watchMousePointer"
-        },
-        null);
-    }
-}
-
-class DelegationPerm extends Perm {
-    public DelegationPerm() {
-    super("DelegationPermission",
-        "javax.security.auth.kerberos.DelegationPermission",
-        new String[]    {
-                // allow user input
-                },
-        null);
-    }
-}
-
-class FilePerm extends Perm {
-    public FilePerm() {
-    super("FilePermission",
-        "java.io.FilePermission",
-        new String[]    {
-                "<<ALL FILES>>"
-                },
-        new String[]    {
-                "read",
-                "write",
-                "delete",
-                "execute"
-                });
-    }
-}
-
-class URLPerm extends Perm {
-    public URLPerm() {
-        super("URLPermission",
-                "java.net.URLPermission",
-                new String[]    {
-                    "<"+ PolicyTool.getMessage("url") + ">",
-                },
-                new String[]    {
-                    "<" + PolicyTool.getMessage("method.list") + ">:<"
-                        + PolicyTool.getMessage("request.headers.list") + ">",
-                });
-    }
-}
-
-class InqSecContextPerm extends Perm {
-    public InqSecContextPerm() {
-    super("InquireSecContextPermission",
-        "com.sun.security.jgss.InquireSecContextPermission",
-        new String[]    {
-                "KRB5_GET_SESSION_KEY",
-                "KRB5_GET_TKT_FLAGS",
-                "KRB5_GET_AUTHZ_DATA",
-                "KRB5_GET_AUTHTIME"
-                },
-        null);
-    }
-}
-
-class LogPerm extends Perm {
-    public LogPerm() {
-    super("LoggingPermission",
-        "java.util.logging.LoggingPermission",
-        new String[]    {
-                "control"
-                },
-        null);
-    }
-}
-
-class MgmtPerm extends Perm {
-    public MgmtPerm() {
-    super("ManagementPermission",
-        "java.lang.management.ManagementPermission",
-        new String[]    {
-                "control",
-                "monitor"
-                },
-        null);
-    }
-}
-
-class MBeanPerm extends Perm {
-    public MBeanPerm() {
-    super("MBeanPermission",
-        "javax.management.MBeanPermission",
-        new String[]    {
-                // allow user input
-                },
-        new String[]    {
-                "addNotificationListener",
-                "getAttribute",
-                "getClassLoader",
-                "getClassLoaderFor",
-                "getClassLoaderRepository",
-                "getDomains",
-                "getMBeanInfo",
-                "getObjectInstance",
-                "instantiate",
-                "invoke",
-                "isInstanceOf",
-                "queryMBeans",
-                "queryNames",
-                "registerMBean",
-                "removeNotificationListener",
-                "setAttribute",
-                "unregisterMBean"
-                });
-    }
-}
-
-class MBeanSvrPerm extends Perm {
-    public MBeanSvrPerm() {
-    super("MBeanServerPermission",
-        "javax.management.MBeanServerPermission",
-        new String[]    {
-                "createMBeanServer",
-                "findMBeanServer",
-                "newMBeanServer",
-                "releaseMBeanServer"
-                },
-        null);
-    }
-}
-
-class MBeanTrustPerm extends Perm {
-    public MBeanTrustPerm() {
-    super("MBeanTrustPermission",
-        "javax.management.MBeanTrustPermission",
-        new String[]    {
-                "register"
-                },
-        null);
-    }
-}
-
-class NetPerm extends Perm {
-    public NetPerm() {
-    super("NetPermission",
-        "java.net.NetPermission",
-        new String[]    {
-                "allowHttpTrace",
-                "setDefaultAuthenticator",
-                "requestPasswordAuthentication",
-                "specifyStreamHandler",
-                "getNetworkInformation",
-                "setProxySelector",
-                "getProxySelector",
-                "setCookieHandler",
-                "getCookieHandler",
-                "setResponseCache",
-                "getResponseCache"
-                },
-        null);
-    }
-}
-
-class NetworkPerm extends Perm {
-    public NetworkPerm() {
-    super("NetworkPermission",
-        "jdk.net.NetworkPermission",
-        new String[]    {
-                "setOption.SO_FLOW_SLA",
-                "getOption.SO_FLOW_SLA"
-                },
-        null);
-    }
-}
-
-class PrivCredPerm extends Perm {
-    public PrivCredPerm() {
-    super("PrivateCredentialPermission",
-        "javax.security.auth.PrivateCredentialPermission",
-        new String[]    {
-                // allow user input
-                },
-        new String[]    {
-                "read"
-                });
-    }
-}
-
-class PropPerm extends Perm {
-    public PropPerm() {
-    super("PropertyPermission",
-        "java.util.PropertyPermission",
-        new String[]    {
-                // allow user input
-                },
-        new String[]    {
-                "read",
-                "write"
-                });
-    }
-}
-
-class ReflectPerm extends Perm {
-    public ReflectPerm() {
-    super("ReflectPermission",
-        "java.lang.reflect.ReflectPermission",
-        new String[]    {
-                "suppressAccessChecks"
-                },
-        null);
-    }
-}
-
-class RuntimePerm extends Perm {
-    public RuntimePerm() {
-    super("RuntimePermission",
-        "java.lang.RuntimePermission",
-        new String[]    {
-                "createClassLoader",
-                "getClassLoader",
-                "setContextClassLoader",
-                "enableContextClassLoaderOverride",
-                "setSecurityManager",
-                "createSecurityManager",
-                "getenv.<" +
-                    PolicyTool.getMessage("environment.variable.name") + ">",
-                "exitVM",
-                "shutdownHooks",
-                "setFactory",
-                "setIO",
-                "modifyThread",
-                "stopThread",
-                "modifyThreadGroup",
-                "getProtectionDomain",
-                "readFileDescriptor",
-                "writeFileDescriptor",
-                "loadLibrary.<" +
-                    PolicyTool.getMessage("library.name") + ">",
-                "accessClassInPackage.<" +
-                    PolicyTool.getMessage("package.name")+">",
-                "defineClassInPackage.<" +
-                    PolicyTool.getMessage("package.name")+">",
-                "accessDeclaredMembers",
-                "queuePrintJob",
-                "getStackTrace",
-                "setDefaultUncaughtExceptionHandler",
-                "preferences",
-                "usePolicy",
-                // "inheritedChannel"
-                },
-        null);
-    }
-}
-
-class SecurityPerm extends Perm {
-    public SecurityPerm() {
-    super("SecurityPermission",
-        "java.security.SecurityPermission",
-        new String[]    {
-                "createAccessControlContext",
-                "getDomainCombiner",
-                "getPolicy",
-                "setPolicy",
-                "createPolicy.<" +
-                    PolicyTool.getMessage("policy.type") + ">",
-                "getProperty.<" +
-                    PolicyTool.getMessage("property.name") + ">",
-                "setProperty.<" +
-                    PolicyTool.getMessage("property.name") + ">",
-                "insertProvider.<" +
-                    PolicyTool.getMessage("provider.name") + ">",
-                "removeProvider.<" +
-                    PolicyTool.getMessage("provider.name") + ">",
-                //"setSystemScope",
-                //"setIdentityPublicKey",
-                //"setIdentityInfo",
-                //"addIdentityCertificate",
-                //"removeIdentityCertificate",
-                //"printIdentity",
-                "clearProviderProperties.<" +
-                    PolicyTool.getMessage("provider.name") + ">",
-                "putProviderProperty.<" +
-                    PolicyTool.getMessage("provider.name") + ">",
-                "removeProviderProperty.<" +
-                    PolicyTool.getMessage("provider.name") + ">",
-                //"getSignerPrivateKey",
-                //"setSignerKeyPair"
-                },
-        null);
-    }
-}
-
-class SerialPerm extends Perm {
-    public SerialPerm() {
-    super("SerializablePermission",
-        "java.io.SerializablePermission",
-        new String[]    {
-                "enableSubclassImplementation",
-                "enableSubstitution"
-                },
-        null);
-    }
-}
-
-class ServicePerm extends Perm {
-    public ServicePerm() {
-    super("ServicePermission",
-        "javax.security.auth.kerberos.ServicePermission",
-        new String[]    {
-                // allow user input
-                },
-        new String[]    {
-                "initiate",
-                "accept"
-                });
-    }
-}
-
-class SocketPerm extends Perm {
-    public SocketPerm() {
-    super("SocketPermission",
-        "java.net.SocketPermission",
-        new String[]    {
-                // allow user input
-                },
-        new String[]    {
-                "accept",
-                "connect",
-                "listen",
-                "resolve"
-                });
-    }
-}
-
-class SQLPerm extends Perm {
-    public SQLPerm() {
-    super("SQLPermission",
-        "java.sql.SQLPermission",
-        new String[]    {
-                "setLog",
-                "callAbort",
-                "setSyncFactory",
-                "setNetworkTimeout",
-                },
-        null);
-    }
-}
-
-class SSLPerm extends Perm {
-    public SSLPerm() {
-    super("SSLPermission",
-        "javax.net.ssl.SSLPermission",
-        new String[]    {
-                "setHostnameVerifier",
-                "getSSLSessionContext"
-                },
-        null);
-    }
-}
-
-class SubjDelegPerm extends Perm {
-    public SubjDelegPerm() {
-    super("SubjectDelegationPermission",
-        "javax.management.remote.SubjectDelegationPermission",
-        new String[]    {
-                // allow user input
-                },
-        null);
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Warning: A public key for alias {0} does not exist.  Make sure a KeyStore is properly configured."},
-        {"Warning.Class.not.found.class", "Warning: Class not found: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Warning: Invalid argument(s) for constructor: {0}"},
-        {"Illegal.Principal.Type.type", "Illegal Principal Type: {0}"},
-        {"Illegal.option.option", "Illegal option: {0}"},
-        {"Usage.policytool.options.", "Usage: policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    policy file location"},
-        {"New", "&New"},
-        {"Open", "&Open..."},
-        {"Save", "&Save"},
-        {"Save.As", "Save &As..."},
-        {"View.Warning.Log", "View &Warning Log"},
-        {"Exit", "E&xit"},
-        {"Add.Policy.Entry", "&Add Policy Entry"},
-        {"Edit.Policy.Entry", "&Edit Policy Entry"},
-        {"Remove.Policy.Entry", "&Remove Policy Entry"},
-        {"Edit", "&Edit"},
-        {"Retain", "Retain"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Warning: File name may include escaped backslash characters. " +
-                        "It is not necessary to escape backslash characters " +
-                        "(the tool escapes characters as necessary when writing " +
-                        "the policy contents to the persistent store).\n\n" +
-                        "Click on Retain to retain the entered name, or click on " +
-                        "Edit to edit the name."},
-
-        {"Add.Public.Key.Alias", "Add Public Key Alias"},
-        {"Remove.Public.Key.Alias", "Remove Public Key Alias"},
-        {"File", "&File"},
-        {"KeyStore", "&KeyStore"},
-        {"Policy.File.", "Policy File:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "Could not open policy file: {0}: {1}"},
-        {"Policy.Tool", "Policy Tool"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Errors have occurred while opening the policy configuration.  View the Warning Log for more information."},
-        {"Error", "Error"},
-        {"OK", "OK"},
-        {"Status", "Status"},
-        {"Warning", "Warning"},
-        {"Permission.",
-                "Permission:                                                       "},
-        {"Principal.Type.", "Principal Type:"},
-        {"Principal.Name.", "Principal Name:"},
-        {"Target.Name.",
-                "Target Name:                                                    "},
-        {"Actions.",
-                "Actions:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "OK to overwrite existing file {0}?"},
-        {"Cancel", "Cancel"},
-        {"CodeBase.", "&CodeBase:"},
-        {"SignedBy.", "&SignedBy:"},
-        {"Add.Principal", "&Add Principal"},
-        {"Edit.Principal", "&Edit Principal"},
-        {"Remove.Principal", "&Remove Principal"},
-        {"Principals.", "&Principals:"},
-        {".Add.Permission", "  A&dd Permission"},
-        {".Edit.Permission", "  Ed&it Permission"},
-        {"Remove.Permission", "Re&move Permission"},
-        {"Done", "Done"},
-        {"KeyStore.URL.", "KeyStore &URL:"},
-        {"KeyStore.Type.", "KeyStore &Type:"},
-        {"KeyStore.Provider.", "KeyStore &Provider:"},
-        {"KeyStore.Password.URL.", "KeyStore Pass&word URL:"},
-        {"Principals", "Principals"},
-        {".Edit.Principal.", "  Edit Principal:"},
-        {".Add.New.Principal.", "  Add New Principal:"},
-        {"Permissions", "Permissions"},
-        {".Edit.Permission.", "  Edit Permission:"},
-        {".Add.New.Permission.", "  Add New Permission:"},
-        {"Signed.By.", "Signed By:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "Cannot Specify Principal with a Wildcard Class without a Wildcard Name"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "Cannot Specify Principal without a Name"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "Permission and Target Name must have a value"},
-        {"Remove.this.Policy.Entry.", "Remove this Policy Entry?"},
-        {"Overwrite.File", "Overwrite File"},
-        {"Policy.successfully.written.to.filename",
-                "Policy successfully written to {0}"},
-        {"null.filename", "null filename"},
-        {"Save.changes.", "Save changes?"},
-        {"Yes", "&Yes"},
-        {"No", "&No"},
-        {"Policy.Entry", "Policy Entry"},
-        {"Save.Changes", "Save Changes"},
-        {"No.Policy.Entry.selected", "No Policy Entry selected"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "Unable to open KeyStore: {0}"},
-        {"No.principal.selected", "No principal selected"},
-        {"No.permission.selected", "No permission selected"},
-        {"name", "name"},
-        {"configuration.type", "configuration type"},
-        {"environment.variable.name", "environment variable name"},
-        {"library.name", "library name"},
-        {"package.name", "package name"},
-        {"policy.type", "policy type"},
-        {"property.name", "property name"},
-        {"provider.name", "provider name"},
-        {"url", "url"},
-        {"method.list", "method list"},
-        {"request.headers.list", "request headers list"},
-        {"Principal.List", "Principal List"},
-        {"Permission.List", "Permission List"},
-        {"Code.Base", "Code Base"},
-        {"KeyStore.U.R.L.", "KeyStore U R L:"},
-        {"KeyStore.Password.U.R.L.", "KeyStore Password U R L:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_de.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_de extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Warnung: Kein Public Key f\u00FCr Alias {0} vorhanden. Vergewissern Sie sich, dass der KeyStore ordnungsgem\u00E4\u00DF konfiguriert ist."},
-        {"Warning.Class.not.found.class", "Warnung: Klasse nicht gefunden: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Warnung: Ung\u00FCltige(s) Argument(e) f\u00FCr Constructor: {0}"},
-        {"Illegal.Principal.Type.type", "Ung\u00FCltiger Principal-Typ: {0}"},
-        {"Illegal.option.option", "Ung\u00FCltige Option: {0}"},
-        {"Usage.policytool.options.", "Verwendung: policytool [Optionen]"},
-        {".file.file.policy.file.location",
-                " [-file <Datei>]    Policy-Dateiverzeichnis"},
-        {"New", "Neu"},
-        {"Open", "\u00D6ffnen"},
-        {"Save", "Speichern"},
-        {"Save.As", "Speichern unter"},
-        {"View.Warning.Log", "Warnungslog anzeigen"},
-        {"Exit", "Beenden"},
-        {"Add.Policy.Entry", "Policy-Eintrag hinzuf\u00FCgen"},
-        {"Edit.Policy.Entry", "Policy-Eintrag bearbeiten"},
-        {"Remove.Policy.Entry", "Policy-Eintrag entfernen"},
-        {"Edit", "Bearbeiten"},
-        {"Retain", "Beibehalten"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Warnung: M\u00F6glicherweise enth\u00E4lt der Dateiname Escapezeichen mit Backslash. Es ist nicht notwendig, Backslash-Zeichen zu escapen (das Tool f\u00FChrt dies automatisch beim Schreiben des Policy-Contents in den persistenten Speicher aus).\n\nKlicken Sie auf \"Beibehalten\", um den eingegebenen Namen beizubehalten oder auf \"Bearbeiten\", um den Namen zu bearbeiten."},
-
-        {"Add.Public.Key.Alias", "Public Key-Alias hinzuf\u00FCgen"},
-        {"Remove.Public.Key.Alias", "Public Key-Alias entfernen"},
-        {"File", "Datei"},
-        {"KeyStore", "KeyStore"},
-        {"Policy.File.", "Policy-Datei:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "Policy-Datei konnte nicht ge\u00F6ffnet werden: {0}: {1}"},
-        {"Policy.Tool", "Policy-Tool"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Beim \u00D6ffnen der Policy-Konfiguration sind Fehler aufgetreten. Weitere Informationen finden Sie im Warnungslog."},
-        {"Error", "Fehler"},
-        {"OK", "OK"},
-        {"Status", "Status"},
-        {"Warning", "Warnung"},
-        {"Permission.",
-                "Berechtigung:                                                       "},
-        {"Principal.Type.", "Principal-Typ:"},
-        {"Principal.Name.", "Principal-Name:"},
-        {"Target.Name.",
-                "Zielname:                                                    "},
-        {"Actions.",
-                "Aktionen:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "Vorhandene Datei {0} \u00FCberschreiben?"},
-        {"Cancel", "Abbrechen"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "Principal hinzuf\u00FCgen"},
-        {"Edit.Principal", "Principal bearbeiten"},
-        {"Remove.Principal", "Principal entfernen"},
-        {"Principals.", "Principals:"},
-        {".Add.Permission", "  Berechtigung hinzuf\u00FCgen"},
-        {".Edit.Permission", "  Berechtigung bearbeiten"},
-        {"Remove.Permission", "Berechtigung entfernen"},
-        {"Done", "Fertig"},
-        {"KeyStore.URL.", "KeyStore-URL:"},
-        {"KeyStore.Type.", "KeyStore-Typ:"},
-        {"KeyStore.Provider.", "KeyStore-Provider:"},
-        {"KeyStore.Password.URL.", "KeyStore-Kennwort-URL:"},
-        {"Principals", "Principals"},
-        {".Edit.Principal.", "  Principal bearbeiten:"},
-        {".Add.New.Principal.", "  Neuen Principal hinzuf\u00FCgen:"},
-        {"Permissions", "Berechtigungen"},
-        {".Edit.Permission.", "  Berechtigung bearbeiten:"},
-        {".Add.New.Permission.", "  Neue Berechtigung hinzuf\u00FCgen:"},
-        {"Signed.By.", "Signiert von:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "Principal kann nicht mit einer Platzhalterklasse ohne Platzhalternamen angegeben werden"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "Principal kann nicht ohne einen Namen angegeben werden"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "Berechtigung und Zielname m\u00FCssen einen Wert haben"},
-        {"Remove.this.Policy.Entry.", "Diesen Policy-Eintrag entfernen?"},
-        {"Overwrite.File", "Datei \u00FCberschreiben"},
-        {"Policy.successfully.written.to.filename",
-                "Policy erfolgreich in {0} geschrieben"},
-        {"null.filename", "Null-Dateiname"},
-        {"Save.changes.", "\u00C4nderungen speichern?"},
-        {"Yes", "Ja"},
-        {"No", "Nein"},
-        {"Policy.Entry", "Policy-Eintrag"},
-        {"Save.Changes", "\u00C4nderungen speichern"},
-        {"No.Policy.Entry.selected", "Kein Policy-Eintrag ausgew\u00E4hlt"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "KeyStore kann nicht ge\u00F6ffnet werden: {0}"},
-        {"No.principal.selected", "Kein Principal ausgew\u00E4hlt"},
-        {"No.permission.selected", "Keine Berechtigung ausgew\u00E4hlt"},
-        {"name", "Name"},
-        {"configuration.type", "Konfigurationstyp"},
-        {"environment.variable.name", "Umgebungsvariablenname"},
-        {"library.name", "Library-Name"},
-        {"package.name", "Packagename"},
-        {"policy.type", "Policy-Typ"},
-        {"property.name", "Eigenschaftsname"},
-        {"provider.name", "Providername"},
-        {"url", "URL"},
-        {"method.list", "Methodenliste"},
-        {"request.headers.list", "Headerliste anfordern"},
-        {"Principal.List", "Principal-Liste"},
-        {"Permission.List", "Berechtigungsliste"},
-        {"Code.Base", "Codebase"},
-        {"KeyStore.U.R.L.", "KeyStore-URL:"},
-        {"KeyStore.Password.U.R.L.", "KeyStore-Kennwort-URL:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_es.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_es extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Advertencia: no hay clave p\u00FAblica para el alias {0}. Aseg\u00FArese de que se ha configurado correctamente un almac\u00E9n de claves."},
-        {"Warning.Class.not.found.class", "Advertencia: no se ha encontrado la clase: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Advertencia: argumento(s) no v\u00E1lido(s) para el constructor: {0}"},
-        {"Illegal.Principal.Type.type", "Tipo de principal no permitido: {0}"},
-        {"Illegal.option.option", "Opci\u00F3n no permitida: {0}"},
-        {"Usage.policytool.options.", "Sintaxis: policytool [opciones]"},
-        {".file.file.policy.file.location",
-                "  [-file <archivo>]    ubicaci\u00F3n del archivo de normas"},
-        {"New", "Nuevo"},
-        {"Open", "Abrir"},
-        {"Save", "Guardar"},
-        {"Save.As", "Guardar como"},
-        {"View.Warning.Log", "Ver Log de Advertencias"},
-        {"Exit", "Salir"},
-        {"Add.Policy.Entry", "Agregar Entrada de Pol\u00EDtica"},
-        {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"},
-        {"Remove.Policy.Entry", "Eliminar Entrada de Pol\u00EDtica"},
-        {"Edit", "Editar"},
-        {"Retain", "Mantener"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Advertencia: el nombre del archivo puede contener caracteres de barra invertida de escape. No es necesario utilizar barras invertidas de escape (la herramienta aplica caracteres de escape seg\u00FAn sea necesario al escribir el contenido de las pol\u00EDticas en el almac\u00E9n persistente).\n\nHaga clic en Mantener para conservar el nombre introducido o en Editar para modificarlo."},
-
-        {"Add.Public.Key.Alias", "Agregar Alias de Clave P\u00FAblico"},
-        {"Remove.Public.Key.Alias", "Eliminar Alias de Clave P\u00FAblico"},
-        {"File", "Archivo"},
-        {"KeyStore", "Almac\u00E9n de Claves"},
-        {"Policy.File.", "Archivo de Pol\u00EDtica:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "No se ha podido abrir el archivo de pol\u00EDtica: {0}: {1}"},
-        {"Policy.Tool", "Herramienta de Pol\u00EDticas"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Ha habido errores al abrir la configuraci\u00F3n de pol\u00EDticas. V\u00E9ase el log de advertencias para obtener m\u00E1s informaci\u00F3n."},
-        {"Error", "Error"},
-        {"OK", "Aceptar"},
-        {"Status", "Estado"},
-        {"Warning", "Advertencia"},
-        {"Permission.",
-                "Permiso:                                                       "},
-        {"Principal.Type.", "Tipo de Principal:"},
-        {"Principal.Name.", "Nombre de Principal:"},
-        {"Target.Name.",
-                "Nombre de Destino:                                                    "},
-        {"Actions.",
-                "Acciones:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\u00BFSobrescribir el archivo existente {0}?"},
-        {"Cancel", "Cancelar"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "Agregar Principal"},
-        {"Edit.Principal", "Editar Principal"},
-        {"Remove.Principal", "Eliminar Principal"},
-        {"Principals.", "Principales:"},
-        {".Add.Permission", "  Agregar Permiso"},
-        {".Edit.Permission", "  Editar Permiso"},
-        {"Remove.Permission", "Eliminar Permiso"},
-        {"Done", "Listo"},
-        {"KeyStore.URL.", "URL de Almac\u00E9n de Claves:"},
-        {"KeyStore.Type.", "Tipo de Almac\u00E9n de Claves:"},
-        {"KeyStore.Provider.", "Proveedor de Almac\u00E9n de Claves:"},
-        {"KeyStore.Password.URL.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"},
-        {"Principals", "Principales"},
-        {".Edit.Principal.", "  Editar Principal:"},
-        {".Add.New.Principal.", "  Agregar Nuevo Principal:"},
-        {"Permissions", "Permisos"},
-        {".Edit.Permission.", "  Editar Permiso:"},
-        {".Add.New.Permission.", "  Agregar Permiso Nuevo:"},
-        {"Signed.By.", "Firmado Por:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "No se puede especificar un principal con una clase de comod\u00EDn sin un nombre de comod\u00EDn"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "No se puede especificar el principal sin un nombre"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "Permiso y Nombre de Destino deben tener un valor"},
-        {"Remove.this.Policy.Entry.", "\u00BFEliminar esta entrada de pol\u00EDtica?"},
-        {"Overwrite.File", "Sobrescribir Archivo"},
-        {"Policy.successfully.written.to.filename",
-                "Pol\u00EDtica escrita correctamente en {0}"},
-        {"null.filename", "nombre de archivo nulo"},
-        {"Save.changes.", "\u00BFGuardar los cambios?"},
-        {"Yes", "S\u00ED"},
-        {"No", "No"},
-        {"Policy.Entry", "Entrada de Pol\u00EDtica"},
-        {"Save.Changes", "Guardar Cambios"},
-        {"No.Policy.Entry.selected", "No se ha seleccionado la entrada de pol\u00EDtica"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "No se ha podido abrir el almac\u00E9n de claves: {0}"},
-        {"No.principal.selected", "No se ha seleccionado un principal"},
-        {"No.permission.selected", "No se ha seleccionado un permiso"},
-        {"name", "nombre"},
-        {"configuration.type", "tipo de configuraci\u00F3n"},
-        {"environment.variable.name", "nombre de variable de entorno"},
-        {"library.name", "nombre de la biblioteca"},
-        {"package.name", "nombre del paquete"},
-        {"policy.type", "tipo de pol\u00EDtica"},
-        {"property.name", "nombre de la propiedad"},
-        {"provider.name", "nombre del proveedor"},
-        {"url", "url"},
-        {"method.list", "lista de m\u00E9todos"},
-        {"request.headers.list", "lista de cabeceras de solicitudes"},
-        {"Principal.List", "Lista de Principales"},
-        {"Permission.List", "Lista de Permisos"},
-        {"Code.Base", "Base de C\u00F3digo"},
-        {"KeyStore.U.R.L.", "URL de Almac\u00E9n de Claves:"},
-        {"KeyStore.Password.U.R.L.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_fr.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_fr extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Avertissement\u00A0: il n''existe pas de cl\u00E9 publique pour l''alias {0}. V\u00E9rifiez que le fichier de cl\u00E9s d''acc\u00E8s est correctement configur\u00E9."},
-        {"Warning.Class.not.found.class", "Avertissement : classe introuvable - {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Avertissement\u00A0: arguments non valides pour le constructeur\u00A0- {0}"},
-        {"Illegal.Principal.Type.type", "Type de principal non admis : {0}"},
-        {"Illegal.option.option", "Option non admise : {0}"},
-        {"Usage.policytool.options.", "Syntaxe : policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    emplacement du fichier de r\u00E8gles"},
-        {"New", "Nouveau"},
-        {"Open", "Ouvrir"},
-        {"Save", "Enregistrer"},
-        {"Save.As", "Enregistrer sous"},
-        {"View.Warning.Log", "Afficher le journal des avertissements"},
-        {"Exit", "Quitter"},
-        {"Add.Policy.Entry", "Ajouter une r\u00E8gle"},
-        {"Edit.Policy.Entry", "Modifier une r\u00E8gle"},
-        {"Remove.Policy.Entry", "Enlever une r\u00E8gle"},
-        {"Edit", "Modifier"},
-        {"Retain", "Conserver"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Avertissement : il se peut que le nom de fichier contienne des barres obliques inverses avec caract\u00E8re d'\u00E9chappement. Il n'est pas n\u00E9cessaire d'ajouter un caract\u00E8re d'\u00E9chappement aux barres obliques inverses. L'outil proc\u00E8de \u00E0 l'\u00E9chappement si n\u00E9cessaire lorsqu'il \u00E9crit le contenu des r\u00E8gles dans la zone de stockage persistant).\n\nCliquez sur Conserver pour garder le nom saisi ou sur Modifier pour le remplacer."},
-
-        {"Add.Public.Key.Alias", "Ajouter un alias de cl\u00E9 publique"},
-        {"Remove.Public.Key.Alias", "Enlever un alias de cl\u00E9 publique"},
-        {"File", "Fichier"},
-        {"KeyStore", "Fichier de cl\u00E9s"},
-        {"Policy.File.", "Fichier de r\u00E8gles :"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "Impossible d''ouvrir le fichier de r\u00E8gles\u00A0: {0}: {1}"},
-        {"Policy.Tool", "Policy Tool"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Des erreurs se sont produites \u00E0 l'ouverture de la configuration de r\u00E8gles. Pour plus d'informations, consultez le journal des avertissements."},
-        {"Error", "Erreur"},
-        {"OK", "OK"},
-        {"Status", "Statut"},
-        {"Warning", "Avertissement"},
-        {"Permission.",
-                "Droit :                                                       "},
-        {"Principal.Type.", "Type de principal :"},
-        {"Principal.Name.", "Nom de principal :"},
-        {"Target.Name.",
-                "Nom de cible :                                                    "},
-        {"Actions.",
-                "Actions :                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "Remplacer le fichier existant {0} ?"},
-        {"Cancel", "Annuler"},
-        {"CodeBase.", "Base de code :"},
-        {"SignedBy.", "Sign\u00E9 par :"},
-        {"Add.Principal", "Ajouter un principal"},
-        {"Edit.Principal", "Modifier un principal"},
-        {"Remove.Principal", "Enlever un principal"},
-        {"Principals.", "Principaux :"},
-        {".Add.Permission", "  Ajouter un droit"},
-        {".Edit.Permission", "  Modifier un droit"},
-        {"Remove.Permission", "Enlever un droit"},
-        {"Done", "Termin\u00E9"},
-        {"KeyStore.URL.", "URL du fichier de cl\u00E9s :"},
-        {"KeyStore.Type.", "Type du fichier de cl\u00E9s :"},
-        {"KeyStore.Provider.", "Fournisseur du fichier de cl\u00E9s :"},
-        {"KeyStore.Password.URL.", "URL du mot de passe du fichier de cl\u00E9s :"},
-        {"Principals", "Principaux"},
-        {".Edit.Principal.", "  Modifier un principal :"},
-        {".Add.New.Principal.", "  Ajouter un principal :"},
-        {"Permissions", "Droits"},
-        {".Edit.Permission.", "  Modifier un droit :"},
-        {".Add.New.Permission.", "  Ajouter un droit :"},
-        {"Signed.By.", "Sign\u00E9 par :"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "Impossible de sp\u00E9cifier un principal avec une classe g\u00E9n\u00E9rique sans nom g\u00E9n\u00E9rique"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "Impossible de sp\u00E9cifier un principal sans nom"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "Le droit et le nom de cible doivent avoir une valeur"},
-        {"Remove.this.Policy.Entry.", "Enlever cette r\u00E8gle ?"},
-        {"Overwrite.File", "Remplacer le fichier"},
-        {"Policy.successfully.written.to.filename",
-                "R\u00E8gle \u00E9crite dans {0}"},
-        {"null.filename", "nom de fichier NULL"},
-        {"Save.changes.", "Enregistrer les modifications ?"},
-        {"Yes", "Oui"},
-        {"No", "Non"},
-        {"Policy.Entry", "R\u00E8gle"},
-        {"Save.Changes", "Enregistrer les modifications"},
-        {"No.Policy.Entry.selected", "Aucune r\u00E8gle s\u00E9lectionn\u00E9e"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "Impossible d''ouvrir le fichier de cl\u00E9s d''acc\u00E8s : {0}"},
-        {"No.principal.selected", "Aucun principal s\u00E9lectionn\u00E9"},
-        {"No.permission.selected", "Aucun droit s\u00E9lectionn\u00E9"},
-        {"name", "nom"},
-        {"configuration.type", "type de configuration"},
-        {"environment.variable.name", "Nom de variable d'environnement"},
-        {"library.name", "nom de biblioth\u00E8que"},
-        {"package.name", "nom de package"},
-        {"policy.type", "type de r\u00E8gle"},
-        {"property.name", "nom de propri\u00E9t\u00E9"},
-        {"provider.name", "nom du fournisseur"},
-        {"url", "url"},
-        {"method.list", "liste des m\u00E9thodes"},
-        {"request.headers.list", "liste des en-t\u00EAtes de demande"},
-        {"Principal.List", "Liste de principaux"},
-        {"Permission.List", "Liste de droits"},
-        {"Code.Base", "Base de code"},
-        {"KeyStore.U.R.L.", "URL du fichier de cl\u00E9s :"},
-        {"KeyStore.Password.U.R.L.", "URL du mot de passe du fichier de cl\u00E9s :"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_it.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_it extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Avvertenza: non esiste una chiave pubblica per l''alias {0}. Verificare che il keystore sia configurato correttamente."},
-        {"Warning.Class.not.found.class", "Avvertenza: classe non trovata: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Avvertenza: argomento o argomenti non validi per il costruttore {0}"},
-        {"Illegal.Principal.Type.type", "Tipo principal non valido: {0}"},
-        {"Illegal.option.option", "Opzione non valida: {0}"},
-        {"Usage.policytool.options.", "Uso: policytool [opzioni]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    posizione del file dei criteri"},
-        {"New", "Nuovo"},
-        {"Open", "Apri"},
-        {"Save", "Salva"},
-        {"Save.As", "Salva con nome"},
-        {"View.Warning.Log", "Visualizza registro avvertenze"},
-        {"Exit", "Esci"},
-        {"Add.Policy.Entry", "Aggiungi voce dei criteri"},
-        {"Edit.Policy.Entry", "Modifica voce dei criteri"},
-        {"Remove.Policy.Entry", "Rimuovi voce dei criteri"},
-        {"Edit", "Modifica"},
-        {"Retain", "Mantieni"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Avvertenza: il nome file pu\u00F2 includere barre rovesciate con escape. Non \u00E8 necessario eseguire l'escape delle barre rovesciate (se necessario lo strumento esegue l'escape dei caratteri al momento della scrittura del contenuto dei criteri nell'area di memorizzazione persistente).\n\nFare click su Mantieni per conservare il nome immesso, oppure su Modifica per modificare il nome."},
-
-        {"Add.Public.Key.Alias", "Aggiungi alias chiave pubblica"},
-        {"Remove.Public.Key.Alias", "Rimuovi alias chiave pubblica"},
-        {"File", "File"},
-        {"KeyStore", "Keystore"},
-        {"Policy.File.", "File dei criteri:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "Impossibile aprire il file di criteri {0}: {1}"},
-        {"Policy.Tool", "Strumento criteri"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Si sono verificati errori durante l'apertura della configurazione dei criteri. Consultare il registro delle avvertenze per ulteriori informazioni."},
-        {"Error", "Errore"},
-        {"OK", "OK"},
-        {"Status", "Stato"},
-        {"Warning", "Avvertenza"},
-        {"Permission.",
-                "Autorizzazione:                                                       "},
-        {"Principal.Type.", "Tipo principal:"},
-        {"Principal.Name.", "Nome principal:"},
-        {"Target.Name.",
-                "Nome destinazione:                                                    "},
-        {"Actions.",
-                "Azioni:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "OK per sovrascrivere il file {0}?"},
-        {"Cancel", "Annulla"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "Aggiungi principal"},
-        {"Edit.Principal", "Modifica principal"},
-        {"Remove.Principal", "Rimuovi principal"},
-        {"Principals.", "Principal:"},
-        {".Add.Permission", "  Aggiungi autorizzazione"},
-        {".Edit.Permission", "  Modifica autorizzazione"},
-        {"Remove.Permission", "Rimuovi autorizzazione"},
-        {"Done", "Fine"},
-        {"KeyStore.URL.", "URL keystore:"},
-        {"KeyStore.Type.", "Tipo keystore:"},
-        {"KeyStore.Provider.", "Provider keystore:"},
-        {"KeyStore.Password.URL.", "URL password keystore:"},
-        {"Principals", "Principal:"},
-        {".Edit.Principal.", "  Modifica principal:"},
-        {".Add.New.Principal.", "  Aggiungi nuovo principal:"},
-        {"Permissions", "Autorizzazioni"},
-        {".Edit.Permission.", "  Modifica autorizzazione:"},
-        {".Add.New.Permission.", "  Aggiungi nuova autorizzazione:"},
-        {"Signed.By.", "Firmato da:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "Impossibile specificare principal con una classe carattere jolly senza un nome carattere jolly"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "Impossibile specificare principal senza un nome"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "L'autorizzazione e il nome destinazione non possono essere nulli"},
-        {"Remove.this.Policy.Entry.", "Rimuovere questa voce dei criteri?"},
-        {"Overwrite.File", "Sovrascrivi file"},
-        {"Policy.successfully.written.to.filename",
-                "I criteri sono stati scritti in {0}"},
-        {"null.filename", "nome file nullo"},
-        {"Save.changes.", "Salvare le modifiche?"},
-        {"Yes", "S\u00EC"},
-        {"No", "No"},
-        {"Policy.Entry", "Voce dei criteri"},
-        {"Save.Changes", "Salva le modifiche"},
-        {"No.Policy.Entry.selected", "Nessuna voce dei criteri selezionata"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "Impossibile aprire il keystore: {0}"},
-        {"No.principal.selected", "Nessun principal selezionato"},
-        {"No.permission.selected", "Nessuna autorizzazione selezionata"},
-        {"name", "nome"},
-        {"configuration.type", "tipo di configurazione"},
-        {"environment.variable.name", "nome variabile ambiente"},
-        {"library.name", "nome libreria"},
-        {"package.name", "nome package"},
-        {"policy.type", "tipo di criteri"},
-        {"property.name", "nome propriet\u00E0"},
-        {"provider.name", "nome provider"},
-        {"url", "url"},
-        {"method.list", "lista metodi"},
-        {"request.headers.list", "lista intestazioni di richiesta"},
-        {"Principal.List", "Lista principal"},
-        {"Permission.List", "Lista autorizzazioni"},
-        {"Code.Base", "Codebase"},
-        {"KeyStore.U.R.L.", "URL keystore:"},
-        {"KeyStore.Password.U.R.L.", "URL password keystore:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_ja.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_ja extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "\u8B66\u544A: \u5225\u540D{0}\u306E\u516C\u958B\u9375\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002\u30AD\u30FC\u30B9\u30C8\u30A2\u304C\u6B63\u3057\u304F\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-        {"Warning.Class.not.found.class", "\u8B66\u544A: \u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "\u8B66\u544A: \u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}"},
-        {"Illegal.Principal.Type.type", "\u4E0D\u6B63\u306A\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7: {0}"},
-        {"Illegal.option.option", "\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}"},
-        {"Usage.policytool.options.", "\u4F7F\u7528\u65B9\u6CD5: policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]  \u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240"},
-        {"New", "\u65B0\u898F"},
-        {"Open", "\u958B\u304F"},
-        {"Save", "\u4FDD\u5B58"},
-        {"Save.As", "\u5225\u540D\u4FDD\u5B58"},
-        {"View.Warning.Log", "\u8B66\u544A\u30ED\u30B0\u306E\u8868\u793A"},
-        {"Exit", "\u7D42\u4E86"},
-        {"Add.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0"},
-        {"Edit.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u7DE8\u96C6"},
-        {"Remove.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664"},
-        {"Edit", "\u7DE8\u96C6"},
-        {"Retain", "\u4FDD\u6301"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "\u8B66\u544A: \u30D5\u30A1\u30A4\u30EB\u540D\u306B\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3059\u308B\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093(\u30C4\u30FC\u30EB\u306F\u30DD\u30EA\u30B7\u30FC\u5185\u5BB9\u3092\u6C38\u7D9A\u30B9\u30C8\u30A2\u306B\u66F8\u304D\u8FBC\u3080\u3068\u304D\u306B\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3057\u307E\u3059)\u3002\n\n\u5165\u529B\u6E08\u306E\u540D\u524D\u3092\u4FDD\u6301\u3059\u308B\u306B\u306F\u300C\u4FDD\u6301\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3001\u540D\u524D\u3092\u7DE8\u96C6\u3059\u308B\u306B\u306F\u300C\u7DE8\u96C6\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-
-        {"Add.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u306E\u8FFD\u52A0"},
-        {"Remove.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u3092\u524A\u9664"},
-        {"File", "\u30D5\u30A1\u30A4\u30EB"},
-        {"KeyStore", "\u30AD\u30FC\u30B9\u30C8\u30A2"},
-        {"Policy.File.", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F: {0}: {1}"},
-        {"Policy.Tool", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30C4\u30FC\u30EB"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "\u30DD\u30EA\u30B7\u30FC\u69CB\u6210\u3092\u958B\u304F\u3068\u304D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u8A73\u7D30\u306F\u8B66\u544A\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-        {"Error", "\u30A8\u30E9\u30FC"},
-        {"OK", "OK"},
-        {"Status", "\u72B6\u614B"},
-        {"Warning", "\u8B66\u544A"},
-        {"Permission.",
-                "\u30A2\u30AF\u30BB\u30B9\u6A29:                                                       "},
-        {"Principal.Type.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7:"},
-        {"Principal.Name.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u540D\u524D:"},
-        {"Target.Name.",
-                "\u30BF\u30FC\u30B2\u30C3\u30C8\u540D:                                                    "},
-        {"Actions.",
-                "\u30A2\u30AF\u30B7\u30E7\u30F3:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\u3002"},
-        {"Cancel", "\u53D6\u6D88"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u8FFD\u52A0"},
-        {"Edit.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6"},
-        {"Remove.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u524A\u9664"},
-        {"Principals.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB:"},
-        {".Add.Permission", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0"},
-        {".Edit.Permission", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6"},
-        {"Remove.Permission", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u524A\u9664"},
-        {"Done", "\u5B8C\u4E86"},
-        {"KeyStore.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2URL:"},
-        {"KeyStore.Type.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30BF\u30A4\u30D7:"},
-        {"KeyStore.Provider.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0:"},
-        {"KeyStore.Password.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9URL:"},
-        {"Principals", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB"},
-        {".Edit.Principal.", "  \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6:"},
-        {".Add.New.Principal.", "  \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u65B0\u898F\u8FFD\u52A0:"},
-        {"Permissions", "\u30A2\u30AF\u30BB\u30B9\u6A29"},
-        {".Edit.Permission.", "  \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6:"},
-        {".Add.New.Permission.", "  \u65B0\u898F\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0:"},
-        {"Signed.By.", "\u7F72\u540D\u8005:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u540D\u306E\u306A\u3044\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u30FB\u30AF\u30E9\u30B9\u3092\u4F7F\u7528\u3057\u3066\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "\u540D\u524D\u3092\u4F7F\u7528\u305B\u305A\u306B\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "\u30A2\u30AF\u30BB\u30B9\u6A29\u3068\u30BF\u30FC\u30B2\u30C3\u30C8\u540D\u306F\u3001\u5024\u3092\u4FDD\u6301\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
-        {"Remove.this.Policy.Entry.", "\u3053\u306E\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u3092\u524A\u9664\u3057\u307E\u3059\u304B\u3002"},
-        {"Overwrite.File", "\u30D5\u30A1\u30A4\u30EB\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059"},
-        {"Policy.successfully.written.to.filename",
-                "\u30DD\u30EA\u30B7\u30FC\u306E{0}\u3078\u306E\u66F8\u8FBC\u307F\u306B\u6210\u529F\u3057\u307E\u3057\u305F"},
-        {"null.filename", "\u30D5\u30A1\u30A4\u30EB\u540D\u304Cnull\u3067\u3059"},
-        {"Save.changes.", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\u3002"},
-        {"Yes", "\u306F\u3044"},
-        {"No", "\u3044\u3044\u3048"},
-        {"Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA"},
-        {"Save.Changes", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059"},
-        {"No.Policy.Entry.selected", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "\u30AD\u30FC\u30B9\u30C8\u30A2{0}\u3092\u958B\u3051\u307E\u305B\u3093"},
-        {"No.principal.selected", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
-        {"No.permission.selected", "\u30A2\u30AF\u30BB\u30B9\u6A29\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
-        {"name", "\u540D\u524D"},
-        {"configuration.type", "\u69CB\u6210\u30BF\u30A4\u30D7"},
-        {"environment.variable.name", "\u74B0\u5883\u5909\u6570\u540D"},
-        {"library.name", "\u30E9\u30A4\u30D6\u30E9\u30EA\u540D"},
-        {"package.name", "\u30D1\u30C3\u30B1\u30FC\u30B8\u540D"},
-        {"policy.type", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30BF\u30A4\u30D7"},
-        {"property.name", "\u30D7\u30ED\u30D1\u30C6\u30A3\u540D"},
-        {"provider.name", "\u30D7\u30ED\u30D0\u30A4\u30C0\u540D"},
-        {"url", "URL"},
-        {"method.list", "\u30E1\u30BD\u30C3\u30C9\u30FB\u30EA\u30B9\u30C8"},
-        {"request.headers.list", "\u30EA\u30AF\u30A8\u30B9\u30C8\u30FB\u30D8\u30C3\u30C0\u30FC\u30FB\u30EA\u30B9\u30C8"},
-        {"Principal.List", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30EA\u30B9\u30C8"},
-        {"Permission.List", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u30EA\u30B9\u30C8"},
-        {"Code.Base", "\u30B3\u30FC\u30C9\u30FB\u30D9\u30FC\u30B9"},
-        {"KeyStore.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2U R L:"},
-        {"KeyStore.Password.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9U R L:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_ko.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_ko extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "\uACBD\uACE0: {0} \uBCC4\uCE6D\uC5D0 \uB300\uD55C \uACF5\uC6A9 \uD0A4\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uD0A4 \uC800\uC7A5\uC18C\uAC00 \uC81C\uB300\uB85C \uAD6C\uC131\uB418\uC5B4 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
-        {"Warning.Class.not.found.class", "\uACBD\uACE0: \uD074\uB798\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "\uACBD\uACE0: \uC0DD\uC131\uC790\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uC778\uC218: {0}"},
-        {"Illegal.Principal.Type.type", "\uC798\uBABB\uB41C \uC8FC\uCCB4 \uC720\uD615: {0}"},
-        {"Illegal.option.option", "\uC798\uBABB\uB41C \uC635\uC158: {0}"},
-        {"Usage.policytool.options.", "\uC0AC\uC6A9\uBC95: policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    \uC815\uCC45 \uD30C\uC77C \uC704\uCE58"},
-        {"New", "\uC0C8\uB85C \uB9CC\uB4E4\uAE30"},
-        {"Open", "\uC5F4\uAE30"},
-        {"Save", "\uC800\uC7A5"},
-        {"Save.As", "\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5"},
-        {"View.Warning.Log", "\uACBD\uACE0 \uB85C\uADF8 \uBCF4\uAE30"},
-        {"Exit", "\uC885\uB8CC"},
-        {"Add.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uCD94\uAC00"},
-        {"Edit.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uD3B8\uC9D1"},
-        {"Remove.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uC81C\uAC70"},
-        {"Edit", "\uD3B8\uC9D1"},
-        {"Retain", "\uC720\uC9C0"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "\uACBD\uACE0: \uD30C\uC77C \uC774\uB984\uC5D0 \uC774\uC2A4\uCF00\uC774\uD504\uB41C \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uAC00 \uD3EC\uD568\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uB294 \uC774\uC2A4\uCF00\uC774\uD504\uD560 \uD544\uC694\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uC601\uAD6C \uC800\uC7A5\uC18C\uC5D0 \uC815\uCC45 \uCF58\uD150\uCE20\uB97C \uC4F8 \uB54C \uD544\uC694\uC5D0 \uB530\uB77C \uC790\uB3D9\uC73C\uB85C \uBB38\uC790\uAC00 \uC774\uC2A4\uCF00\uC774\uD504\uB429\uB2C8\uB2E4.\n\n\uC785\uB825\uB41C \uC774\uB984\uC744 \uADF8\uB300\uB85C \uC720\uC9C0\uD558\uB824\uBA74 [\uC720\uC9C0]\uB97C \uB204\uB974\uACE0, \uC774\uB984\uC744 \uD3B8\uC9D1\uD558\uB824\uBA74 [\uD3B8\uC9D1]\uC744 \uB204\uB974\uC2ED\uC2DC\uC624."},
-
-        {"Add.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uCD94\uAC00"},
-        {"Remove.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uC81C\uAC70"},
-        {"File", "\uD30C\uC77C"},
-        {"KeyStore", "\uD0A4 \uC800\uC7A5\uC18C"},
-        {"Policy.File.", "\uC815\uCC45 \uD30C\uC77C:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "\uC815\uCC45 \uD30C\uC77C\uC744 \uC5F4 \uC218 \uC5C6\uC74C: {0}: {1}"},
-        {"Policy.Tool", "\uC815\uCC45 \uD234"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "\uC815\uCC45 \uAD6C\uC131\uC744 \uC5EC\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 \uACBD\uACE0 \uB85C\uADF8\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
-        {"Error", "\uC624\uB958"},
-        {"OK", "\uD655\uC778"},
-        {"Status", "\uC0C1\uD0DC"},
-        {"Warning", "\uACBD\uACE0"},
-        {"Permission.",
-                "\uAD8C\uD55C:                                                       "},
-        {"Principal.Type.", "\uC8FC\uCCB4 \uC720\uD615:"},
-        {"Principal.Name.", "\uC8FC\uCCB4 \uC774\uB984:"},
-        {"Target.Name.",
-                "\uB300\uC0C1 \uC774\uB984:                                                    "},
-        {"Actions.",
-                "\uC791\uC5C5:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\uAE30\uC874 \uD30C\uC77C {0}\uC744(\uB97C) \uACB9\uCCD0 \uC4F0\uACA0\uC2B5\uB2C8\uAE4C?"},
-        {"Cancel", "\uCDE8\uC18C"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "\uC8FC\uCCB4 \uCD94\uAC00"},
-        {"Edit.Principal", "\uC8FC\uCCB4 \uD3B8\uC9D1"},
-        {"Remove.Principal", "\uC8FC\uCCB4 \uC81C\uAC70"},
-        {"Principals.", "\uC8FC\uCCB4:"},
-        {".Add.Permission", "  \uAD8C\uD55C \uCD94\uAC00"},
-        {".Edit.Permission", "  \uAD8C\uD55C \uD3B8\uC9D1"},
-        {"Remove.Permission", "\uAD8C\uD55C \uC81C\uAC70"},
-        {"Done", "\uC644\uB8CC"},
-        {"KeyStore.URL.", "\uD0A4 \uC800\uC7A5\uC18C URL:"},
-        {"KeyStore.Type.", "\uD0A4 \uC800\uC7A5\uC18C \uC720\uD615:"},
-        {"KeyStore.Provider.", "\uD0A4 \uC800\uC7A5\uC18C \uC81C\uACF5\uC790:"},
-        {"KeyStore.Password.URL.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"},
-        {"Principals", "\uC8FC\uCCB4"},
-        {".Edit.Principal.", "  \uC8FC\uCCB4 \uD3B8\uC9D1:"},
-        {".Add.New.Principal.", "  \uC0C8 \uC8FC\uCCB4 \uCD94\uAC00:"},
-        {"Permissions", "\uAD8C\uD55C"},
-        {".Edit.Permission.", "  \uAD8C\uD55C \uD3B8\uC9D1:"},
-        {".Add.New.Permission.", "  \uC0C8 \uAD8C\uD55C \uCD94\uAC00:"},
-        {"Signed.By.", "\uC11C\uBA85\uC790:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "\uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uC774\uB984 \uC5C6\uC774 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uD074\uB798\uC2A4\uB97C \uC0AC\uC6A9\uD558\uB294 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "\uC774\uB984 \uC5C6\uC774 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "\uAD8C\uD55C\uACFC \uB300\uC0C1 \uC774\uB984\uC758 \uAC12\uC774 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
-        {"Remove.this.Policy.Entry.", "\uC774 \uC815\uCC45 \uD56D\uBAA9\uC744 \uC81C\uAC70\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
-        {"Overwrite.File", "\uD30C\uC77C \uACB9\uCCD0\uC4F0\uAE30"},
-        {"Policy.successfully.written.to.filename",
-                "{0}\uC5D0 \uC131\uACF5\uC801\uC73C\uB85C \uC815\uCC45\uC744 \uC37C\uC2B5\uB2C8\uB2E4."},
-        {"null.filename", "\uB110 \uD30C\uC77C \uC774\uB984"},
-        {"Save.changes.", "\uBCC0\uACBD \uC0AC\uD56D\uC744 \uC800\uC7A5\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
-        {"Yes", "\uC608"},
-        {"No", "\uC544\uB2C8\uC624"},
-        {"Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9"},
-        {"Save.Changes", "\uBCC0\uACBD \uC0AC\uD56D \uC800\uC7A5"},
-        {"No.Policy.Entry.selected", "\uC120\uD0DD\uB41C \uC815\uCC45 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "\uD0A4 \uC800\uC7A5\uC18C\uB97C \uC5F4 \uC218 \uC5C6\uC74C: {0}"},
-        {"No.principal.selected", "\uC120\uD0DD\uB41C \uC8FC\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."},
-        {"No.permission.selected", "\uC120\uD0DD\uB41C \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
-        {"name", "\uC774\uB984"},
-        {"configuration.type", "\uAD6C\uC131 \uC720\uD615"},
-        {"environment.variable.name", "\uD658\uACBD \uBCC0\uC218 \uC774\uB984"},
-        {"library.name", "\uB77C\uC774\uBE0C\uB7EC\uB9AC \uC774\uB984"},
-        {"package.name", "\uD328\uD0A4\uC9C0 \uC774\uB984"},
-        {"policy.type", "\uC815\uCC45 \uC720\uD615"},
-        {"property.name", "\uC18D\uC131 \uC774\uB984"},
-        {"provider.name", "\uC81C\uACF5\uC790 \uC774\uB984"},
-        {"url", "URL"},
-        {"method.list", "\uBA54\uC18C\uB4DC \uBAA9\uB85D"},
-        {"request.headers.list", "\uC694\uCCAD \uD5E4\uB354 \uBAA9\uB85D"},
-        {"Principal.List", "\uC8FC\uCCB4 \uBAA9\uB85D"},
-        {"Permission.List", "\uAD8C\uD55C \uBAA9\uB85D"},
-        {"Code.Base", "\uCF54\uB4DC \uBCA0\uC774\uC2A4"},
-        {"KeyStore.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C URL:"},
-        {"KeyStore.Password.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_pt_BR.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_pt_BR extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Advert\u00EAncia: N\u00E3o existe uma chave p\u00FAblica para o alias {0}. Certifique-se de que um KeyStore esteja configurado adequadamente."},
-        {"Warning.Class.not.found.class", "Advert\u00EAncia: Classe n\u00E3o encontrada: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Advert\u00EAncia: Argumento(s) inv\u00E1lido(s) para o construtor: {0}"},
-        {"Illegal.Principal.Type.type", "Tipo Principal Inv\u00E1lido: {0}"},
-        {"Illegal.option.option", "Op\u00E7\u00E3o inv\u00E1lida: {0}"},
-        {"Usage.policytool.options.", "Uso: policytool [op\u00E7\u00F5es]"},
-        {".file.file.policy.file.location",
-                "  [-file <arquivo>]    localiza\u00E7\u00E3o do arquivo de pol\u00EDtica"},
-        {"New", "Novo"},
-        {"Open", "Abrir"},
-        {"Save", "Salvar"},
-        {"Save.As", "Salvar Como"},
-        {"View.Warning.Log", "Exibir Log de Advert\u00EAncias"},
-        {"Exit", "Sair"},
-        {"Add.Policy.Entry", "Adicionar Entrada de Pol\u00EDtica"},
-        {"Edit.Policy.Entry", "Editar Entrada de Pol\u00EDtica"},
-        {"Remove.Policy.Entry", "Remover Entrada de Pol\u00EDtica"},
-        {"Edit", "Editar"},
-        {"Retain", "Reter"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Advert\u00EAncia: O nome do arquivo pode conter caracteres de escape barra invertida. N\u00E3o \u00E9 necess\u00E1rio fazer o escape dos caracteres de barra invertida (a ferramenta faz o escape dos caracteres conforme necess\u00E1rio ao gravar o conte\u00FAdo da pol\u00EDtica no armazenamento persistente).\n\nClique em Reter para reter o nome da entrada ou clique em Editar para edit\u00E1-lo."},
-
-        {"Add.Public.Key.Alias", "Adicionar Alias de Chave P\u00FAblica"},
-        {"Remove.Public.Key.Alias", "Remover Alias de Chave P\u00FAblica"},
-        {"File", "Arquivo"},
-        {"KeyStore", "KeyStore"},
-        {"Policy.File.", "Arquivo de Pol\u00EDtica:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "N\u00E3o foi poss\u00EDvel abrir o arquivo de pol\u00EDtica: {0}: {1}"},
-        {"Policy.Tool", "Ferramenta de Pol\u00EDtica"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Erros durante a abertura da configura\u00E7\u00E3o da pol\u00EDtica. Consulte o Log de Advert\u00EAncias para obter mais informa\u00E7\u00F5es."},
-        {"Error", "Erro"},
-        {"OK", "OK"},
-        {"Status", "Status"},
-        {"Warning", "Advert\u00EAncia"},
-        {"Permission.",
-                "Permiss\u00E3o:                                                       "},
-        {"Principal.Type.", "Tipo do Principal:"},
-        {"Principal.Name.", "Nome do Principal:"},
-        {"Target.Name.",
-                "Nome do Alvo:                                                    "},
-        {"Actions.",
-                "A\u00E7\u00F5es:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "Est\u00E1 correto substituir o arquivo existente {0}?"},
-        {"Cancel", "Cancelar"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "Adicionar Principal"},
-        {"Edit.Principal", "Editar Principal"},
-        {"Remove.Principal", "Remover Principal"},
-        {"Principals.", "Principais:"},
-        {".Add.Permission", "  Adicionar Permiss\u00E3o"},
-        {".Edit.Permission", "  Editar Permiss\u00E3o"},
-        {"Remove.Permission", "Remover Permiss\u00E3o"},
-        {"Done", "Conclu\u00EDdo"},
-        {"KeyStore.URL.", "URL do KeyStore:"},
-        {"KeyStore.Type.", "Tipo de KeyStore:"},
-        {"KeyStore.Provider.", "Fornecedor de KeyStore:"},
-        {"KeyStore.Password.URL.", "URL da Senha do KeyStore:"},
-        {"Principals", "Principais"},
-        {".Edit.Principal.", "  Editar Principal:"},
-        {".Add.New.Principal.", "  Adicionar Novo Principal:"},
-        {"Permissions", "Permiss\u00F5es"},
-        {".Edit.Permission.", "  Editar Permiss\u00E3o:"},
-        {".Add.New.Permission.", "  Adicionar Nova Permiss\u00E3o:"},
-        {"Signed.By.", "Assinado por:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal com uma Classe de Curinga sem um Nome de Curinga"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal sem um Nome"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "O Nome de Destino e a Permiss\u00E3o devem ter um Valor"},
-        {"Remove.this.Policy.Entry.", "Remover esta Entrada de Pol\u00EDtica?"},
-        {"Overwrite.File", "Substituir Arquivo"},
-        {"Policy.successfully.written.to.filename",
-                "Pol\u00EDtica gravada com \u00EAxito em {0}"},
-        {"null.filename", "nome de arquivo nulo"},
-        {"Save.changes.", "Salvar altera\u00E7\u00F5es?"},
-        {"Yes", "Sim"},
-        {"No", "N\u00E3o"},
-        {"Policy.Entry", "Entrada de Pol\u00EDtica"},
-        {"Save.Changes", "Salvar Altera\u00E7\u00F5es"},
-        {"No.Policy.Entry.selected", "Nenhuma Entrada de Pol\u00EDtica Selecionada"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "N\u00E3o \u00E9 poss\u00EDvel abrir a KeyStore: {0}"},
-        {"No.principal.selected", "Nenhum principal selecionado"},
-        {"No.permission.selected", "Nenhuma permiss\u00E3o selecionada"},
-        {"name", "nome"},
-        {"configuration.type", "tipo de configura\u00E7\u00E3o"},
-        {"environment.variable.name", "nome da vari\u00E1vel de ambiente"},
-        {"library.name", "nome da biblioteca"},
-        {"package.name", "nome do pacote"},
-        {"policy.type", "tipo de pol\u00EDtica"},
-        {"property.name", "nome da propriedade"},
-        {"provider.name", "nome do fornecedor"},
-        {"url", "url"},
-        {"method.list", "lista de m\u00E9todos"},
-        {"request.headers.list", "solicitar lista de cabe\u00E7alhos"},
-        {"Principal.List", "Lista de Principais"},
-        {"Permission.List", "Lista de Permiss\u00F5es"},
-        {"Code.Base", "Base de C\u00F3digo"},
-        {"KeyStore.U.R.L.", "U R L da KeyStore:"},
-        {"KeyStore.Password.U.R.L.", "U R L da Senha do KeyStore:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_sv.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_sv extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "Varning! Det finns ingen offentlig nyckel f\u00F6r aliaset {0}. Kontrollera att det aktuella nyckellagret \u00E4r korrekt konfigurerat."},
-        {"Warning.Class.not.found.class", "Varning! Klassen hittades inte: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "Varning! Ogiltiga argument f\u00F6r konstruktor: {0}"},
-        {"Illegal.Principal.Type.type", "Otill\u00E5ten identitetshavaretyp: {0}"},
-        {"Illegal.option.option", "Otill\u00E5tet alternativ: {0}"},
-        {"Usage.policytool.options.", "Syntax: policytool [alternativ]"},
-        {".file.file.policy.file.location",
-                "  [-file <fil>]    policyfilens plats"},
-        {"New", "Nytt"},
-        {"Open", "\u00D6ppna"},
-        {"Save", "Spara"},
-        {"Save.As", "Spara som"},
-        {"View.Warning.Log", "Visa varningslogg"},
-        {"Exit", "Avsluta"},
-        {"Add.Policy.Entry", "L\u00E4gg till policypost"},
-        {"Edit.Policy.Entry", "Redigera policypost"},
-        {"Remove.Policy.Entry", "Ta bort policypost"},
-        {"Edit", "Redigera"},
-        {"Retain", "Beh\u00E5ll"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "Varning! Filnamnet kan inneh\u00E5lla omv\u00E4nda snedstreck inom citattecken. Citattecken kr\u00E4vs inte f\u00F6r omv\u00E4nda snedstreck (verktyget hanterar detta n\u00E4r policyinneh\u00E5llet skrivs till det best\u00E4ndiga lagret).\n\nKlicka p\u00E5 Beh\u00E5ll f\u00F6r att beh\u00E5lla det angivna namnet, eller klicka p\u00E5 Redigera f\u00F6r att \u00E4ndra det."},
-
-        {"Add.Public.Key.Alias", "L\u00E4gg till offentligt nyckelalias"},
-        {"Remove.Public.Key.Alias", "Ta bort offentligt nyckelalias"},
-        {"File", "Fil"},
-        {"KeyStore", "Nyckellager"},
-        {"Policy.File.", "Policyfil:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "Kan inte \u00F6ppna policyfilen: {0}: {1}"},
-        {"Policy.Tool", "Policyverktyg"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "Det uppstod ett fel n\u00E4r policykonfigurationen skulle \u00F6ppnas. Se varningsloggen f\u00F6r mer information."},
-        {"Error", "Fel"},
-        {"OK", "OK"},
-        {"Status", "Status"},
-        {"Warning", "Varning"},
-        {"Permission.",
-                "Beh\u00F6righet:                                                       "},
-        {"Principal.Type.", "Identitetshavaretyp:"},
-        {"Principal.Name.", "Identitetshavare:"},
-        {"Target.Name.",
-                "M\u00E5l:                                                    "},
-        {"Actions.",
-                "Funktioner:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "Ska den befintliga filen {0} skrivas \u00F6ver?"},
-        {"Cancel", "Avbryt"},
-        {"CodeBase.", "Kodbas:"},
-        {"SignedBy.", "Signerad av:"},
-        {"Add.Principal", "L\u00E4gg till identitetshavare"},
-        {"Edit.Principal", "Redigera identitetshavare"},
-        {"Remove.Principal", "Ta bort identitetshavare"},
-        {"Principals.", "Identitetshavare:"},
-        {".Add.Permission", "  L\u00E4gg till beh\u00F6righet"},
-        {".Edit.Permission", "  Redigera beh\u00F6righet"},
-        {"Remove.Permission", "Ta bort beh\u00F6righet"},
-        {"Done", "Utf\u00F6rd"},
-        {"KeyStore.URL.", "URL f\u00F6r nyckellager:"},
-        {"KeyStore.Type.", "Nyckellagertyp:"},
-        {"KeyStore.Provider.", "Nyckellagerleverant\u00F6r:"},
-        {"KeyStore.Password.URL.", "URL f\u00F6r l\u00F6senord till nyckellager:"},
-        {"Principals", "Identitetshavare"},
-        {".Edit.Principal.", "  Redigera identitetshavare:"},
-        {".Add.New.Principal.", "  L\u00E4gg till ny identitetshavare:"},
-        {"Permissions", "Beh\u00F6righet"},
-        {".Edit.Permission.", "  Redigera beh\u00F6righet:"},
-        {".Add.New.Permission.", "  L\u00E4gg till ny beh\u00F6righet:"},
-        {"Signed.By.", "Signerad av:"},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "Kan inte specificera identitetshavare med jokerteckenklass utan jokerteckennamn"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "Kan inte specificera identitetshavare utan namn"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "Beh\u00F6righet och m\u00E5lnamn m\u00E5ste ha ett v\u00E4rde"},
-        {"Remove.this.Policy.Entry.", "Vill du ta bort den h\u00E4r policyposten?"},
-        {"Overwrite.File", "Skriv \u00F6ver fil"},
-        {"Policy.successfully.written.to.filename",
-                "Policy har skrivits till {0}"},
-        {"null.filename", "nullfilnamn"},
-        {"Save.changes.", "Vill du spara \u00E4ndringarna?"},
-        {"Yes", "Ja"},
-        {"No", "Nej"},
-        {"Policy.Entry", "Policyfel"},
-        {"Save.Changes", "Spara \u00E4ndringar"},
-        {"No.Policy.Entry.selected", "Ingen policypost har valts"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "Kan inte \u00F6ppna nyckellagret: {0}"},
-        {"No.principal.selected", "Ingen identitetshavare har valts"},
-        {"No.permission.selected", "Ingen beh\u00F6righet har valts"},
-        {"name", "namn"},
-        {"configuration.type", "konfigurationstyp"},
-        {"environment.variable.name", "variabelnamn f\u00F6r milj\u00F6"},
-        {"library.name", "biblioteksnamn"},
-        {"package.name", "paketnamn"},
-        {"policy.type", "policytyp"},
-        {"property.name", "egenskapsnamn"},
-        {"provider.name", "leverant\u00F6rsnamn"},
-        {"url", "url"},
-        {"method.list", "metodlista"},
-        {"request.headers.list", "beg\u00E4ranrubriklista"},
-        {"Principal.List", "Lista \u00F6ver identitetshavare"},
-        {"Permission.List", "Beh\u00F6righetslista"},
-        {"Code.Base", "Kodbas"},
-        {"KeyStore.U.R.L.", "URL f\u00F6r nyckellager:"},
-        {"KeyStore.Password.U.R.L.", "URL f\u00F6r l\u00F6senord till nyckellager:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_CN.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_CN extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "\u8B66\u544A: \u522B\u540D {0} \u7684\u516C\u5171\u5BC6\u94A5\u4E0D\u5B58\u5728\u3002\u8BF7\u786E\u4FDD\u5DF2\u6B63\u786E\u914D\u7F6E\u5BC6\u94A5\u5E93\u3002"},
-        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u7C7B: {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "\u8B66\u544A: \u6784\u9020\u5668\u7684\u53C2\u6570\u65E0\u6548: {0}"},
-        {"Illegal.Principal.Type.type", "\u975E\u6CD5\u7684\u4E3B\u7528\u6237\u7C7B\u578B: {0}"},
-        {"Illegal.option.option", "\u975E\u6CD5\u9009\u9879: {0}"},
-        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [\u9009\u9879]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    \u7B56\u7565\u6587\u4EF6\u4F4D\u7F6E"},
-        {"New", "\u65B0\u5EFA"},
-        {"Open", "\u6253\u5F00"},
-        {"Save", "\u4FDD\u5B58"},
-        {"Save.As", "\u53E6\u5B58\u4E3A"},
-        {"View.Warning.Log", "\u67E5\u770B\u8B66\u544A\u65E5\u5FD7"},
-        {"Exit", "\u9000\u51FA"},
-        {"Add.Policy.Entry", "\u6DFB\u52A0\u7B56\u7565\u6761\u76EE"},
-        {"Edit.Policy.Entry", "\u7F16\u8F91\u7B56\u7565\u6761\u76EE"},
-        {"Remove.Policy.Entry", "\u5220\u9664\u7B56\u7565\u6761\u76EE"},
-        {"Edit", "\u7F16\u8F91"},
-        {"Retain", "\u4FDD\u7559"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "\u8B66\u544A: \u6587\u4EF6\u540D\u5305\u542B\u8F6C\u4E49\u7684\u53CD\u659C\u6760\u5B57\u7B26\u3002\u4E0D\u9700\u8981\u5BF9\u53CD\u659C\u6760\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49 (\u8BE5\u5DE5\u5177\u5728\u5C06\u7B56\u7565\u5185\u5BB9\u5199\u5165\u6C38\u4E45\u5B58\u50A8\u65F6\u4F1A\u6839\u636E\u9700\u8981\u5BF9\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49)\u3002\n\n\u5355\u51FB\u201C\u4FDD\u7559\u201D\u53EF\u4FDD\u7559\u8F93\u5165\u7684\u540D\u79F0, \u6216\u8005\u5355\u51FB\u201C\u7F16\u8F91\u201D\u53EF\u7F16\u8F91\u8BE5\u540D\u79F0\u3002"},
-
-        {"Add.Public.Key.Alias", "\u6DFB\u52A0\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
-        {"Remove.Public.Key.Alias", "\u5220\u9664\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
-        {"File", "\u6587\u4EF6"},
-        {"KeyStore", "\u5BC6\u94A5\u5E93"},
-        {"Policy.File.", "\u7B56\u7565\u6587\u4EF6:"},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "\u65E0\u6CD5\u6253\u5F00\u7B56\u7565\u6587\u4EF6: {0}: {1}"},
-        {"Policy.Tool", "\u7B56\u7565\u5DE5\u5177"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "\u6253\u5F00\u7B56\u7565\u914D\u7F6E\u65F6\u51FA\u9519\u3002\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u67E5\u770B\u8B66\u544A\u65E5\u5FD7\u3002"},
-        {"Error", "\u9519\u8BEF"},
-        {"OK", "\u786E\u5B9A"},
-        {"Status", "\u72B6\u6001"},
-        {"Warning", "\u8B66\u544A"},
-        {"Permission.",
-                "\u6743\u9650:                                                       "},
-        {"Principal.Type.", "\u4E3B\u7528\u6237\u7C7B\u578B:"},
-        {"Principal.Name.", "\u4E3B\u7528\u6237\u540D\u79F0:"},
-        {"Target.Name.",
-                "\u76EE\u6807\u540D\u79F0:                                                    "},
-        {"Actions.",
-                "\u64CD\u4F5C:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\u786E\u8BA4\u8986\u76D6\u73B0\u6709\u7684\u6587\u4EF6{0}?"},
-        {"Cancel", "\u53D6\u6D88"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "\u6DFB\u52A0\u4E3B\u7528\u6237"},
-        {"Edit.Principal", "\u7F16\u8F91\u4E3B\u7528\u6237"},
-        {"Remove.Principal", "\u5220\u9664\u4E3B\u7528\u6237"},
-        {"Principals.", "\u4E3B\u7528\u6237:"},
-        {".Add.Permission", "  \u6DFB\u52A0\u6743\u9650"},
-        {".Edit.Permission", "  \u7F16\u8F91\u6743\u9650"},
-        {"Remove.Permission", "\u5220\u9664\u6743\u9650"},
-        {"Done", "\u5B8C\u6210"},
-        {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL:"},
-        {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B:"},
-        {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9:"},
-        {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"},
-        {"Principals", "\u4E3B\u7528\u6237"},
-        {".Edit.Principal.", "  \u7F16\u8F91\u4E3B\u7528\u6237:"},
-        {".Add.New.Principal.", "  \u6DFB\u52A0\u65B0\u4E3B\u7528\u6237:"},
-        {"Permissions", "\u6743\u9650"},
-        {".Edit.Permission.", "  \u7F16\u8F91\u6743\u9650:"},
-        {".Add.New.Permission.", "  \u52A0\u5165\u65B0\u7684\u6743\u9650:"},
-        {"Signed.By.", "\u7B7E\u7F72\u4EBA: "},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "\u6CA1\u6709\u901A\u914D\u7B26\u540D\u79F0, \u65E0\u6CD5\u4F7F\u7528\u901A\u914D\u7B26\u7C7B\u6307\u5B9A\u4E3B\u7528\u6237"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "\u6CA1\u6709\u540D\u79F0, \u65E0\u6CD5\u6307\u5B9A\u4E3B\u7528\u6237"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "\u6743\u9650\u53CA\u76EE\u6807\u540D\u5FC5\u987B\u6709\u4E00\u4E2A\u503C"},
-        {"Remove.this.Policy.Entry.", "\u662F\u5426\u5220\u9664\u6B64\u7B56\u7565\u6761\u76EE?"},
-        {"Overwrite.File", "\u8986\u76D6\u6587\u4EF6"},
-        {"Policy.successfully.written.to.filename",
-                "\u7B56\u7565\u5DF2\u6210\u529F\u5199\u5165\u5230{0}"},
-        {"null.filename", "\u7A7A\u6587\u4EF6\u540D"},
-        {"Save.changes.", "\u662F\u5426\u4FDD\u5B58\u6240\u505A\u7684\u66F4\u6539?"},
-        {"Yes", "\u662F"},
-        {"No", "\u5426"},
-        {"Policy.Entry", "\u7B56\u7565\u6761\u76EE"},
-        {"Save.Changes", "\u4FDD\u5B58\u66F4\u6539"},
-        {"No.Policy.Entry.selected", "\u6CA1\u6709\u9009\u62E9\u7B56\u7565\u6761\u76EE"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "\u65E0\u6CD5\u6253\u5F00\u5BC6\u94A5\u5E93: {0}"},
-        {"No.principal.selected", "\u672A\u9009\u62E9\u4E3B\u7528\u6237"},
-        {"No.permission.selected", "\u6CA1\u6709\u9009\u62E9\u6743\u9650"},
-        {"name", "\u540D\u79F0"},
-        {"configuration.type", "\u914D\u7F6E\u7C7B\u578B"},
-        {"environment.variable.name", "\u73AF\u5883\u53D8\u91CF\u540D"},
-        {"library.name", "\u5E93\u540D\u79F0"},
-        {"package.name", "\u7A0B\u5E8F\u5305\u540D\u79F0"},
-        {"policy.type", "\u7B56\u7565\u7C7B\u578B"},
-        {"property.name", "\u5C5E\u6027\u540D\u79F0"},
-        {"provider.name", "\u63D0\u4F9B\u65B9\u540D\u79F0"},
-        {"url", "URL"},
-        {"method.list", "\u65B9\u6CD5\u5217\u8868"},
-        {"request.headers.list", "\u8BF7\u6C42\u6807\u5934\u5217\u8868"},
-        {"Principal.List", "\u4E3B\u7528\u6237\u5217\u8868"},
-        {"Permission.List", "\u6743\u9650\u5217\u8868"},
-        {"Code.Base", "\u4EE3\u7801\u5E93"},
-        {"KeyStore.U.R.L.", "\u5BC6\u94A5\u5E93 URL:"},
-        {"KeyStore.Password.U.R.L.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_HK.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_HK extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u914D\u7F6E\u6B63\u78BA\u3002"},
-        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
-        {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
-        {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
-        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
-        {"New", "\u65B0\u589E"},
-        {"Open", "\u958B\u555F"},
-        {"Save", "\u5132\u5B58"},
-        {"Save.As", "\u53E6\u5B58\u65B0\u6A94"},
-        {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"},
-        {"Exit", "\u7D50\u675F"},
-        {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"},
-        {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"},
-        {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"},
-        {"Edit", "\u7DE8\u8F2F"},
-        {"Retain", "\u4FDD\u7559"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
-
-        {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
-        {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
-        {"File", "\u6A94\u6848"},
-        {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"},
-        {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
-        {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "\u958B\u555F\u539F\u5247\u8A18\u7F6E\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
-        {"Error", "\u932F\u8AA4"},
-        {"OK", "\u78BA\u5B9A"},
-        {"Status", "\u72C0\u614B"},
-        {"Warning", "\u8B66\u544A"},
-        {"Permission.",
-                "\u6B0A\u9650:                                                       "},
-        {"Principal.Type.", "Principal \u985E\u578B: "},
-        {"Principal.Name.", "Principal \u540D\u7A31: "},
-        {"Target.Name.",
-                "\u76EE\u6A19\u540D\u7A31:                                                    "},
-        {"Actions.",
-                "\u52D5\u4F5C:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
-        {"Cancel", "\u53D6\u6D88"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "\u65B0\u589E Principal"},
-        {"Edit.Principal", "\u7DE8\u8F2F Principal"},
-        {"Remove.Principal", "\u79FB\u9664 Principal"},
-        {"Principals.", "Principal:"},
-        {".Add.Permission", "  \u65B0\u589E\u6B0A\u9650"},
-        {".Edit.Permission", "  \u7DE8\u8F2F\u6B0A\u9650"},
-        {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"},
-        {"Done", "\u5B8C\u6210"},
-        {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "},
-        {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"},
-        {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"},
-        {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "},
-        {"Principals", "Principal"},
-        {".Edit.Principal.", "  \u7DE8\u8F2F Principal: "},
-        {".Add.New.Principal.", "  \u65B0\u589E Principal: "},
-        {"Permissions", "\u6B0A\u9650"},
-        {".Edit.Permission.", "  \u7DE8\u8F2F\u6B0A\u9650:"},
-        {".Add.New.Permission.", "  \u65B0\u589E\u6B0A\u9650:"},
-        {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
-        {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
-        {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
-        {"Policy.successfully.written.to.filename",
-                "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
-        {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
-        {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
-        {"Yes", "\u662F"},
-        {"No", "\u5426"},
-        {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
-        {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
-        {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
-        {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
-        {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
-        {"name", "\u540D\u7A31"},
-        {"configuration.type", "\u7D44\u614B\u985E\u578B"},
-        {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
-        {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
-        {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
-        {"policy.type", "\u539F\u5247\u985E\u578B"},
-        {"property.name", "\u5C6C\u6027\u540D\u7A31"},
-        {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
-        {"Principal.List", "Principal \u6E05\u55AE"},
-        {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
-        {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
-        {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
-        {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/Resources_zh_TW.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_TW extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-        {"NEWLINE", "\n"},
-        {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
-                "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u914D\u7F6E\u6B63\u78BA\u3002"},
-        {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
-        {"Warning.Invalid.argument.s.for.constructor.arg",
-                "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
-        {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
-        {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
-        {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
-        {".file.file.policy.file.location",
-                "  [-file <file>]    \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
-        {"New", "\u65B0\u589E"},
-        {"Open", "\u958B\u555F"},
-        {"Save", "\u5132\u5B58"},
-        {"Save.As", "\u53E6\u5B58\u65B0\u6A94"},
-        {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"},
-        {"Exit", "\u7D50\u675F"},
-        {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"},
-        {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"},
-        {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"},
-        {"Edit", "\u7DE8\u8F2F"},
-        {"Retain", "\u4FDD\u7559"},
-
-        {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
-            "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
-
-        {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
-        {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
-        {"File", "\u6A94\u6848"},
-        {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"},
-        {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
-        {"Could.not.open.policy.file.policyFile.e.toString.",
-                "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
-        {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
-        {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
-                "\u958B\u555F\u539F\u5247\u8A18\u7F6E\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
-        {"Error", "\u932F\u8AA4"},
-        {"OK", "\u78BA\u5B9A"},
-        {"Status", "\u72C0\u614B"},
-        {"Warning", "\u8B66\u544A"},
-        {"Permission.",
-                "\u6B0A\u9650:                                                       "},
-        {"Principal.Type.", "Principal \u985E\u578B: "},
-        {"Principal.Name.", "Principal \u540D\u7A31: "},
-        {"Target.Name.",
-                "\u76EE\u6A19\u540D\u7A31:                                                    "},
-        {"Actions.",
-                "\u52D5\u4F5C:                                                             "},
-        {"OK.to.overwrite.existing.file.filename.",
-                "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
-        {"Cancel", "\u53D6\u6D88"},
-        {"CodeBase.", "CodeBase:"},
-        {"SignedBy.", "SignedBy:"},
-        {"Add.Principal", "\u65B0\u589E Principal"},
-        {"Edit.Principal", "\u7DE8\u8F2F Principal"},
-        {"Remove.Principal", "\u79FB\u9664 Principal"},
-        {"Principals.", "Principal:"},
-        {".Add.Permission", "  \u65B0\u589E\u6B0A\u9650"},
-        {".Edit.Permission", "  \u7DE8\u8F2F\u6B0A\u9650"},
-        {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"},
-        {"Done", "\u5B8C\u6210"},
-        {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "},
-        {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"},
-        {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"},
-        {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "},
-        {"Principals", "Principal"},
-        {".Edit.Principal.", "  \u7DE8\u8F2F Principal: "},
-        {".Add.New.Principal.", "  \u65B0\u589E Principal: "},
-        {"Permissions", "\u6B0A\u9650"},
-        {".Edit.Permission.", "  \u7DE8\u8F2F\u6B0A\u9650:"},
-        {".Add.New.Permission.", "  \u65B0\u589E\u6B0A\u9650:"},
-        {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
-        {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
-            "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
-        {"Cannot.Specify.Principal.without.a.Name",
-            "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
-        {"Permission.and.Target.Name.must.have.a.value",
-                "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
-        {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
-        {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
-        {"Policy.successfully.written.to.filename",
-                "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
-        {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
-        {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
-        {"Yes", "\u662F"},
-        {"No", "\u5426"},
-        {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
-        {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
-        {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
-        {"Unable.to.open.KeyStore.ex.toString.",
-                "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
-        {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
-        {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
-        {"name", "\u540D\u7A31"},
-        {"configuration.type", "\u7D44\u614B\u985E\u578B"},
-        {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
-        {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
-        {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
-        {"policy.type", "\u539F\u5247\u985E\u578B"},
-        {"property.name", "\u5C6C\u6027\u540D\u7A31"},
-        {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
-        {"url", "URL"},
-        {"method.list", "\u65B9\u6CD5\u6E05\u55AE"},
-        {"request.headers.list", "\u8981\u6C42\u6A19\u982D\u6E05\u55AE"},
-        {"Principal.List", "Principal \u6E05\u55AE"},
-        {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
-        {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
-        {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
-        {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
-    };
-
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    @Override
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/MultiplexProviderFactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.sun.tracing.ProviderFactory;
-import com.sun.tracing.Provider;
-import com.sun.tracing.Probe;
-
-/**
- * Factory class to create tracing Providers.
- *
- * This factory creates a "multiplex provider", which is a provider that
- * encapsulates a list of providers and whose probes trigger a corresponding
- * trigger in each of the encapsulated providers' probes.
- *
- * This is used when there are multiple tracing frameworks activated at once.
- * A user-defined provider gets implementation for each of the activated
- * frameworks and this multiplex framework is what is ultimately passed
- * back to the user.  All probe triggers are multiplexed to each
- * active framework.
- *
- * @since 1.7
- */
-public class MultiplexProviderFactory extends ProviderFactory {
-
-    private Set<ProviderFactory> factories;
-
-    public MultiplexProviderFactory(Set<ProviderFactory> factories) {
-        this.factories = factories;
-    }
-
-    public <T extends Provider> T createProvider(Class<T> cls) {
-        HashSet<Provider> providers = new HashSet<Provider>();
-        for (ProviderFactory factory : factories) {
-            providers.add(factory.createProvider(cls));
-        }
-        MultiplexProvider provider = new MultiplexProvider(cls, providers);
-        provider.init();
-        return provider.newProxyInstance();
-    }
-}
-
-class MultiplexProvider extends ProviderSkeleton {
-
-    private Set<Provider> providers;
-
-    protected ProbeSkeleton createProbe(Method m) {
-        return new MultiplexProbe(m, providers);
-    }
-
-    MultiplexProvider(Class<? extends Provider> type, Set<Provider> providers) {
-        super(type);
-        this.providers = providers;
-    }
-
-    public void dispose() {
-        for (Provider p : providers) {
-            p.dispose();
-        }
-        super.dispose();
-    }
-}
-
-class MultiplexProbe extends ProbeSkeleton {
-
-    private Set<Probe> probes;
-
-    MultiplexProbe(Method m, Set<Provider> providers) {
-        super(m.getParameterTypes());
-        probes = new HashSet<Probe>();
-        for (Provider p : providers) {
-            Probe probe = p.getProbe(m);
-            if (probe != null) {
-                probes.add(probe);
-            }
-        }
-    }
-
-    public boolean isEnabled() {
-        for (Probe p : probes) {
-            if (p.isEnabled()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public void uncheckedTrigger(Object[] args) {
-        for (Probe p : probes) {
-            try {
-                // try the fast path
-                ProbeSkeleton ps = (ProbeSkeleton)p;
-                ps.uncheckedTrigger(args);
-            } catch (ClassCastException e) {
-                // Probe.trigger takes an "Object ..." varargs parameter,
-                // so we can't call it directly.
-                try {
-                    Method m = Probe.class.getMethod(
-                        "trigger", Class.forName("[java.lang.Object"));
-                    m.invoke(p, args);
-                } catch (Exception e1) {
-                    assert false; // This shouldn't happen
-                }
-            }
-        }
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/NullProviderFactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing;
-
-import java.lang.reflect.Method;
-
-import com.sun.tracing.ProviderFactory;
-import com.sun.tracing.Provider;
-
-/**
- * Factory class to create tracing Providers.
- *
- * This factory will create tracing instances that do nothing.
- * It is used when no tracing is desired, but Provider instances still
- * must be generated so that tracing calls in the application continue to
- * run.
- *
- * @since 1.7
- */
-public class NullProviderFactory extends ProviderFactory {
-
-    /**
-     * Creates and returns a Null provider.
-     *
-     * See comments at {@code ProviderSkeleton.createProvider()} for more
-     * details.
-     *
-     * @return a provider whose probe trigger are no-ops.
-     */
-    public <T extends Provider> T createProvider(Class<T> cls) {
-        NullProvider provider = new NullProvider(cls);
-        provider.init();
-        return provider.newProxyInstance();
-    }
-}
-
-class NullProvider extends ProviderSkeleton {
-
-    NullProvider(Class<? extends Provider> type) {
-        super(type);
-    }
-
-    protected ProbeSkeleton createProbe(Method m) {
-        return new NullProbe(m.getParameterTypes());
-    }
-}
-
-class NullProbe extends ProbeSkeleton {
-
-    public NullProbe(Class<?>[] parameters) {
-        super(parameters);
-    }
-
-    public boolean isEnabled() {
-        return false;
-    }
-
-    public void uncheckedTrigger(Object[] args) {
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/PrintStreamProviderFactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing;
-
-import java.lang.reflect.Method;
-import java.io.PrintStream;
-import java.util.HashMap;
-
-import com.sun.tracing.ProviderFactory;
-import com.sun.tracing.Provider;
-import com.sun.tracing.ProviderName;
-import com.sun.tracing.Probe;
-import com.sun.tracing.ProbeName;
-
-/**
- * Factory class to create tracing Providers.
- *
- * This factory will create tracing instances that print to a PrintStream
- * when activated.
- *
- * @since 1.7
- */
-public class PrintStreamProviderFactory extends ProviderFactory {
-
-    private PrintStream stream;
-
-    public PrintStreamProviderFactory(PrintStream stream) {
-        this.stream = stream;
-    }
-
-    public <T extends Provider> T createProvider(Class<T> cls) {
-        PrintStreamProvider provider = new PrintStreamProvider(cls, stream);
-        provider.init();
-        return provider.newProxyInstance();
-    }
-}
-
-class PrintStreamProvider extends ProviderSkeleton {
-
-    private PrintStream stream;
-    private String providerName;
-
-    protected ProbeSkeleton createProbe(Method m) {
-        String probeName = getAnnotationString(m, ProbeName.class, m.getName());
-        return new PrintStreamProbe(this, probeName, m.getParameterTypes());
-    }
-
-    PrintStreamProvider(Class<? extends Provider> type, PrintStream stream) {
-        super(type);
-        this.stream = stream;
-        this.providerName = getProviderName();
-    }
-
-    PrintStream getStream() {
-        return stream;
-    }
-
-    String getName() {
-        return providerName;
-    }
-}
-
-class PrintStreamProbe extends ProbeSkeleton {
-
-    private PrintStreamProvider provider;
-    private String name;
-
-    PrintStreamProbe(PrintStreamProvider p, String name, Class<?>[] params) {
-        super(params);
-        this.provider = p;
-        this.name = name;
-    }
-
-    public boolean isEnabled() {
-        return true;
-    }
-
-    public void uncheckedTrigger(Object[] args) {
-        StringBuilder sb = new StringBuilder();
-        sb.append(provider.getName());
-        sb.append(".");
-        sb.append(name);
-        sb.append("(");
-        boolean first = true;
-        for (Object o : args) {
-            if (first == false) {
-                sb.append(",");
-            } else {
-                first = false;
-            }
-            sb.append(o.toString());
-        }
-        sb.append(")");
-        provider.getStream().println(sb.toString());
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/ProbeSkeleton.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Field;
-import com.sun.tracing.Probe;
-
-/**
- * Provides common code for implementation of {@code Probe} classes.
- *
- * @since 1.7
- */
-public abstract class ProbeSkeleton implements Probe {
-
-    protected Class<?>[] parameters;
-
-    protected ProbeSkeleton(Class<?>[] parameters) {
-        this.parameters = parameters;
-    }
-
-    public abstract boolean isEnabled();  // framework-dependent
-
-    /**
-     * Triggers the probe with verified arguments.
-     *
-     * The caller of this method must have already determined that the
-     * arity and types of the arguments match what the probe was
-     * declared with.
-     */
-    public abstract void uncheckedTrigger(Object[] args); // framework-dependent
-
-    private static boolean isAssignable(Object o, Class<?> formal) {
-        if (o != null) {
-            if ( !formal.isInstance(o) ) {
-                if ( formal.isPrimitive() ) { // o might be a boxed primitive
-                    try {
-                        // Yuck.  There must be a better way of doing this
-                        Field f = o.getClass().getField("TYPE");
-                        return formal.isAssignableFrom((Class<?>)f.get(null));
-                    } catch (Exception e) {
-                        /* fall-through. */
-                    }
-                }
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Performs a type-check of the parameters before triggering the probe.
-     */
-    public void trigger(Object ... args) {
-        if (args.length != parameters.length) {
-            throw new IllegalArgumentException("Wrong number of arguments");
-        } else {
-            for (int i = 0; i < parameters.length; ++i) {
-                if ( !isAssignable(args[i], parameters[i]) ) {
-                    throw new IllegalArgumentException(
-                            "Wrong type of argument at position " + i);
-                }
-            }
-            uncheckedTrigger(args);
-        }
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/ProviderSkeleton.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2008, 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 sun.tracing;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import com.sun.tracing.Provider;
-import com.sun.tracing.Probe;
-import com.sun.tracing.ProviderName;
-
-/**
- * Provides a common code for implementation of {@code Provider} classes.
- *
- * Each tracing subsystem needs to provide three classes, a factory
- * (derived from {@code ProviderFactory}, a provider (a subclass of
- * {@code Provider}, and a probe type (subclass of {@code ProbeSkeleton}).
- *
- * The factory object takes a user-defined interface and provides an
- * implementation of it whose method calls will trigger probes in the
- * tracing framework.
- *
- * The framework's provider class, and its instances, are not seen by the
- * user at all -- they usually sit in the background and receive and dispatch
- * the calls to the user's provider interface.  The {@code ProviderSkeleton}
- * class provides almost all of the implementation needed by a framework
- * provider.  Framework providers must only provide a constructor and
- * disposal method, and implement the {@code createProbe} method to create
- * an appropriate {@code ProbeSkeleton} subclass.
- *
- * The framework's probe class provides the implementation of the two
- * probe methods, {@code isEnabled()} and {@code uncheckedTrigger()}.  Both are
- * framework-dependent implementations.
- *
- * @since 1.7
- */
-
-public abstract class ProviderSkeleton implements InvocationHandler, Provider {
-
-    protected boolean active; // set to false after dispose() is called
-    protected Class<? extends Provider> providerType; // user's interface
-    protected HashMap<Method, ProbeSkeleton> probes; // methods to probes
-
-
-    /**
-     * Creates a framework-specific probe subtype.
-     *
-     * This method is implemented by the framework's provider and returns
-     * framework-specific probes for a method.
-     *
-     * @param method A method in the user's interface
-     * @return a subclass of ProbeSkeleton for the particular framework.
-     */
-    protected abstract ProbeSkeleton createProbe(Method method);
-
-    /**
-     * Initializes the provider.
-     *
-     * @param type the user's interface
-     */
-    protected ProviderSkeleton(Class<? extends Provider> type) {
-        this.active = false; // in case of some error during initialization
-        this.providerType = type;
-        this.probes = new HashMap<Method,ProbeSkeleton>();
-    }
-
-    /**
-     * Post-constructor initialization routine.
-     *
-     * Subclass instances must be initialized before they can create probes.
-     * It is up to the factory implementations to call this after construction.
-     */
-    public void init() {
-        Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
-            public Method[] run() {
-                return providerType.getDeclaredMethods();
-            }
-        });
-
-        for (Method m : methods) {
-            if ( m.getReturnType() != Void.TYPE ) {
-                throw new IllegalArgumentException(
-                   "Return value of method is not void");
-            } else {
-                probes.put(m, createProbe(m));
-            }
-        }
-        this.active = true;
-    }
-
-    /**
-     * Magic routine which creates an implementation of the user's interface.
-     *
-     * This method creates the instance of the user's interface which is
-     * passed back to the user.  Every call upon that interface will be
-     * redirected to the {@code invoke()} method of this class (until
-     * overridden by the VM).
-     *
-     * @return an implementation of the user's interface
-     */
-    @SuppressWarnings("unchecked")
-    public <T extends Provider> T newProxyInstance() {
-        final InvocationHandler ih = this;
-        return AccessController.doPrivileged(new PrivilegedAction<T>() {
-            public T run() {
-               return (T)Proxy.newProxyInstance(providerType.getClassLoader(),
-                   new Class<?>[] { providerType }, ih);
-            }});
-    }
-
-    /**
-     * Triggers a framework probe when a user interface method is called.
-     *
-     * This method dispatches a user interface method call to the appropriate
-     * probe associated with this framework.
-     *
-     * If the invoked method is not a user-defined member of the interface,
-     * then it is a member of {@code Provider} or {@code Object} and we
-     * invoke the method directly.
-     *
-     * @param proxy the instance whose method was invoked
-     * @param method the method that was called
-     * @param args the arguments passed in the call.
-     * @return always null, if the method is a user-defined probe
-     */
-    public Object invoke(Object proxy, Method method, Object[] args) {
-        Class<?> declaringClass = method.getDeclaringClass();
-        // not a provider subtype's own method
-        if (declaringClass != providerType) {
-            try {
-                // delegate only to methods declared by
-                // com.sun.tracing.Provider or java.lang.Object
-                if (declaringClass == Provider.class ||
-                    declaringClass == Object.class) {
-                    return method.invoke(this, args);
-                } else {
-                    // assert false : "this should never happen"
-                    //    reaching here would indicate a breach
-                    //    in security in the higher layers
-                    throw new SecurityException();
-                }
-            } catch (IllegalAccessException e) {
-                assert false;
-            } catch (InvocationTargetException e) {
-                assert false;
-            }
-        } else {
-            triggerProbe(method, args);
-        }
-        return null;
-    }
-
-    /**
-     * Direct accessor for {@code Probe} objects.
-     *
-     * @param m the method corresponding to a probe
-     * @return the method associated probe object, or null
-     */
-    public Probe getProbe(Method m) {
-        return active ? probes.get(m) : null;
-    }
-
-    /**
-     * Default provider disposal method.
-     *
-     * This is overridden in subclasses as needed.
-     */
-    public void dispose() {
-        active = false;
-        probes.clear();
-    }
-
-    /**
-     * Gets the user-specified provider name for the user's interface.
-     *
-     * If the user's interface has a {@ProviderName} annotation, that value
-     * is used.  Otherwise we use the simple name of the user interface's class.
-     * @return the provider name
-     */
-    protected String getProviderName() {
-        return getAnnotationString(
-                providerType, ProviderName.class, providerType.getSimpleName());
-    }
-
-    /**
-     * Utility method for getting a string value from an annotation.
-     *
-     * Used for getting a string value from an annotation with a 'value' method.
-     *
-     * @param element the element that was annotated, either a class or method
-     * @param annotation the class of the annotation we're interested in
-     * @param defaultValue the value to return if the annotation doesn't
-     * exist, doesn't have a "value", or the value is empty.
-     */
-    protected static String getAnnotationString(
-            AnnotatedElement element, Class<? extends Annotation> annotation,
-            String defaultValue) {
-        String ret = (String)getAnnotationValue(
-                element, annotation, "value", defaultValue);
-        return ret.isEmpty() ? defaultValue : ret;
-    }
-
-    /**
-     * Utility method for calling an arbitrary method in an annotation.
-     *
-     * @param element the element that was annotated, either a class or method
-     * @param annotation the class of the annotation we're interested in
-     * @param methodName the name of the method in the annotation we wish
-     * to call.
-     * @param defaultValue the value to return if the annotation doesn't
-     * exist, or we couldn't invoke the method for some reason.
-     * @return the result of calling the annotation method, or the default.
-     */
-    protected static Object getAnnotationValue(
-            AnnotatedElement element, Class<? extends Annotation> annotation,
-            String methodName, Object defaultValue) {
-        Object ret = defaultValue;
-        try {
-            Method m = annotation.getMethod(methodName);
-            Annotation a = element.getAnnotation(annotation);
-            ret = m.invoke(a);
-        } catch (NoSuchMethodException e) {
-            assert false;
-        } catch (IllegalAccessException e) {
-            assert false;
-        } catch (InvocationTargetException e) {
-            assert false;
-        } catch (NullPointerException e) {
-            assert false;
-        }
-        return ret;
-    }
-
-    protected void triggerProbe(Method method, Object[] args) {
-        if (active) {
-            ProbeSkeleton p = probes.get(method);
-            if (p != null) {
-                // Skips argument check -- already done by javac
-                p.uncheckedTrigger(args);
-            }
-        }
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/Activation.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing.dtrace;
-
-import java.lang.ref.WeakReference;
-import java.lang.ref.ReferenceQueue;
-import java.security.Permission;
-import java.util.HashSet;
-
-class Activation {
-    private SystemResource resource;
-    private int referenceCount;
-
-    Activation(String moduleName, DTraceProvider[] providers) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            Permission perm =
-                new RuntimePermission("com.sun.tracing.dtrace.createProvider");
-            security.checkPermission(perm);
-        }
-        referenceCount = providers.length;
-        for (DTraceProvider p : providers) {
-            p.setActivation(this);
-        }
-        resource = new SystemResource(
-            this, JVM.activate(moduleName, providers));
-    }
-
-    void disposeProvider(DTraceProvider p) {
-        if (--referenceCount == 0) {
-            resource.dispose();
-        }
-    }
-}
-
-/**
- * The native resource part of an Activation.
- *
- * This holds the native handle.
- *
- * If the user loses a reference to a set of Providers without disposing them,
- * and GC determines the Activation is unreachable, then the next
- * activation or flush call will automatically dispose the unreachable objects
- *
- * The SystemResource instances are creating during activation, and
- * unattached during disposal.  When created, they always have a
- * strong reference to them via the {@code resources} static member.  Explicit
- * {@code dispose} calls will unregister the native resource and remove
- * references to the SystemResource object.  Absent an explicit dispose,
- * when their associated Activation object becomes garbage, the SystemResource
- * object will be enqueued on the reference queue and disposed at the
- * next call to {@code flush}.
- */
-class SystemResource extends WeakReference<Activation> {
-
-    private long handle;
-
-    private static ReferenceQueue<Activation> referenceQueue =
-        referenceQueue = new ReferenceQueue<Activation>();
-    static HashSet<SystemResource> resources = new HashSet<SystemResource>();
-
-    SystemResource(Activation activation, long handle) {
-        super(activation, referenceQueue);
-        this.handle = handle;
-        flush();
-        resources.add(this);
-    }
-
-    void dispose() {
-        JVM.dispose(handle);
-        resources.remove(this);
-        handle = 0;
-    }
-
-    static void flush() {
-        SystemResource resource = null;
-        while ((resource = (SystemResource)referenceQueue.poll()) != null) {
-            if (resource.handle != 0) {
-                resource.dispose();
-            }
-        }
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProbe.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing.dtrace;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
-import sun.tracing.ProbeSkeleton;
-
-class DTraceProbe extends ProbeSkeleton {
-    private Object proxy;
-    private Method declared_method;
-    private Method implementing_method;
-
-    DTraceProbe(Object proxy, Method m) {
-        super(m.getParameterTypes());
-        this.proxy = proxy;
-        this.declared_method = m;
-        try {
-            // The JVM will override the proxy method's implementation with
-            // a version that will invoke the probe.
-            this.implementing_method =  proxy.getClass().getMethod(
-                m.getName(), m.getParameterTypes());
-        } catch (NoSuchMethodException e) {
-            throw new RuntimeException("Internal error, wrong proxy class");
-        }
-    }
-
-    public boolean isEnabled() {
-        return JVM.isEnabled(implementing_method);
-    }
-
-    public void uncheckedTrigger(Object[] args) {
-        try {
-            implementing_method.invoke(proxy, args);
-        } catch (IllegalAccessException e) {
-            assert false;
-        } catch (InvocationTargetException e) {
-            assert false;
-        }
-    }
-
-    String getProbeName() {
-        return DTraceProvider.getProbeName(declared_method);
-    }
-
-    String getFunctionName() {
-        return DTraceProvider.getFunctionName(declared_method);
-    }
-
-    Method getMethod() {
-        return implementing_method;
-    }
-
-    Class<?>[] getParameterTypes() {
-        return this.parameters;
-    }
-}
-
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProvider.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2008, 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 sun.tracing.dtrace;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.annotation.Annotation;
-
-import sun.tracing.ProviderSkeleton;
-import sun.tracing.ProbeSkeleton;
-import com.sun.tracing.Provider;
-import com.sun.tracing.ProbeName;
-import com.sun.tracing.dtrace.Attributes;
-import com.sun.tracing.dtrace.ModuleName;
-import com.sun.tracing.dtrace.FunctionName;
-import com.sun.tracing.dtrace.StabilityLevel;
-import com.sun.tracing.dtrace.DependencyClass;
-
-import sun.misc.ProxyGenerator;
-
-class DTraceProvider extends ProviderSkeleton {
-
-    private Activation activation;
-    private Object proxy;
-
-    // For proxy generation
-    private final static Class<?>[] constructorParams = { InvocationHandler.class };
-    private final String proxyClassNamePrefix = "$DTraceTracingProxy";
-
-    static final String DEFAULT_MODULE = "java_tracing";
-    static final String DEFAULT_FUNCTION = "unspecified";
-
-    private static long nextUniqueNumber = 0;
-    private static synchronized long getUniqueNumber() {
-        return nextUniqueNumber++;
-    }
-
-    protected ProbeSkeleton createProbe(Method m) {
-        return new DTraceProbe(proxy, m);
-    }
-
-    DTraceProvider(Class<? extends Provider> type) {
-        super(type);
-    }
-
-    void setProxy(Object p) {
-        proxy = p;
-    }
-
-    void setActivation(Activation a) {
-        this.activation = a;
-    }
-
-    public void dispose() {
-        if (activation != null) {
-            activation.disposeProvider(this);
-            activation = null;
-        }
-        super.dispose();
-    }
-
-    /**
-     * Magic routine which creates an implementation of the user's interface.
-     *
-     * This method uses the ProxyGenerator directly to bypass the
-     * java.lang.reflect.proxy cache so that we get a unique class each
-     * time it's called and can't accidently reuse a $Proxy class.
-     *
-     * @return an implementation of the user's interface
-     */
-    @SuppressWarnings("unchecked")
-    public <T extends Provider> T newProxyInstance() {
-        /*
-         * Choose a name for the proxy class to generate.
-         */
-        long num = getUniqueNumber();
-
-        String proxyPkg = "";
-        if (!Modifier.isPublic(providerType.getModifiers())) {
-            String name = providerType.getName();
-            int n = name.lastIndexOf('.');
-            proxyPkg = ((n == -1) ? "" : name.substring(0, n + 1));
-        }
-
-        String proxyName = proxyPkg + proxyClassNamePrefix + num;
-
-        /*
-         * Generate the specified proxy class.
-         */
-        Class<?> proxyClass = null;
-        byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
-                proxyName, new Class<?>[] { providerType });
-        try {
-            proxyClass = JVM.defineClass(
-                providerType.getClassLoader(), proxyName,
-                proxyClassFile, 0, proxyClassFile.length);
-        } catch (ClassFormatError e) {
-            /*
-             * A ClassFormatError here means that (barring bugs in the
-             * proxy class generation code) there was some other
-             * invalid aspect of the arguments supplied to the proxy
-             * class creation (such as virtual machine limitations
-             * exceeded).
-             */
-            throw new IllegalArgumentException(e.toString());
-        }
-
-        /*
-         * Invoke its constructor with the designated invocation handler.
-         */
-        try {
-            Constructor<?> cons = proxyClass.getConstructor(constructorParams);
-            return (T)cons.newInstance(new Object[] { this });
-        } catch (ReflectiveOperationException e) {
-            throw new InternalError(e.toString(), e);
-        }
-    }
-
-    // In the normal case, the proxy object's method implementations will call
-    // this method (it usually calls the ProviderSkeleton's version).  That
-    // method uses the passed 'method' object to lookup the associated
-    // 'ProbeSkeleton' and calls uncheckedTrigger() on that probe to cause the
-    // probe to fire.  DTrace probes are different in that the proxy class's
-    // methods are immediately overridden with native code to fire the probe
-    // directly.  So this method should never get invoked.  We also wire up the
-    // DTraceProbe.uncheckedTrigger() method to call the proxy method instead
-    // of doing the work itself.
-    protected void triggerProbe(Method method, Object[] args) {
-        assert false : "This method should have been overridden by the JVM";
-    }
-
-    public String getProviderName() {
-        return super.getProviderName();
-    }
-
-    String getModuleName() {
-        return getAnnotationString(
-            providerType, ModuleName.class, DEFAULT_MODULE);
-    }
-
-    static String getProbeName(Method method) {
-        return getAnnotationString(
-            method, ProbeName.class, method.getName());
-    }
-
-    static String getFunctionName(Method method) {
-        return getAnnotationString(
-            method, FunctionName.class, DEFAULT_FUNCTION);
-    }
-
-    DTraceProbe[] getProbes() {
-        return probes.values().toArray(new DTraceProbe[0]);
-    }
-
-    StabilityLevel getNameStabilityFor(Class<? extends Annotation> type) {
-        Attributes attrs = (Attributes)getAnnotationValue(
-            providerType, type, "value", null);
-        if (attrs == null) {
-            return StabilityLevel.PRIVATE;
-        } else {
-            return attrs.name();
-        }
-    }
-
-    StabilityLevel getDataStabilityFor(Class<? extends Annotation> type) {
-        Attributes attrs = (Attributes)getAnnotationValue(
-            providerType, type, "value", null);
-        if (attrs == null) {
-            return StabilityLevel.PRIVATE;
-        } else {
-            return attrs.data();
-        }
-    }
-
-    DependencyClass getDependencyClassFor(Class<? extends Annotation> type) {
-        Attributes attrs = (Attributes)getAnnotationValue(
-            providerType, type, "value", null);
-        if (attrs == null) {
-            return DependencyClass.UNKNOWN;
-        } else {
-            return attrs.dependency();
-        }
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing.dtrace;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.security.Permission;
-
-import com.sun.tracing.ProviderFactory;
-import com.sun.tracing.Provider;
-
-/**
- * Factory class to create JSDT Providers.
- *
- * This class contains methods to create an instance of a Provider
- * interface which can be used to place tracepoints in an application.
- * Method calls upon that instance trigger DTrace probes that
- * are visible from DTrace scripts.   Such calls have no other
- * side effects in the application.
- * <p>
- * The DTrace script mechanisms for listing and matching probes will not see
- * nor match any probes until the provider they reside in is created by a
- * call to {@code createProvider()} (or {@code createProviders()}).
- * <p>
- * Providers that are created should be disposed of when they are no longer
- * needed to free up system resources, at which point the associated
- * DTrace probes will no longer be available to DTrace.  One disposes a
- * provider by calling
- * {@link com.sun.tracing.Provider#dispose Provider.dispose()} on a
- * created provider instance.
- *
- * @since 1.7
- */
-public final class DTraceProviderFactory extends ProviderFactory {
-    /**
-     * Creates an instance of a provider which can then be used to trigger
-     * DTrace probes.
-     *
-     * The provider specification, provided as an argument, should only
-     * contain methods which have a 'void' return type and String or
-     * integer-based typed arguments (long, int, short, char, byte, or boolean).
-     *
-     * @param cls A user-defined interface which extends {@code Provider}.
-     * @return An instance of the interface which is used to trigger
-     * the DTrace probes.
-     * @throws java.lang.SecurityException if a security manager has been
-     * installed and it denies
-     * RuntimePermission("com.sun.dtrace.jsdt.createProvider")
-     * @throws java.lang.IllegalArgumentException if the interface contains
-     * methods that do not return null, or that contain arguments that are
-     * not String or integer types.
-     */
-    public <T extends Provider> T createProvider(Class<T> cls) {
-        DTraceProvider jsdt = new DTraceProvider(cls);
-        T proxy = jsdt.newProxyInstance();
-        jsdt.setProxy(proxy);
-        jsdt.init();
-        new Activation(jsdt.getModuleName(), new DTraceProvider[] { jsdt });
-        return proxy;
-    }
-
-    /**
-     * Creates multiple providers at once.
-     *
-     * This method batches together a number of provider instantiations.
-     * It works similarly
-     * to {@code createProvider}, but operates on a set of providers instead
-     * of one at a time.  This method is in place since some DTrace
-     * implementations limit the number of times that providers can be
-     * created.  When numerous providers can be created at once with this
-     * method, it will count only as a single creation point to DTrace, thus
-     * it uses less system resources.
-     * <p>
-     * All of the probes in the providers will be visible to DTrace after
-     * this call and all will remain visible until all of the providers
-     * are disposed.
-     * <p>
-     * The {@code moduleName} parameter will override any {@code ModuleName}
-     * annotation associated with any of the providers in the set.
-     * All of the probes created by this call will share the same
-     * module name.
-     * <p>
-     * @param providers a set of provider specification interfaces
-     * @param moduleName the module name to associate with all probes
-     * @return A map which maps the provider interface specification to an
-     * implementing instance.
-     * @throws java.lang.SecurityException if a security manager has been
-     * installed and it denies
-     * RuntimePermission("com.sun.dtrace.jsdt.createProvider")
-     * @throws java.lang.IllegalArgumentException if any of the interface
-     * contains methods that do not return null, or that contain arguments
-     * that are not String or integer types.
-     */
-    public Map<Class<? extends Provider>,Provider> createProviders(
-            Set<Class<? extends Provider>> providers, String moduleName) {
-        HashMap<Class<? extends Provider>,Provider> map =
-            new HashMap<Class<? extends Provider>,Provider>();
-        HashSet<DTraceProvider> jsdts = new HashSet<DTraceProvider>();
-        for (Class<? extends Provider> cls : providers) {
-            DTraceProvider jsdt = new DTraceProvider(cls);
-            jsdts.add(jsdt);
-            map.put(cls, jsdt.newProxyInstance());
-        }
-        new Activation(moduleName, jsdts.toArray(new DTraceProvider[0]));
-        return map;
-    }
-
-    /**
-     * Used to check the status of DTrace support in the underlying JVM and
-     * operating system.
-     *
-     * This is an informative method only - the Java-level effects of
-     * creating providers and triggering probes will not change whether or
-     * not DTrace is supported by the underlying systems.
-     *
-     * @return true if DTrace is supported
-     */
-    public static boolean isSupported() {
-        try {
-            SecurityManager security = System.getSecurityManager();
-            if (security != null) {
-                Permission perm = new RuntimePermission(
-                        "com.sun.tracing.dtrace.createProvider");
-                security.checkPermission(perm);
-            }
-            return JVM.isSupported();
-        } catch (SecurityException e) {
-            return false;
-        }
-    }
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/dtrace/JVM.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tracing.dtrace;
-
-import java.lang.reflect.Method;
-
-/**
- * Container class for JVM interface native methods
- *
- * @since 1.7
- */
-class JVM {
-
-    static {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Void>() {
-                public Void run() {
-                    System.loadLibrary("jsdt");
-                    return null;
-                }
-            });
-    }
-
-    static long activate(String moduleName, DTraceProvider[] providers) {
-        return activate0(moduleName, providers);
-    }
-
-    static void dispose(long handle) {
-        dispose0(handle);
-    }
-
-    static boolean isEnabled(Method m) {
-        return isEnabled0(m);
-    }
-
-    static boolean isSupported() {
-        return isSupported0();
-    }
-
-    static Class<?> defineClass(
-            ClassLoader loader, String name, byte[] b, int off, int len) {
-        return defineClass0(loader, name, b, off, len);
-    }
-
-    private static native long activate0(
-        String moduleName, DTraceProvider[] providers);
-    private static native void dispose0(long activation_handle);
-    private static native boolean isEnabled0(Method m);
-    private static native boolean isSupported0();
-    private static native Class<?> defineClass0(
-        ClassLoader loader, String name, byte[] b, int off, int len);
-}
--- a/jdk/src/jdk.runtime/share/classes/sun/tracing/package-info.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-/**
- * This package contains internal common code for implementing tracing
- * frameworks, and defined a number of existing frameworks.
- * <p>
- * There are four tracing frameworks currently defined.  The "Null" and
- * "Multiplex" frameworks are used internally as part of the implementation.
- * The "DTrace" framework is the prime consumer framework at the moment,
- * while the "PrintStream" framework is a functional, but hidden, framework
- * which can be used to track probe firings.  All but the "DTrace" framework
- * are defined in this package.  The "DTrace" framework is implemented in the
- * {@code sun.tracing.dtrace} package.
- * <p>
- * This package also contains the {@code ProviderSkeleton} class, which
- * holds most of the common code needed for implementing frameworks.
- * <p>
- * The "Null" framework is used when there are no other active frameworks.
- * It accomplishes absolutely nothing and is merely a placeholder so that
- * the application can call the tracing routines without error.
- * <p>
- * The "Multiplex" framework is used when there are multiple active frameworks.
- * It is initialized with the framework factories and create providers and
- * probes that dispatch to each active framework in turn.
- * <p>
- * The "PrintStream" framework is currently a debugging framework which
- * dispatches trace calls to a user-defined PrintStream class, defined by
- * a property.  It may some day be opened up to general use.
- * <p>
- * See the {@code sun.tracing.dtrace} and {@code com.sun.tracing.dtrace}
- * packages for information on the "DTrace" framework.
- */
-
-package sun.tracing;
--- a/jdk/src/jdk.runtime/share/native/libjsdt/JVM.c	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdlib.h>
-
-#include "jvm.h"
-#include "jni.h"
-#include "jni_util.h"
-
-#include "jvm_symbols.h"
-#include "sun_tracing_dtrace_JVM.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static JvmSymbols* jvm_symbols = NULL;
-
-static void initialize() {
-    static int initialized = 0;
-    if (initialized == 0) {
-        jvm_symbols = lookupJvmSymbols();
-        initialized = 1;
-    }
-}
-
-/*
- * Class:     sun_tracing_dtrace_JVM
- * Method:    isSupported0
- * Signature: ()I
- */
-JNIEXPORT jboolean JNICALL Java_sun_tracing_dtrace_JVM_isSupported0(
-        JNIEnv* env, jclass cls) {
-    initialize();
-    if (jvm_symbols != NULL) {
-        return jvm_symbols->IsSupported(env) ? JNI_TRUE : JNI_FALSE;
-    } else {
-        return JNI_FALSE;
-    }
-}
-
-// Macros that cause an immediate return if we detect an exception
-#define CHECK if ((*env)->ExceptionOccurred(env)) { return; }
-#define CHECK_(x) if ((*env)->ExceptionOccurred(env)) { return x; }
-
-static void readProbeData (
-        JNIEnv* env, jobject probe, JVM_DTraceProbe* jvm_probe) {
-    jclass clazz;
-    jmethodID mid;
-    jobject method;
-
-    if (jvm_probe == NULL) {
-        return; // just in case
-    }
-
-    clazz = (*env)->GetObjectClass(env, probe); CHECK
-
-    mid = (*env)->GetMethodID(
-        env, clazz, "getFunctionName", "()Ljava/lang/String;"); CHECK
-    jvm_probe->function = (jstring)(*env)->CallObjectMethod(
-        env, probe, mid); CHECK
-
-    mid = (*env)->GetMethodID(
-        env, clazz, "getProbeName", "()Ljava/lang/String;"); CHECK
-    jvm_probe->name = (jstring)(*env)->CallObjectMethod(env, probe, mid); CHECK
-
-    mid = (*env)->GetMethodID(
-        env, clazz, "getMethod", "()Ljava/lang/reflect/Method;"); CHECK
-    method = (*env)->CallObjectMethod(env, probe, mid); CHECK
-    jvm_probe->method = (*env)->FromReflectedMethod(env, method); CHECK
-}
-
-static void readFieldInterfaceAttributes(
-        char* annotationName, JNIEnv* env, jobject provider,
-        JVM_DTraceInterfaceAttributes* attrs) {
-    jobject result;
-    jobject result_clazz;
-    jclass provider_clazz;
-    jclass annotation_clazz;
-    jmethodID get;
-    jmethodID enc;
-
-    provider_clazz = (*env)->GetObjectClass(env, provider); CHECK
-    annotation_clazz = (*env)->FindClass(env, annotationName); CHECK
-
-    get = (*env)->GetMethodID(env, provider_clazz, "getNameStabilityFor",
-        "(Ljava/lang/Class;)Lcom/sun/tracing/dtrace/StabilityLevel;"); CHECK
-    result = (*env)->CallObjectMethod(
-        env, provider, get, annotation_clazz); CHECK
-    result_clazz = (*env)->GetObjectClass(env, result); CHECK
-    enc = (*env)->GetMethodID(env, result_clazz, "getEncoding", "()I"); CHECK
-    attrs->nameStability = (*env)->CallIntMethod(env, result, enc); CHECK
-
-    get = (*env)->GetMethodID(env, provider_clazz, "getDataStabilityFor",
-        "(Ljava/lang/Class;)Lcom/sun/tracing/dtrace/StabilityLevel;"); CHECK
-    result = (*env)->CallObjectMethod(
-        env, provider, get, annotation_clazz); CHECK
-    result_clazz = (*env)->GetObjectClass(env, result); CHECK
-    enc = (*env)->GetMethodID(env, result_clazz, "getEncoding", "()I"); CHECK
-    attrs->dataStability = (*env)->CallIntMethod(env, result, enc); CHECK
-
-    get = (*env)->GetMethodID(env, provider_clazz, "getDependencyClassFor",
-        "(Ljava/lang/Class;)Lcom/sun/tracing/dtrace/DependencyClass;"); CHECK
-    result = (*env)->CallObjectMethod(
-        env, provider, get, annotation_clazz); CHECK
-    result_clazz = (*env)->GetObjectClass(env, result); CHECK
-    enc = (*env)->GetMethodID(env, result_clazz, "getEncoding", "()I"); CHECK
-    attrs->dependencyClass = (*env)->CallIntMethod(env, result, enc); CHECK
-}
-
-static void readInterfaceAttributes(
-        JNIEnv* env, jobject provider, JVM_DTraceProvider* jvm_provider) {
-    readFieldInterfaceAttributes("com/sun/tracing/dtrace/ProviderAttributes",
-        env, provider, &(jvm_provider->providerAttributes));
-    readFieldInterfaceAttributes("com/sun/tracing/dtrace/ModuleAttributes",
-        env, provider, &(jvm_provider->moduleAttributes));
-    readFieldInterfaceAttributes("com/sun/tracing/dtrace/FunctionAttributes",
-        env, provider, &(jvm_provider->functionAttributes));
-    readFieldInterfaceAttributes("com/sun/tracing/dtrace/NameAttributes",
-        env, provider, &(jvm_provider->nameAttributes));
-    readFieldInterfaceAttributes("com/sun/tracing/dtrace/ArgsAttributes",
-        env, provider, &(jvm_provider->argsAttributes));
-}
-
-static int readProviderData(
-        JNIEnv* env, jobject provider, JVM_DTraceProvider* jvm_provider) {
-    jmethodID mid;
-    jobjectArray probes;
-    jsize i;
-    jclass clazz = (*env)->GetObjectClass(env, provider); CHECK_(0)
-    mid = (*env)->GetMethodID(
-        env, clazz, "getProbes", "()[Lsun/tracing/dtrace/DTraceProbe;"); CHECK_(0)
-    probes = (jobjectArray)(*env)->CallObjectMethod(
-        env, provider, mid); CHECK_(0)
-
-    // Fill JVM structure, describing provider
-    jvm_provider->probe_count = (*env)->GetArrayLength(env, probes); CHECK_(0)
-    jvm_provider->probes = (JVM_DTraceProbe*)calloc(
-        jvm_provider->probe_count, sizeof(*jvm_provider->probes));
-    mid = (*env)->GetMethodID(
-        env, clazz, "getProviderName", "()Ljava/lang/String;"); CHECK_(0)
-    jvm_provider->name = (jstring)(*env)->CallObjectMethod(
-        env, provider, mid); CHECK_(0)
-
-    readInterfaceAttributes(env, provider, jvm_provider); CHECK_(0)
-
-    for (i = 0; i < jvm_provider->probe_count; ++i) {
-        jobject probe = (*env)->GetObjectArrayElement(env, probes, i); CHECK_(0)
-        readProbeData(env, probe, &jvm_provider->probes[i]); CHECK_(0)
-    }
-
-    return 1;
-}
-
-/*
- * Class:     sun_tracing_dtrace_JVM
- * Method:    activate0
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_sun_tracing_dtrace_JVM_activate0(
-        JNIEnv* env, jclass cls, jstring moduleName, jobjectArray providers) {
-    jlong handle = 0;
-    jsize num_providers;
-    jsize i;
-    jsize count = 0;
-    JVM_DTraceProvider* jvm_providers;
-
-    initialize();
-
-    if (jvm_symbols == NULL) {
-      return 0;
-    }
-
-    num_providers = (*env)->GetArrayLength(env, providers); CHECK_(0L)
-
-    jvm_providers = (JVM_DTraceProvider*)calloc(
-        num_providers, sizeof(*jvm_providers));
-
-    for (; count < num_providers; ++count) {
-        JVM_DTraceProvider* p = &(jvm_providers[count]);
-        jobject provider = (*env)->GetObjectArrayElement(
-            env, providers, count);
-        if ((*env)->ExceptionOccurred(env) ||
-            ! readProviderData(env, provider, p)) {
-            // got an error, bail out!
-            break;
-        }
-    }
-
-    if (count == num_providers) {
-        // all providers successfully loaded - get the handle
-        handle = jvm_symbols->Activate(
-            env, JVM_TRACING_DTRACE_VERSION, moduleName,
-            num_providers, jvm_providers);
-    }
-
-    for (i = 0; i < num_providers; ++i) {
-        JVM_DTraceProvider* p = &(jvm_providers[i]);
-        free(p->probes);
-    }
-    free(jvm_providers);
-
-    return handle;
-}
-
-/*
- * Class:     sun_tracing_dtrace_JVM
- * Method:    dispose0
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_sun_tracing_dtrace_JVM_dispose0(
-        JNIEnv* env, jclass cls, jlong handle) {
-    if (jvm_symbols != NULL && handle != 0) {
-        jvm_symbols->Dispose(env, handle);
-    }
-}
-
-/*
- * Class:     sun_tracing_dtrace_JVM
- * Method:    isEnabled0
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
- */
-JNIEXPORT jboolean JNICALL Java_sun_tracing_dtrace_JVM_isEnabled0(
-        JNIEnv* env, jclass cls, jobject method) {
-    jmethodID mid;
-    if (jvm_symbols != NULL && method != NULL) {
-        mid = (*env)->FromReflectedMethod(env, method);
-        return jvm_symbols->IsProbeEnabled(env, mid);
-    }
-    return JNI_FALSE;
-}
-
-/*
- * Class:     sun_tracing_dtrace_JVM
- * Method:    defineClass0
- * Signature: (Ljava/lang/ClassLoader;Ljava/lang/String;[BII)Ljava/lang/Class;
- *
- * The implementation of this native static method is a copy of that of
- * the native instance method Java_java_lang_ClassLoader_defineClass0()
- * with the implicit "this" parameter becoming the "loader" parameter.
- *
- * This code was cloned and modified from java_lang_reflect_Proxy
- */
-JNIEXPORT jclass JNICALL
-Java_sun_tracing_dtrace_JVM_defineClass0(
-        JNIEnv *env, jclass ignore, jobject loader, jstring name, jbyteArray data,
-        jint offset, jint length)
-{
-    jbyte *body;
-    char *utfName;
-    jclass result = 0;
-    char buf[128];
-
-    if (data == NULL) {
-        return 0;
-    }
-
-    /* Work around 4153825. malloc crashes on Solaris when passed a
-     * negative size.
-     */
-    if (length < 0) {
-        return 0;
-    }
-
-    body = (jbyte *)malloc(length);
-
-    if (body == 0) {
-        return 0;
-    }
-
-    (*env)->GetByteArrayRegion(env, data, offset, length, body);
-
-    if ((*env)->ExceptionOccurred(env))
-        goto free_body;
-
-    if (name != NULL) {
-        int i;
-        jsize len = (*env)->GetStringUTFLength(env, name);
-        int unicode_len = (*env)->GetStringLength(env, name);
-        if (len >= (jsize)sizeof(buf)) {
-            utfName = malloc(len + 1);
-            if (utfName == NULL) {
-                goto free_body;
-            }
-        } else {
-            utfName = buf;
-        }
-        (*env)->GetStringUTFRegion(env, name, 0, unicode_len, utfName);
-
-        // Convert '.' to '/' in the package name
-        for (i = 0; i < unicode_len; ++i) {
-            if (utfName[i] == '.') {
-                utfName[i] = '/';
-            }
-        }
-    } else {
-        utfName = NULL;
-    }
-
-    result = (*env)->DefineClass(env, utfName, loader, body, length);
-
-    if (utfName && utfName != buf)
-        free(utfName);
-
- free_body:
-    free(body);
-    return result;
-}
-
-#ifdef __cplusplus
-}
-#endif
--- a/jdk/src/jdk.runtime/share/native/libjsdt/jvm_symbols.h	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-#ifndef _JVM_SYMBOLS_H
-#define _JVM_SYMBOLS_H
-
-#include "jvm.h"
-
-typedef jint (JNICALL* GetVersion_t)(JNIEnv*);
-typedef jboolean (JNICALL *IsSupported_t)(JNIEnv*);
-typedef jlong (JNICALL* Activate_t)(
-    JNIEnv*, jint, jstring, jint, JVM_DTraceProvider*);
-typedef void (JNICALL *Dispose_t)(JNIEnv*, jlong);
-typedef jboolean (JNICALL *IsProbeEnabled_t)(JNIEnv*, jmethodID);
-
-typedef struct {
-    GetVersion_t     GetVersion;
-    IsSupported_t    IsSupported;
-    Activate_t       Activate;
-    Dispose_t        Dispose;
-    IsProbeEnabled_t IsProbeEnabled;
-} JvmSymbols;
-
-// Platform-dependent implementation.
-// Returns NULL if the symbols are not found
-extern JvmSymbols* lookupJvmSymbols();
-
-#endif // def _JVM_SYMBOLS_H
--- a/jdk/src/jdk.runtime/unix/native/libjsdt/jvm_symbols_md.c	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <dlfcn.h>
-#include <stdlib.h>
-
-#include <jvm.h>
-
-#include "jvm_symbols.h"
-
-JvmSymbols* lookupJvmSymbols() {
-    JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
-    if (syms != NULL) {
-        syms->GetVersion = (GetVersion_t)
-            dlsym(RTLD_DEFAULT, "JVM_DTraceGetVersion");
-        syms->IsSupported = (IsSupported_t)
-            dlsym(RTLD_DEFAULT, "JVM_DTraceIsSupported");
-        syms->Activate = (Activate_t)
-            dlsym(RTLD_DEFAULT, "JVM_DTraceActivate");
-        syms->Dispose = (Dispose_t)
-            dlsym(RTLD_DEFAULT, "JVM_DTraceDispose");
-        syms->IsProbeEnabled = (IsProbeEnabled_t)
-            dlsym(RTLD_DEFAULT, "JVM_DTraceIsProbeEnabled");
-
-        if ( syms->GetVersion == NULL || syms->Activate == NULL ||
-             syms->IsProbeEnabled == NULL || syms->Dispose == NULL ||
-             syms->IsSupported == NULL) {
-            free(syms);
-            syms = NULL;
-        }
-    }
-    return syms;
-}
--- a/jdk/src/jdk.runtime/windows/native/libjsdt/jvm_symbols_md.c	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <jvm.h>
-
-#include "jvm_symbols.h"
-
-JvmSymbols* lookupJvmSymbols() {
-    JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
-    if (syms != NULL) {
-        HINSTANCE jvm = GetModuleHandle("jvm.dll");
-        if (jvm == NULL) {
-            free(syms);
-            return NULL;
-        }
-        syms->GetVersion = (GetVersion_t)
-            GetProcAddress(jvm, "JVM_DTraceGetVersion");
-        syms->IsSupported = (IsSupported_t)
-            GetProcAddress(jvm, "JVM_DTraceIsSupported");
-        syms->Activate = (Activate_t)
-            GetProcAddress(jvm, "JVM_DTraceActivate");
-        syms->Dispose = (Dispose_t)
-            GetProcAddress(jvm, "JVM_DTraceDispose");
-        syms->IsProbeEnabled = (IsProbeEnabled_t)
-            GetProcAddress(jvm, "JVM_DTraceIsProbeEnabled");
-
-        (void)FreeLibrary(jvm);
-        if ( syms->GetVersion == NULL || syms->IsSupported == NULL ||
-             syms->Activate == NULL || syms->Dispose == NULL ||
-             syms->IsProbeEnabled == NULL) {
-            free(syms);
-            syms = NULL;
-        }
-
-    }
-    return syms;
-}
--- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -464,11 +464,6 @@
             union sctp_notification *snp;
             jboolean allocated = JNI_FALSE;
 
-            if (rv > SCTP_NOTIFICATION_SIZE) {
-                JNU_ThrowInternalError(env, "should not reach here");
-                return -1;
-            }
-
             if (!(msg->msg_flags & MSG_EOR) && length < SCTP_NOTIFICATION_SIZE) {
                 char* newBuf;
                 int rvSAVE = rv;
--- a/jdk/test/ProblemList.txt	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 20:20:43 2017 +0200
@@ -141,9 +141,6 @@
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
-# 8069286
-java/lang/management/MemoryMXBean/LowMemoryTest.java		generic-all
-
 ############################################################################
 
 # jdk_jmx
@@ -352,7 +349,4 @@
 # 8064572 8060736 8062938
 sun/jvmstat/monitor/MonitoredVm/CR6672135.java			generic-all
 
-# 8060088
-com/sun/tracing/BasicWithSecurityMgr.java                       generic-all
-
 ############################################################################
--- a/jdk/test/TEST.groups	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/TEST.groups	Wed Jul 05 20:20:43 2017 +0200
@@ -190,7 +190,6 @@
 
 svc_tools = \
     com/sun/tools/attach \
-    com/sun/tracing \
     sun/tools \
     -sun/tools/java \
     -sun/tools/native2ascii \
@@ -407,6 +406,7 @@
   com/sun/tools \
   demo \
   sun/security/tools/jarsigner \
+  sun/security/tools/policytool \
   sun/rmi/rmic \
   sun/tools \
   sun/jvmstat \
@@ -456,7 +456,6 @@
   com/oracle/security/ucrypto/TestRSA.java \
   sun/net/ftp \
   sun/net/www/protocol/ftp \
-  sun/security/tools/policytool \
   java/net/URI/URItoURLTest.java \
   java/net/URL/URIToURLTest.java \
   java/net/URLConnection/HandleContentTypeWithAttrs.java \
@@ -562,7 +561,6 @@
   com/sun/security/auth \
   com/sun/security/sasl \
   com/sun/security/jgss \
-  com/sun/tracing \
   java/util/prefs \
   javax/naming \
   javax/security \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8067846
+ * @summary Test for send failed notification
+ */
+
+import com.sun.nio.sctp.*;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import static java.lang.System.out;
+import static java.nio.ByteBuffer.*;
+
+public class SendFailed {
+
+    static final SocketAddress remoteAddress = new InetSocketAddress("127.0.0.1", 3000);
+
+    static final int[] bufferSizes =
+            { 20, 49, 50, 51, 100, 101, 1024, 1025, 4095, 4096, 4097, 8191, 8192, 8193};
+
+    void test(String[] args) throws IOException {
+        SocketAddress address = null;
+
+        if (!Util.isSCTPSupported()) {
+            out.println("SCTP protocol is not supported");
+            out.println("Test cannot be run");
+            return;
+        }
+
+        System.out.println("remote address: " + remoteAddress);
+        System.out.println("Note, remote address should not be up");
+
+        /* combinations with various buffer sizes, and offsets */
+        for (int send=0; send < bufferSizes.length; send++) {
+            for (int recv=0; recv < bufferSizes.length; recv++) {
+                for (boolean direct : new boolean[] {true, false})
+                    runWithManyOffsets(bufferSizes[send], bufferSizes[recv], direct);
+            }
+        }
+    }
+
+    void runWithManyOffsets(int sendBufferSize, int recvBufferSize, boolean direct)
+        throws IOException
+    {
+        doTest(sendBufferSize, recvBufferSize, direct, 0);
+        doTest(sendBufferSize, recvBufferSize, direct, 1);
+        doTest(sendBufferSize, recvBufferSize, direct, 3);
+        doTest(sendBufferSize, recvBufferSize, direct, 7);
+        doTest(sendBufferSize, recvBufferSize, direct, 9);
+        doTest(sendBufferSize, recvBufferSize, direct, 13);
+        doTest(sendBufferSize, recvBufferSize, direct, 15);
+    }
+
+    void doTest(int sendBufferSize, int recvBufferSize, boolean direct, int offset)
+        throws IOException
+    {
+        debug("%n--- Testing with send size:[%d], recv size:[%d], offset:[%d] "
+                + ", direct [%s]. ", sendBufferSize, recvBufferSize, offset, direct);
+
+        try (SctpMultiChannel channel = SctpMultiChannel.open()) {
+            MessageInfo messageInfo = MessageInfo.createOutgoing(remoteAddress, 0);
+            ByteBuffer sendBuffer = filledBuffer(sendBufferSize, direct);
+
+            debug("%nAttempting to send to %s. ", remoteAddress);
+            int sent = channel.send(sendBuffer, messageInfo);
+            sendBuffer.flip();
+
+            SendFailedNotificationHandler handler =
+                    new SendFailedNotificationHandler();
+            ByteBuffer recvBuffer = direct ? allocateDirect(recvBufferSize)
+                                           : allocate((recvBufferSize));
+            channel.receive(recvBuffer, null, handler);
+
+            // verify sent buffer received by send failed notification
+            ByteBuffer buffer = handler.getSendFailedByteBuffer();
+            check(buffer.remaining() == sent);
+            check(buffer.position() == 0);
+            check(buffer.limit() == sent);
+            assertSameContent(sendBuffer, handler.getSendFailedByteBuffer());
+        }
+    }
+
+    class SendFailedNotificationHandler extends AbstractNotificationHandler<Object>
+    {
+        /** Reference to the buffer captured in send failed notification */
+        private ByteBuffer sentBuffer;
+
+        @Override
+        public HandlerResult handleNotification(
+                Notification notification, Object attachment) {
+            fail("Unknown notification type");
+            return HandlerResult.CONTINUE;
+        }
+
+        @Override
+        public HandlerResult handleNotification(
+                AssociationChangeNotification notification, Object attachment) {
+            AssociationChangeNotification.AssocChangeEvent event = notification.event();
+            debug("%nAssociationChangeNotification");
+            debug("%n  Association: %s. ", notification.association());
+            debug("%n  Event: %s. ", event);
+            return HandlerResult.CONTINUE;
+        }
+
+        @Override
+        public HandlerResult handleNotification(
+                SendFailedNotification notification, Object attachment) {
+            debug("%nSendFailedNotification: %s. ", notification);
+            sentBuffer = notification.buffer();
+            return HandlerResult.RETURN;
+        }
+
+        public ByteBuffer getSendFailedByteBuffer() {
+            return sentBuffer;
+        }
+
+        @Override
+        public HandlerResult handleNotification(
+                PeerAddressChangeNotification pacn, Object attachment)
+        {
+            debug("%nPeerAddressChangeNotification: %s", pacn);
+            return HandlerResult.CONTINUE;
+        }
+
+        @Override
+        public HandlerResult handleNotification(
+                ShutdownNotification notification, Object attachment) {
+            debug("%nShutdownNotification");
+            debug("%n  Association: %s. ", notification.association());
+            return HandlerResult.CONTINUE;
+        }
+    }
+
+    static ByteBuffer filledBuffer(int size, boolean direct) {
+        ByteBuffer buffer = direct ? allocateDirect(size) : allocate((size));
+        for (int i=0; i< size; i++)
+            buffer.put((byte)i);
+        buffer.flip();
+        return buffer;
+    }
+
+    static void assertSameContent(ByteBuffer bb1, ByteBuffer bb2) {
+        if (!bb1.equals(bb2))
+            throw new RuntimeException("Buffers are not equal; bb1: " + bb1 + ", bb2: " + bb2);
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    boolean debug = true;
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++; Thread.dumpStack();}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond) {if (cond) pass(); else fail();}
+    void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
+    void debug(String message, Object... args) {if(debug) { out.printf(message, args); } }
+    public static void main(String[] args) throws Throwable {
+        Class<?> k = new Object(){}.getClass().getEnclosingClass();
+        try {k.getMethod("instanceMain",String[].class)
+                .invoke( k.newInstance(), (Object) args);}
+        catch (Throwable e) {throw e.getCause();}}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- a/jdk/test/com/sun/tracing/BasicFunctionality.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 6537506
- * @ignore 6962535
- * @summary Basic unit test for tracing framework
- */
-
-import com.sun.tracing.*;
-import java.lang.reflect.Method;
-
-@ProviderName("NamedProvider")
-interface BasicProvider extends Provider {
-    void plainProbe();
-    void probeWithArgs(int a, float f, String s, Long l);
-    @ProbeName("namedProbe") void probeWithName();
-    void overloadedProbe();
-    void overloadedProbe(int i);
-}
-
-interface InvalidProvider extends Provider {
-    int nonVoidProbe();
-}
-
-public class BasicFunctionality {
-
-    public static ProviderFactory factory;
-    public static BasicProvider bp;
-
-    public static void main(String[] args) throws Exception {
-
-        factory = ProviderFactory.getDefaultFactory();
-        if (factory != null) {
-            bp = factory.createProvider(BasicProvider.class);
-        }
-
-        testProviderFactory();
-        testProbe();
-        testProvider();
-    }
-
-    static void fail(String s) throws Exception {
-        throw new Exception(s);
-    }
-
-    static void testProviderFactory() throws Exception {
-        if (factory == null) {
-            fail("ProviderFactory.getDefaultFactory: Did not create factory");
-        }
-        if (bp == null) {
-            fail("ProviderFactory.createProvider: Did not create provider");
-        }
-        try {
-            factory.createProvider(null);
-            fail("ProviderFactory.createProvider: Did not throw NPE for null");
-        } catch (NullPointerException e) {}
-
-       try {
-           factory.createProvider(InvalidProvider.class);
-           fail("Factory.createProvider: Should error with non-void probes");
-       } catch (IllegalArgumentException e) {}
-    }
-
-    public static void testProvider() throws Exception {
-
-       // These just shouldn't throw any exeptions:
-       bp.plainProbe();
-       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
-       bp.probeWithArgs(42, (float)3.14, null, null);
-       bp.probeWithName();
-       bp.overloadedProbe();
-       bp.overloadedProbe(42);
-
-       Method m = BasicProvider.class.getMethod("plainProbe");
-       Probe p = bp.getProbe(m);
-       if (p == null) {
-           fail("Provider.getProbe: Did not return probe");
-       }
-
-       Method m2 = BasicFunctionality.class.getMethod("testProvider");
-       p = bp.getProbe(m2);
-       if (p != null) {
-           fail("Provider.getProbe: Got probe with invalid spec");
-       }
-
-       bp.dispose();
-       // These just shouldn't throw any exeptions:
-       bp.plainProbe();
-       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
-       bp.probeWithArgs(42, (float)3.14, null, null);
-       bp.probeWithName();
-       bp.overloadedProbe();
-       bp.overloadedProbe(42);
-
-       if (bp.getProbe(m) != null) {
-           fail("Provider.getProbe: Should return null after dispose()");
-       }
-
-       bp.dispose(); // just to make sure nothing bad happens
-    }
-
-    static void testProbe() throws Exception {
-       Method m = BasicProvider.class.getMethod("plainProbe");
-       Probe p = bp.getProbe(m);
-       p.isEnabled(); // just make sure it doesn't do anything bad
-       p.trigger();
-
-       try {
-         p.trigger(0);
-         fail("Probe.trigger: too many arguments not caught");
-       } catch (IllegalArgumentException e) {}
-
-       p = bp.getProbe(BasicProvider.class.getMethod(
-           "probeWithArgs", int.class, float.class, String.class, Long.class));
-       try {
-         p.trigger();
-         fail("Probe.trigger: too few arguments not caught");
-       } catch (IllegalArgumentException e) {}
-
-       try {
-         p.trigger((float)3.14, (float)3.14, "", new Long(0L));
-         fail("Probe.trigger: wrong type primitive arguments not caught");
-       } catch (IllegalArgumentException e) {}
-    }
-}
--- a/jdk/test/com/sun/tracing/BasicWithSecurityMgr.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 6899605
- * @summary Basic unit test for tracing framework with security manager
- *          enabled
- */
-
-import com.sun.tracing.*;
-import java.lang.reflect.Method;
-
-@ProviderName("NamedProvider")
-interface BasicProvider extends Provider {
-    void plainProbe();
-    void probeWithArgs(int a, float f, String s, Long l);
-    @ProbeName("namedProbe") void probeWithName();
-    void overloadedProbe();
-    void overloadedProbe(int i);
-}
-
-interface InvalidProvider extends Provider {
-    int nonVoidProbe();
-}
-
-public class BasicWithSecurityMgr {
-
-    public static ProviderFactory factory;
-    public static BasicProvider bp;
-
-    public static void main(String[] args) throws Exception {
-        // enable security manager
-        System.setSecurityManager(new SecurityManager());
-
-        factory = ProviderFactory.getDefaultFactory();
-        if (factory != null) {
-            bp = factory.createProvider(BasicProvider.class);
-        }
-
-        testProviderFactory();
-        testProbe();
-        testProvider();
-    }
-
-    static void fail(String s) throws Exception {
-        throw new Exception(s);
-    }
-
-    static void testProviderFactory() throws Exception {
-        if (factory == null) {
-            fail("ProviderFactory.getDefaultFactory: Did not create factory");
-        }
-        if (bp == null) {
-            fail("ProviderFactory.createProvider: Did not create provider");
-        }
-        try {
-            factory.createProvider(null);
-            fail("ProviderFactory.createProvider: Did not throw NPE for null");
-        } catch (NullPointerException e) {}
-
-       try {
-           factory.createProvider(InvalidProvider.class);
-           fail("Factory.createProvider: Should error with non-void probes");
-       } catch (IllegalArgumentException e) {}
-    }
-
-    public static void testProvider() throws Exception {
-
-       // These just shouldn't throw any exeptions:
-       bp.plainProbe();
-       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
-       bp.probeWithArgs(42, (float)3.14, null, null);
-       bp.probeWithName();
-       bp.overloadedProbe();
-       bp.overloadedProbe(42);
-
-       Method m = BasicProvider.class.getMethod("plainProbe");
-       Probe p = bp.getProbe(m);
-       if (p == null) {
-           fail("Provider.getProbe: Did not return probe");
-       }
-
-       Method m2 = BasicWithSecurityMgr.class.getMethod("testProvider");
-       p = bp.getProbe(m2);
-       if (p != null) {
-           fail("Provider.getProbe: Got probe with invalid spec");
-       }
-
-       bp.dispose();
-       // These just shouldn't throw any exeptions:
-       bp.plainProbe();
-       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
-       bp.probeWithArgs(42, (float)3.14, null, null);
-       bp.probeWithName();
-       bp.overloadedProbe();
-       bp.overloadedProbe(42);
-
-       if (bp.getProbe(m) != null) {
-           fail("Provider.getProbe: Should return null after dispose()");
-       }
-
-       bp.dispose(); // just to make sure nothing bad happens
-    }
-
-    static void testProbe() throws Exception {
-       Method m = BasicProvider.class.getMethod("plainProbe");
-       Probe p = bp.getProbe(m);
-       p.isEnabled(); // just make sure it doesn't do anything bad
-       p.trigger();
-
-       try {
-         p.trigger(0);
-         fail("Probe.trigger: too many arguments not caught");
-       } catch (IllegalArgumentException e) {}
-
-       p = bp.getProbe(BasicProvider.class.getMethod(
-           "probeWithArgs", int.class, float.class, String.class, Long.class));
-       try {
-         p.trigger();
-         fail("Probe.trigger: too few arguments not caught");
-       } catch (IllegalArgumentException e) {}
-
-       try {
-         p.trigger((float)3.14, (float)3.14, "", new Long(0L));
-         fail("Probe.trigger: wrong type primitive arguments not caught");
-       } catch (IllegalArgumentException e) {}
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Color/LoadProfileWithSM.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.color.*;
+
+/*
+ * @test
+ * @bug 8058969
+ * @summary test standard profiles loads with SecurityManager installed.
+ * @run main/othervm LoadProfileWithSM
+ */
+
+public class LoadProfileWithSM {
+
+    public static void main(String[] args) {
+        System.setSecurityManager(new SecurityManager());
+        ICC_Profile profile =
+            ((ICC_ColorSpace)(ColorSpace.getInstance(
+                ColorSpace.CS_GRAY))).getProfile();
+        /* request profile data in order to force profile loading */
+        profile.getData();
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Color/LoadStandardProfilesTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8039271
+ * @summary test all standard profiles load correctly.
+ */
+
+import java.awt.color.ICC_Profile;
+
+public class LoadStandardProfilesTest {
+
+    public static void main(String args[]) {
+        try {
+            ICC_Profile sRGB      = ICC_Profile.getInstance("sRGB.pf");
+            ICC_Profile gray      = ICC_Profile.getInstance("GRAY.pf");
+            ICC_Profile pycc      = ICC_Profile.getInstance("PYCC.pf");
+            ICC_Profile ciexyz    = ICC_Profile.getInstance("CIEXYZ.pf");
+            ICC_Profile linearRGB = ICC_Profile.getInstance("LINEAR_RGB.pf");
+
+            if (sRGB == null ||
+                gray == null ||
+                pycc == null ||
+                ciexyz == null ||
+                linearRGB == null)
+            {
+                throw new RuntimeException("null profile.");
+            }
+        } catch (Exception e) {
+           throw new RuntimeException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Button;
+import java.awt.Canvas;
+import java.awt.Checkbox;
+import java.awt.Choice;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.FileDialog;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.List;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.Scrollbar;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.Window;
+import java.util.ArrayList;
+import java.util.Objects;
+
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JDesktopPane;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPasswordField;
+import javax.swing.JPopupMenu;
+import javax.swing.JProgressBar;
+import javax.swing.JRadioButton;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JRootPane;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTextPane;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.JTree;
+import javax.swing.JViewport;
+import javax.swing.JWindow;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.table.JTableHeader;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 6459798
+ * @author Sergey Bylokhov
+ */
+public final class DimensionEncapsulation implements Runnable {
+
+    java.util.List<Component> failures = new ArrayList<>();
+
+    public static void main(final String[] args) throws Exception {
+        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+            SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+            SwingUtilities.invokeAndWait(new DimensionEncapsulation());
+        }
+    }
+
+    @Override
+    public void run() {
+        runTest(new Panel());
+        runTest(new Button());
+        runTest(new Checkbox());
+        runTest(new Canvas());
+        runTest(new Choice());
+        runTest(new Label());
+        runTest(new Scrollbar());
+        runTest(new TextArea());
+        runTest(new TextField());
+        runTest(new Dialog(new JFrame()));
+        runTest(new Frame());
+        runTest(new Window(new JFrame()));
+        runTest(new FileDialog(new JFrame()));
+        runTest(new List());
+        runTest(new ScrollPane());
+        runTest(new JFrame());
+        runTest(new JDialog(new JFrame()));
+        runTest(new JWindow(new JFrame()));
+        runTest(new JLabel("hi"));
+        runTest(new JMenu());
+        runTest(new JTree());
+        runTest(new JTable());
+        runTest(new JMenuItem());
+        runTest(new JCheckBoxMenuItem());
+        runTest(new JToggleButton());
+        runTest(new JSpinner());
+        runTest(new JSlider());
+        runTest(Box.createVerticalBox());
+        runTest(Box.createHorizontalBox());
+        runTest(new JTextField());
+        runTest(new JTextArea());
+        runTest(new JTextPane());
+        runTest(new JPasswordField());
+        runTest(new JFormattedTextField());
+        runTest(new JEditorPane());
+        runTest(new JButton());
+        runTest(new JColorChooser());
+        runTest(new JFileChooser());
+        runTest(new JCheckBox());
+        runTest(new JInternalFrame());
+        runTest(new JDesktopPane());
+        runTest(new JTableHeader());
+        runTest(new JLayeredPane());
+        runTest(new JRootPane());
+        runTest(new JMenuBar());
+        runTest(new JOptionPane());
+        runTest(new JRadioButton());
+        runTest(new JRadioButtonMenuItem());
+        runTest(new JPopupMenu());
+        //runTest(new JScrollBar()); --> don't test defines max and min in
+        // terms of preferred
+        runTest(new JScrollPane());
+        runTest(new JViewport());
+        runTest(new JSplitPane());
+        runTest(new JTabbedPane());
+        runTest(new JToolBar());
+        runTest(new JSeparator());
+        runTest(new JProgressBar());
+        if (!failures.isEmpty()) {
+            System.out.println("These classes failed");
+            for (final Component failure : failures) {
+                System.out.println(failure.getClass());
+            }
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    public void runTest(final Component c) {
+        try {
+            test(c);
+            c.setMinimumSize(new Dimension(100, 10));
+            c.setMaximumSize(new Dimension(200, 20));
+            c.setPreferredSize(new Dimension(300, 30));
+            test(c);
+        } catch (final Throwable ignored) {
+            failures.add(c);
+        }
+    }
+
+    public void test(final Component component) {
+        final Dimension psize = component.getPreferredSize();
+        psize.width += 200;
+        if (Objects.equals(psize, component.getPreferredSize())) {
+            throw new RuntimeException("PreferredSize is wrong");
+        }
+        final Dimension msize = component.getMaximumSize();
+        msize.width += 200;
+        if (Objects.equals(msize, component.getMaximumSize())) {
+            throw new RuntimeException("MaximumSize is wrong");
+        }
+        final Dimension misize = component.getMinimumSize();
+        misize.width += 200;
+        if (Objects.equals(misize, component.getMinimumSize())) {
+            throw new RuntimeException("MinimumSize is wrong");
+        }
+    }
+
+    private static void setLookAndFeel(final LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.out.println("LookAndFeel: " + laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Component;
+import java.awt.Insets;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JColorChooser;
+import javax.swing.JComponent;
+import javax.swing.JDesktopPane;
+import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
+import javax.swing.JFormattedTextField;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPasswordField;
+import javax.swing.JPopupMenu;
+import javax.swing.JProgressBar;
+import javax.swing.JRadioButton;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JRootPane;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTextPane;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.JTree;
+import javax.swing.JViewport;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.table.JTableHeader;
+
+import static javax.swing.UIManager.LookAndFeelInfo;
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 6459800
+ * @author Sergey Bylokhov
+ */
+public final class InsetsEncapsulation implements Runnable {
+
+    private final Collection<Component> failures = new ArrayList<>();
+
+    public static void main(final String[] args) throws Exception {
+        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+            SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+            SwingUtilities.invokeAndWait(new InsetsEncapsulation());
+        }
+    }
+
+    @Override
+    public void run() {
+        runTest(new JLabel("hi"));
+        runTest(new JMenu());
+        runTest(new JTree());
+        runTest(new JTable());
+        runTest(new JMenuItem());
+        runTest(new JCheckBoxMenuItem());
+        runTest(new JToggleButton());
+        runTest(new JSpinner());
+        runTest(new JSlider());
+        runTest(Box.createVerticalBox());
+        runTest(Box.createHorizontalBox());
+        runTest(new JTextField());
+        runTest(new JTextArea());
+        runTest(new JTextPane());
+        runTest(new JPasswordField());
+        runTest(new JFormattedTextField());
+        runTest(new JEditorPane());
+        runTest(new JButton());
+        runTest(new JColorChooser());
+        runTest(new JFileChooser());
+        runTest(new JCheckBox());
+        runTest(new JInternalFrame());
+        runTest(new JDesktopPane());
+        runTest(new JTableHeader());
+        runTest(new JLayeredPane());
+        runTest(new JRootPane());
+        runTest(new JMenuBar());
+        runTest(new JOptionPane());
+        runTest(new JRadioButton());
+        runTest(new JRadioButtonMenuItem());
+        runTest(new JPopupMenu());
+        runTest(new JScrollBar());
+        runTest(new JScrollPane());
+        runTest(new JViewport());
+        runTest(new JSplitPane());
+        runTest(new JTabbedPane());
+        runTest(new JToolBar());
+        runTest(new JSeparator());
+        runTest(new JProgressBar());
+        if (!failures.isEmpty()) {
+            System.out.println("These classes failed");
+            for (final Component failure : failures) {
+                System.out.println(failure.getClass());
+            }
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    void runTest(final JComponent component) {
+        try {
+            test(component);
+        } catch (final Throwable ignored) {
+            failures.add(component);
+        }
+    }
+
+    void test(final JComponent component) {
+        final Insets p = component.getInsets();
+        p.top += 3;
+        if (p.equals(component.getInsets())) {
+            throw new RuntimeException("Insets altered by altering Insets!");
+        }
+    }
+
+    private static void setLookAndFeel(final LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.out.println("LookAndFeel: " + laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Desktop/8064934/bug8064934.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8064934
+ * @summary Incorrect Exception message from java.awt.Desktop.open()
+ * @author Dmitry Markov
+ * @run main bug8064934
+ */
+import sun.awt.OSInfo;
+
+import java.awt.*;
+import java.io.File;
+import java.io.IOException;
+import java.security.AccessController;
+
+public class bug8064934 {
+    private static final String NO_ASSOCIATION_ERROR_MESSAGE = "Error message: No application is associated with" +
+            " the specified file for this operation.";
+
+    public static void main(String[] args) {
+        // This test is intended only for Windows
+        if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) != OSInfo.OSType.WINDOWS) {
+            System.out.println("The test is for Windows platform only");
+            return;
+        }
+
+        // Test whether Desktop is supported of not
+        if (!Desktop.isDesktopSupported()) {
+            System.out.println("Desktop is not supported");
+            return;
+        }
+
+        Desktop desktop = Desktop.getDesktop();
+        // Test whether open action is supported or not
+        if (!desktop.isSupported(Desktop.Action.OPEN)) {
+            System.out.println("Desktop.Action.OPEN is not supported");
+            return;
+        }
+
+        File file = null;
+        try {
+            file = File.createTempFile("test", ".foo");
+            if (!file.exists()) {
+                throw new RuntimeException("Can not create temp file");
+            }
+            desktop.open(file);
+        } catch (IOException ioe) {
+            String errorMessage = ioe.getMessage().trim();
+            if (errorMessage != null && !errorMessage.endsWith(NO_ASSOCIATION_ERROR_MESSAGE)) {
+                throw new RuntimeException("Test FAILED! Wrong Error message: \n" +
+                        "Actual " + errorMessage.substring(errorMessage.indexOf("Error message:")) + "\n" +
+                        "Expected " + NO_ASSOCIATION_ERROR_MESSAGE);
+            }
+        } finally {
+            if (file != null) {
+                file.delete();
+            }
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FontClass/HelvLtOblTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8064833
+ * @summary Test correct font is obtained via famil+style
+ * @run main HelvLtOblTest
+ */
+
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.RenderingHints;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.image.BufferedImage;
+
+public class HelvLtOblTest extends JComponent {
+
+    static Font helvFont = null;
+
+    static int[] codes = { 0x23, 0x4a, 0x48, 0x3, 0x4a, 0x55, 0x42, 0x4d,
+                    0x4a, 0x44, 0x3,
+                    0x53, 0x46, 0x45, 0x3, 0x55, 0x46, 0x59, 0x55, };
+
+    static String str = "Big italic red text";
+
+    public static void main(String[] args) throws Exception {
+        String os = System.getProperty("os.name");
+        if (!os.startsWith("Mac")) {
+             return;
+        }
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        Font[] fonts = ge.getAllFonts();
+        for (int i=0; i<fonts.length; i++) {
+            if (fonts[i].getPSName().equals("Helvetica-LightOblique")) {
+                 helvFont = fonts[i];
+                 break;
+            }
+        }
+        if (helvFont == null) {
+            return;
+        }
+        final HelvLtOblTest test = new HelvLtOblTest();
+        SwingUtilities.invokeLater(() -> {
+            JFrame f = new JFrame();
+            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+            f.add("Center", test);
+            f.pack();
+            f.setVisible(true);
+        });
+        test.compareImages();
+    }
+
+    public Dimension getPreferredSize() {
+      return new Dimension(400,400);
+    }
+
+    public void paintComponent(Graphics g) {
+         super.paintComponent(g);
+         Graphics2D g2 = (Graphics2D)g;
+         FontRenderContext frc = new FontRenderContext(null, true, true);
+         Font f = helvFont.deriveFont(Font.PLAIN, 40);
+         System.out.println("font = " +f.getFontName());
+         GlyphVector gv = f.createGlyphVector(frc, codes);
+         g.setFont(f);
+         g.setColor(Color.white);
+         g.fillRect(0,0,400,400);
+         g.setColor(Color.black);
+         g2.drawGlyphVector(gv, 5,200);
+         g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+         g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+                             RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+         g2.drawString(str, 5, 250);
+    }
+
+    void compareImages() {
+         BufferedImage bi0 = drawText(false);
+         BufferedImage bi1 = drawText(true);
+         compare(bi0, bi1);
+    }
+
+    BufferedImage drawText(boolean doGV) {
+        int w = 400;
+        int h = 50;
+        BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = bi.createGraphics();
+        g.setColor(Color.white);
+        g.fillRect(0,0,w,h);
+        g.setColor(Color.black);
+        Font f = helvFont.deriveFont(Font.PLAIN, 40);
+        g.setFont(f);
+        int x = 5;
+        int y = h - 10;
+        if (doGV) {
+            FontRenderContext frc = new FontRenderContext(null, true, true);
+            GlyphVector gv = f.createGlyphVector(frc, codes);
+            g.drawGlyphVector(gv, 5, y);
+       } else {
+           g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                              RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+           g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+                              RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+           g.drawString(str, x, y);
+       }
+       return bi;
+    }
+
+    // Need to allow for minimal rounding error, so allow each component
+    // to differ by 1.
+    void compare(BufferedImage bi0, BufferedImage bi1) {
+        int wid = bi0.getWidth();
+        int hgt = bi0.getHeight();
+        for (int x=0; x<wid; x++) {
+            for (int y=0; y<hgt; y++) {
+                int rgb0 = bi0.getRGB(x, y);
+                int rgb1 = bi1.getRGB(x, y);
+                if (rgb0 == rgb1) continue;
+                int r0 = (rgb0 & 0xff0000) >> 16;
+                int r1 = (rgb1 & 0xff0000) >> 16;
+                int rdiff = r0-r1; if (rdiff<0) rdiff = -rdiff;
+                int g0 = (rgb0 & 0x00ff00) >> 8;
+                int g1 = (rgb1 & 0x00ff00) >> 8;
+                int gdiff = g0-g1; if (gdiff<0) gdiff = -gdiff;
+                int b0 = (rgb0 & 0x0000ff);
+                int b1 = (rgb1 & 0x0000ff);
+                int bdiff = b0-b1; if (bdiff<0) bdiff = -bdiff;
+                if (rdiff > 1 || gdiff > 1 || bdiff > 1) {
+                    throw new RuntimeException(
+                      "Images differ at x=" + x + " y="+ y + " " +
+                      Integer.toHexString(rgb0) + " vs " +
+                      Integer.toHexString(rgb1));
+                }
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FullScreen/NonExistentDisplayModeTest/NonExistentDisplayModeTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.DisplayMode;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.util.ArrayList;
+import java.util.Random;
+
+import static java.awt.DisplayMode.REFRESH_RATE_UNKNOWN;
+
+/**
+ * @test
+ * @bug 6430607
+ * @summary Test that we throw an exception for incorrect display modes
+ * @author Dmitri.Trembovetski@Sun.COM area=FullScreen
+ * @run main/othervm NonExistentDisplayModeTest
+ * @run main/othervm -Dsun.java2d.noddraw=true NonExistentDisplayModeTest
+ * @run main/othervm -Dsun.java2d.opengl=true NonExistentDisplayModeTest
+ */
+public class NonExistentDisplayModeTest {
+
+    public static void main(String[] args) {
+        new NonExistentDisplayModeTest().start();
+    }
+
+    private void start() {
+        Frame f = new Frame("Testing, please wait..");
+        f.pack();
+        GraphicsDevice gd = f.getGraphicsConfiguration().getDevice();
+        if (!gd.isFullScreenSupported()) {
+            System.out.println("Exclusive FS mode not supported, test passed.");
+            f.dispose();
+            return;
+        }
+
+        gd.setFullScreenWindow(f);
+        if (!gd.isDisplayChangeSupported()) {
+            System.out.println("DisplayMode change not supported, test passed.");
+            f.dispose();
+            return;
+        }
+
+        DisplayMode dms[] = gd.getDisplayModes();
+        ArrayList<DisplayMode> dmList = new ArrayList<DisplayMode>(dms.length);
+        for (DisplayMode dm : dms) {
+            dmList.add(dm);
+        }
+
+        ArrayList<DisplayMode> nonExistentDms = createNonExistentDMList(dmList);
+
+        for (DisplayMode dm : nonExistentDms) {
+            boolean exThrown = false;
+            try {
+                System.out.printf("Testing mode: (%4dx%4d) depth=%3d rate=%d\n",
+                                  dm.getWidth(), dm.getHeight(),
+                                  dm.getBitDepth(), dm.getRefreshRate());
+                gd.setDisplayMode(dm);
+            } catch (IllegalArgumentException e) {
+                exThrown = true;
+            }
+            if (!exThrown) {
+                gd.setFullScreenWindow(null);
+                f.dispose();
+                throw new
+                    RuntimeException("Failed: No exception thrown for dm "+dm);
+            }
+        }
+        gd.setFullScreenWindow(null);
+        f.dispose();
+        System.out.println("Test passed.");
+    }
+
+    private static final Random rnd = new Random();
+    private ArrayList<DisplayMode>
+        createNonExistentDMList(ArrayList<DisplayMode> dmList)
+    {
+        ArrayList<DisplayMode> newList =
+            new ArrayList<DisplayMode>(dmList.size());
+        // vary one parameter at a time
+        int param = 0;
+        for (DisplayMode dm : dmList) {
+            param = ++param % 3;
+            switch (param) {
+                case 0: {
+                    DisplayMode newDM = deriveSize(dm);
+                    if (!dmList.contains(newDM)) {
+                        newList.add(newDM);
+                    }
+                    break;
+                }
+                case 1: {
+                    DisplayMode newDM = deriveDepth(dm);
+                    if (!dmList.contains(newDM)) {
+                        newList.add(newDM);
+                    }
+                    break;
+                }
+                case 2: {
+                    if (dm.getRefreshRate() != REFRESH_RATE_UNKNOWN) {
+                        DisplayMode newDM = deriveRR(dm);
+                        if (!dmList.contains(newDM)) {
+                            newList.add(newDM);
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+        return newList;
+    }
+
+    private static DisplayMode deriveSize(DisplayMode dm) {
+        int w = dm.getWidth() / 7;
+        int h = dm.getHeight() / 3;
+        return new DisplayMode(w, h, dm.getBitDepth(), dm.getRefreshRate());
+    }
+    private static DisplayMode deriveRR(DisplayMode dm) {
+        return new DisplayMode(dm.getWidth(), dm.getHeight(),
+                               dm.getBitDepth(), 777);
+    }
+    private static DisplayMode deriveDepth(DisplayMode dm) {
+        int depth;
+        if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) {
+            depth = 77;
+        } else {
+            depth = DisplayMode.BIT_DEPTH_MULTI;
+        }
+        return new DisplayMode(dm.getWidth(), dm.getHeight(),
+                               depth, dm.getRefreshRate());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/MenuBar/RemoveHelpMenu/RemoveHelpMenu.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+
+/**
+ * @test
+ * @bug 6475361
+ * @author Sergey Bylokhov
+ */
+public final class RemoveHelpMenu {
+
+    public static void main(final String[] args) {
+        final Frame frame = new Frame("RemoveHelpMenu Test");
+        try {
+            frame.pack();
+            // peer exists
+            test1(getMenuBar(frame));
+            test2(getMenuBar(frame));
+            test3(getMenuBar(frame));
+            test4(getMenuBar(frame));
+        } finally {
+            frame.dispose();
+        }
+        // peer is null
+        test1(getMenuBar(frame));
+        test2(getMenuBar(frame));
+        test3(getMenuBar(frame));
+        test4(getMenuBar(frame));
+    }
+
+    private static MenuBar getMenuBar(final Frame frame) {
+        final MenuBar menuBar = new MenuBar();
+        frame.setMenuBar(menuBar);
+        return menuBar;
+    }
+
+    private static void checkHelpMenu(final Menu menu, final boolean expected) {
+        final boolean actual = menu.toString().contains("isHelpMenu=true");
+        if (actual != expected) {
+            throw new RuntimeException("Incorrect menu type");
+        }
+    }
+
+    private static void checkMenuCount(final MenuBar bar, final int expected) {
+        final int actual = bar.getMenuCount();
+        if (actual != expected) {
+            throw new RuntimeException("Incorrect menus count");
+        }
+    }
+
+    private static void checkCurrentMenu(final MenuBar bar, final Menu menu) {
+        if (bar.getHelpMenu() != menu) {
+            throw new RuntimeException("Wrong HelpMenu");
+        }
+    }
+
+    private static void test1(final MenuBar menuBar) {
+        checkCurrentMenu(menuBar, null);
+        checkMenuCount(menuBar, 0);
+    }
+
+    private static void test2(final MenuBar menuBar) {
+        final Menu helpMenu = new Menu("Help Menu");
+        menuBar.setHelpMenu(helpMenu);
+        checkCurrentMenu(menuBar, helpMenu);
+        checkMenuCount(menuBar, 1);
+        checkHelpMenu(helpMenu, true);
+
+        menuBar.remove(helpMenu);
+        checkCurrentMenu(menuBar, null);
+        checkMenuCount(menuBar, 0);
+        checkHelpMenu(helpMenu, false);
+    }
+
+    private static void test3(final MenuBar menuBar) {
+        final Menu helpMenu1 = new Menu("Help Menu1");
+        final Menu helpMenu2 = new Menu("Help Menu2");
+        menuBar.setHelpMenu(helpMenu1);
+        checkCurrentMenu(menuBar, helpMenu1);
+        checkMenuCount(menuBar, 1);
+        checkHelpMenu(helpMenu1, true);
+        checkHelpMenu(helpMenu2, false);
+
+        menuBar.setHelpMenu(helpMenu2);
+        checkCurrentMenu(menuBar, helpMenu2);
+        checkMenuCount(menuBar, 1);
+        checkHelpMenu(helpMenu1, false);
+        checkHelpMenu(helpMenu2, true);
+
+        menuBar.remove(helpMenu2);
+        checkCurrentMenu(menuBar, null);
+        checkMenuCount(menuBar, 0);
+        checkHelpMenu(helpMenu1, false);
+        checkHelpMenu(helpMenu2, false);
+    }
+
+    private static void test4(final MenuBar menuBar) {
+        final Menu helpMenu = new Menu("Help Menu");
+        menuBar.setHelpMenu(helpMenu);
+        checkCurrentMenu(menuBar, helpMenu);
+        checkMenuCount(menuBar, 1);
+        checkHelpMenu(helpMenu, true);
+
+        menuBar.setHelpMenu(null);
+        checkCurrentMenu(menuBar, null);
+        checkMenuCount(menuBar, 0);
+        checkHelpMenu(helpMenu, false);
+    }
+}
\ No newline at end of file
--- a/jdk/test/java/awt/Mixing/HWDisappear.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/awt/Mixing/HWDisappear.java	Wed Jul 05 20:20:43 2017 +0200
@@ -40,6 +40,7 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 import test.java.awt.regtesthelpers.Util;
 
 public class HWDisappear
@@ -109,7 +110,7 @@
 
         // Click on the button.
         Point bLoc = b.getLocationOnScreen();
-        robot.mouseMove(bLoc.x + b.getWidth() / 2, bLoc.y + 5);
+        robot.mouseMove(bLoc.x + b.getWidth() / 2, bLoc.y + b.getHeight() / 2);
 
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
@@ -148,8 +149,9 @@
     //  instantiated in the same VM.  Being static (and using
     //  static vars), it aint gonna work.  Not worrying about
     //  it for now.
-    public static void main( String args[] ) throws InterruptedException
+    public static void main( String args[] ) throws Exception
     {
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
         mainThread = Thread.currentThread();
         try
         {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8061636
+ * @summary fix for 7079254 changes behavior of MouseListener, MouseMotionListener
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Alexander Zvegintsev
+ * @run main RemovedComponentMouseListener
+ */
+
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class RemovedComponentMouseListener extends JFrame {
+
+    static boolean mouseReleasedReceived;
+    static JButton button;
+
+    public RemovedComponentMouseListener() {
+        JPanel panel = new JPanel();
+        JPanel buttonPanel = new JPanel();
+        button = new JButton("Button");
+
+        setSize(300, 300);
+
+        buttonPanel.add(button);
+        panel.add(buttonPanel);
+        setContentPane(panel);
+
+        button.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mousePressed(MouseEvent e) {
+                buttonPanel.remove(button);
+                panel.add(button);
+                button.revalidate();
+                button.repaint();
+            }
+
+            @Override
+            public void mouseReleased(MouseEvent e) {
+                mouseReleasedReceived = true;
+            }
+        });
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            new RemovedComponentMouseListener();
+        });
+
+        Robot r = Util.createRobot();
+        r.setAutoDelay(100);
+        r.waitForIdle();
+        Util.pointOnComp(button, r);
+
+        r.waitForIdle();
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.waitForIdle();
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        r.waitForIdle();
+        if (!mouseReleasedReceived) {
+            throw new RuntimeException("mouseReleased event was not received");
+        }
+    }
+}
--- a/jdk/test/java/awt/color/LoadProfileWithSM.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.color.*;
-
-/*
- * @test
- * @bug 8058969
- * @summary test standard profiles loads with SecurityManager installed.
- * @run main/othervm LoadProfileWithSM
- */
-
-public class LoadProfileWithSM {
-
-    public static void main(String[] args) {
-        System.setSecurityManager(new SecurityManager());
-        ICC_Profile profile =
-            ((ICC_ColorSpace)(ColorSpace.getInstance(
-                ColorSpace.CS_GRAY))).getProfile();
-        /* request profile data in order to force profile loading */
-        profile.getData();
-   }
-}
--- a/jdk/test/java/awt/color/LoadStandardProfilesTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8039271
- * @summary test all standard profiles load correctly.
- */
-
-import java.awt.color.ICC_Profile;
-
-public class LoadStandardProfilesTest {
-
-    public static void main(String args[]) {
-        try {
-            ICC_Profile sRGB      = ICC_Profile.getInstance("sRGB.pf");
-            ICC_Profile gray      = ICC_Profile.getInstance("GRAY.pf");
-            ICC_Profile pycc      = ICC_Profile.getInstance("PYCC.pf");
-            ICC_Profile ciexyz    = ICC_Profile.getInstance("CIEXYZ.pf");
-            ICC_Profile linearRGB = ICC_Profile.getInstance("LINEAR_RGB.pf");
-
-            if (sRGB == null ||
-                gray == null ||
-                pycc == null ||
-                ciexyz == null ||
-                linearRGB == null)
-            {
-                throw new RuntimeException("null profile.");
-            }
-        } catch (Exception e) {
-           throw new RuntimeException(e);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+@test
+@bug 8068283
+@summary Checks that <Alt>+Char accelerators work when pressed in a text component
+@author Anton Nashatyrev
+@run main AltCharAcceleratorTest
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class AltCharAcceleratorTest {
+
+    boolean action1 = false;
+    boolean action2 = false;
+
+    CountDownLatch focusLatch = new CountDownLatch(1);
+    CountDownLatch actionLatch = new CountDownLatch(2);
+
+    public AltCharAcceleratorTest() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                JFrame f = new JFrame("frame");
+                final JTextField t = new JTextField();
+                JMenuBar mb = new JMenuBar();
+                JMenu m1 = new JMenu("File");
+                JMenuItem i1 = new JMenuItem("Save");
+                JMenuItem i2 = new JMenuItem("Load");
+
+                i1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.ALT_MASK));
+                i2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.ALT_MASK));
+
+                i1.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        System.out.println("Action1!");
+                        action1 = true;
+                        actionLatch.countDown();
+                    }
+                });
+
+                i2.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        System.out.println("Action2!");
+                        action2 = true;
+                        actionLatch.countDown();
+                    }
+                });
+
+                t.addFocusListener(new FocusAdapter() {
+                    @Override
+                    public void focusGained(FocusEvent e) {
+                        System.out.println("Focused!");
+                        focusLatch.countDown();
+                    }
+                });
+
+                t.setColumns(10);
+                t.requestFocusInWindow();
+
+                f.setJMenuBar(mb);
+                mb.add(m1);
+                m1.add(i1);
+                m1.add(i2);
+
+                f.setLayout(new FlowLayout());
+                f.add(t);
+                f.setSize(200, 200);
+
+                f.setVisible(true);
+            }
+        });
+    }
+
+    void test() throws Exception {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+
+        focusLatch.await(5, TimeUnit.SECONDS);
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(100);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_T);
+        robot.keyRelease(KeyEvent.VK_T);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_F);
+        robot.keyRelease(KeyEvent.VK_F);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        actionLatch.await(5, TimeUnit.SECONDS);
+
+        if (!action1 || !action2) {
+            throw new RuntimeException("Actions not performed");
+        }
+
+        System.out.println("Passed.");
+    }
+
+    public static void main(String[] args) throws Exception {
+        AltCharAcceleratorTest t = new AltCharAcceleratorTest();
+        t.test();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/BufferedImage/GetPropertyNames.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.util.Properties;
+
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+
+/**
+ * @test
+ * @bug 8066132
+ * @author Sergey Bylokhov
+ */
+public final class GetPropertyNames {
+
+    static BufferedImage defaultProps = new BufferedImage(1, 1, TYPE_INT_ARGB);
+
+    public static void main(final String[] args) {
+        // default result is null
+        if (defaultProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for null properties result is null
+        final BufferedImage emptyProps = getBufferedImage(null);
+        if (emptyProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for empty properties result is null
+        final BufferedImage nullProps = getBufferedImage(new Properties());
+        if (nullProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for non-string keys result is null
+        final Properties properties = new Properties();
+        properties.put(1, 1);
+        properties.put(2, 2);
+        properties.put(3, 3);
+        final BufferedImage nonStringProps = getBufferedImage(properties);
+        if (nonStringProps.getPropertyNames() != null) {
+            throw new RuntimeException("PropertyNames should be null");
+        }
+        // for string keys result is not null
+        properties.clear();
+        properties.setProperty("1", "1");
+        properties.setProperty("2", "2");
+        validate(getBufferedImage(properties), 2);
+        // for the mix of strings and objects result is not null
+        properties.clear();
+        properties.put(1, 1);
+        properties.put(2, 2);
+        properties.put(3, 3);
+        properties.setProperty("key1", "value1");
+        properties.setProperty("key2", "value2");
+        final BufferedImage mixProps = getBufferedImage(properties);
+        validate(mixProps, 2);
+        if (!"value1".equals(mixProps.getProperty("key1"))
+            || !"value2".equals(mixProps.getProperty("key2"))) {
+            throw new RuntimeException("Wrong key-value pair");
+        }
+    }
+
+
+    private static BufferedImage getBufferedImage(final Properties properties) {
+        return new BufferedImage(defaultProps.getColorModel(),
+                                 defaultProps.getRaster(),
+                                 defaultProps.isAlphaPremultiplied(),
+                                 properties);
+    }
+
+    private static void validate(final BufferedImage bi, final int expected) {
+        final String[] names = bi.getPropertyNames();
+        if (names.length != expected) {
+            throw new RuntimeException("Wrong number of names");
+        }
+        for (final String name : names) {
+            final Object property = bi.getProperty(name);
+            if (property == Image.UndefinedProperty || property == null) {
+                throw new RuntimeException("Unexpected property");
+            }
+        }
+    }
+}
--- a/jdk/test/java/beans/Introspector/7064279/Test7064279.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/beans/Introspector/7064279/Test7064279.java	Wed Jul 05 20:20:43 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 7064279
  * @summary Tests that Introspector does not have strong references to context class loader
  * @author Sergey Malenkov
+ * @run main/othervm -Xmx128m Test7064279
  */
 
 import java.beans.Introspector;
--- a/jdk/test/java/beans/Introspector/Test7172865.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/beans/Introspector/Test7172865.java	Wed Jul 05 20:20:43 2017 +0200
@@ -30,6 +30,7 @@
  * @bug 7172854 7172865
  * @summary Tests that cached methods are not lost
  * @author Sergey Malenkov
+ * @run main/othervm -Xmx128m Test7172865
  */
 
 public class Test7172865 {
--- a/jdk/test/java/beans/Introspector/Test7195106.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/beans/Introspector/Test7195106.java	Wed Jul 05 20:20:43 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 7195106
  * @summary Tests that explicit BeanInfo is not collected
  * @author Sergey Malenkov
+ * @run main/othervm -Xmx128m Test7195106
  */
 
 import java.awt.Image;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LambdaStackTrace.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025636
+ * @summary Synthetic frames should be hidden in exceptions
+ * @compile -XDignore.symbol.file LUtils.java LambdaStackTrace.java
+ * @run main LambdaStackTrace
+ */
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_ABSTRACT;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_INTERFACE;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
+
+public class LambdaStackTrace {
+
+    static File classes = new File(System.getProperty("test.classes"));
+
+    public static void main(String[] args) throws Exception {
+        testBasic();
+        testBridgeMethods();
+    }
+
+    /**
+     * Test the simple case
+     */
+    private static void testBasic() throws Exception {
+        try {
+            Runnable r = () -> {
+                throw new RuntimeException();
+            };
+            r.run();
+        } catch (Exception ex) {
+            // Before 8025636 the stacktrace would look like:
+            //  at LambdaStackTrace.lambda$main$0(LambdaStackTrace.java:37)
+            //  at LambdaStackTrace$$Lambda$1/1937396743.run(<Unknown>:1000000)
+            //  at LambdaStackTrace.testBasic(LambdaStackTrace.java:40)
+            //  at ...
+            //
+            // We are verifying that the middle frame above is gone.
+
+            verifyFrames(ex.getStackTrace(),
+                    "LambdaStackTrace\\..*",
+                    "LambdaStackTrace.testBasic");
+        }
+    }
+
+    /**
+     * Test the more complicated case with bridge methods.
+     *
+     * We set up the following interfaces:
+     *
+     * interface Maker {
+     *   Object make();
+     * }
+     * interface StringMaker extends Maker {
+     *   String make();
+     * }
+     *
+     * And we will use them like so:
+     *
+     * StringMaker sm = () -> { throw new RuntimeException(); };
+     * sm.make();
+     * ((Maker)m).make();
+     *
+     * The first call is a "normal" interface call, the second will use a
+     * bridge method. In both cases the generated lambda frame should
+     * be removed from the stack trace.
+     */
+    private static void testBridgeMethods() throws Exception {
+        // setup
+        generateInterfaces();
+        compileCaller();
+
+        // test
+        StackTraceElement[] frames = call("Caller", "callStringMaker");
+        verifyFrames(frames,
+                "Caller\\..*",
+                "Caller.callStringMaker");
+
+        frames = call("Caller", "callMaker");
+        verifyFrames(frames,
+                "Caller\\..*",
+                "Caller.callMaker");
+    }
+
+    private static void generateInterfaces() throws IOException {
+        // We can't let javac compile these interfaces because in > 1.8 it will insert
+        // bridge methods into the interfaces - we want code that looks like <= 1.7,
+        // so we generate it.
+        try (FileOutputStream fw = new FileOutputStream(new File(classes, "Maker.class"))) {
+            fw.write(generateMaker());
+        }
+        try (FileOutputStream fw = new FileOutputStream(new File(classes, "StringMaker.class"))) {
+            fw.write(generateStringMaker());
+        }
+    }
+
+    private static byte[] generateMaker() {
+        // interface Maker {
+        //   Object make();
+        // }
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(V1_7, ACC_INTERFACE | ACC_ABSTRACT, "Maker", null, "java/lang/Object", null);
+        cw.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, "make",
+                "()Ljava/lang/Object;", null, null);
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    private static byte[] generateStringMaker() {
+        // interface StringMaker extends Maker {
+        //   String make();
+        // }
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(V1_7, ACC_INTERFACE | ACC_ABSTRACT, "StringMaker", null, "java/lang/Object", new String[]{"Maker"});
+        cw.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, "make",
+                "()Ljava/lang/String;", null, null);
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+
+    static void emitCode(File f) {
+        ArrayList<String> scratch = new ArrayList<>();
+        scratch.add("public class Caller {");
+        scratch.add("    public static void callStringMaker() {");
+        scratch.add("        StringMaker sm = () -> { throw new RuntimeException(); };");
+        scratch.add("        sm.make();");
+        scratch.add("    }");
+        scratch.add("    public static void callMaker() {");
+        scratch.add("        StringMaker sm = () -> { throw new RuntimeException(); };");
+        scratch.add("        ((Maker) sm).make();");  // <-- This will call the bridge method
+        scratch.add("    }");
+        scratch.add("}");
+        LUtils.createFile(f, scratch);
+    }
+
+    static void compileCaller() {
+        File caller = new File(classes, "Caller.java");
+        emitCode(caller);
+        LUtils.compile("-cp", classes.getAbsolutePath(), "-d", classes.getAbsolutePath(), caller.getAbsolutePath());
+    }
+
+    private static void verifyFrames(StackTraceElement[] stack, String... patterns) throws Exception {
+        for (int i = 0; i < patterns.length; i++) {
+            String cm = stack[i].getClassName() + "." + stack[i].getMethodName();
+            if (!cm.matches(patterns[i])) {
+                System.err.println("Actual trace did not match expected trace at frame " + i);
+                System.err.println("Expected frame patterns:");
+                for (int j = 0; j < patterns.length; j++) {
+                    System.err.println("  " + j + ": " + patterns[j]);
+                }
+                System.err.println("Actual frames:");
+                for (int j = 0; j < patterns.length; j++) {
+                    System.err.println("  " + j + ": " + stack[j]);
+                }
+                throw new Exception("Incorrect stack frames found");
+            }
+        }
+    }
+
+    private static StackTraceElement[] call(String clazz, String method) throws Exception {
+        Class<?> c = Class.forName(clazz);
+        try {
+            Method m = c.getDeclaredMethod(method);
+            m.invoke(null);
+        } catch(InvocationTargetException ex) {
+            return ex.getTargetException().getStackTrace();
+        }
+        throw new Exception("Expected exception to be thrown");
+    }
+}
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -32,8 +32,7 @@
  *
  * @library /lib/testlibrary/
  * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
- * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
- * @run main/timeout=600 LowMemoryTest
+  * @run main/timeout=600 LowMemoryTest
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
@@ -116,14 +115,13 @@
             triggers++;
         }
         public void checkResult() throws Exception {
-            if ((!isRelaxed && triggers != NUM_TRIGGERS) ||
-                (isRelaxed && triggers < NUM_TRIGGERS)) {
+            if (!checkValue(triggers, NUM_TRIGGERS)) {
                 throw new RuntimeException("Unexpected number of triggers = " +
                     triggers + " but expected to be " + NUM_TRIGGERS);
             }
 
             for (int i = 0; i < triggers; i++) {
-                if (count[i] != i+1) {
+                if (!checkValue(count[i], i + 1)) {
                     throw new RuntimeException("Unexpected count of" +
                         " notification #" + i +
                         " count = " + count[i] +
@@ -136,6 +134,18 @@
                 }
             }
         }
+
+        private boolean checkValue(int value, int target) {
+            return checkValue((long)value, target);
+        }
+
+        private boolean checkValue(long value, int target) {
+            if (!isRelaxed) {
+                return value == target;
+            } else {
+                return value >= target;
+            }
+        }
     }
 
     private static long newThreshold;
--- a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java	Wed Jul 05 20:20:43 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4227192 8004928
+ * @bug 4227192 8004928 8072656
  * @summary This is a test of the restrictions on the parameters that may
  * be passed to the Proxy.getProxyClass method.
  * @author Peter Jones
@@ -31,9 +31,12 @@
  * @run main ClassRestrictions
  */
 
+import java.io.File;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
 import java.net.URLClassLoader;
+import java.net.URL;
+import java.nio.file.Paths;
 
 public class ClassRestrictions {
 
@@ -105,8 +108,13 @@
              * All of the interfaces types must be visible by name though the
              * specified class loader.
              */
-            ClassLoader altLoader = new URLClassLoader(
-                ((URLClassLoader) loader).getURLs(), null);
+            String[] cpaths = System.getProperty("test.classes", ".")
+                                    .split(File.pathSeparator);
+            URL[] urls = new URL[cpaths.length];
+            for (int i=0; i < cpaths.length; i++) {
+                urls[i] = Paths.get(cpaths[i]).toUri().toURL();
+            }
+            ClassLoader altLoader = new URLClassLoader(urls, null);
             Class altBarClass;
             altBarClass = Class.forName(Bar.class.getName(), false, altLoader);
             try {
--- a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -65,11 +65,17 @@
         charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022"));
         charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_GB"));
         charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_CNS"));
-        charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_Solaris"));
         charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_MS932"));
         charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_MS5022X"));
-        charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_Solaris"));
         charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_MS5022X"));
+        try {
+            charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0208_Solaris"));
+            charsets.remove(Class.forName("sun.nio.cs.ext.JIS_X_0212_Solaris"));
+        } catch (ClassNotFoundException x) {
+            // these two might be moved into stdcs
+            charsets.remove(Class.forName("sun.nio.cs.JIS_X_0208_Solaris"));
+            charsets.remove(Class.forName("sun.nio.cs.JIS_X_0212_Solaris"));
+        }
 
         // report the charsets that are implemented but not available
         iter = charsets.iterator();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/ProtectionDomain/PreserveCombinerTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.DomainCombiner;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import sun.misc.SharedSecrets;
+
+/*
+ * @test
+ * @bug 8064331
+ * @summary Make sure that JavaSecurityAccess.doIntersectionPrivilege()
+ *          is not dropping the information about the domain combiner of
+ *          the stack ACC
+ */
+
+public class PreserveCombinerTest {
+    public static void main(String[]args) throws Exception {
+        final DomainCombiner dc = new DomainCombiner() {
+            @Override
+            public ProtectionDomain[] combine(ProtectionDomain[] currentDomains, ProtectionDomain[] assignedDomains) {
+                return currentDomains; // basically a no-op
+            }
+        };
+
+        // Get an instance of the saved ACC
+        AccessControlContext saved = AccessController.getContext();
+        // Simulate the stack ACC with a DomainCombiner attached
+        AccessControlContext stack = new AccessControlContext(AccessController.getContext(), dc);
+
+        // Now try to run JavaSecurityAccess.doIntersectionPrivilege() and assert
+        // whether the DomainCombiner from the stack ACC is preserved
+        boolean ret = SharedSecrets.getJavaSecurityAccess().doIntersectionPrivilege(new PrivilegedAction<Boolean>() {
+            @Override
+            public Boolean run() {
+                return dc == AccessController.getContext().getDomainCombiner();
+            }
+        }, stack, saved);
+
+        if (!ret) {
+            System.exit(1);
+        }
+    }
+}
+
--- a/jdk/test/java/util/Arrays/TimSortStackSize2.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/Arrays/TimSortStackSize2.java	Wed Jul 05 20:20:43 2017 +0200
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 8072909
- * @run main/othervm TimSortStackSize2 67108864
+ * @run main/othervm -Xmx385m TimSortStackSize2 67108864
  * not for regular execution on all platforms:
  * run main/othervm -Xmx8g TimSortStackSize2 1073741824
- * run main/othervm -Xmx32g TimSortStackSize2 2147483644
+ * run main/othervm -Xmx16g TimSortStackSize2 2147483644
  * @summary Test TimSort stack size on big arrays
  */
 import java.util.ArrayList;
@@ -41,22 +41,30 @@
         int lengthOfTest = Integer.parseInt(args[0]);
         boolean passed = true;
         try {
-            Arrays.sort(new TimSortStackSize2(lengthOfTest).createArray(),
-                new Comparator<Object>() {
+            Integer [] a = new TimSortStackSize2(lengthOfTest).createArray();
+            long begin = System.nanoTime();
+            Arrays.sort(a, new Comparator<Object>() {
                     @SuppressWarnings("unchecked")
                     public int compare(Object first, Object second) {
                         return ((Comparable<Object>)first).compareTo(second);
                     }
                 });
-            System.out.println("TimSort OK");
+            long end = System.nanoTime();
+            System.out.println("TimSort: " + (end - begin));
+            a = null;
         } catch (ArrayIndexOutOfBoundsException e){
-            System.out.println("TimSort broken");
+            System.out.println("TimSort broken:");
             e.printStackTrace();
             passed = false;
         }
+
         try {
-            Arrays.sort(new TimSortStackSize2(lengthOfTest).createArray());
-            System.out.println("ComparableTimSort OK");
+            Integer [] a = new TimSortStackSize2(lengthOfTest).createArray();
+            long begin = System.nanoTime();
+            Arrays.sort(a);
+            long end = System.nanoTime();
+            System.out.println("ComparableTimSort: " + (end - begin));
+            a = null;
         } catch (ArrayIndexOutOfBoundsException e){
             System.out.println("ComparableTimSort broken:");
             e.printStackTrace();
--- a/jdk/test/java/util/Optional/Basic.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/Optional/Basic.java	Wed Jul 05 20:20:43 2017 +0200
@@ -27,8 +27,12 @@
  * @run testng Basic
  */
 
+import java.lang.AssertionError;
+import java.lang.NullPointerException;
+import java.lang.Throwable;
 import java.util.NoSuchElementException;
 import java.util.Optional;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Stream;
 
 import static org.testng.Assert.*;
@@ -51,7 +55,23 @@
         assertTrue(!empty.toString().isEmpty());
         assertTrue(!empty.toString().equals(presentEmptyString.toString()));
         assertTrue(!empty.isPresent());
-        empty.ifPresent(v -> { fail(); });
+
+        empty.ifPresent(v -> fail());
+
+        AtomicBoolean emptyCheck = new AtomicBoolean();
+        empty.ifPresentOrElse(v -> fail(), () -> emptyCheck.set(true));
+        assertTrue(emptyCheck.get());
+
+        try {
+            empty.ifPresentOrElse(v -> fail(), () -> { throw new ObscureException(); });
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+
         assertSame(null, empty.orElse(null));
         RuntimeException orElse = new RuntimeException() { };
         assertSame(Boolean.FALSE, empty.orElse(Boolean.FALSE));
@@ -59,6 +79,31 @@
         assertSame(Boolean.FALSE, empty.orElseGet(() -> Boolean.FALSE));
     }
 
+    @Test(groups = "unit")
+    public void testIfPresentAndOrElseAndNull() {
+        Optional<Boolean> empty = Optional.empty();
+        Optional<Boolean> present = Optional.of(Boolean.TRUE);
+
+        // No NPE
+        present.ifPresentOrElse(v -> {}, null);
+        empty.ifPresent(null);
+        empty.ifPresentOrElse(null, () -> {});
+
+        // NPE
+        try {
+            present.ifPresent(null);
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            present.ifPresentOrElse(null, () -> {});
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            empty.ifPresentOrElse(v -> {}, null);
+            fail();
+        } catch (NullPointerException ex) {}
+    }
+
     @Test(expectedExceptions=NoSuchElementException.class)
     public void testEmptyGet() {
         Optional<Boolean> empty = Optional.empty();
@@ -102,12 +147,33 @@
         assertTrue(!present.toString().equals(presentEmptyString.toString()));
         assertTrue(-1 != present.toString().indexOf(Boolean.TRUE.toString()));
         assertSame(Boolean.TRUE, present.get());
+
+        AtomicBoolean presentCheck = new AtomicBoolean();
+        present.ifPresent(v -> presentCheck.set(true));
+        assertTrue(presentCheck.get());
+        presentCheck.set(false);
+        present.ifPresentOrElse(v -> presentCheck.set(true), () -> fail());
+        assertTrue(presentCheck.get());
+
         try {
             present.ifPresent(v -> { throw new ObscureException(); });
             fail();
         } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+        try {
+            present.ifPresentOrElse(v -> { throw new ObscureException(); }, () -> fail());
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
 
-        }
         assertSame(Boolean.TRUE, present.orElse(null));
         assertSame(Boolean.TRUE, present.orElse(Boolean.FALSE));
         assertSame(Boolean.TRUE, present.orElseGet(null));
--- a/jdk/test/java/util/Optional/BasicDouble.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicDouble.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalDouble;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.DoubleStream;
 
 import static org.testng.Assert.*;
@@ -49,41 +50,82 @@
         assertTrue(0 == empty.hashCode());
         assertTrue(!empty.toString().isEmpty());
         assertTrue(!empty.isPresent());
+
         empty.ifPresent(v -> { fail(); });
+
+        AtomicBoolean emptyCheck = new AtomicBoolean();
+        empty.ifPresentOrElse(v -> fail(), () -> emptyCheck.set(true));
+        assertTrue(emptyCheck.get());
+
+        try {
+            empty.ifPresentOrElse(v -> fail(), () -> { throw new ObscureException(); });
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+
         assertEquals(2.0, empty.orElse(2.0));
         assertEquals(2.0, empty.orElseGet(()-> 2.0));
     }
 
-        @Test(expectedExceptions=NoSuchElementException.class)
-        public void testEmptyGet() {
-            OptionalDouble empty = OptionalDouble.empty();
+    @Test(groups = "unit")
+    public void testIfPresentAndOrElseAndNull() {
+        OptionalDouble empty = OptionalDouble.empty();
+        OptionalDouble present = OptionalDouble.of(1.0);
 
-            double got = empty.getAsDouble();
-        }
+        // No NPE
+        present.ifPresentOrElse(v -> {}, null);
+        empty.ifPresent(null);
+        empty.ifPresentOrElse(null, () -> {});
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseGetNull() {
-            OptionalDouble empty = OptionalDouble.empty();
-
-            double got = empty.orElseGet(null);
-        }
+        // NPE
+        try {
+            present.ifPresent(null);
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            present.ifPresentOrElse(null, () -> {});
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            empty.ifPresentOrElse(v -> {}, null);
+            fail();
+        } catch (NullPointerException ex) {}
+    }
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseThrowNull() throws Throwable {
-            OptionalDouble empty = OptionalDouble.empty();
+    @Test(expectedExceptions=NoSuchElementException.class)
+    public void testEmptyGet() {
+        OptionalDouble empty = OptionalDouble.empty();
+
+        double got = empty.getAsDouble();
+    }
 
-            double got = empty.orElseThrow(null);
-        }
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseGetNull() {
+        OptionalDouble empty = OptionalDouble.empty();
+
+        double got = empty.orElseGet(null);
+    }
 
-        @Test(expectedExceptions=ObscureException.class)
-        public void testEmptyOrElseThrow() throws Exception {
-            OptionalDouble empty = OptionalDouble.empty();
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseThrowNull() throws Throwable {
+        OptionalDouble empty = OptionalDouble.empty();
+
+        double got = empty.orElseThrow(null);
+    }
 
-            double got = empty.orElseThrow(ObscureException::new);
-        }
+    @Test(expectedExceptions=ObscureException.class)
+    public void testEmptyOrElseThrow() throws Exception {
+        OptionalDouble empty = OptionalDouble.empty();
 
-        @Test(groups = "unit")
-        public void testPresent() {
+        double got = empty.orElseThrow(ObscureException::new);
+    }
+
+    @Test(groups = "unit")
+    public void testPresent() {
         OptionalDouble empty = OptionalDouble.empty();
         OptionalDouble present = OptionalDouble.of(1.0);
 
@@ -96,12 +138,33 @@
         assertFalse(present.toString().isEmpty());
         assertTrue(-1 != present.toString().indexOf(Double.toString(present.getAsDouble()).toString()));
         assertEquals(1.0, present.getAsDouble());
+
+        AtomicBoolean presentCheck = new AtomicBoolean();
+        present.ifPresent(v -> presentCheck.set(true));
+        assertTrue(presentCheck.get());
+        presentCheck.set(false);
+        present.ifPresentOrElse(v -> presentCheck.set(true), () -> fail());
+        assertTrue(presentCheck.get());
+
         try {
             present.ifPresent(v -> { throw new ObscureException(); });
             fail();
-        } catch(ObscureException expected) {
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+        try {
+            present.ifPresentOrElse(v -> { throw new ObscureException(); }, () -> fail());
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
 
-        }
         assertEquals(1.0, present.orElse(2.0));
         assertEquals(1.0, present.orElseGet(null));
         assertEquals(1.0, present.orElseGet(()-> 2.0));
--- a/jdk/test/java/util/Optional/BasicInt.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicInt.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalInt;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.IntStream;
 
 import static org.testng.Assert.*;
@@ -49,11 +50,52 @@
         assertTrue(0 == empty.hashCode());
         assertTrue(!empty.toString().isEmpty());
         assertTrue(!empty.isPresent());
+
         empty.ifPresent(v -> { fail(); });
+
+        AtomicBoolean emptyCheck = new AtomicBoolean();
+        empty.ifPresentOrElse(v -> fail(), () -> emptyCheck.set(true));
+        assertTrue(emptyCheck.get());
+
+        try {
+            empty.ifPresentOrElse(v -> fail(), () -> { throw new ObscureException(); });
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+
         assertEquals(2, empty.orElse(2));
         assertEquals(2, empty.orElseGet(()-> 2));
     }
 
+    @Test(groups = "unit")
+    public void testIfPresentAndOrElseAndNull() {
+        OptionalInt empty = OptionalInt.empty();
+        OptionalInt present = OptionalInt.of(1);
+
+        // No NPE
+        present.ifPresentOrElse(v -> {}, null);
+        empty.ifPresent(null);
+        empty.ifPresentOrElse(null, () -> {});
+
+        // NPE
+        try {
+            present.ifPresent(null);
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            present.ifPresentOrElse(null, () -> {});
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            empty.ifPresentOrElse(v -> {}, null);
+            fail();
+        } catch (NullPointerException ex) {}
+    }
+
     @Test(expectedExceptions=NoSuchElementException.class)
     public void testEmptyGet() {
         OptionalInt empty = OptionalInt.empty();
@@ -96,12 +138,33 @@
         assertFalse(present.toString().isEmpty());
         assertTrue(-1 != present.toString().indexOf(Integer.toString(present.getAsInt()).toString()));
         assertEquals(1, present.getAsInt());
+
+        AtomicBoolean presentCheck = new AtomicBoolean();
+        present.ifPresent(v -> presentCheck.set(true));
+        assertTrue(presentCheck.get());
+        presentCheck.set(false);
+        present.ifPresentOrElse(v -> presentCheck.set(true), () -> fail());
+        assertTrue(presentCheck.get());
+
         try {
             present.ifPresent(v -> { throw new ObscureException(); });
             fail();
-        } catch(ObscureException expected) {
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+        try {
+            present.ifPresentOrElse(v -> { throw new ObscureException(); }, () -> fail());
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
 
-        }
         assertEquals(1, present.orElse(2));
         assertEquals(1, present.orElseGet(null));
         assertEquals(1, present.orElseGet(()-> 2));
--- a/jdk/test/java/util/Optional/BasicLong.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/Optional/BasicLong.java	Wed Jul 05 20:20:43 2017 +0200
@@ -29,6 +29,7 @@
 
 import java.util.NoSuchElementException;
 import java.util.OptionalLong;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.LongStream;
 
 import static org.testng.Assert.*;
@@ -49,41 +50,82 @@
         assertTrue(0 == empty.hashCode());
         assertTrue(!empty.toString().isEmpty());
         assertTrue(!empty.isPresent());
+
         empty.ifPresent(v -> { fail(); });
+
+        AtomicBoolean emptyCheck = new AtomicBoolean();
+        empty.ifPresentOrElse(v -> fail(), () -> emptyCheck.set(true));
+        assertTrue(emptyCheck.get());
+
+        try {
+            empty.ifPresentOrElse(v -> fail(), () -> { throw new ObscureException(); });
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+
         assertEquals(2, empty.orElse(2));
         assertEquals(2, empty.orElseGet(()-> 2));
     }
 
-        @Test(expectedExceptions=NoSuchElementException.class)
-        public void testEmptyGet() {
-            OptionalLong empty = OptionalLong.empty();
+    @Test(groups = "unit")
+    public void testIfPresentAndOrElseAndNull() {
+        OptionalLong empty = OptionalLong.empty();
+        OptionalLong present = OptionalLong.of(1);
 
-            long got = empty.getAsLong();
-        }
+        // No NPE
+        present.ifPresentOrElse(v -> {}, null);
+        empty.ifPresent(null);
+        empty.ifPresentOrElse(null, () -> {});
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseGetNull() {
-            OptionalLong empty = OptionalLong.empty();
-
-            long got = empty.orElseGet(null);
-        }
+        // NPE
+        try {
+            present.ifPresent(null);
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            present.ifPresentOrElse(null, () -> {});
+            fail();
+        } catch (NullPointerException ex) {}
+        try {
+            empty.ifPresentOrElse(v -> {}, null);
+            fail();
+        } catch (NullPointerException ex) {}
+    }
 
-        @Test(expectedExceptions=NullPointerException.class)
-        public void testEmptyOrElseThrowNull() throws Throwable {
-            OptionalLong empty = OptionalLong.empty();
+    @Test(expectedExceptions=NoSuchElementException.class)
+    public void testEmptyGet() {
+        OptionalLong empty = OptionalLong.empty();
+
+        long got = empty.getAsLong();
+    }
 
-            long got = empty.orElseThrow(null);
-        }
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseGetNull() {
+        OptionalLong empty = OptionalLong.empty();
+
+        long got = empty.orElseGet(null);
+    }
 
-        @Test(expectedExceptions=ObscureException.class)
-        public void testEmptyOrElseThrow() throws Exception {
-            OptionalLong empty = OptionalLong.empty();
+    @Test(expectedExceptions=NullPointerException.class)
+    public void testEmptyOrElseThrowNull() throws Throwable {
+        OptionalLong empty = OptionalLong.empty();
+
+        long got = empty.orElseThrow(null);
+    }
 
-            long got = empty.orElseThrow(ObscureException::new);
-        }
+    @Test(expectedExceptions=ObscureException.class)
+    public void testEmptyOrElseThrow() throws Exception {
+        OptionalLong empty = OptionalLong.empty();
 
-        @Test(groups = "unit")
-        public void testPresent() {
+        long got = empty.orElseThrow(ObscureException::new);
+    }
+
+    @Test(groups = "unit")
+    public void testPresent() {
         OptionalLong empty = OptionalLong.empty();
         OptionalLong present = OptionalLong.of(1L);
 
@@ -96,12 +138,35 @@
         assertFalse(present.toString().isEmpty());
         assertTrue(-1 != present.toString().indexOf(Long.toString(present.getAsLong()).toString()));
         assertEquals(1L, present.getAsLong());
+
+        AtomicBoolean presentCheck = new AtomicBoolean();
+        present.ifPresent(v -> presentCheck.set(true));
+        assertTrue(presentCheck.get());
+        presentCheck.set(false);
+        present.ifPresentOrElse(v -> presentCheck.set(true), () -> fail());
+        assertTrue(presentCheck.get());
+
         try {
             present.ifPresent(v -> { throw new ObscureException(); });
             fail();
-        } catch(ObscureException expected) {
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
+        try {
+            present.ifPresentOrElse(v -> {
+                throw new ObscureException();
+            }, () -> fail());
+            fail();
+        } catch (ObscureException expected) {
+        } catch (AssertionError e) {
+            throw e;
+        } catch (Throwable t) {
+            fail();
+        }
 
-        }
         assertEquals(1, present.orElse(2));
         assertEquals(1, present.orElseGet(null));
         assertEquals(1, present.orElseGet(()-> 2));
--- a/jdk/test/java/util/regex/PatternStreamTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/java/util/regex/PatternStreamTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -114,9 +114,20 @@
         data.add(new Object[]{description, input, pattern, expected});
 
 
+        description = "Empty input";
         input = "";
         pattern = Pattern.compile("\u56da");
         expected = new ArrayList<>();
+        expected.add("");
+
+        data.add(new Object[]{description, input, pattern, expected});
+
+
+        description = "Empty input with empty pattern";
+        input = "";
+        pattern = Pattern.compile("");
+        expected = new ArrayList<>();
+        expected.add("");
 
         data.add(new Object[]{description, input, pattern, expected});
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/jpeg/MagentaEXIFTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     8071707 6243376
+ * @summary Test verifies that EXIF images with differing sampling factors
+ *          are written correctly
+ *
+ * @run     main MagentaEXIFTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
+import javax.imageio.metadata.IIOInvalidTreeException;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.metadata.IIOMetadataNode;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.ImageOutputStream;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+public class MagentaEXIFTest {
+
+    public static void main(final String[] argv) throws Exception {
+
+        IIOMetadata jpegmetadata = null;
+        ImageWriter jpgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
+        try {
+        jpegmetadata = createJPEGMetadata(jpgWriter);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ImageOutputStream output = ImageIO.createImageOutputStream(baos);
+        jpgWriter.setOutput(output);
+        int w=100, h=100;
+        BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = bi.createGraphics();
+        g2d.setColor(Color.white);
+        g2d.fillRect(0, 0, w, h);
+        IIOImage image = new IIOImage(bi, null, jpegmetadata);
+        jpgWriter.write(null, image, null);
+        jpgWriter.dispose();
+
+        baos.flush();
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        ImageInputStream iis = ImageIO.createImageInputStream(bais);
+        bi = ImageIO.read(iis);
+        for (int i=0; i<bi.getWidth(); i++) {
+            for(int j=0; j<bi.getHeight(); j++) {
+               if (bi.getRGB(i, j) != Color.white.getRGB()) {
+                   throw new RuntimeException("Wrong color : " + Integer.toHexString(bi.getRGB(i, j)));
+               }
+            }
+        }
+
+    }
+
+
+    static void displayMetadata(Node node, int level) {
+        for (int i = 0; i < level; i++) System.out.print("  ");
+        System.out.print("<" + node.getNodeName());
+        NamedNodeMap map = node.getAttributes();
+        if (map != null) { // print attribute values
+            int length = map.getLength();
+            for (int i = 0; i < length; i++) {
+                Node attr = map.item(i);
+                System.out.print(" " + attr.getNodeName() +
+                                 "=\"" + attr.getNodeValue() + "\"");
+            }
+        }
+
+        Node child = node.getFirstChild();
+        if (child != null) {
+            System.out.println(">"); // close current tag
+            while (child != null) { // emit child tags recursively
+                displayMetadata(child, level + 1);
+                child = child.getNextSibling();
+            }
+            for (int i = 0; i < level; i++) System.out.print("  ");
+            System.out.println("</" + node.getNodeName() + ">");
+        } else {
+            System.out.println("/>");
+        }
+    }
+
+    /*
+     * Construct a JPEG IIOMetadata that has had the JFIF marker removed and
+     * an APP1 EXIF marker added, and further massaged so that we have differing
+     * horizontal and vertical sampling factors for one channel.
+     */
+    static IIOMetadata createJPEGMetadata(ImageWriter iw) throws IIOInvalidTreeException {
+        String jpegMDName = "javax_imageio_jpeg_image_1.0";
+        ImageWriter imgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
+        BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
+        ImageTypeSpecifier ist = new ImageTypeSpecifier(bi);
+        IIOMetadata metadata = imgWriter.getDefaultImageMetadata(ist, null);
+
+        IIOMetadataNode root = new IIOMetadataNode(jpegMDName);
+        IIOMetadataNode header = new IIOMetadataNode("JPEGvariety");
+        IIOMetadataNode sequence = new IIOMetadataNode("markerSequence");
+
+        root.appendChild(header);
+        root.appendChild(sequence);
+
+        IIOMetadataNode app1 = new IIOMetadataNode("unknown");
+        app1.setUserObject(new byte[255]);
+        app1.setAttribute("MarkerTag", "255");
+        sequence.appendChild(app1);
+
+        IIOMetadataNode sof = new IIOMetadataNode("sof");
+        sof.setAttribute("process", "0");
+        sof.setAttribute("samplePrecision", "8");
+        sof.setAttribute("numLines", "100");
+        sof.setAttribute("samplesPerLine", "100");
+        sof.setAttribute("numFrameComponents", "3");
+        IIOMetadataNode c1 = new IIOMetadataNode("componentSpec");
+        c1.setAttribute("componentId", "1");
+        c1.setAttribute("HsamplingFactor", "1");
+        c1.setAttribute("VsamplingFactor", "2");
+        c1.setAttribute("QtableSelector", "1");
+        sof.appendChild(c1);
+        IIOMetadataNode c2 = new IIOMetadataNode("componentSpec");
+        c2.setAttribute("componentId", "2");
+        c2.setAttribute("HsamplingFactor", "1");
+        c2.setAttribute("VsamplingFactor", "1");
+        c2.setAttribute("QtableSelector", "1");
+        sof.appendChild(c2);
+        IIOMetadataNode c3 = new IIOMetadataNode("componentSpec");
+        c3.setAttribute("componentId", "3");
+        c3.setAttribute("HsamplingFactor", "1");
+        c3.setAttribute("VsamplingFactor", "1");
+        c3.setAttribute("QtableSelector", "1");
+        sof.appendChild(c3);
+        sequence.appendChild(sof);
+        metadata.setFromTree(jpegMDName, root);
+        IIOMetadata def = imgWriter.getDefaultImageMetadata(ist, null);
+        metadata.mergeTree(jpegMDName, def.getAsTree(jpegMDName));
+        Node tree = metadata.getAsTree(jpegMDName);
+        Node variety = tree.getFirstChild();
+        Node jfif = variety.getFirstChild();
+        variety.removeChild(jfif);
+        sequence = (IIOMetadataNode)tree.getLastChild();
+        NodeList markers = sequence.getChildNodes();
+        IIOMetadataNode n, sofNode=null;
+        for (int i=0;i<markers.getLength();i++) {
+           n = (IIOMetadataNode)markers.item(i);
+           if (n.getNodeName().equals("sof")) {
+                sofNode = n;
+                break;
+           }
+        }
+        IIOMetadataNode componentSpec = (IIOMetadataNode)sofNode.getFirstChild();
+        Attr attr = componentSpec.getAttributeNode("HsamplingFactor");
+        attr.setValue("1");
+        attr = componentSpec.getAttributeNode("VsamplingFactor");
+        attr.setValue("2");
+        metadata.setFromTree(jpegMDName, tree);
+        String[] names = metadata.getMetadataFormatNames();
+        int length = names.length;
+        for (int i = 0; i < length; i++) {
+            System.out.println( "Format name: " + names[ i ] );
+            displayMetadata(metadata.getAsTree(names[i]), 0);
+        }
+
+        return metadata;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/shared/WriteAfterAbort.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriter;
+import javax.imageio.event.IIOWriteProgressListener;
+import javax.imageio.spi.IIORegistry;
+import javax.imageio.spi.ImageWriterSpi;
+import javax.imageio.stream.ImageOutputStream;
+
+import static java.awt.image.BufferedImage.TYPE_BYTE_BINARY;
+
+/**
+ * @test
+ * @bug 4952954
+ * @summary abortFlag must be cleared for every ImageWriter.write operation
+ * @author Sergey Bylokhov
+ */
+public final class WriteAfterAbort implements IIOWriteProgressListener {
+
+    private volatile boolean abortFlag = true;
+    private volatile boolean isAbortCalled;
+    private volatile boolean isCompleteCalled;
+    private volatile boolean isProgressCalled;
+    private volatile boolean isStartedCalled;
+    private static final int WIDTH = 100;
+    private static final int HEIGHT = 100;
+
+    private void test(final ImageWriter writer) throws IOException {
+        // Image initialization
+        final BufferedImage imageWrite = new BufferedImage(WIDTH, HEIGHT,
+                                                           TYPE_BYTE_BINARY);
+        final Graphics2D g = imageWrite.createGraphics();
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, WIDTH, HEIGHT);
+        g.dispose();
+
+        // File initialization
+        final File file = File.createTempFile("temp", ".img");
+        file.deleteOnExit();
+        final FileOutputStream fos = new SkipWriteOnAbortOutputStream(file);
+        final ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
+        writer.setOutput(ios);
+        writer.addIIOWriteProgressListener(this);
+
+        // This write will be aborted, and file will not be touched
+        writer.write(imageWrite);
+        if (!isStartedCalled) {
+            throw new RuntimeException("Started should be called");
+        }
+        if (!isProgressCalled) {
+            throw new RuntimeException("Progress should be called");
+        }
+        if (!isAbortCalled) {
+            throw new RuntimeException("Abort should be called");
+        }
+        if (isCompleteCalled) {
+            throw new RuntimeException("Complete should not be called");
+        }
+        // Flush aborted data
+        ios.flush();
+
+        // This write should be completed successfully and the file should
+        // contain correct image data.
+        abortFlag = false;
+        isAbortCalled = false;
+        isCompleteCalled = false;
+        isProgressCalled = false;
+        isStartedCalled = false;
+        writer.write(imageWrite);
+
+        if (!isStartedCalled) {
+            throw new RuntimeException("Started should be called");
+        }
+        if (!isProgressCalled) {
+            throw new RuntimeException("Progress should be called");
+        }
+        if (isAbortCalled) {
+            throw new RuntimeException("Abort should not be called");
+        }
+        if (!isCompleteCalled) {
+            throw new RuntimeException("Complete should be called");
+        }
+        writer.dispose();
+        ios.close();
+
+        // Validates content of the file.
+        final BufferedImage imageRead = ImageIO.read(file);
+        for (int x = 0; x < WIDTH; ++x) {
+            for (int y = 0; y < HEIGHT; ++y) {
+                if (imageRead.getRGB(x, y) != imageWrite.getRGB(x, y)) {
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        }
+    }
+
+    public static void main(final String[] args) throws IOException {
+        final IIORegistry registry = IIORegistry.getDefaultInstance();
+        final Iterator<ImageWriterSpi> iter = registry.getServiceProviders(
+                ImageWriterSpi.class, provider -> true, true);
+
+        // Validates all supported ImageWriters
+        while (iter.hasNext()) {
+            final WriteAfterAbort writeAfterAbort = new WriteAfterAbort();
+            final ImageWriter writer = iter.next().createWriterInstance();
+            System.out.println("ImageWriter = " + writer);
+            writeAfterAbort.test(writer);
+        }
+        System.out.println("Test passed");
+    }
+
+    // Callbacks
+
+    @Override
+    public void imageComplete(ImageWriter source) {
+        isCompleteCalled = true;
+    }
+
+    @Override
+    public void imageProgress(ImageWriter source, float percentageDone) {
+        isProgressCalled = true;
+        if (percentageDone > 50 && abortFlag) {
+            source.abort();
+        }
+    }
+
+    @Override
+    public void imageStarted(ImageWriter source, int imageIndex) {
+        isStartedCalled = true;
+    }
+
+    @Override
+    public void writeAborted(final ImageWriter source) {
+        isAbortCalled = true;
+    }
+
+    @Override
+    public void thumbnailComplete(ImageWriter source) {
+    }
+
+    @Override
+    public void thumbnailProgress(ImageWriter source, float percentageDone) {
+    }
+
+    @Override
+    public void thumbnailStarted(ImageWriter source, int imageIndex,
+                                 int thumbnailIndex) {
+    }
+
+    /**
+     * We need to skip writes on abort, because content of the file after abort
+     * is undefined.
+     */
+    private class SkipWriteOnAbortOutputStream extends FileOutputStream {
+
+        SkipWriteOnAbortOutputStream(File file) throws FileNotFoundException {
+            super(file);
+        }
+
+        @Override
+        public void write(int b) throws IOException {
+            if (!abortFlag) {
+                super.write(b);
+            }
+        }
+
+        @Override
+        public void write(byte[] b) throws IOException {
+            if (!abortFlag) {
+                super.write(b);
+            }
+        }
+
+        @Override
+        public void write(byte[] b, int off, int len) throws IOException {
+            if (!abortFlag) {
+                super.write(b, off, len);
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/PrintSEUmlauts/PrintSEUmlauts.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+import java.awt.Graphics;
+import java.awt.GraphicsEnvironment;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
+import javax.print.SimpleDoc;
+import javax.print.StreamPrintService;
+import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.HashDocAttributeSet;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.event.PrintJobAdapter;
+import javax.print.event.PrintJobEvent;
+
+/*
+ * @test
+ * @bug 8067364
+ * @summary Printing to Postscript doesn't support dieresis
+ * @build PrintSEUmlauts
+ * @run main/othervm PrintSEUmlauts
+ */
+public class PrintSEUmlauts implements Printable {
+
+    public static void main(String[] args) throws Exception {
+
+        GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+        DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
+        String mime = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();
+
+        StreamPrintServiceFactory[] factories =
+                StreamPrintServiceFactory.
+                        lookupStreamPrintServiceFactories(flavor, mime);
+        if (factories.length == 0) {
+            System.out.println("No print service found.");
+            return;
+        }
+
+        FileOutputStream output = new FileOutputStream("out.ps");
+        StreamPrintService service = factories[0].getPrintService(output);
+
+        SimpleDoc doc =
+             new SimpleDoc(new PrintSEUmlauts(),
+                           DocFlavor.SERVICE_FORMATTED.PRINTABLE,
+                           new HashDocAttributeSet());
+        DocPrintJob job = service.createPrintJob();
+        job.addPrintJobListener(new PrintJobAdapter() {
+            @Override
+            public void printJobCompleted(PrintJobEvent pje) {
+                testPrintAndExit();
+            }
+        });
+
+        job.print(doc, new HashPrintRequestAttributeSet());
+    }
+
+    private static final boolean DEBUG = false;
+    private static void testPrintAndExit() {
+        String expected = "<e4> 7.44 100.0 100.0 S";
+        String content = "";
+
+        File file = new File("out.ps");
+        if (!DEBUG) {
+            file.deleteOnExit();
+        }
+
+        try (FileInputStream stream = new FileInputStream(file)) {
+            byte[] data = new byte[(int) file.length()];
+            stream.read(data);
+            content = new String(data, StandardCharsets.ISO_8859_1);
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+
+        if (!content.contains(expected)) {
+            System.err.println("FAIL");
+            if (DEBUG) {
+                System.err.println("printing content");
+                System.err.println(content);
+            }
+            throw new RuntimeException("Expected <e4> to represent 'ä' but not found!");
+        }
+        System.err.println("SUCCESS");
+    }
+
+    public int print(Graphics g, PageFormat pf, int pg) {
+       if (pg > 0) return NO_SUCH_PAGE;
+       g.drawString("ä", 100, 100);
+       return PAGE_EXISTS;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/AbstractButton/AnimatedIcon/AnimatedIcon.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+
+import static java.awt.image.BufferedImage.TYPE_INT_RGB;
+
+/**
+ * @test
+ * @bug 6573305
+ * @summary Animated icon should animate when the JButton is pressed.
+ * @author Sergey Bylokhov
+ */
+public final class AnimatedIcon {
+
+    public static void main(final String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            final BufferedImage bi = new BufferedImage(1, 1, TYPE_INT_RGB);
+            final ImageIcon icon = new ImageIcon(bi);
+            final JButton button = new JButton(icon);
+            // Default icon is set => imageUpdate should return true for it
+            isAnimated(bi, button);
+            button.getModel().setPressed(true);
+            button.getModel().setArmed(true);
+            isAnimated(bi, button);
+            button.getModel().setPressed(false);
+            button.getModel().setArmed(false);
+            button.getModel().setSelected(true);
+            isAnimated(bi, button);
+            button.getModel().setSelected(false);
+            button.getModel().setRollover(true);
+            button.setRolloverEnabled(true);
+            isAnimated(bi, button);
+            button.getModel().setSelected(true);
+            isAnimated(bi, button);
+            // Default icon is not set => imageUpdate should return true for
+            // other icons if any
+            button.setIcon(null);
+            button.setPressedIcon(icon);
+            button.getModel().setPressed(true);
+            button.getModel().setArmed(true);
+            isAnimated(bi, button);
+        });
+    }
+
+    private static void isAnimated(BufferedImage bi, JButton button) {
+        if (!button.imageUpdate(bi, ImageObserver.SOMEBITS, 0, 0, 1, 1)) {
+            throw new RuntimeException();
+        }
+    }
+}
--- a/jdk/test/javax/swing/JColorChooser/Test4177735.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/javax/swing/JColorChooser/Test4177735.java	Wed Jul 05 20:20:43 2017 +0200
@@ -38,9 +38,20 @@
     private static final long DELAY = 1000L;
 
     public static void main(String[] args) throws Exception {
+        int hsvIndex = 0;
+        int panelsLength;
+        int finalIndex;
         JColorChooser chooser = new JColorChooser();
         AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
-        chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });
+        panelsLength = panels.length;
+
+        for(int i = 0; i < panelsLength; i++) {
+            if(panels[i].getDisplayName().equals("HSV")) {
+                hsvIndex = i;
+            }
+        }
+        finalIndex = Math.min(hsvIndex, panelsLength - 1);
+        chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });
 
         JDialog dialog = show(chooser);
         pause(DELAY);
--- a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java	Wed Jul 05 20:20:43 2017 +0200
@@ -59,7 +59,7 @@
                 editorPaneLayer.setUI(layerUI);
 
                 scrollPane = new JScrollPane(editorPaneLayer);
-
+                scrollPane.setViewportBorder(null);
                 scrollPane.setPreferredSize(new Dimension(200, 250));
                 frame.add(scrollPane);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/4209065/bug4209065.html	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<Html>
+<Body>
+<!--
+<H1>Test</H1>
+<Center>
+<APPLET  code="bug4209065.class" WIDTH = 600 HEIGHT = 400>
+</APPLET>
+</Center>
+-->
+
+</Body>
+</Html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/4209065/bug4209065.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JApplet;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+
+/**
+ * @test
+ * @bug 4209065
+ * @author Georges Saab
+ * @run applet/manual=yesno bug4209065.html
+ */
+public final class bug4209065 extends JApplet {
+
+    @Override
+    public void init() {
+        try {
+            EventQueue.invokeAndWait(this::createTabbedPane);
+        } catch (InterruptedException | InvocationTargetException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void createTabbedPane() {
+        JTabbedPane tp = new JTabbedPane();
+        getContentPane().add(tp);
+        String text = "<html><center>If the style of the text on the tabs matches"
+                      + "<br>the descriptions, press <em><b>PASS</b></em></center></html>";
+        tp.addTab("<html><center><font size=+3>big</font></center></html>", new JLabel(text));
+        tp.addTab("<html><center><font color=red>red</font></center></html>", new JLabel(text));
+        tp.addTab("<html><center><em><b>Bold Italic!</b></em></center></html>", new JLabel(text));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java	Wed Jul 05 20:20:43 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+import javax.imageio.ImageIO;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+
+/**
+ * @test
+ * @bug 8015085
+ * @summary Shortening via " ... " is broken for Strings containing a combining
+ *          diaeresis.
+ * @author Sergey Bylokhov
+ */
+public class TestBadBreak {
+
+    static JFrame frame;
+    static Robot robot;
+    static final String withCombiningDiaeresis =    "123p://.aaaaaaaaaaaaaaaaaaaaaa.123/a\u0308" ;
+    static final String withoutCombiningDiaeresis = "123p://.aaaaaaaaaaaaaaaaaaaaaa.123/\u00E4" ;
+
+    public static void main(final String[] args) throws Exception {
+        robot = new Robot();
+        final BufferedImage bi1 = new BufferedImage(200, 90, TYPE_INT_ARGB);
+        final BufferedImage bi2 = new BufferedImage(200, 90, TYPE_INT_ARGB);
+        test(withCombiningDiaeresis, bi1);
+        test(withoutCombiningDiaeresis, bi2);
+        for (int x = 0; x < bi1.getWidth(); ++x) {
+            for (int y = 0; y < bi1.getHeight(); ++y) {
+                if (bi1.getRGB(x, y) != bi2.getRGB(x, y)) {
+                    ImageIO.write(bi1, "png", new File("image1.png"));
+                    ImageIO.write(bi2, "png", new File("image2.png"));
+                    throw new RuntimeException("Wrong color");
+                }
+            }
+        }
+    }
+
+    private static void test(final String text, final BufferedImage i1)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame();
+                final JLabel label = new JLabel(text) {
+                    @Override
+                    protected void paintComponent(Graphics g) {
+                        Graphics2D g2d = i1.createGraphics();
+                        super.paintComponent(g2d);
+                        g2d.dispose();
+                    }
+                };
+                frame.getContentPane().add(label);
+                frame.setBounds(200, 200, 200, 90);
+            }
+        });
+        robot.waitForIdle();
+        SwingUtilities.invokeAndWait(() -> frame.setVisible(true));
+        robot.waitForIdle();
+        SwingUtilities.invokeAndWait(frame::dispose);
+        robot.waitForIdle();
+    }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,20 @@
  */
 
 package jdk.testlibrary;
+import java.util.regex.Pattern;
+import java.io.RandomAccessFile;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
+    private static final String javaVersion = System.getProperty("java.version");
     private static final String osArch      = System.getProperty("os.arch");
     private static final String vmName      = System.getProperty("java.vm.name");
+    private static final String userName    = System.getProperty("user.name");
+    private static final String compiler    = System.getProperty("sun.management.compiler");
 
     public static boolean isClient() {
         return vmName.endsWith(" Client VM");
@@ -38,6 +45,23 @@
         return vmName.endsWith(" Server VM");
     }
 
+    public static boolean isGraal() {
+        return vmName.endsWith(" Graal VM");
+    }
+
+    public static boolean isMinimal() {
+        return vmName.endsWith(" Minimal VM");
+    }
+
+    public static boolean isEmbedded() {
+        return vmName.contains("Embedded");
+    }
+
+    public static boolean isTieredSupported() {
+        return compiler.contains("Tiered Compilers");
+    }
+
+
     public static boolean is32bit() {
         return dataModel.equals("32");
     }
@@ -46,6 +70,18 @@
         return dataModel.equals("64");
     }
 
+    public static boolean isAix() {
+        return isOs("aix");
+    }
+
+    public static boolean isLinux() {
+        return isOs("linux");
+    }
+
+    public static boolean isOSX() {
+        return isOs("mac");
+    }
+
     public static boolean isSolaris() {
         return isOs("sunos");
     }
@@ -54,14 +90,6 @@
         return isOs("win");
     }
 
-    public static boolean isOSX() {
-        return isOs("mac");
-    }
-
-    public static boolean isLinux() {
-        return isOs("linux");
-    }
-
     private static boolean isOs(String osname) {
         return osName.toLowerCase().startsWith(osname.toLowerCase());
     }
@@ -71,7 +99,8 @@
     }
 
     public static boolean isDebugBuild() {
-        return vmVersion.toLowerCase().contains("debug");
+        return (vmVersion.toLowerCase().contains("debug") ||
+                javaVersion.toLowerCase().contains("debug"));
     }
 
     public static String getVMVersion() {
@@ -80,33 +109,101 @@
 
     // Returns true for sparc and sparcv9.
     public static boolean isSparc() {
-        return isArch("sparc");
+        return isArch("sparc.*");
     }
 
     public static boolean isARM() {
-        return isArch("arm");
+        return isArch("arm.*");
     }
 
     public static boolean isPPC() {
-        return isArch("ppc");
+        return isArch("ppc.*");
     }
 
     public static boolean isX86() {
-        // On Linux it's 'i386', Windows 'x86'
-        return (isArch("i386") || isArch("x86"));
+        // On Linux it's 'i386', Windows 'x86' without '_64' suffix.
+        return isArch("(i386)|(x86(?!_64))");
     }
 
     public static boolean isX64() {
         // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
-        return (isArch("amd64") || isArch("x86_64"));
+        return isArch("(amd64)|(x86_64)");
     }
 
-    private static boolean isArch(String archname) {
-        return osArch.toLowerCase().startsWith(archname.toLowerCase());
+    private static boolean isArch(String archnameRE) {
+        return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
+                .matcher(osArch)
+                .matches();
     }
 
     public static String getOsArch() {
         return osArch;
     }
 
+    /**
+     * Return a boolean for whether we expect to be able to attach
+     * the SA to our own processes on this system.
+     */
+    public static boolean shouldSAAttach()
+                               throws IOException {
+
+        if (isAix()) {
+            return false;   // SA not implemented.
+        } else if (isLinux()) {
+            return canPtraceAttachLinux();
+        } else if (isOSX()) {
+            return canAttachOSX();
+        } else {
+            // Other platforms expected to work:
+            return true;
+        }
+    }
+
+    /**
+     * On Linux, first check the SELinux boolean "deny_ptrace" and return false
+     * as we expect to be denied if that is "1".
+     */
+    public static boolean canPtraceAttachLinux()
+                               throws IOException {
+
+        // SELinux deny_ptrace:
+        try(RandomAccessFile file = new RandomAccessFile("/sys/fs/selinux/booleans/deny_ptrace", "r")) {
+            if (file.readByte() != '0') {
+                return false;
+            }
+        }
+        catch(FileNotFoundException ex) {
+            // Ignored
+        }
+
+        // YAMA enhanced security ptrace_scope:
+        // 0 - a process can PTRACE_ATTACH to any other process running under the same uid
+        // 1 - restricted ptrace: a process must be a children of the inferior or user is root
+        // 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
+        // 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
+
+        try(RandomAccessFile file = new RandomAccessFile("/proc/sys/kernel/yama/ptrace_scope", "r")) {
+            byte yama_scope = file.readByte();
+            if (yama_scope == '3') {
+                return false;
+            }
+
+            if (!userName.equals("root") && yama_scope != '0') {
+                return false;
+            }
+        }
+        catch(FileNotFoundException ex) {
+            // Ignored
+        }
+
+        // Otherwise expect to be permitted:
+        return true;
+    }
+
+    /**
+     * On OSX, expect permission to attach only if we are root.
+     */
+    public static boolean canAttachOSX() {
+        return userName.equals("root");
+    }
 }
--- a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6405536
+ * @bug 6405536 8042967
  * @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying
  * @author Andreas Sterbenz
  * @library ..
@@ -176,17 +176,28 @@
         verify(provider, "NONEwithECDSA", publicKey, data1SHA, sig, true);
         verify(provider, "NONEwithECDSA", publicKey, data2SHA, sig, false);
 
-        testSigning(provider, privateKey, publicKey);
+        System.out.println("Testing with default signature format: ASN.1");
+        testSigning(provider, privateKey, publicKey, false);
+
+        System.out.println("Testing with IEEE P1363 signature format");
+        testSigning(provider, privateKey, publicKey, true);
     }
 
-    private void testSigning(Provider provider, PrivateKey privateKey,
-            PublicKey publicKey) throws Exception {
+    private void testSigning(Provider provider,
+                             PrivateKey privateKey,
+                             PublicKey publicKey,
+                             boolean p1363Format) throws Exception {
         byte[] data = new byte[2048];
         new Random().nextBytes(data);
 
         // sign random data using SHA1withECDSA and verify using
         // SHA1withECDSA and NONEwithECDSA
-        Signature s = Signature.getInstance("SHA1withECDSA", provider);
+        Signature s;
+        if (p1363Format) {
+            s = Signature.getInstance("SHA1withECDSAinP1363Format", provider);
+        } else {
+            s = Signature.getInstance("SHA1withECDSA", provider);
+        }
         s.initSign(privateKey);
         s.update(data);
         byte[] s1 = s.sign();
@@ -197,7 +208,11 @@
             throw new Exception("Sign/verify 1 failed");
         }
 
-        s = Signature.getInstance("NONEwithECDSA", provider);
+        if (p1363Format) {
+            s = Signature.getInstance("NONEwithECDSAinP1363Format", provider);
+        } else {
+            s = Signature.getInstance("NONEwithECDSA", provider);
+        }
         MessageDigest md = MessageDigest.getInstance("SHA-1");
         byte[] digest = md.digest(data);
         s.initVerify(publicKey);
@@ -218,7 +233,11 @@
             throw new Exception("Sign/verify 3 failed");
         }
 
-        s = Signature.getInstance("SHA1withECDSA", provider);
+        if (p1363Format) {
+            s = Signature.getInstance("SHA1withECDSAinP1363Format", provider);
+        } else {
+            s = Signature.getInstance("SHA1withECDSA", provider);
+        }
         s.initVerify(publicKey);
         s.update(data);
         if (!s.verify(s2)) {
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary Verify that the RSA KeyPairGenerator works
  * @author Andreas Sterbenz
  * @library ..
+ * @run main/othervm TestKeyPairGenerator
  */
 
 import java.io.*;
--- a/jdk/test/sun/security/provider/DSA/TestDSA2.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/security/provider/DSA/TestDSA2.java	Wed Jul 05 20:20:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,10 @@
  */
 /*
  * @test
- * @bug 7044060
+ * @bug 7044060 8042967
  * @run main/othervm/timeout=250 TestDSA2
- * @summary verify that DSA signature works using SHA and SHA-224 and SHA-256 digests.
+ * @summary verify that DSA signature works using SHA and SHA-224 and
+ *          SHA-256 digests.
  */
 
 
@@ -40,7 +41,14 @@
     private static final String PROV = "SUN";
 
     private static final String[] SIG_ALGOS = {
-        "SHA1withDSA", "SHA224withDSA", "SHA256withDSA"
+        "NONEwithDSA",
+        "SHA1withDSA",
+        "SHA224withDSA",
+        "SHA256withDSA",
+        "NONEwithDSAinP1363Format",
+        "SHA1withDSAinP1363Format",
+        "SHA224withDSAinP1363Format",
+        "SHA256withDSAinP1363Format"
     };
 
     private static final int[] KEYSIZES = {
@@ -48,15 +56,20 @@
     };
 
     public static void main(String[] args) throws Exception {
-        boolean[] expectedToPass = { true, true, true };
+        boolean[] expectedToPass = { true, true, true, true,
+                                     true, true, true, true };
         test(1024, expectedToPass);
-        boolean[] expectedToPass2 = { true, true, true };
+        boolean[] expectedToPass2 = { true, true, true, true,
+                                      true, true, true, true };
         test(2048, expectedToPass2);
     }
 
     private static void test(int keySize, boolean[] testStatus)
-        throws Exception {
-        byte[] data = "1234567890".getBytes();
+            throws Exception {
+        // Raw DSA requires the data to be exactly 20 bytes long. Use a
+        // 20-byte array for these tests so that the NONEwithDSA* algorithms
+        // don't complain.
+        byte[] data = "12345678901234567890".getBytes();
         System.out.println("Test against key size: " + keySize);
 
         KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", PROV);
--- a/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -37,6 +37,7 @@
 import java.util.List;
 import java.util.Map;
 import jdk.testlibrary.Utils;
+import jdk.testlibrary.Platform;
 
 public class JMapHeapConfigTest {
 
@@ -55,6 +56,8 @@
 
     // ignoring MaxMetaspaceSize
 
+    static final String desiredMaxHeapSize = "-Xmx128m";
+
     private static Map<String, String> parseJMapOutput(List<String> jmapOutput) {
         Map<String, String> heapConfigMap = new HashMap<String, String>();
         boolean shouldParse = false;
@@ -107,12 +110,38 @@
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         System.out.println("Starting JMapHeapConfigTest");
 
+        if (!Platform.shouldSAAttach()) {
+            // Silently skip the test if we don't have enough permissions to attach
+            System.err.println("Error! Insufficient permissions to attach.");
+            return;
+        }
+
+        if (!LingeredApp.isLastModifiedWorking()) {
+            // Exact behaviour of the test depends to operating system and the test nature,
+            // so just print the warning and continue
+            System.err.println("Warning! Last modified time doesn't work.");
+        }
+
+        boolean mx_found = false;
+        List<String> jvmOptions = Utils.getVmOptions();
+        for (String option : jvmOptions) {
+            if (option.startsWith("-Xmx")) {
+               System.out.println("INFO: maximum heap size set by JTREG as " + option);
+               mx_found = true;
+               break;
+           }
+        }
+
         // Forward vm options to LingeredApp
         ArrayList<String> cmd = new ArrayList();
         cmd.addAll(Utils.getVmOptions());
+        if (!mx_found) {
+            cmd.add(desiredMaxHeapSize);
+            System.out.println("INFO: maximum heap size set explicitly as " + desiredMaxHeapSize);
+        }
         cmd.add("-XX:+PrintFlagsFinal");
 
         TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "-heap");
--- a/jdk/test/sun/tools/jmap/heapconfig/LingeredApp.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/tools/jmap/heapconfig/LingeredApp.java	Wed Jul 05 20:20:43 2017 +0200
@@ -363,6 +363,41 @@
     }
 
     /**
+     * LastModified time might not work correctly in some cases it might
+     * cause later failures
+     */
+
+    public static boolean isLastModifiedWorking() {
+        boolean sane = true;
+        try {
+            long lm = lastModified(".");
+            if (lm == 0) {
+                System.err.println("SANITY Warning! The lastModifiedTime() doesn't work on this system, it returns 0");
+                sane = false;
+            }
+
+            long now = epoch();
+            if (lm > now) {
+                System.err.println("SANITY Warning! The Clock is wrong on this system lastModifiedTime() > getTime()");
+                sane = false;
+            }
+
+            setLastModified(".", epoch());
+            long lm1 = lastModified(".");
+            if (lm1 <= lm) {
+                System.err.println("SANITY Warning! The setLastModified doesn't work on this system");
+                sane = false;
+            }
+        }
+        catch(IOException e) {
+            System.err.println("SANITY Warning! IOException during sanity check " + e);
+            sane = false;
+        }
+
+        return sane;
+    }
+
+    /**
      * This part is the application it self
      */
     public static void main(String args[]) {
@@ -378,16 +413,8 @@
             Path path = Paths.get(theLockFileName);
 
             while (Files.exists(path)) {
-                long lm = lastModified(theLockFileName);
-                long now = epoch();
-
-                // A bit of paranoja, don't allow test app to run more than an hour
-                if (now - lm > 3600) {
-                    throw new IOException("Lock is too old. Aborting");
-                }
-
-                // Touch lock to indicate our rediness
-                setLastModified(theLockFileName, now);
+                // Touch the lock to indicate our readiness
+                setLastModified(theLockFileName, epoch());
                 Thread.sleep(spinDelay);
             }
 
--- a/jdk/test/sun/tools/jmap/heapconfig/LingeredAppTest.java	Thu Feb 19 16:36:35 2015 -0800
+++ b/jdk/test/sun/tools/jmap/heapconfig/LingeredAppTest.java	Wed Jul 05 20:20:43 2017 +0200
@@ -31,8 +31,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 public class LingeredAppTest {
 
--- a/make/CompileJavaModules.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -89,7 +89,11 @@
 
 ################################################################################
 
-java.desktop_COPY := .gif .png .wav .txt .xml .css flavormap.properties .pf
+java.datatransfer_COPY := flavormap.properties
+
+################################################################################
+
+java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
 java.desktop_CLEAN := iio-plugin.properties
 
 java.desktop_EXCLUDES += \
--- a/make/Images.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/Images.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -183,7 +183,6 @@
       keytool.1 \
       orbd.1 \
       pack200.1 \
-      policytool.1 \
       rmid.1 \
       rmiregistry.1 \
       servertool.1 \
@@ -220,6 +219,7 @@
       jstat.1 \
       jstatd.1 \
       native2ascii.1 \
+      policytool.1 \
       rmic.1 \
       schemagen.1 \
       serialver.1 \
--- a/make/Main.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/Main.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -347,8 +347,8 @@
   $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
 
   # Declare dependencies from <module>-lib to <module>-java
-  # Skip jdk.jdwp.agent as it contains no java code.
-  $(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
+  # Skip modules that do not have java source.
+  $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
 
   # Declare dependencies from all other <module>-lib to java.base-lib
   $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
--- a/make/common/IdlCompilation.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/common/IdlCompilation.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -94,7 +94,7 @@
 endef
 
 define SetupIdlCompilationInner
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
 
--- a/make/common/JavaCompilation.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/common/JavaCompilation.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -65,7 +65,7 @@
 endef
 
 define SetupJavaCompilerInner
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
 
@@ -84,6 +84,9 @@
 # Parameter 1 is the name of the rule. This name is used as variable prefix,
 # and the targets generated are listed in a variable by that name.
 #
+# Parameter 2 is a list of dependencies for the jar target. If left empty,
+# dependencies are searched using SRCS, which should not be empty.
+#
 # Remaining parameters are named arguments. These include:
 #   SRCS:=List of directories in where to find files to add to archive
 #   SUFFIXES:=File suffixes to include in jar
@@ -106,7 +109,7 @@
 
 define SetupArchiveInner
   # NOTE: $2 is dependencies, not a named argument!
-  $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(findstring $(LOG_LEVEL),trace), $(info *[2] <dependencies> = $(strip $2)))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
@@ -362,6 +365,10 @@
 # This is the new clean standard. Though it is to be superseded by
 # a standard annotation processor from with sjavac.
 #
+# An empty echo ensures that the input to sed always ends with a newline.
+# Certain implementations (e.g. Solaris) will skip the last line without
+# it.
+#
 # The sed expression does this:
 # 1. Add a backslash before any :, = or ! that do not have a backslash already.
 # 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX
@@ -384,7 +391,7 @@
   # Now we can setup the depency that will trigger the copying.
   $$($1_BIN)$$($2_TARGET) : $2
 	$(MKDIR) -p $$(@D)
-	export LC_ALL=C ; $(CAT) $$< \
+	export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
 	    | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
 	        -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \
 	    | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
@@ -434,10 +441,15 @@
 endef
 
 define SetupJavaCompilationInner
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
 
+  # Verify arguments
+  ifeq ($$($1_BIN),)
+    $$(error Must specify BIN (in $1))
+  endif
+
   # Extract the info from the java compiler setup.
   $1_JVM := $$($$($1_SETUP)_JVM)
   $1_JAVAC := $$($$($1_SETUP)_JAVAC)
--- a/make/common/MakeBase.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/common/MakeBase.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -377,7 +377,7 @@
 # This is to be called by all SetupFoo macros
 define LogSetupMacroEntry
   $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
-  $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
+  $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $(strip $($i)),$(NEWLINE) $(strip [$i] $($i))))))
 endef
 
 # Support macro for all SetupFoo macros.
@@ -515,7 +515,6 @@
   # 2 : Dest file
   # 3 : Variable to add targets to
   # 4 : Macro to call for copy operation
-
   $2: $1
 	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
 	$$($$(strip $4))
@@ -523,22 +522,43 @@
   $3 += $2
 endef
 
+# Setup make rules for copying files, with an option to do more complex
+# processing instead of copying.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SRC     : Source root dir (defaults to dir of first file)
+#   DEST    : Dest root dir
+#   FILES   : List of files to copy with absolute paths, or path relative to SRC.
+#             Must be in SRC.
+#   FLATTEN : Set to flatten the directory structure in the DEST dir.
+#   MACRO   : Optionally override the default macro used for making the copy.
+#             Default is 'install-file'
+
 define SetupCopyFiles
-  # param 1 is for example COPY_MYFILES
-  # param 2,3,4,5 are named args.
-  #   SRC   : Source root dir
-  #   DEST  : Dest root dir
-  #   FILES : List of files to copy with absolute paths, or path relative to SRC. Must be in SRC.
-  #   FLATTEN : Set to flatten the directory structure in the DEST dir.
-  #   MACRO : Optionally override the default macro used for making the copy. Default is 'install-file'
-  $(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupCopyFilesInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupCopyFilesInner
+  $(foreach i,2 3 4 5 6, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
-  $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles))
+  $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk))
 
   ifeq ($$($1_MACRO), )
     $1_MACRO := install-file
   endif
 
+  # Default SRC to the dir of the first file.
+  ifeq ($$($1_SRC), )
+    $1_SRC := $$(dir $$(firstword $$($1_FILES)))
+  endif
+
+  # Remove any trailing slash from SRC
+  $1_SRC := $$(patsubst %/,%,$$($1_SRC))
+
   $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
       $$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
       $$($1_DEST)/$$(if $$($1_FLATTEN),$$(notdir $$f),$$f), $1, $$($1_MACRO))))
--- a/make/common/NativeCompilation.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/common/NativeCompilation.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -201,7 +201,7 @@
 endef
 
 define SetupNativeCompilationInner
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))
   $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
 
--- a/make/common/RMICompilation.gmk	Thu Feb 19 16:36:35 2015 -0800
+++ b/make/common/RMICompilation.gmk	Wed Jul 05 20:20:43 2017 +0200
@@ -43,7 +43,7 @@
 endef
 
 define SetupRMICompilationInner
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
 
--- a/modules.xml	Thu Feb 19 16:36:35 2015 -0800
+++ b/modules.xml	Wed Jul 05 20:20:43 2017 +0200
@@ -41,7 +41,8 @@
   <module>
     <name>java.activation</name>
     <depend>java.base</depend>
-    <depend re-exports="true">java.desktop</depend>
+    <depend re-exports="true">java.datatransfer</depend>
+    <depend>java.desktop</depend>
     <depend>java.logging</depend>
     <export>
       <name>javax.activation</name>
@@ -315,6 +316,7 @@
     <export>
       <name>sun.reflect.misc</name>
       <to>java.corba</to>
+      <to>java.datatransfer</to>
       <to>java.desktop</to>
       <to>java.management</to>
       <to>java.rmi</to>
@@ -358,7 +360,7 @@
       <to>java.rmi</to>
       <to>java.security.jgss</to>
       <to>jdk.crypto.pkcs11</to>
-      <to>jdk.runtime</to>
+      <to>jdk.dev</to>
       <to>jdk.security.auth</to>
     </export>
     <export>
@@ -391,7 +393,6 @@
       <to>jdk.crypto.ucrypto</to>
       <to>jdk.deploy.osx</to>
       <to>jdk.dev</to>
-      <to>jdk.runtime</to>
       <to>jdk.security.auth</to>
     </export>
     <export>
@@ -584,11 +585,23 @@
     </export>
   </module>
   <module>
+    <name>java.datatransfer</name>
+    <depend>java.base</depend>
+    <export>
+      <name>java.awt.datatransfer</name>
+    </export>
+    <export>
+      <name>sun.datatransfer</name>
+      <to>java.desktop</to>
+    </export>
+  </module>
+  <module>
     <name>java.desktop</name>
     <depend>java.base</depend>
     <depend>java.logging</depend>
     <depend>java.prefs</depend>
     <depend re-exports="true">java.xml</depend>
+    <depend re-exports="true">java.datatransfer</depend>
     <depend>jdk.charsets</depend>
     <export>
       <name>java.applet</name>
@@ -600,9 +613,6 @@
       <name>java.awt.color</name>
     </export>
     <export>
-      <name>java.awt.datatransfer</name>
-    </export>
-    <export>
       <name>java.awt.dnd</name>
     </export>
     <export>
@@ -887,6 +897,7 @@
     <depend re-exports="true">java.activation</depend>
     <depend re-exports="true">java.compact3</depend>
     <depend re-exports="true">java.corba</depend>
+    <depend re-exports="true">java.datatransfer</depend>
     <depend re-exports="true">java.desktop</depend>
     <depend re-exports="true">java.transaction</depend>
     <depend re-exports="true">java.xml.bind</depend>
@@ -1113,6 +1124,7 @@
     <depend re-exports="true">java.activation</depend>
     <depend>java.base</depend>
     <depend>java.compiler</depend>
+    <depend>java.datatransfer</depend>
     <depend>java.desktop</depend>
     <depend>java.logging</depend>
     <depend re-exports="true">java.xml</depend>
@@ -1320,6 +1332,7 @@
     <name>java.xml.ws</name>
     <depend>java.annotations.common</depend>
     <depend>java.base</depend>
+    <depend>java.datatransfer</depend>
     <depend>java.desktop</depend>
     <depend>java.logging</depend>
     <depend>java.management</depend>
@@ -1576,6 +1589,7 @@
     <depend>java.base</depend>
     <depend>java.scripting</depend>
     <depend>java.xml</depend>
+    <depend>java.desktop</depend>
     <depend>jdk.compiler</depend>
     <depend>jdk.rmic</depend>
     <depend>jdk.xml.bind</depend>
@@ -1587,6 +1601,7 @@
   <module>
     <name>jdk.hotspot.agent</name>
     <depend>java.base</depend>
+    <depend>java.datatransfer</depend>
     <depend>java.desktop</depend>
     <depend>java.rmi</depend>
     <depend>java.scripting</depend>
@@ -1710,8 +1725,6 @@
   <module>
     <name>jdk.runtime</name>
     <depend>java.base</depend>
-    <depend>java.desktop</depend>
-    <depend>java.se</depend>
   </module>
   <module>
     <name>jdk.scripting.nashorn</name>
@@ -1759,6 +1772,7 @@
     <depend>java.activation</depend>
     <depend>java.base</depend>
     <depend>java.compiler</depend>
+    <depend>java.datatransfer</depend>
     <depend>java.desktop</depend>
     <depend>java.logging</depend>
     <depend>java.xml</depend>