Merge
authorduke
Wed, 05 Jul 2017 20:24:03 +0200
changeset 29401 138ecbd9f404
parent 29400 73b85977a990 (current diff)
parent 29399 9905d528e91c (diff)
child 29417 adf9967bd14e
Merge
jdk/make/launcher/Launcher-jdk.runtime.gmk
jdk/make/lib/Lib-jdk.runtime.gmk
jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java
jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java
jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/CommandLine.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp
jdk/src/jdk.runtime/share/native/common-unpack/bands.h
jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp
jdk/src/jdk.runtime/share/native/common-unpack/bytes.h
jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp
jdk/src/jdk.runtime/share/native/common-unpack/coding.h
jdk/src/jdk.runtime/share/native/common-unpack/constants.h
jdk/src/jdk.runtime/share/native/common-unpack/defines.h
jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp
jdk/src/jdk.runtime/share/native/common-unpack/unpack.h
jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp
jdk/src/jdk.runtime/share/native/common-unpack/utils.h
jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp
jdk/src/jdk.runtime/share/native/common-unpack/zip.h
jdk/src/jdk.runtime/share/native/libunpack/jni.cpp
jdk/src/jdk.runtime/share/native/unpack200/main.cpp
jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest
--- a/.hgtags-top-repo	Thu Mar 12 13:35:03 2015 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 20:24:03 2017 +0200
@@ -296,3 +296,4 @@
 6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51
 1822e59f17121b09e7899cf338cfb6e37fe5fceb jdk9-b52
 d6ed47125a76cd1cf8a100568507bfb5e9669d9f jdk9-b53
+cb7367141e910e265b8344a8facee740bd1e5467 jdk9-b54
--- a/common/autoconf/configure.ac	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/autoconf/configure.ac	Wed Jul 05 20:24:03 2017 +0200
@@ -195,6 +195,7 @@
 
 # Setup debug symbols (need objcopy from the toolchain for that)
 JDKOPT_SETUP_DEBUG_SYMBOLS
+JDKOPT_SETUP_CODE_COVERAGE
 
 ###############################################################################
 #
--- a/common/autoconf/flags.m4	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/autoconf/flags.m4	Wed Jul 05 20:24:03 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
@@ -478,6 +478,8 @@
       CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
       CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
     fi
+    CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
+    CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
     CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
@@ -529,7 +531,7 @@
   #    CXXFLAGS_JDK  - C++ Compiler flags
   #    COMMON_CCXXFLAGS_JDK - common to C and C++
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
     case $OPENJDK_TARGET_CPU_ARCH in
       arm )
@@ -549,7 +551,6 @@
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
     if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
-      CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
     fi
 
     CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
@@ -676,7 +677,7 @@
 
   # The shared libraries are compiled using the picflag.
   CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
+  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
 
   # Executable flags
   CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
@@ -687,6 +688,19 @@
   AC_SUBST(CXXFLAGS_JDKLIB)
   AC_SUBST(CXXFLAGS_JDKEXE)
 
+  # Flags for compiling test libraries
+  CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+
+  # Flags for compiling test executables
+  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
+  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+
+  AC_SUBST(CFLAGS_TESTLIB)
+  AC_SUBST(CFLAGS_TESTEXE)
+  AC_SUBST(CXXFLAGS_TESTLIB)
+  AC_SUBST(CXXFLAGS_TESTEXE)
+
   # Setup LDFLAGS et al.
   #
 
@@ -800,6 +814,16 @@
   AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
   AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
   AC_SUBST(LDFLAGS_CXX_JDK)
+
+  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
+  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+  LDFLAGS_TESTLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX"
+  LDFLAGS_TESTEXE_SUFFIX="$LDFLAGS_JDKEXE_SUFFIX"
+
+  AC_SUBST(LDFLAGS_TESTLIB)
+  AC_SUBST(LDFLAGS_TESTEXE)
+  AC_SUBST(LDFLAGS_TESTLIB_SUFFIX)
+  AC_SUBST(LDFLAGS_TESTEXE_SUFFIX)
 ])
 
 # FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
@@ -883,17 +907,31 @@
 
   case "${TOOLCHAIN_TYPE}" in
     microsoft)
+      DISABLE_WARNING_PREFIX="-wd"
       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
       ;;
     solstudio)
+      DISABLE_WARNING_PREFIX="-erroff="
       CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
       ;;
     gcc)
+      # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
+      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
+          [GCC_CAN_DISABLE_WARNINGS=true],
+          [GCC_CAN_DISABLE_WARNINGS=false]
+      )
+      if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
+        DISABLE_WARNING_PREFIX="-Wno-"
+      else
+        DISABLE_WARNING_PREFIX=
+      fi
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
     clang)
+      DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
   esac
+  AC_SUBST(DISABLE_WARNING_PREFIX)
   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 ])
--- a/common/autoconf/generated-configure.sh	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 20:24:03 2017 +0200
@@ -680,16 +680,26 @@
 X_CFLAGS
 XMKMF
 FIXPATH
+GCOV_ENABLED
 ZIP_DEBUGINFO_FILES
 ENABLE_DEBUG_SYMBOLS
 CFLAGS_WARNINGS_ARE_ERRORS
+DISABLE_WARNING_PREFIX
 COMPILER_SUPPORTS_TARGET_BITS_FLAG
 ZERO_ARCHFLAG
+LDFLAGS_TESTEXE_SUFFIX
+LDFLAGS_TESTLIB_SUFFIX
+LDFLAGS_TESTEXE
+LDFLAGS_TESTLIB
 LDFLAGS_CXX_JDK
 LDFLAGS_JDKEXE_SUFFIX
 LDFLAGS_JDKLIB_SUFFIX
 LDFLAGS_JDKEXE
 LDFLAGS_JDKLIB
+CXXFLAGS_TESTEXE
+CXXFLAGS_TESTLIB
+CFLAGS_TESTEXE
+CFLAGS_TESTLIB
 CXXFLAGS_JDKEXE
 CXXFLAGS_JDKLIB
 CFLAGS_JDKEXE
@@ -1084,6 +1094,7 @@
 with_extra_ldflags
 enable_debug_symbols
 enable_zip_debug_info
+enable_native_coverage
 with_x
 with_cups
 with_cups_include
@@ -1852,6 +1863,9 @@
   --disable-debug-symbols disable generation of debug symbols [enabled]
   --disable-zip-debug-info
                           disable zipping of debug-info files [enabled]
+  --enable-native-coverage
+                          enable native compilation with code coverage
+                          data[disabled]
   --disable-freetype-bundling
                           disable bundling of the freetype library with the
                           build result [enabled on Windows or when using
@@ -3736,7 +3750,7 @@
 
 
 #
-# 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
@@ -3993,6 +4007,12 @@
 
 
 
+################################################################################
+#
+# Gcov coverage data for hotspot
+#
+
+
 #
 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4348,7 +4368,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1425490712
+DATE_WHEN_GENERATED=1425994551
 
 ###############################################################################
 #
@@ -42349,6 +42369,8 @@
       CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
       CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
     fi
+    CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
+    CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
     LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
     CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
@@ -42415,7 +42437,7 @@
   #    CXXFLAGS_JDK  - C++ Compiler flags
   #    COMMON_CCXXFLAGS_JDK - common to C and C++
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
         -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
     case $OPENJDK_TARGET_CPU_ARCH in
       arm )
@@ -42435,7 +42457,6 @@
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
     if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
       COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
-      CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
     fi
 
     CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
@@ -42562,7 +42583,7 @@
 
   # The shared libraries are compiled using the picflag.
   CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
+  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
 
   # Executable flags
   CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
@@ -42573,6 +42594,19 @@
 
 
 
+  # Flags for compiling test libraries
+  CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+
+  # Flags for compiling test executables
+  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
+  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+
+
+
+
+
+
   # Setup LDFLAGS et al.
   #
 
@@ -42687,6 +42721,16 @@
 
 
 
+  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
+  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
+  LDFLAGS_TESTLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX"
+  LDFLAGS_TESTEXE_SUFFIX="$LDFLAGS_JDKEXE_SUFFIX"
+
+
+
+
+
+
 
   # Some Zero and Shark settings.
   # ZERO_ARCHFLAG tells the compiler which mode to build for
@@ -42835,21 +42879,97 @@
 
   case "${TOOLCHAIN_TYPE}" in
     microsoft)
+      DISABLE_WARNING_PREFIX="-wd"
       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
       ;;
     solstudio)
+      DISABLE_WARNING_PREFIX="-erroff="
       CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
       ;;
     gcc)
+      # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
+$as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
+  supports=yes
+
+  saved_cflags="$CFLAGS"
+  CFLAGS="$CFLAGS -Wno-this-is-a-warning-that-do-not-exist"
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  supports=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  CFLAGS="$saved_cflags"
+
+  saved_cxxflags="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAG -Wno-this-is-a-warning-that-do-not-exist"
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  supports=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  CXXFLAGS="$saved_cxxflags"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
+$as_echo "$supports" >&6; }
+  if test "x$supports" = "xyes" ; then
+    GCC_CAN_DISABLE_WARNINGS=true
+  else
+    GCC_CAN_DISABLE_WARNINGS=false
+
+  fi
+
+      if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
+        DISABLE_WARNING_PREFIX="-Wno-"
+      else
+        DISABLE_WARNING_PREFIX=
+      fi
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
     clang)
+      DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
   esac
 
 
 
+
 # Setup debug symbols (need objcopy from the toolchain for that)
 
   #
@@ -42915,6 +43035,45 @@
 
 
 
+  # Check whether --enable-native-coverage was given.
+if test "${enable_native_coverage+set}" = set; then :
+  enableval=$enable_native_coverage;
+fi
+
+  GCOV_ENABLED="false"
+  if test "x$enable_native_coverage" = "xyes"; then
+    if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking if native coverage is enabled" >&5
+$as_echo_n "checking if native coverage is enabled... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
+      GCOV_LDFLAGS="-fprofile-arcs"
+      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
+      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
+      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
+      CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
+      CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
+      CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
+      CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
+      LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
+      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
+      GCOV_ENABLED="true"
+    else
+      as_fn_error $? "--enable-native-coverage only works with toolchain type gcc" "$LINENO" 5
+    fi
+  elif test "x$enable_native_coverage" = "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if native coverage is enabled" >&5
+$as_echo_n "checking if native coverage is enabled... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  elif test "x$enable_native_coverage" != "x"; then
+    as_fn_error $? "--enable-native-coverage can only be assigned \"yes\" or \"no\"" "$LINENO" 5
+  fi
+
+
+
+
 ###############################################################################
 #
 # Check dependencies for external and internal libraries.
--- a/common/autoconf/jdk-options.m4	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/autoconf/jdk-options.m4	Wed Jul 05 20:24:03 2017 +0200
@@ -640,3 +640,41 @@
   AC_SUBST(ENABLE_DEBUG_SYMBOLS)
   AC_SUBST(ZIP_DEBUGINFO_FILES)
 ])
+
+################################################################################
+#
+# Gcov coverage data for hotspot
+#
+AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
+[
+  AC_ARG_ENABLE(native-coverage, [AS_HELP_STRING([--enable-native-coverage],
+      [enable native compilation with code coverage data@<:@disabled@:>@])])
+  GCOV_ENABLED="false"
+  if test "x$enable_native_coverage" = "xyes"; then
+    if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
+      AC_MSG_CHECKING([if native coverage is enabled])
+      AC_MSG_RESULT([yes])
+      GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
+      GCOV_LDFLAGS="-fprofile-arcs"
+      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
+      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
+      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
+      CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
+      CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
+      CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
+      CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
+      LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
+      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
+      GCOV_ENABLED="true"
+    else
+      AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc])
+    fi
+  elif test "x$enable_native_coverage" = "xno"; then
+    AC_MSG_CHECKING([if native coverage is enabled])
+    AC_MSG_RESULT([no])
+  elif test "x$enable_native_coverage" != "x"; then
+    AC_MSG_ERROR([--enable-native-coverage can only be assigned "yes" or "no"])
+  fi
+
+  AC_SUBST(GCOV_ENABLED)
+])
--- a/common/autoconf/spec.gmk.in	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 20:24:03 2017 +0200
@@ -292,6 +292,8 @@
 # Enable RMIConnector IIOP transport
 RMICONNECTOR_IIOP=@RMICONNECTOR_IIOP@
 
+GCOV_ENABLED=@GCOV_ENABLED@
+
 # Necessary additional compiler flags to compile X11
 X_CFLAGS:=@X_CFLAGS@
 X_LIBS:=@X_LIBS@
@@ -324,6 +326,7 @@
 C_FLAG_DEPS:=@C_FLAG_DEPS@
 CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
 
+DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
 CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
 
 CFLAGS_CCACHE:=@CFLAGS_CCACHE@
@@ -379,6 +382,16 @@
 # Sometimes a different linker is needed for c++ executables
 LDEXECXX:=@FIXPATH@ @LDEXECXX@
 
+# Compiler and linker flags used when building native tests
+CFLAGS_TESTLIB:=@CFLAGS_TESTLIB@
+CXXFLAGS_TESTLIB:=@CXXFLAGS_TESTLIB@
+CFLAGS_TESTEXE:=@CFLAGS_TESTEXE@
+CXXFLAGS_TESTEXE:=@CXXFLAGS_TESTEXE@
+LDFLAGS_TESTLIB:=@LDFLAGS_TESTLIB@
+LDFLAGS_TESTLIB_SUFFIX:=@LDFLAGS_TESTLIB_SUFFIX@
+LDFLAGS_TESTEXE:=@LDFLAGS_TESTEXE@
+LDFLAGS_TESTEXE_SUFFIX:=@LDFLAGS_TESTEXE_SUFFIX@
+
 # BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the
 # build platform.
 BUILD_CC:=@FIXPATH@ @BUILD_CC@
@@ -701,6 +714,10 @@
 TEST_IMAGE_SUBDIR:=test
 TEST_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
 
+# Symbols image
+SYMBOLS_IMAGE_SUBDIR:=symbols
+SYMBOLS_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR)
+
 # Macosx bundles directory definitions
 JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
 JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
--- a/common/bin/hgforest.sh	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/bin/hgforest.sh	Wed Jul 05 20:24:03 2017 +0200
@@ -26,6 +26,9 @@
 
 usage() {
       echo "usage: $0 [-h|--help] [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] <command> [commands...]" > ${status_output}
+      echo "command format : mercurial-command [ "jdk" ] [ extra-url ]"
+      echo "command option: jdk : used only with clone command to request just the extra repos for JDK-only builds"
+      echo "command option : extra-url : server hosting the extra repositories"
       echo "Environment variables which modify behaviour:"
       echo "   HGFOREST_QUIET      : (boolean) If 'true' then standard output is redirected to /dev/null"
       echo "   HGFOREST_VERBOSE    : (boolean) If 'true' then Mercurial asked to produce verbose output"
@@ -179,7 +182,8 @@
 trap 'nice_exit' EXIT
 
 subrepos="corba jaxp jaxws langtools jdk hotspot nashorn"
-subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs"
+jdk_subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed"
+subrepos_extra="$jdk_subrepos_extra deploy install sponsors pubs"
 
 # Only look in specific locations for possible forests (avoids long searches)
 pull_default=""
@@ -209,6 +213,11 @@
   pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
 
   if [ $# -gt 0 ] ; then
+    if [ "x${1}" = "xjdk" ] ; then
+       subrepos_extra=$jdk_subrepos_extra
+       echo "subrepos being cloned are $subrepos_extra"
+       shift
+    fi
     # if there is an "extra sources" path then reparent "extra" repos to that path
     if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
       echo "ERROR: Need initial clone from non-local source" > ${status_output}
--- a/common/bin/unshuffle_list.txt	Thu Mar 12 13:35:03 2015 -0700
+++ b/common/bin/unshuffle_list.txt	Wed Jul 05 20:24:03 2017 +0200
@@ -1299,15 +1299,14 @@
 jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m : jdk/src/macosx/native/com/apple/concurrent/Dispatch.m
 jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/native/apple/launcher/JavaAppLauncher.m
 jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
-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
 jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver : jdk/src/share/classes/com/sun/net/httpserver
 jdk/src/jdk.httpserver/share/classes/sun/net/httpserver : jdk/src/share/classes/sun/net/httpserver
+jdk/src/jdk.jartool/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
+jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
+jdk/src/jdk.jartool/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
 jdk/src/jdk.jcmd/share/classes/sun/tools/jcmd : jdk/src/share/classes/sun/tools/jcmd
 jdk/src/jdk.jcmd/share/classes/sun/tools/jinfo : jdk/src/share/classes/sun/tools/jinfo
 jdk/src/jdk.jcmd/share/classes/sun/tools/jmap : jdk/src/share/classes/sun/tools/jmap
@@ -1433,6 +1432,27 @@
 jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns : jdk/src/share/classes/sun/net/spi/nameservice/dns
 jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry : jdk/src/share/classes/com/sun/jndi/rmi/registry
 jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/url/rmi : jdk/src/share/classes/com/sun/jndi/url/rmi
+jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/bands.h : jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
+jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/bytes.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/bytes.h : jdk/src/share/native/com/sun/java/util/jar/pack/bytes.h
+jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/coding.h : jdk/src/share/native/com/sun/java/util/jar/pack/coding.h
+jdk/src/jdk.pack200/share/native/common-unpack/constants.h : jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
+jdk/src/jdk.pack200/share/native/common-unpack/defines.h : jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
+jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/unpack.h : jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
+jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/utils.h : jdk/src/share/native/com/sun/java/util/jar/pack/utils.h
+jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+jdk/src/jdk.pack200/share/native/common-unpack/zip.h : jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
+jdk/src/jdk.pack200/share/native/libjsdt : jdk/src/share/native/sun/tracing/dtrace
+jdk/src/jdk.pack200/share/native/libunpack/jni.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
+jdk/src/jdk.pack200/share/native/unpack200/main.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
+jdk/src/jdk.pack200/unix/native/libjsdt/jvm_symbols_md.c : jdk/src/solaris/native/sun/tracing/dtrace/jvm_symbols_md.c
+jdk/src/jdk.pack200/windows/native/libjsdt/jvm_symbols_md.c : jdk/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c
+jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest : jdk/src/windows/resource/unpack200_proto.exe.manifest
+jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool : jdk/src/share/classes/sun/security/tools/policytool
 jdk/src/jdk.rmic/share/classes/sun/rmi/rmic : jdk/src/share/classes/sun/rmi/rmic
 jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/newrmic : jdk/src/share/classes/sun/rmi/rmic/newrmic
 jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/newrmic/jrmp : jdk/src/share/classes/sun/rmi/rmic/newrmic/jrmp
@@ -1442,28 +1462,6 @@
 jdk/src/jdk.rmic/share/classes/sun/tools/java : jdk/src/share/classes/sun/tools/java
 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/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
-jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/bytes.cpp
-jdk/src/jdk.runtime/share/native/common-unpack/bytes.h : jdk/src/share/native/com/sun/java/util/jar/pack/bytes.h
-jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp
-jdk/src/jdk.runtime/share/native/common-unpack/coding.h : jdk/src/share/native/com/sun/java/util/jar/pack/coding.h
-jdk/src/jdk.runtime/share/native/common-unpack/constants.h : jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
-jdk/src/jdk.runtime/share/native/common-unpack/defines.h : jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
-jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
-jdk/src/jdk.runtime/share/native/common-unpack/unpack.h : jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
-jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp
-jdk/src/jdk.runtime/share/native/common-unpack/utils.h : jdk/src/share/native/com/sun/java/util/jar/pack/utils.h
-jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
-jdk/src/jdk.runtime/share/native/common-unpack/zip.h : jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
-jdk/src/jdk.runtime/share/native/libjsdt : jdk/src/share/native/sun/tracing/dtrace
-jdk/src/jdk.runtime/share/native/libunpack/jni.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
-jdk/src/jdk.runtime/share/native/unpack200/main.cpp : jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
-jdk/src/jdk.runtime/unix/native/libjsdt/jvm_symbols_md.c : jdk/src/solaris/native/sun/tracing/dtrace/jvm_symbols_md.c
-jdk/src/jdk.runtime/windows/native/libjsdt/jvm_symbols_md.c : jdk/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c
-jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest : jdk/src/windows/resource/unpack200_proto.exe.manifest
 jdk/src/jdk.sctp/macosx/classes/sun/nio/ch/sctp : jdk/src/macosx/classes/sun/nio/ch/sctp
 jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp : jdk/src/share/classes/com/sun/nio/sctp
 jdk/src/jdk.sctp/share/classes/sun/nio/ch/sctp : jdk/src/share/classes/sun/nio/ch/sctp
--- a/hotspot/.hgtags	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 20:24:03 2017 +0200
@@ -456,3 +456,4 @@
 403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
 9fb7fdc554db5be5c5b10f88f529ec3b870c44e3 jdk9-b52
 effd5ef0c3eb4bb85aa975c489d6761dbf13ad6a jdk9-b53
+c3b117fa5bdedfafd9ed236403e6d406911195b1 jdk9-b54
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Wed Jul 05 20:24:03 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.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -2204,7 +2204,8 @@
 
 // Write the card table byte if needed.
 void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
-  CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+  CardTableModRefBS* bs =
+    barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
   assert(bs->kind() == BarrierSet::CardTableModRef ||
          bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
 #ifdef ASSERT
@@ -2310,9 +2311,8 @@
   Label& filtered = (filtered_ext != NULL) ? *filtered_ext : filtered_int;
   assert_different_registers(Rstore_addr, Rnew_val, Rtmp1, Rtmp2);
 
-  G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
-  assert(bs->kind() == BarrierSet::G1SATBCT ||
-         bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+  G1SATBCardTableLoggingModRefBS* bs =
+    barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
 
   // Does store cross heap regions?
   if (G1RSBarrierRegionFilter) {
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -694,7 +694,7 @@
             __ release();
           }
 
-          CardTableModRefBS* const ct = (CardTableModRefBS*)bs;
+          CardTableModRefBS* const ct = barrier_set_cast<CardTableModRefBS>(bs);
           assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
           assert_different_registers(addr, count, tmp);
 
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Jul 05 20:24:03 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
@@ -916,7 +916,7 @@
         Register cardtable = G5;
         Register tmp  = G1_scratch;
         Register tmp2 = G3_scratch;
-        jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
+        jbyte* byte_map_base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
 
         Label not_already_dirty, restart, refill, young_card;
 
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -3858,9 +3858,8 @@
 
   if (new_val == G0) return;
 
-  G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
-  assert(bs->kind() == BarrierSet::G1SATBCT ||
-         bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+  G1SATBCardTableLoggingModRefBS* bs =
+    barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
 
   if (G1RSBarrierRegionFilter) {
     xor3(store_addr, new_val, tmp);
@@ -3904,7 +3903,8 @@
 void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) {
   // If we're writing constant NULL, we can skip the write barrier.
   if (new_val == G0) return;
-  CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+  CardTableModRefBS* bs =
+    barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
   assert(bs->kind() == BarrierSet::CardTableModRef ||
          bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
   card_table_write(bs->byte_map_base, tmp, store_addr);
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Wed Jul 05 20:24:03 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
@@ -1019,7 +1019,7 @@
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
         {
-          CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+          CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
           assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
           assert_different_registers(addr, count, tmp);
 
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Jul 05 20:24:03 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
@@ -1718,8 +1718,8 @@
         // arg0: store_address
         Address store_addr(rbp, 2*BytesPerWord);
 
-        BarrierSet* bs = Universe::heap()->barrier_set();
-        CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+        CardTableModRefBS* ct =
+          barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
 
         Label done;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -4204,8 +4204,8 @@
   Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
                                        PtrQueue::byte_offset_of_buf()));
 
-  BarrierSet* bs = Universe::heap()->barrier_set();
-  CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+  CardTableModRefBS* ct =
+    barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
 
   Label done;
@@ -4305,7 +4305,7 @@
 void MacroAssembler::store_check_part_2(Register obj) {
   BarrierSet* bs = Universe::heap()->barrier_set();
   assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
-  CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+  CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
 
   // The calculation for byte_map_base is as follows:
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Jul 05 20:24:03 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
@@ -752,7 +752,7 @@
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
         {
-          CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+          CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
           assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
 
           Label L_loop;
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Jul 05 20:24:03 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
@@ -1272,7 +1272,7 @@
       case BarrierSet::CardTableModRef:
       case BarrierSet::CardTableExtension:
         {
-          CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+          CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
           assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
 
           Label L_loop;
--- a/hotspot/src/os/windows/vm/attachListener_windows.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/os/windows/vm/attachListener_windows.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -62,7 +62,7 @@
 class Win32AttachListener: AllStatic {
  private:
   enum {
-    preallocate_count = 4                   // number of preallocated operations
+    max_enqueued_operations = 4
   };
 
   // protects the preallocated list and the operation list
@@ -83,9 +83,12 @@
   static void set_tail(Win32AttachOperation* tail)          { _tail = tail; }
 
 
-  // used to wakeup the listener
-  static HANDLE _wakeup;
-  static HANDLE wakeup()                                    { return _wakeup; }
+  // A semaphore is used for communication about enqueued operations.
+  // The maximum count for the semaphore object will be set to "max_enqueued_operations".
+  // The state of a semaphore is signaled when its count is greater than
+  // zero (there are operations enqueued), and nonsignaled when it is zero.
+  static HANDLE _enqueued_ops_semaphore;
+  static HANDLE enqueued_ops_semaphore() { return _enqueued_ops_semaphore; }
 
  public:
   enum {
@@ -110,7 +113,7 @@
 
 // statics
 HANDLE Win32AttachListener::_mutex;
-HANDLE Win32AttachListener::_wakeup;
+HANDLE Win32AttachListener::_enqueued_ops_semaphore;
 Win32AttachOperation* Win32AttachListener::_avail;
 Win32AttachOperation* Win32AttachListener::_head;
 Win32AttachOperation* Win32AttachListener::_tail;
@@ -155,20 +158,19 @@
 };
 
 
-// preallocate the required number of operations
+// Preallocate the maximum number of operations that can be enqueued.
 int Win32AttachListener::init() {
   _mutex = (void*)::CreateMutex(NULL, FALSE, NULL);
   guarantee(_mutex != (HANDLE)NULL, "mutex creation failed");
 
-  _wakeup = ::CreateSemaphore(NULL, 0, 1, NULL);
-  guarantee(_wakeup != (HANDLE)NULL, "semaphore creation failed");
+  _enqueued_ops_semaphore = ::CreateSemaphore(NULL, 0, max_enqueued_operations, NULL);
+  guarantee(_enqueued_ops_semaphore != (HANDLE)NULL, "semaphore creation failed");
 
   set_head(NULL);
   set_tail(NULL);
+  set_available(NULL);
 
-  // preallocate a few operations
-  set_available(NULL);
-  for (int i=0; i<preallocate_count; i++) {
+  for (int i=0; i<max_enqueued_operations; i++) {
     Win32AttachOperation* op = new Win32AttachOperation();
     op->set_next(available());
     set_available(op);
@@ -221,8 +223,12 @@
     op->set_arg(2, arg2);
     op->set_pipe(pipename);
 
-    // wakeup the thread waiting for operations
-    ::ReleaseSemaphore(wakeup(), 1, NULL);
+    // Increment number of enqueued operations.
+    // Side effect: Semaphore will be signaled and will release
+    // any blocking waiters (i.e. the AttachListener thread).
+    BOOL not_exceeding_semaphore_maximum_count =
+      ::ReleaseSemaphore(enqueued_ops_semaphore(), 1, NULL);
+    guarantee(not_exceeding_semaphore_maximum_count, "invariant");
   }
   ::ReleaseMutex(mutex());
 
@@ -230,10 +236,12 @@
 }
 
 
-// dequeue the operation from the head of the operation list. If
+// dequeue the operation from the head of the operation list.
 Win32AttachOperation* Win32AttachListener::dequeue() {
   for (;;) {
-    DWORD res = ::WaitForSingleObject(wakeup(), INFINITE);
+    DWORD res = ::WaitForSingleObject(enqueued_ops_semaphore(), INFINITE);
+    // returning from WaitForSingleObject will have decreased
+    // the current count of the semaphore by 1.
     guarantee(res == WAIT_OBJECT_0, "wait failed");
 
     res = ::WaitForSingleObject(mutex(), INFINITE);
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Wed Jul 05 20:24:03 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
@@ -2105,8 +2105,14 @@
 
 // LIR_OpProfileType
 void LIR_OpProfileType::print_instr(outputStream* out) const {
-  out->print("exact = "); exact_klass()->print_name_on(out);
-  out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
+  out->print("exact = ");
+  if  (exact_klass() == NULL) {
+    out->print("unknown");
+  } else {
+    exact_klass()->print_name_on(out);
+  }
+  out->print(" current = "); ciTypeEntries::print_ciklass(out, current_klass());
+  out->print(" ");
   mdp()->print(out);          out->print(" ");
   obj()->print(out);          out->print(" ");
   tmp()->print(out);          out->print(" ");
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1582,9 +1582,9 @@
 ////////////////////////////////////////////////////////////////////////
 
 void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
-
-  assert(sizeof(*((CardTableModRefBS*)_bs)->byte_map_base) == sizeof(jbyte), "adjust this code");
-  LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base);
+  CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(_bs);
+  assert(sizeof(*(ct->byte_map_base)) == sizeof(jbyte), "adjust this code");
+  LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base);
   if (addr->is_address()) {
     LIR_Address* address = addr->as_address_ptr();
     // ptr cannot be an object because we use this barrier for array card marks
@@ -1609,7 +1609,6 @@
     __ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
   }
 
-  CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
   LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
   if(((int)ct->byte_map_base & 0xff) == 0) {
     __ move(tmp, card_addr);
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -43,7 +43,7 @@
   #define TRACE_BCEA(level, code)
 #endif
 
-// Maintain a map of which aguments a local variable or
+// Maintain a map of which arguments a local variable or
 // stack slot may contain.  In addition to tracking
 // arguments, it tracks two special values, "allocated"
 // which represents any object allocated in the current
@@ -319,14 +319,16 @@
     bool must_record_dependencies = false;
     for (i = arg_size - 1; i >= 0; i--) {
       ArgumentMap arg = state.raw_pop();
-      if (!is_argument(arg))
+      // Check if callee arg is a caller arg or an allocated object
+      bool allocated = arg.contains_allocated();
+      if (!(is_argument(arg) || allocated))
         continue;
       for (int j = 0; j < _arg_size; j++) {
         if (arg.contains(j)) {
           _arg_modified[j] |= analyzer._arg_modified[i];
         }
       }
-      if (!is_arg_stack(arg)) {
+      if (!(is_arg_stack(arg) || allocated)) {
         // arguments have already been recognized as escaping
       } else if (analyzer.is_arg_stack(i) && !analyzer.is_arg_returned(i)) {
         set_method_escape(arg);
@@ -1392,12 +1394,12 @@
   method()->print_short_name();
   tty->print_cr(has_dependencies() ? " (not stored)" : "");
   tty->print("     non-escaping args:      ");
-  _arg_local.print_on(tty);
+  _arg_local.print();
   tty->print("     stack-allocatable args: ");
-  _arg_stack.print_on(tty);
+  _arg_stack.print();
   if (_return_local) {
     tty->print("     returned args:          ");
-    _arg_returned.print_on(tty);
+    _arg_returned.print();
   } else if (is_return_allocated()) {
     tty->print_cr("     return allocated value");
   } else {
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Wed Jul 05 20:24:03 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
@@ -1091,6 +1091,7 @@
     }
     // update idnum for new location
     merged_methods->at(i)->set_method_idnum(i);
+    merged_methods->at(i)->set_orig_method_idnum(i);
   }
 
   // Verify correct order
--- a/hotspot/src/share/vm/code/codeCache.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -360,7 +360,7 @@
  * run the constructor for the CodeBlob subclass he is busy
  * instantiating.
  */
-CodeBlob* CodeCache::allocate(int size, int code_blob_type) {
+CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool strict) {
   // Possibly wakes up the sweeper thread.
   NMethodSweeper::notify(code_blob_type);
   assert_locked_or_safepoint(CodeCache_lock);
@@ -379,11 +379,28 @@
     if (cb != NULL) break;
     if (!heap->expand_by(CodeCacheExpansionSize)) {
       // Expansion failed
-      if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonNMethod)) {
-        // Fallback solution: Store non-nmethod code in the non-profiled code heap.
-        // Note that at in the sweeper, we check the reverse_free_ratio of the non-profiled
-        // code heap and force stack scanning if less than 10% if the code heap are free.
-        return allocate(size, CodeBlobType::MethodNonProfiled);
+      if (SegmentedCodeCache && !strict) {
+        // Fallback solution: Try to store code in another code heap.
+        // Note that in the sweeper, we check the reverse_free_ratio of the code heap
+        // and force stack scanning if less than 10% of the code heap are free.
+        int type = code_blob_type;
+        switch (type) {
+        case CodeBlobType::NonNMethod:
+          type = CodeBlobType::MethodNonProfiled;
+          strict = false;   // Allow recursive search for other heaps
+          break;
+        case CodeBlobType::MethodProfiled:
+          type = CodeBlobType::MethodNonProfiled;
+          strict = true;
+          break;
+        case CodeBlobType::MethodNonProfiled:
+          type = CodeBlobType::MethodProfiled;
+          strict = true;
+          break;
+        }
+        if (heap_available(type)) {
+          return allocate(size, type, strict);
+        }
       }
       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       CompileBroker::handle_full_code_cache(code_blob_type);
--- a/hotspot/src/share/vm/code/codeCache.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -122,7 +122,7 @@
   static void initialize();
 
   // Allocation/administration
-  static CodeBlob* allocate(int size, int code_blob_type); // allocates a new CodeBlob
+  static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
   static void commit(CodeBlob* cb);                        // called when the allocated CodeBlob has been filled
   static int  alignment_unit();                            // guaranteed alignment of all CodeBlobs
   static int  alignment_offset();                          // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -343,8 +343,8 @@
     }
 
     BarrierSet* bs = Universe::heap()->barrier_set();
-    if (bs->kind() == BarrierSet::CardTableModRef &&
-        adr == (address)((CardTableModRefBS*)(bs))->byte_map_base) {
+    if (bs->is_a(BarrierSet::CardTableModRef) &&
+        adr == (address)(barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base)) {
       st->print("word_map_base");
       if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr);
       return;
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Wed Jul 05 20:24:03 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
@@ -97,9 +97,7 @@
 void ConcurrentMarkSweepThread::run() {
   assert(this == cmst(), "just checking");
 
-  this->record_stack_base_and_size();
-  this->initialize_thread_local_storage();
-  this->set_active_handles(JNIHandleBlock::allocate_block());
+  initialize_in_thread();
   // From this time Thread::current() should be working.
   assert(this == Thread::current(), "just checking");
   if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) {
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 20:24:03 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
@@ -1440,7 +1440,7 @@
   CMCountDataClosureBase(G1CollectedHeap* g1h,
                          BitMap* region_bm, BitMap* card_bm):
     _g1h(g1h), _cm(g1h->concurrent_mark()),
-    _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+    _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
     _region_bm(region_bm), _card_bm(card_bm) { }
 };
 
@@ -3111,7 +3111,7 @@
                               BitMap* cm_card_bm,
                               uint max_worker_id) :
     _g1h(g1h), _cm(g1h->concurrent_mark()),
-    _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+    _ct_bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
     _cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
 
   bool doHeapRegion(HeapRegion* hr) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
   if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
     G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
     add_to_alloc_buffer_waste(alloc_buf->words_remaining());
-    alloc_buf->retire(false /* end_of_gc */, false /* retain */);
+    alloc_buf->retire();
 
     HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context);
     if (buf == NULL) {
@@ -154,9 +154,7 @@
     G1ParGCAllocBuffer* const buf = _alloc_buffers[state];
     if (buf != NULL) {
       add_to_alloc_buffer_waste(buf->words_remaining());
-      buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state),
-                                  true /* end_of_gc */,
-                                  false /* retain */);
+      buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state));
     }
   }
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,11 +159,11 @@
     _retired = false;
   }
 
-  virtual void retire(bool end_of_gc, bool retain) {
+  virtual void retire() {
     if (_retired) {
       return;
     }
-    ParGCAllocBuffer::retire(end_of_gc, retain);
+    ParGCAllocBuffer::retire();
     _retired = true;
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1274,7 +1274,7 @@
   virtual bool is_in_closed_subset(const void* p) const;
 
   G1SATBCardTableLoggingModRefBS* g1_barrier_set() {
-    return (G1SATBCardTableLoggingModRefBS*) barrier_set();
+    return barrier_set_cast<G1SATBCardTableLoggingModRefBS>(barrier_set());
   }
 
   // This resets the card table to all zeros.  It is used after
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -33,8 +33,11 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
-G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
-  CardTableModRefBS(whole_heap, kind) { }
+G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(
+  MemRegion whole_heap,
+  const BarrierSet::FakeRtti& fake_rtti) :
+  CardTableModRefBS(whole_heap, fake_rtti.add_tag(BarrierSet::G1SATBCT))
+{ }
 
 void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
   // Nulls should have been already filtered.
@@ -130,7 +133,7 @@
 
 G1SATBCardTableLoggingModRefBS::
 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) :
-  G1SATBCardTableModRefBS(whole_heap, BarrierSet::G1SATBCTLogging),
+  G1SATBCardTableModRefBS(whole_heap, BarrierSet::FakeRtti(G1SATBCTLogging)),
   _dcqs(JavaThread::dirty_card_queue_set()),
   _listener()
 {
@@ -203,7 +206,7 @@
   if (new_val == NULL) return;
   // Otherwise, log it.
   G1SATBCardTableLoggingModRefBS* g1_bs =
-    (G1SATBCardTableLoggingModRefBS*)Universe::heap()->barrier_set();
+    barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
   g1_bs->write_ref_field_work(field, new_val);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -43,7 +43,7 @@
     g1_young_gen = CT_MR_BS_last_reserved << 1
   };
 
-  G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+  G1SATBCardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
   ~G1SATBCardTableModRefBS() { }
 
 public:
@@ -53,10 +53,6 @@
   // pre-marking object graph.
   static void enqueue(oop pre_val);
 
-  bool is_a(BarrierSet::Name bsn) {
-    return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn);
-  }
-
   virtual bool has_write_ref_pre_barrier() { return true; }
 
   // This notes that we don't need to access any BarrierSet data
@@ -128,6 +124,11 @@
   }
 };
 
+template<>
+struct BarrierSet::GetName<G1SATBCardTableModRefBS> {
+  static const BarrierSet::Name value = BarrierSet::G1SATBCT;
+};
+
 class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener {
  private:
   G1SATBCardTableLoggingModRefBS* _card_table;
@@ -159,11 +160,6 @@
 
   virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
 
-  bool is_a(BarrierSet::Name bsn) {
-    return bsn == BarrierSet::G1SATBCTLogging ||
-      G1SATBCardTableModRefBS::is_a(bsn);
-  }
-
   void write_ref_field_work(void* field, oop new_val, bool release = false);
 
   // Can be called from static contexts.
@@ -177,4 +173,9 @@
   void write_ref_array_work(MemRegion mr) { invalidate(mr); }
 };
 
+template<>
+struct BarrierSet::GetName<G1SATBCardTableLoggingModRefBS> {
+  static const BarrierSet::Name value = BarrierSet::G1SATBCTLogging;
+};
+
 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -193,7 +193,7 @@
   HeapRegionRemSet* hrrs = rem_set();
   hrrs->clear();
   CardTableModRefBS* ct_bs =
-                   (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set();
+    barrier_set_cast<CardTableModRefBS>(G1CollectedHeap::heap()->barrier_set());
   ct_bs->clear(MemRegion(bottom(), end()));
 }
 
@@ -643,13 +643,9 @@
   // _vo == UseNextMarking -> use "next" marking information,
   // _vo == UseMarkWord    -> use mark word from object header.
   VerifyLiveClosure(G1CollectedHeap* g1h, VerifyOption vo) :
-    _g1h(g1h), _bs(NULL), _containing_obj(NULL),
-    _failures(false), _n_failures(0), _vo(vo)
-  {
-    BarrierSet* bs = _g1h->barrier_set();
-    if (bs->is_a(BarrierSet::CardTableModRef))
-      _bs = (CardTableModRefBS*)bs;
-  }
+    _g1h(g1h), _bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())),
+    _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo)
+  { }
 
   void set_containing_obj(oop obj) {
     _containing_obj = obj;
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 20:24:03 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
@@ -232,7 +232,7 @@
     if (word_sz * 100 <
         ParallelGCBufferWastePct * plab->word_sz()) {
       // Is small enough; abandon this buffer and start a new one.
-      plab->retire(false, false);
+      plab->retire();
       size_t buf_size = plab->word_sz();
       HeapWord* buf_space = sp->par_allocate(buf_size);
       if (buf_space == NULL) {
@@ -463,10 +463,7 @@
 
     // Flush stats related to To-space PLAB activity and
     // retire the last buffer.
-    par_scan_state.to_space_alloc_buffer()->
-      flush_stats_and_retire(_gen.plab_stats(),
-                             true /* end_of_gc */,
-                             false /* retain */);
+    par_scan_state.to_space_alloc_buffer()->flush_and_retire_stats(_gen.plab_stats());
 
     // Every thread has its own age table.  We need to merge
     // them all into one.
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Wed Jul 05 20:24:03 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
@@ -81,7 +81,7 @@
     assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
 
     _young_gen = heap->young_gen();
-    _card_table = (CardTableExtension*)heap->barrier_set();
+    _card_table = barrier_set_cast<CardTableExtension>(heap->barrier_set());
     // No point in asserting barrier set type here. Need to make CardTableExtension
     // a unique barrier set type.
   }
@@ -341,7 +341,9 @@
 
   PSOldGen* old_gen = heap->old_gen();
 
-  CheckForPreciseMarks check(heap->young_gen(), (CardTableExtension*)heap->barrier_set());
+  CheckForPreciseMarks check(
+    heap->young_gen(),
+    barrier_set_cast<CardTableExtension>(heap->barrier_set()));
 
   old_gen->oop_iterate_no_header(&check);
 
@@ -349,8 +351,8 @@
 }
 
 void CardTableExtension::verify_all_young_refs_precise_helper(MemRegion mr) {
-  CardTableExtension* card_table = (CardTableExtension*)Universe::heap()->barrier_set();
-  // FIX ME ASSERT HERE
+  CardTableExtension* card_table =
+    barrier_set_cast<CardTableExtension>(Universe::heap()->barrier_set());
 
   jbyte* bot = card_table->byte_for(mr.start());
   jbyte* top = card_table->byte_for(mr.end());
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -54,10 +54,16 @@
   };
 
   CardTableExtension(MemRegion whole_heap) :
-    CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) { }
-
-  // Too risky for the 4/10/02 putback
-  // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
+    CardTableModRefBS(
+      whole_heap,
+      // Concrete tag should be BarrierSet::CardTableExtension.
+      // That will presently break things in a bunch of places though.
+      // The concrete tag is used as a dispatch key in many places, and
+      // CardTableExtension does not correctly dispatch in some of those
+      // uses. This will be addressed as part of a reorganization of the
+      // BarrierSet hierarchy.
+      BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableExtension))
+    { }
 
   // Scavenge support
   void scavenge_contents_parallel(ObjectStartArray* start_array,
@@ -110,4 +116,9 @@
 #endif // ASSERT
 };
 
+template<>
+struct BarrierSet::GetName<CardTableExtension> {
+  static const BarrierSet::Name value = BarrierSet::CardTableExtension;
+};
+
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,6 +1,6 @@
 
 /*
- * 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
@@ -98,6 +98,7 @@
   // Set up the thread for stack overflow support
   this->record_stack_base_and_size();
   this->initialize_thread_local_storage();
+  this->initialize_named_thread();
   // Bind yourself to your processor.
   if (processor_id() != GCTaskManager::sentinel_worker()) {
     if (TraceGCTaskThread) {
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,6 +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
@@ -233,15 +232,12 @@
                       young_gen->to_space()->is_empty();
     young_gen_empty = eden_empty && survivors_empty;
 
-    BarrierSet* bs = heap->barrier_set();
-    if (bs->is_a(BarrierSet::ModRef)) {
-      ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
-      MemRegion old_mr = heap->old_gen()->reserved();
-      if (young_gen_empty) {
-        modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
-      } else {
-        modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
-      }
+    ModRefBarrierSet* modBS = barrier_set_cast<ModRefBarrierSet>(heap->barrier_set());
+    MemRegion old_mr = heap->old_gen()->reserved();
+    if (young_gen_empty) {
+      modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+    } else {
+      modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
     }
 
     // Delete metaspaces for unloaded class loaders and clean up loader_data graph
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Wed Jul 05 20:24:03 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
@@ -111,8 +111,8 @@
 
   Universe::heap()->barrier_set()->resize_covered_region(cmr);
 
-  CardTableModRefBS* _ct = (CardTableModRefBS*)Universe::heap()->barrier_set();
-  assert (_ct->kind() == BarrierSet::CardTableModRef, "Sanity");
+  CardTableModRefBS* _ct =
+    barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
 
   // Verify that the start and end of this generation is the start of a card.
   // If this wasn't true, a single card could span more than one generation,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 20:24:03 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
@@ -1050,16 +1050,12 @@
   bool young_gen_empty = eden_empty && from_space->is_empty() &&
     to_space->is_empty();
 
-  BarrierSet* bs = heap->barrier_set();
-  if (bs->is_a(BarrierSet::ModRef)) {
-    ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
-    MemRegion old_mr = heap->old_gen()->reserved();
-
-    if (young_gen_empty) {
-      modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
-    } else {
-      modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
-    }
+  ModRefBarrierSet* modBS = barrier_set_cast<ModRefBarrierSet>(heap->barrier_set());
+  MemRegion old_mr = heap->old_gen()->reserved();
+  if (young_gen_empty) {
+    modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+  } else {
+    modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
   }
 
   // Delete metaspaces for unloaded class loaders and clean up loader_data graph
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,6 +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
@@ -866,9 +865,7 @@
                            NULL);                      // header provides liveness info
 
   // Cache the cardtable
-  BarrierSet* bs = Universe::heap()->barrier_set();
-  assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
-  _card_table = (CardTableExtension*)bs;
+  _card_table = barrier_set_cast<CardTableExtension>(heap->barrier_set());
 
   _counters = new CollectorCounters("PSScavenge", 0);
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, 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
@@ -183,8 +183,8 @@
     PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
 
     assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
-    CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set();
-    // FIX ME! Assert that card_table is the type we believe it to be.
+    CardTableExtension* card_table =
+      barrier_set_cast<CardTableExtension>(Universe::heap()->barrier_set());
 
     card_table->scavenge_contents_parallel(_gen->start_array(),
                                            _gen->object_space(),
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Wed Jul 05 20:24:03 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
@@ -56,6 +56,7 @@
 void ConcurrentGCThread::initialize_in_thread() {
   this->record_stack_base_and_size();
   this->initialize_thread_local_storage();
+  this->initialize_named_thread();
   this->set_active_handles(JNIHandleBlock::allocate_block());
   // From this time Thread::current() should be working.
   assert(this == Thread::current(), "just checking");
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Wed Jul 05 20:24:03 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
@@ -24,27 +24,30 @@
 
 #include "precompiled.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
-#include "memory/sharedHeap.hpp"
+#include "memory/threadLocalAllocBuffer.hpp"
 #include "oops/arrayOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "utilities/globalDefinitions.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+size_t ParGCAllocBuffer::min_size() {
+  // Make sure that we return something that is larger than AlignmentReserve
+  return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
+}
+
+size_t ParGCAllocBuffer::max_size() {
+  return ThreadLocalAllocBuffer::max_size();
+}
 
 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
-  _end(NULL), _hard_end(NULL),
-  _retained(false), _retained_filler(),
-  _allocated(0), _wasted(0)
+  _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0)
 {
-  assert (min_size() > AlignmentReserve, "Inconsistency!");
-  // arrayOopDesc::header_size depends on command line initialization.
-  FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT));
-  AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0;
+  // ArrayOopDesc::header_size depends on command line initialization.
+  AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
+  assert(min_size() > AlignmentReserve,
+         err_msg("Minimum PLAB size " SIZE_FORMAT" must be larger than alignment reserve " SIZE_FORMAT" "
+                 "to be able to contain objects", min_size(), AlignmentReserve));
 }
 
-size_t ParGCAllocBuffer::FillerHeaderSize;
-
 // If the minimum object size is greater than MinObjAlignment, we can
 // end up with a shard at the end of the buffer that's smaller than
 // the smallest object.  We can't allow that because the buffer must
@@ -52,39 +55,33 @@
 // sure we have enough space for a filler int array object.
 size_t ParGCAllocBuffer::AlignmentReserve;
 
-void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) {
-  assert(!retain || end_of_gc, "Can only retain at GC end.");
-  if (_retained) {
-    // If the buffer had been retained shorten the previous filler object.
-    assert(_retained_filler.end() <= _top, "INVARIANT");
-    CollectedHeap::fill_with_object(_retained_filler);
-    // Wasted space book-keeping, otherwise (normally) done in invalidate()
-    _wasted += _retained_filler.word_size();
-    _retained = false;
-  }
-  assert(!end_of_gc || !_retained, "At this point, end_of_gc ==> !_retained.");
+void ParGCAllocBuffer::flush_and_retire_stats(PLABStats* stats) {
+  // Retire the last allocation buffer.
+  size_t unused = retire_internal();
+
+  // Now flush the statistics.
+  stats->add_allocated(_allocated);
+  stats->add_wasted(_wasted);
+  stats->add_unused(unused);
+
+  // Since we have flushed the stats we need to clear  the _allocated and _wasted
+  // fields in case somebody retains an instance of this over GCs. Not doing so
+  // will artifically inflate the values in the statistics.
+  _allocated = 0;
+  _wasted = 0;
+}
+
+void ParGCAllocBuffer::retire() {
+  _wasted += retire_internal();
+}
+
+size_t ParGCAllocBuffer::retire_internal() {
+  size_t result = 0;
   if (_top < _hard_end) {
     CollectedHeap::fill_with_object(_top, _hard_end);
-    if (!retain) {
-      invalidate();
-    } else {
-      // Is there wasted space we'd like to retain for the next GC?
-      if (pointer_delta(_end, _top) > FillerHeaderSize) {
-        _retained = true;
-        _retained_filler = MemRegion(_top, FillerHeaderSize);
-        _top = _top + FillerHeaderSize;
-      } else {
-        invalidate();
-      }
-    }
+    result += invalidate();
   }
-}
-
-void ParGCAllocBuffer::flush_stats(PLABStats* stats) {
-  assert(ResizePLAB, "Wasted work");
-  stats->add_allocated(_allocated);
-  stats->add_wasted(_wasted);
-  stats->add_unused(pointer_delta(_end, _top));
+  return result;
 }
 
 // Compute desired plab size and latch result for later
@@ -101,44 +98,37 @@
            err_msg("Inconsistency in PLAB stats: "
                    "_allocated: "SIZE_FORMAT", "
                    "_wasted: "SIZE_FORMAT", "
-                   "_unused: "SIZE_FORMAT", "
-                   "_used  : "SIZE_FORMAT,
-                   _allocated, _wasted, _unused, _used));
+                   "_unused: "SIZE_FORMAT,
+                   _allocated, _wasted, _unused));
 
     _allocated = 1;
   }
-  double wasted_frac    = (double)_unused/(double)_allocated;
-  size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
-                                   TargetPLABWastePct);
+  double wasted_frac    = (double)_unused / (double)_allocated;
+  size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct);
   if (target_refills == 0) {
     target_refills = 1;
   }
-  _used = _allocated - _wasted - _unused;
-  size_t plab_sz = _used/(target_refills*no_of_gc_workers);
-  if (PrintPLAB) gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " ", plab_sz);
+  size_t used = _allocated - _wasted - _unused;
+  size_t recent_plab_sz = used / (target_refills * no_of_gc_workers);
   // Take historical weighted average
-  _filter.sample(plab_sz);
+  _filter.sample(recent_plab_sz);
   // Clip from above and below, and align to object boundary
-  plab_sz = MAX2(min_size(), (size_t)_filter.average());
-  plab_sz = MIN2(max_size(), plab_sz);
-  plab_sz = align_object_size(plab_sz);
+  size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average());
+  new_plab_sz = MIN2(max_size(), new_plab_sz);
+  new_plab_sz = align_object_size(new_plab_sz);
   // Latch the result
-  if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = " SIZE_FORMAT ") ", plab_sz);
-  _desired_plab_sz = plab_sz;
-  // Now clear the accumulators for next round:
-  // note this needs to be fixed in the case where we
-  // are retaining across scavenges. FIX ME !!! XXX
-  _allocated = 0;
-  _wasted    = 0;
-  _unused    = 0;
+  if (PrintPLAB) {
+    gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT" desired_plab_sz = " SIZE_FORMAT") ", recent_plab_sz, new_plab_sz);
+  }
+  _desired_plab_sz = new_plab_sz;
+
+  reset();
 }
 
 #ifndef PRODUCT
 void ParGCAllocBuffer::print() {
-  gclog_or_tty->print("parGCAllocBuffer: _bottom: " PTR_FORMAT "  _top: " PTR_FORMAT
-             "  _end: " PTR_FORMAT "  _hard_end: " PTR_FORMAT " _retained: %c"
-             " _retained_filler: [" PTR_FORMAT "," PTR_FORMAT ")\n",
-             _bottom, _top, _end, _hard_end,
-             "FT"[_retained], _retained_filler.start(), _retained_filler.end());
+  gclog_or_tty->print_cr("parGCAllocBuffer: _bottom: " PTR_FORMAT "  _top: " PTR_FORMAT
+    "  _end: " PTR_FORMAT "  _hard_end: " PTR_FORMAT ")",
+    p2i(_bottom), p2i(_top), p2i(_end), p2i(_hard_end));
 }
 #endif // !PRODUCT
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -24,37 +24,43 @@
 
 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
-#include "gc_interface/collectedHeap.hpp"
+
+#include "gc_implementation/shared/gcUtil.hpp"
 #include "memory/allocation.hpp"
-#include "memory/blockOffsetTable.hpp"
-#include "memory/threadLocalAllocBuffer.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-// Forward decl.
-
+// Forward declarations.
 class PLABStats;
 
 // A per-thread allocation buffer used during GC.
 class ParGCAllocBuffer: public CHeapObj<mtGC> {
 protected:
-  char head[32];
-  size_t _word_sz;          // in HeapWord units
+  char      head[32];
+  size_t    _word_sz;          // In HeapWord units
   HeapWord* _bottom;
   HeapWord* _top;
-  HeapWord* _end;       // last allocatable address + 1
-  HeapWord* _hard_end;  // _end + AlignmentReserve
-  bool      _retained;  // whether we hold a _retained_filler
-  MemRegion _retained_filler;
+  HeapWord* _end;           // Last allocatable address + 1
+  HeapWord* _hard_end;      // _end + AlignmentReserve
   // In support of ergonomic sizing of PLAB's
   size_t    _allocated;     // in HeapWord units
   size_t    _wasted;        // in HeapWord units
-  char tail[32];
-  static size_t FillerHeaderSize;
+  char      tail[32];
   static size_t AlignmentReserve;
 
-  // Flush the stats supporting ergonomic sizing of PLAB's
-  // Should not be called directly
-  void flush_stats(PLABStats* stats);
+  // Force future allocations to fail and queries for contains()
+  // to return false. Returns the amount of unused space in this PLAB.
+  size_t invalidate() {
+    _end    = _hard_end;
+    size_t remaining = pointer_delta(_end, _top);  // Calculate remaining space.
+    _top    = _end;      // Force future allocations to fail.
+    _bottom = _end;      // Force future contains() queries to return false.
+    return remaining;
+  }
+
+  // Fill in remaining space with a dummy object and invalidate the PLAB. Returns
+  // the amount of remaining space.
+  size_t retire_internal();
 
 public:
   // Initializes the buffer to be empty, but with the given "word_sz".
@@ -62,14 +68,10 @@
   ParGCAllocBuffer(size_t word_sz);
   virtual ~ParGCAllocBuffer() {}
 
-  static const size_t min_size() {
-    // Make sure that we return something that is larger than AlignmentReserve
-    return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
-  }
-
-  static const size_t max_size() {
-    return ThreadLocalAllocBuffer::max_size();
-  }
+  // Minimum PLAB size.
+  static size_t min_size();
+  // Maximum PLAB size.
+  static size_t max_size();
 
   // If an allocation of the given "word_sz" can be satisfied within the
   // buffer, do the allocation, returning a pointer to the start of the
@@ -128,62 +130,37 @@
     _allocated += word_sz();
   }
 
-  // Flush the stats supporting ergonomic sizing of PLAB's
-  // and retire the current buffer.
-  void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
-    // We flush the stats first in order to get a reading of
-    // unused space in the last buffer.
-    if (ResizePLAB) {
-      flush_stats(stats);
+  // Flush allocation statistics into the given PLABStats supporting ergonomic
+  // sizing of PLAB's and retire the current buffer. To be called at the end of
+  // GC.
+  void flush_and_retire_stats(PLABStats* stats);
 
-      // Since we have flushed the stats we need to clear
-      // the _allocated and _wasted fields. Not doing so
-      // will artifically inflate the values in the stats
-      // to which we add them.
-      // The next time we flush these values, we will add
-      // what we have just flushed in addition to the size
-      // of the buffers allocated between now and then.
-      _allocated = 0;
-      _wasted = 0;
-    }
-    // Retire the last allocation buffer.
-    retire(end_of_gc, retain);
-  }
-
-  // Force future allocations to fail and queries for contains()
-  // to return false
-  void invalidate() {
-    assert(!_retained, "Shouldn't retain an invalidated buffer.");
-    _end    = _hard_end;
-    _wasted += pointer_delta(_end, _top);  // unused  space
-    _top    = _end;      // force future allocations to fail
-    _bottom = _end;      // force future contains() queries to return false
-  }
-
-  // Fills in the unallocated portion of the buffer with a garbage object.
-  // If "end_of_gc" is TRUE, is after the last use in the GC.  IF "retain"
-  // is true, attempt to re-use the unused portion in the next GC.
-  virtual void retire(bool end_of_gc, bool retain);
+  // Fills in the unallocated portion of the buffer with a garbage object and updates
+  // statistics. To be called during GC.
+  virtual void retire();
 
   void print() PRODUCT_RETURN;
 };
 
-// PLAB stats book-keeping
+// PLAB book-keeping.
 class PLABStats VALUE_OBJ_CLASS_SPEC {
-  size_t _allocated;      // total allocated
+  size_t _allocated;      // Total allocated
   size_t _wasted;         // of which wasted (internal fragmentation)
   size_t _unused;         // Unused in last buffer
-  size_t _used;           // derived = allocated - wasted - unused
-  size_t _desired_plab_sz;// output of filter (below), suitably trimmed and quantized
+  size_t _desired_plab_sz;// Output of filter (below), suitably trimmed and quantized
   AdaptiveWeightedAverage
-         _filter;         // integrator with decay
+         _filter;         // Integrator with decay
 
+  void reset() {
+    _allocated = 0;
+    _wasted    = 0;
+    _unused    = 0;
+  }
  public:
   PLABStats(size_t desired_plab_sz_, unsigned wt) :
     _allocated(0),
     _wasted(0),
     _unused(0),
-    _used(0),
     _desired_plab_sz(desired_plab_sz_),
     _filter(wt)
   { }
@@ -200,9 +177,9 @@
     return _desired_plab_sz;
   }
 
+  // Updates the current desired PLAB size. Computes the new desired PLAB size,
+  // updates _desired_plab_sz and clears sensor accumulators.
   void adjust_desired_plab_sz(uint no_of_gc_workers);
-                                 // filter computation, latches output to
-                                 // _desired_plab_sz, clears sensor accumulators
 
   void add_allocated(size_t v) {
     Atomic::add_ptr(v, &_allocated);
--- a/hotspot/src/share/vm/memory/barrierSet.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -27,6 +27,7 @@
 
 #include "memory/memRegion.hpp"
 #include "oops/oopsHierarchy.hpp"
+#include "utilities/fakeRttiSupport.hpp"
 
 // This class provides the interface between a barrier implementation and
 // the rest of the system.
@@ -34,18 +35,57 @@
 class BarrierSet: public CHeapObj<mtGC> {
   friend class VMStructs;
 public:
-  enum Name {
-    ModRef,
-    CardTableModRef,
-    CardTableExtension,
-    G1SATBCT,
-    G1SATBCTLogging
+  // Fake RTTI support.  For a derived class T to participate
+  // - T must have a corresponding Name entry.
+  // - GetName<T> must be specialized to return the corresponding Name
+  //   entry.
+  // - If T is a base class, the constructor must have a FakeRtti
+  //   parameter and pass it up to its base class, with the tag set
+  //   augmented with the corresponding Name entry.
+  // - If T is a concrete class, the constructor must create a
+  //   FakeRtti object whose tag set includes the corresponding Name
+  //   entry, and pass it up to its base class.
+
+  enum Name {                   // associated class
+    ModRef,                     // ModRefBarrierSet
+    CardTableModRef,            // CardTableModRefBS
+    CardTableForRS,             // CardTableModRefBSForCTRS
+    CardTableExtension,         // CardTableExtension
+    G1SATBCT,                   // G1SATBCardTableModRefBS
+    G1SATBCTLogging             // G1SATBCardTableLoggingModRefBS
   };
 
+protected:
+  typedef FakeRttiSupport<BarrierSet, Name> FakeRtti;
+
+private:
+  FakeRtti _fake_rtti;
+
+  // Metafunction mapping a class derived from BarrierSet to the
+  // corresponding Name enum tag.
+  template<typename T> struct GetName;
+
+  // Downcast argument to a derived barrier set type.
+  // The cast is checked in a debug build.
+  // T must have a specialization for BarrierSet::GetName<T>.
+  template<typename T> friend T* barrier_set_cast(BarrierSet* bs);
+
+public:
+  // Note: This is not presently the Name corresponding to the
+  // concrete class of this object.
+  BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
+
+  // Test whether this object is of the type corresponding to bsn.
+  bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
+
+  // End of fake RTTI support.
+
+public:
   enum Flags {
     None                = 0,
     TargetUninitialized = 1
   };
+
 protected:
   // Some barrier sets create tables whose elements correspond to parts of
   // the heap; the CardTableModRefBS is an example.  Such barrier sets will
@@ -53,17 +93,12 @@
   // "covering" parts of the heap that are committed. At most one covered
   // region per generation is needed.
   static const int _max_covered_regions = 2;
-  Name _kind;
 
-  BarrierSet(Name kind) : _kind(kind) { }
+  BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti) { }
   ~BarrierSet() { }
 
 public:
 
-  // To get around prohibition on RTTI.
-  BarrierSet::Name kind() { return _kind; }
-  virtual bool is_a(BarrierSet::Name bsn) = 0;
-
   // These operations indicate what kind of barriers the BarrierSet has.
   virtual bool has_read_ref_barrier() = 0;
   virtual bool has_read_prim_barrier() = 0;
@@ -177,4 +212,10 @@
   virtual void print_on(outputStream* st) const = 0;
 };
 
+template<typename T>
+inline T* barrier_set_cast(BarrierSet* bs) {
+  assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
+  return static_cast<T*>(bs);
+}
+
 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
--- a/hotspot/src/share/vm/memory/barrierSet.inline.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/memory/barrierSet.inline.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -34,7 +34,7 @@
 
 template <class T> void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
   if (kind() == CardTableModRef) {
-    ((CardTableModRefBS*)this)->inline_write_ref_field_pre(field, new_val);
+    barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field_pre(field, new_val);
   } else {
     write_ref_field_pre_work(field, new_val);
   }
@@ -42,7 +42,7 @@
 
 void BarrierSet::write_ref_field(void* field, oop new_val, bool release) {
   if (kind() == CardTableModRef) {
-    ((CardTableModRefBS*)this)->inline_write_ref_field(field, new_val, release);
+    barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field(field, new_val, release);
   } else {
     write_ref_field_work(field, new_val, release);
   }
@@ -78,7 +78,7 @@
 
 inline void BarrierSet::write_region(MemRegion mr) {
   if (kind() == CardTableModRef) {
-    ((CardTableModRefBS*)this)->inline_write_region(mr);
+    barrier_set_cast<CardTableModRefBS>(this)->inline_write_region(mr);
   } else {
     write_region_work(mr);
   }
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -53,8 +53,10 @@
   return align_size_up(_guard_index + 1, MAX2(_page_size, granularity));
 }
 
-CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
-  ModRefBarrierSet(kind),
+CardTableModRefBS::CardTableModRefBS(
+  MemRegion whole_heap,
+  const BarrierSet::FakeRtti& fake_rtti) :
+  ModRefBarrierSet(fake_rtti.add_tag(BarrierSet::CardTableModRef)),
   _whole_heap(whole_heap),
   _guard_index(0),
   _guard_region(),
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -279,11 +279,6 @@
   static int precleaned_card_val() { return precleaned_card; }
   static int deferred_card_val()   { return deferred_card; }
 
-  // For RTTI simulation.
-  bool is_a(BarrierSet::Name bsn) {
-    return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
-  }
-
   virtual void initialize();
 
   // *** Barrier set functions.
@@ -292,7 +287,7 @@
 
 protected:
 
-  CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+  CardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
   ~CardTableModRefBS();
 
   // Record a reference update. Note that these versions are precise!
@@ -462,6 +457,11 @@
   void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
 };
 
+template<>
+struct BarrierSet::GetName<CardTableModRefBS> {
+  static const BarrierSet::Name value = BarrierSet::CardTableModRef;
+};
+
 class CardTableRS;
 
 // A specialization for the CardTableRS gen rem set.
@@ -472,10 +472,24 @@
   bool card_may_have_been_dirty(jbyte cv);
 public:
   CardTableModRefBSForCTRS(MemRegion whole_heap) :
-    CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) {}
+    CardTableModRefBS(
+      whole_heap,
+      // Concrete tag should be BarrierSet::CardTableForRS.
+      // That will presently break things in a bunch of places though.
+      // The concrete tag is used as a dispatch key in many places, and
+      // CardTableForRS does not correctly dispatch in some of those
+      // uses. This will be addressed as part of a reorganization of the
+      // BarrierSet hierarchy.
+      BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS))
+    {}
 
   void set_CTRS(CardTableRS* rs) { _rs = rs; }
 };
 
+template<>
+struct BarrierSet::GetName<CardTableModRefBSForCTRS> {
+  static const BarrierSet::Name value = BarrierSet::CardTableForRS;
+};
+
 
 #endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -37,10 +37,6 @@
 class ModRefBarrierSet: public BarrierSet {
 public:
 
-  bool is_a(BarrierSet::Name bsn) {
-    return bsn == BarrierSet::ModRef;
-  }
-
   // Barriers only on ref writes.
   bool has_read_ref_barrier() { return false; }
   bool has_read_prim_barrier() { return false; }
@@ -60,7 +56,8 @@
 
 protected:
 
-  ModRefBarrierSet(BarrierSet::Name kind) : BarrierSet(kind) { }
+  ModRefBarrierSet(const BarrierSet::FakeRtti& fake_rtti)
+    : BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { }
   ~ModRefBarrierSet() { }
 
   virtual void write_ref_field_work(void* field, oop new_val, bool release = false) = 0;
@@ -100,4 +97,9 @@
   virtual void clear(MemRegion mr) = 0;
 };
 
+template<>
+struct BarrierSet::GetName<ModRefBarrierSet> {
+  static const BarrierSet::Name value = BarrierSet::ModRef;
+};
+
 #endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Wed Jul 05 20:24:03 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
@@ -215,6 +215,7 @@
   u2                _max_stack;                  // Maximum number of entries on the expression stack
   u2                _max_locals;                 // Number of local variables used by this method
   u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
+  u2                _orig_method_idnum;          // Original unique identification number for the method
 
   // Constructor
   ConstMethod(int byte_code_size,
@@ -473,6 +474,9 @@
   u2 method_idnum() const                        { return _method_idnum; }
   void set_method_idnum(u2 idnum)                { _method_idnum = idnum; }
 
+  u2 orig_method_idnum() const                   { return _orig_method_idnum; }
+  void set_orig_method_idnum(u2 idnum)           { _orig_method_idnum = idnum; }
+
   // max stack
   int  max_stack() const                         { return _max_stack; }
   void set_max_stack(int size)                   { _max_stack = size; }
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -454,7 +454,6 @@
           new_method->name()->as_C_string(),
           new_method->signature()->as_C_string()));
       }
-
       return true;
     }
 
@@ -482,7 +481,6 @@
         new_method->name()->as_C_string(),
         new_method->signature()->as_C_string()));
     }
-
     return true;
   }
 
@@ -509,36 +507,33 @@
           (!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
 }
 
-bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
+Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
   if (!is_method_entry()) {
     // not a method entry so not interesting by default
-    return false;
+    return NULL;
   }
-
   Method* m = NULL;
   if (is_vfinal()) {
     // virtual and final so _f2 contains method ptr instead of vtable index
     m = f2_as_vfinal_method();
   } else if (is_f1_null()) {
     // NULL _f1 means this is a virtual entry so also not interesting
-    return false;
+    return NULL;
   } else {
     if (!(_f1->is_method())) {
       // _f1 can also contain a Klass* for an interface
-      return false;
+      return NULL;
     }
     m = f1_as_method();
   }
-
   assert(m != NULL && m->is_method(), "sanity check");
   if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
     // robustness for above sanity checks or method is not in
     // the interesting class
-    return false;
+    return NULL;
   }
-
   // the method is in the interesting class so the entry is interesting
-  return true;
+  return m;
 }
 #endif // INCLUDE_JVMTI
 
@@ -615,7 +610,7 @@
 // If any entry of this ConstantPoolCache points to any of
 // old_methods, replace it with the corresponding new_method.
 void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods,
-                                                     int methods_length, bool * trace_name_printed) {
+                                              int methods_length, bool * trace_name_printed) {
 
   if (methods_length == 0) {
     // nothing to do if there are no methods
@@ -626,7 +621,7 @@
   Klass* old_holder = old_methods[0]->method_holder();
 
   for (int i = 0; i < length(); i++) {
-    if (!entry_at(i)->is_interesting_method_entry(old_holder)) {
+    if (entry_at(i)->get_interesting_method_entry(old_holder) == NULL) {
       // skip uninteresting methods
       continue;
     }
@@ -650,10 +645,33 @@
   }
 }
 
+// If any entry of this ConstantPoolCache points to any of
+// old_methods, replace it with the corresponding new_method.
+void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+  for (int i = 0; i < length(); i++) {
+    ConstantPoolCacheEntry* entry = entry_at(i);
+    Method* old_method = entry->get_interesting_method_entry(holder);
+    if (old_method == NULL || !old_method->is_old()) {
+      continue; // skip uninteresting entries
+    }
+    if (old_method->is_deleted()) {
+      // clean up entries with deleted methods
+      entry->initialize_entry(entry->constant_pool_index());
+      continue;
+    }
+    Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+    assert(new_method != NULL, "method_with_idnum() should not be NULL");
+    assert(old_method != new_method, "sanity check");
+
+    entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed);
+  }
+}
+
 // the constant pool cache should never contain old or obsolete methods
 bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
   for (int i = 1; i < length(); i++) {
-    if (entry_at(i)->is_interesting_method_entry(NULL) &&
+    if (entry_at(i)->get_interesting_method_entry(NULL) != NULL &&
         !entry_at(i)->check_no_old_or_obsolete_entries()) {
       return false;
     }
@@ -663,7 +681,7 @@
 
 void ConstantPoolCache::dump_cache() {
   for (int i = 1; i < length(); i++) {
-    if (entry_at(i)->is_interesting_method_entry(NULL)) {
+    if (entry_at(i)->get_interesting_method_entry(NULL) != NULL) {
       entry_at(i)->print(tty, i);
     }
   }
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Wed Jul 05 20:24:03 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
@@ -379,9 +379,9 @@
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
   bool adjust_method_entry(Method* old_method, Method* new_method,
-         bool * trace_name_printed);
+         bool* trace_name_printed);
   bool check_no_old_or_obsolete_entries();
-  bool is_interesting_method_entry(Klass* k);
+  Method* get_interesting_method_entry(Klass* k);
 #endif // INCLUDE_JVMTI
 
   // Debugging & Printing
@@ -478,7 +478,8 @@
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
   void adjust_method_entries(Method** old_methods, Method** new_methods,
-                             int methods_length, bool * trace_name_printed);
+                             int methods_length, bool* trace_name_printed);
+  void adjust_method_entries(InstanceKlass* holder, bool* trace_name_printed);
   bool check_no_old_or_obsolete_entries();
   void dump_cache();
 #endif // INCLUDE_JVMTI
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -2793,30 +2793,33 @@
 // not yet in the vtable due to concurrent subclass define and superinterface
 // redefinition
 // Note: those in the vtable, should have been updated via adjust_method_entries
-void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
-                                           int methods_length, bool* trace_name_printed) {
+void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {
   // search the default_methods for uses of either obsolete or EMCP methods
   if (default_methods() != NULL) {
-    for (int j = 0; j < methods_length; j++) {
-      Method* old_method = old_methods[j];
-      Method* new_method = new_methods[j];
-
-      for (int index = 0; index < default_methods()->length(); index ++) {
-        if (default_methods()->at(index) == old_method) {
-          default_methods()->at_put(index, new_method);
-          if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
-            if (!(*trace_name_printed)) {
-              // RC_TRACE_MESG macro has an embedded ResourceMark
-              RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
-                             external_name(),
-                             old_method->method_holder()->external_name()));
-              *trace_name_printed = true;
-            }
-            RC_TRACE(0x00100000, ("default method update: %s(%s) ",
-                                  new_method->name()->as_C_string(),
-                                  new_method->signature()->as_C_string()));
-          }
+    for (int index = 0; index < default_methods()->length(); index ++) {
+      Method* old_method = default_methods()->at(index);
+      if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+        continue; // skip uninteresting entries
+      }
+      assert(!old_method->is_deleted(), "default methods may not be deleted");
+
+      Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+      assert(new_method != NULL, "method_with_idnum() should not be NULL");
+      assert(old_method != new_method, "sanity check");
+
+      default_methods()->at_put(index, new_method);
+      if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+        if (!(*trace_name_printed)) {
+          // RC_TRACE_MESG macro has an embedded ResourceMark
+          RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
+                         external_name(),
+                         old_method->method_holder()->external_name()));
+          *trace_name_printed = true;
         }
+        RC_TRACE(0x00100000, ("default method update: %s(%s) ",
+                              new_method->name()->as_C_string(),
+                              new_method->signature()->as_C_string()));
       }
     }
   }
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -937,8 +937,7 @@
   Method* method_at_itable(Klass* holder, int index, TRAPS);
 
 #if INCLUDE_JVMTI
-  void adjust_default_methods(Method** old_methods, Method** new_methods,
-                              int methods_length, bool* trace_name_printed);
+  void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
 #endif // INCLUDE_JVMTI
 
   // Garbage collection
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -863,44 +863,43 @@
   }
   return updated;
 }
-void klassVtable::adjust_method_entries(Method** old_methods, Method** new_methods,
-                                        int methods_length, bool * trace_name_printed) {
-  // search the vtable for uses of either obsolete or EMCP methods
-  for (int j = 0; j < methods_length; j++) {
-    Method* old_method = old_methods[j];
-    Method* new_method = new_methods[j];
+
+// search the vtable for uses of either obsolete or EMCP methods
+void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+  int prn_enabled = 0;
+  for (int index = 0; index < length(); index++) {
+    Method* old_method = unchecked_method_at(index);
+    if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+      continue; // skip uninteresting entries
+    }
+    assert(!old_method->is_deleted(), "vtable methods may not be deleted");
+
+    Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+    assert(new_method != NULL, "method_with_idnum() should not be NULL");
+    assert(old_method != new_method, "sanity check");
 
-    // In the vast majority of cases we could get the vtable index
-    // by using:  old_method->vtable_index()
-    // However, there are rare cases, eg. sun.awt.X11.XDecoratedPeer.getX()
-    // in sun.awt.X11.XFramePeer where methods occur more than once in the
-    // vtable, so, alas, we must do an exhaustive search.
-    for (int index = 0; index < length(); index++) {
-      if (unchecked_method_at(index) == old_method) {
-        put_method_at(new_method, index);
-          // For default methods, need to update the _default_methods array
-          // which can only have one method entry for a given signature
-          bool updated_default = false;
-          if (old_method->is_default_method()) {
-            updated_default = adjust_default_method(index, old_method, new_method);
-          }
+    put_method_at(new_method, index);
+    // For default methods, need to update the _default_methods array
+    // which can only have one method entry for a given signature
+    bool updated_default = false;
+    if (old_method->is_default_method()) {
+      updated_default = adjust_default_method(index, old_method, new_method);
+    }
 
-        if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
-          if (!(*trace_name_printed)) {
-            // RC_TRACE_MESG macro has an embedded ResourceMark
-            RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
-                           klass()->external_name(),
-                           old_method->method_holder()->external_name()));
-            *trace_name_printed = true;
-          }
-          // RC_TRACE macro has an embedded ResourceMark
-          RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
-                                new_method->name()->as_C_string(),
-                                new_method->signature()->as_C_string(),
-                                updated_default ? "true" : "false"));
-        }
-        // cannot 'break' here; see for-loop comment above.
+    if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+      if (!(*trace_name_printed)) {
+        // RC_TRACE_MESG macro has an embedded ResourceMark
+        RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
+                       klass()->external_name(),
+                       old_method->method_holder()->external_name()));
+        *trace_name_printed = true;
       }
+      // RC_TRACE macro has an embedded ResourceMark
+      RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
+                            new_method->name()->as_C_string(),
+                            new_method->signature()->as_C_string(),
+                            updated_default ? "true" : "false"));
     }
   }
 }
@@ -1193,37 +1192,35 @@
 }
 
 #if INCLUDE_JVMTI
-void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
-                                        int methods_length, bool * trace_name_printed) {
-  // search the itable for uses of either obsolete or EMCP methods
-  for (int j = 0; j < methods_length; j++) {
-    Method* old_method = old_methods[j];
-    Method* new_method = new_methods[j];
-    itableMethodEntry* ime = method_entry(0);
+// search the itable for uses of either obsolete or EMCP methods
+void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
 
-    // The itable can describe more than one interface and the same
-    // method signature can be specified by more than one interface.
-    // This means we have to do an exhaustive search to find all the
-    // old_method references.
-    for (int i = 0; i < _size_method_table; i++) {
-      if (ime->method() == old_method) {
-        ime->initialize(new_method);
+  itableMethodEntry* ime = method_entry(0);
+  for (int i = 0; i < _size_method_table; i++, ime++) {
+    Method* old_method = ime->method();
+    if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+      continue; // skip uninteresting entries
+    }
+    assert(!old_method->is_deleted(), "itable methods may not be deleted");
+
+    Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
 
-        if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
-          if (!(*trace_name_printed)) {
-            // RC_TRACE_MESG macro has an embedded ResourceMark
-            RC_TRACE_MESG(("adjust: name=%s",
-              old_method->method_holder()->external_name()));
-            *trace_name_printed = true;
-          }
-          // RC_TRACE macro has an embedded ResourceMark
-          RC_TRACE(0x00200000, ("itable method update: %s(%s)",
-            new_method->name()->as_C_string(),
-            new_method->signature()->as_C_string()));
-        }
-        // cannot 'break' here; see for-loop comment above.
+    assert(new_method != NULL, "method_with_idnum() should not be NULL");
+    assert(old_method != new_method, "sanity check");
+
+    ime->initialize(new_method);
+
+    if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+      if (!(*trace_name_printed)) {
+        // RC_TRACE_MESG macro has an embedded ResourceMark
+        RC_TRACE_MESG(("adjust: name=%s",
+          old_method->method_holder()->external_name()));
+        *trace_name_printed = true;
       }
-      ime++;
+      // RC_TRACE macro has an embedded ResourceMark
+      RC_TRACE(0x00200000, ("itable method update: %s(%s)",
+        new_method->name()->as_C_string(),
+        new_method->signature()->as_C_string()));
     }
   }
 }
--- a/hotspot/src/share/vm/oops/klassVtable.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp	Wed Jul 05 20:24:03 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
@@ -98,8 +98,7 @@
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
   bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
-  void adjust_method_entries(Method** old_methods, Method** new_methods,
-                             int methods_length, bool * trace_name_printed);
+  void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
   bool check_no_old_or_obsolete_entries();
   void dump_vtable();
 #endif // INCLUDE_JVMTI
@@ -288,8 +287,7 @@
   // trace_name_printed is set to true if the current call has
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
-  void adjust_method_entries(Method** old_methods, Method** new_methods,
-                             int methods_length, bool * trace_name_printed);
+  void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
   bool check_no_old_or_obsolete_entries();
   void dump_itable();
 #endif // INCLUDE_JVMTI
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1450,6 +1450,7 @@
       for (int i = 0; i < length; i++) {
         Method* m = methods->at(i);
         m->set_method_idnum(i);
+        m->set_orig_method_idnum(i);
       }
     }
   }
--- a/hotspot/src/share/vm/oops/method.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp	Wed Jul 05 20:24:03 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
@@ -233,6 +233,9 @@
   u2 method_idnum() const           { return constMethod()->method_idnum(); }
   void set_method_idnum(u2 idnum)   { constMethod()->set_method_idnum(idnum); }
 
+  u2 orig_method_idnum() const           { return constMethod()->orig_method_idnum(); }
+  void set_orig_method_idnum(u2 idnum)   { constMethod()->set_orig_method_idnum(idnum); }
+
   // code size
   int code_size() const                  { return constMethod()->code_size(); }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,597 @@
+/*
+ * 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 "opto/arraycopynode.hpp"
+#include "opto/graphKit.hpp"
+
+ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
+  : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
+    _alloc_tightly_coupled(alloc_tightly_coupled),
+    _kind(None),
+    _arguments_validated(false) {
+  init_class_id(Class_ArrayCopy);
+  init_flags(Flag_is_macro);
+  C->add_macro_node(this);
+}
+
+uint ArrayCopyNode::size_of() const { return sizeof(*this); }
+
+ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
+                                   Node* src, Node* src_offset,
+                                   Node* dest, Node* dest_offset,
+                                   Node* length,
+                                   bool alloc_tightly_coupled,
+                                   Node* src_klass, Node* dest_klass,
+                                   Node* src_length, Node* dest_length) {
+
+  ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
+  Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
+
+  ac->init_req(ArrayCopyNode::Src, src);
+  ac->init_req(ArrayCopyNode::SrcPos, src_offset);
+  ac->init_req(ArrayCopyNode::Dest, dest);
+  ac->init_req(ArrayCopyNode::DestPos, dest_offset);
+  ac->init_req(ArrayCopyNode::Length, length);
+  ac->init_req(ArrayCopyNode::SrcLen, src_length);
+  ac->init_req(ArrayCopyNode::DestLen, dest_length);
+  ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
+  ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
+
+  if (may_throw) {
+    ac->set_req(TypeFunc::I_O , kit->i_o());
+    kit->add_safepoint_edges(ac, false);
+  }
+
+  return ac;
+}
+
+void ArrayCopyNode::connect_outputs(GraphKit* kit) {
+  kit->set_all_memory_call(this, true);
+  kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
+  kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
+  kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
+  kit->set_all_memory_call(this);
+}
+
+#ifndef PRODUCT
+const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
+void ArrayCopyNode::dump_spec(outputStream *st) const {
+  CallNode::dump_spec(st);
+  st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
+}
+#endif
+
+intptr_t ArrayCopyNode::get_length_if_constant(PhaseGVN *phase) const {
+  // check that length is constant
+  Node* length = in(ArrayCopyNode::Length);
+  const Type* length_type = phase->type(length);
+
+  if (length_type == Type::TOP) {
+    return -1;
+  }
+
+  assert(is_clonebasic() || is_arraycopy() || is_copyof() || is_copyofrange(), "unexpected array copy type");
+
+  return is_clonebasic() ? length->find_intptr_t_con(-1) : length->find_int_con(-1);
+}
+
+int ArrayCopyNode::get_count(PhaseGVN *phase) const {
+  Node* src = in(ArrayCopyNode::Src);
+  const Type* src_type = phase->type(src);
+
+  if (is_clonebasic()) {
+    if (src_type->isa_instptr()) {
+      const TypeInstPtr* inst_src = src_type->is_instptr();
+      ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+      // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
+      // fields into account. They are rare anyway so easier to simply
+      // skip instances with injected fields.
+      if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
+        return -1;
+      }
+      int nb_fields = ik->nof_nonstatic_fields();
+      return nb_fields;
+    } else {
+      const TypeAryPtr* ary_src = src_type->isa_aryptr();
+      assert (ary_src != NULL, "not an array or instance?");
+      // clone passes a length as a rounded number of longs. If we're
+      // cloning an array we'll do it element by element. If the
+      // length input to ArrayCopyNode is constant, length of input
+      // array must be too.
+
+      assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con() ||
+             phase->is_IterGVN(), "inconsistent");
+
+      if (ary_src->size()->is_con()) {
+        return ary_src->size()->get_con();
+      }
+      return -1;
+    }
+  }
+
+  return get_length_if_constant(phase);
+}
+
+Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
+  if (!is_clonebasic()) {
+    return NULL;
+  }
+
+  Node* src = in(ArrayCopyNode::Src);
+  Node* dest = in(ArrayCopyNode::Dest);
+  Node* ctl = in(TypeFunc::Control);
+  Node* in_mem = in(TypeFunc::Memory);
+
+  const Type* src_type = phase->type(src);
+
+  assert(src->is_AddP(), "should be base + off");
+  assert(dest->is_AddP(), "should be base + off");
+  Node* base_src = src->in(AddPNode::Base);
+  Node* base_dest = dest->in(AddPNode::Base);
+
+  MergeMemNode* mem = MergeMemNode::make(in_mem);
+
+  const TypeInstPtr* inst_src = src_type->isa_instptr();
+
+  if (inst_src == NULL) {
+    return NULL;
+  }
+
+  if (!inst_src->klass_is_exact()) {
+    ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+    assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
+    phase->C->dependencies()->assert_leaf_type(ik);
+  }
+
+  ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+  assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
+
+  for (int i = 0; i < count; i++) {
+    ciField* field = ik->nonstatic_field_at(i);
+    int fieldidx = phase->C->alias_type(field)->index();
+    const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
+    Node* off = phase->MakeConX(field->offset());
+    Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
+    Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
+    BasicType bt = field->layout_type();
+
+    const Type *type;
+    if (bt == T_OBJECT) {
+      if (!field->type()->is_loaded()) {
+        type = TypeInstPtr::BOTTOM;
+      } else {
+        ciType* field_klass = field->type();
+        type = TypeOopPtr::make_from_klass(field_klass->as_klass());
+      }
+    } else {
+      type = Type::get_const_basic_type(bt);
+    }
+
+    Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
+    v = phase->transform(v);
+    Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
+    s = phase->transform(s);
+    mem->set_memory_at(fieldidx, s);
+  }
+
+  if (!finish_transform(phase, can_reshape, ctl, mem)) {
+    return NULL;
+  }
+
+  return mem;
+}
+
+bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+                                       Node*& adr_src,
+                                       Node*& base_src,
+                                       Node*& adr_dest,
+                                       Node*& base_dest,
+                                       BasicType& copy_type,
+                                       const Type*& value_type,
+                                       bool& disjoint_bases) {
+  Node* src = in(ArrayCopyNode::Src);
+  Node* dest = in(ArrayCopyNode::Dest);
+  const Type* src_type = phase->type(src);
+  const TypeAryPtr* ary_src = src_type->isa_aryptr();
+
+  if (is_arraycopy() || is_copyofrange() || is_copyof()) {
+    const Type* dest_type = phase->type(dest);
+    const TypeAryPtr* ary_dest = dest_type->isa_aryptr();
+    Node* src_offset = in(ArrayCopyNode::SrcPos);
+    Node* dest_offset = in(ArrayCopyNode::DestPos);
+
+    // newly allocated object is guaranteed to not overlap with source object
+    disjoint_bases = is_alloc_tightly_coupled();
+
+    if (ary_src  == NULL || ary_src->klass()  == NULL ||
+        ary_dest == NULL || ary_dest->klass() == NULL) {
+      // We don't know if arguments are arrays
+      return false;
+    }
+
+    BasicType src_elem  = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+    BasicType dest_elem = ary_dest->klass()->as_array_klass()->element_type()->basic_type();
+    if (src_elem  == T_ARRAY)  src_elem  = T_OBJECT;
+    if (dest_elem == T_ARRAY)  dest_elem = T_OBJECT;
+
+    if (src_elem != dest_elem || dest_elem == T_VOID) {
+      // We don't know if arguments are arrays of the same type
+      return false;
+    }
+
+    if (dest_elem == T_OBJECT && (!is_alloc_tightly_coupled() || !GraphKit::use_ReduceInitialCardMarks())) {
+      // It's an object array copy but we can't emit the card marking
+      // that is needed
+      return false;
+    }
+
+    value_type = ary_src->elem();
+
+    base_src = src;
+    base_dest = dest;
+
+    uint shift  = exact_log2(type2aelembytes(dest_elem));
+    uint header = arrayOopDesc::base_offset_in_bytes(dest_elem);
+
+    adr_src = src;
+    adr_dest = dest;
+
+    src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size());
+    dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size());
+
+    Node* src_scale = phase->transform(new LShiftXNode(src_offset, phase->intcon(shift)));
+    Node* dest_scale = phase->transform(new LShiftXNode(dest_offset, phase->intcon(shift)));
+
+    adr_src = phase->transform(new AddPNode(base_src, adr_src, src_scale));
+    adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, dest_scale));
+
+    adr_src = new AddPNode(base_src, adr_src, phase->MakeConX(header));
+    adr_dest = new AddPNode(base_dest, adr_dest, phase->MakeConX(header));
+
+    adr_src = phase->transform(adr_src);
+    adr_dest = phase->transform(adr_dest);
+
+    copy_type = dest_elem;
+  } else {
+    assert (is_clonebasic(), "should be");
+
+    disjoint_bases = true;
+    assert(src->is_AddP(), "should be base + off");
+    assert(dest->is_AddP(), "should be base + off");
+    adr_src = src;
+    base_src = src->in(AddPNode::Base);
+    adr_dest = dest;
+    base_dest = dest->in(AddPNode::Base);
+
+    assert(phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con() == phase->type(dest->in(AddPNode::Offset))->is_intptr_t()->get_con(), "same start offset?");
+    BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+    if (elem == T_ARRAY)  elem = T_OBJECT;
+
+    int diff = arrayOopDesc::base_offset_in_bytes(elem) - phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con();
+    assert(diff >= 0, "clone should not start after 1st array element");
+    if (diff > 0) {
+      adr_src = phase->transform(new AddPNode(base_src, adr_src, phase->MakeConX(diff)));
+      adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, phase->MakeConX(diff)));
+    }
+
+    copy_type = elem;
+    value_type = ary_src->elem();
+  }
+  return true;
+}
+
+const TypePtr* ArrayCopyNode::get_address_type(PhaseGVN *phase, Node* n) {
+  const Type* at = phase->type(n);
+  assert(at != Type::TOP, "unexpected type");
+  const TypePtr* atp = at->isa_ptr();
+  // adjust atp to be the correct array element address type
+  atp = atp->add_offset(Type::OffsetBot);
+  return atp;
+}
+
+void ArrayCopyNode::array_copy_test_overlap(PhaseGVN *phase, bool can_reshape, bool disjoint_bases, int count, Node*& forward_ctl, Node*& backward_ctl) {
+  Node* ctl = in(TypeFunc::Control);
+  if (!disjoint_bases && count > 1) {
+    Node* src_offset = in(ArrayCopyNode::SrcPos);
+    Node* dest_offset = in(ArrayCopyNode::DestPos);
+    assert(src_offset != NULL && dest_offset != NULL, "should be");
+    Node* cmp = phase->transform(new CmpINode(src_offset, dest_offset));
+    Node *bol = phase->transform(new BoolNode(cmp, BoolTest::lt));
+    IfNode *iff = new IfNode(ctl, bol, PROB_FAIR, COUNT_UNKNOWN);
+
+    phase->transform(iff);
+
+    forward_ctl = phase->transform(new IfFalseNode(iff));
+    backward_ctl = phase->transform(new IfTrueNode(iff));
+  } else {
+    forward_ctl = ctl;
+  }
+}
+
+Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
+                                        bool can_reshape,
+                                        Node* forward_ctl,
+                                        Node* start_mem_src,
+                                        Node* start_mem_dest,
+                                        const TypePtr* atp_src,
+                                        const TypePtr* atp_dest,
+                                        Node* adr_src,
+                                        Node* base_src,
+                                        Node* adr_dest,
+                                        Node* base_dest,
+                                        BasicType copy_type,
+                                        const Type* value_type,
+                                        int count) {
+  Node* mem = phase->C->top();
+  if (!forward_ctl->is_top()) {
+    // copy forward
+    mem = start_mem_dest;
+
+    if (count > 0) {
+      Node* v = LoadNode::make(*phase, forward_ctl, start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+      v = phase->transform(v);
+      mem = StoreNode::make(*phase, forward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+      mem = phase->transform(mem);
+      for (int i = 1; i < count; i++) {
+        Node* off  = phase->MakeConX(type2aelembytes(copy_type) * i);
+        Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+        Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+        v = LoadNode::make(*phase, forward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+        v = phase->transform(v);
+        mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+        mem = phase->transform(mem);
+      }
+    } else if(can_reshape) {
+      PhaseIterGVN* igvn = phase->is_IterGVN();
+      igvn->_worklist.push(adr_src);
+      igvn->_worklist.push(adr_dest);
+    }
+  }
+  return mem;
+}
+
+Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase,
+                                         bool can_reshape,
+                                         Node* backward_ctl,
+                                         Node* start_mem_src,
+                                         Node* start_mem_dest,
+                                         const TypePtr* atp_src,
+                                         const TypePtr* atp_dest,
+                                         Node* adr_src,
+                                         Node* base_src,
+                                         Node* adr_dest,
+                                         Node* base_dest,
+                                         BasicType copy_type,
+                                         const Type* value_type,
+                                         int count) {
+  Node* mem = phase->C->top();
+  if (!backward_ctl->is_top()) {
+    // copy backward
+    mem = start_mem_dest;
+
+    if (count > 0) {
+      for (int i = count-1; i >= 1; i--) {
+        Node* off  = phase->MakeConX(type2aelembytes(copy_type) * i);
+        Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+        Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+        Node* v = LoadNode::make(*phase, backward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+        v = phase->transform(v);
+        mem = StoreNode::make(*phase, backward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+        mem = phase->transform(mem);
+      }
+      Node* v = LoadNode::make(*phase, backward_ctl, mem, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+      v = phase->transform(v);
+      mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+      mem = phase->transform(mem);
+    } else if(can_reshape) {
+      PhaseIterGVN* igvn = phase->is_IterGVN();
+      igvn->_worklist.push(adr_src);
+      igvn->_worklist.push(adr_dest);
+    }
+  }
+  return mem;
+}
+
+bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
+                                     Node* ctl, Node *mem) {
+  if (can_reshape) {
+    PhaseIterGVN* igvn = phase->is_IterGVN();
+    igvn->set_delay_transform(false);
+    if (is_clonebasic()) {
+      Node* out_mem = proj_out(TypeFunc::Memory);
+
+      if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
+          out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
+        assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
+        return false;
+      }
+
+      igvn->replace_node(out_mem->raw_out(0), mem);
+
+      Node* out_ctl = proj_out(TypeFunc::Control);
+      igvn->replace_node(out_ctl, ctl);
+    } else {
+      // replace fallthrough projections of the ArrayCopyNode by the
+      // new memory, control and the input IO.
+      CallProjections callprojs;
+      extract_projections(&callprojs, true);
+
+      igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
+      igvn->replace_node(callprojs.fallthrough_memproj, mem);
+      igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
+
+      // The ArrayCopyNode is not disconnected. It still has the
+      // projections for the exception case. Replace current
+      // ArrayCopyNode with a dummy new one with a top() control so
+      // that this part of the graph stays consistent but is
+      // eventually removed.
+
+      set_req(0, phase->C->top());
+      remove_dead_region(phase, can_reshape);
+    }
+  } else {
+    if (in(TypeFunc::Control) != ctl) {
+      // we can't return new memory and control from Ideal at parse time
+      assert(!is_clonebasic(), "added control for clone?");
+      return false;
+    }
+  }
+  return true;
+}
+
+
+Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  if (remove_dead_region(phase, can_reshape))  return this;
+
+  if (StressArrayCopyMacroNode && !can_reshape) {
+    phase->record_for_igvn(this);
+    return NULL;
+  }
+
+  // See if it's a small array copy and we can inline it as
+  // loads/stores
+  // Here we can only do:
+  // - arraycopy if all arguments were validated before and we don't
+  // need card marking
+  // - clone for which we don't need to do card marking
+
+  if (!is_clonebasic() && !is_arraycopy_validated() &&
+      !is_copyofrange_validated() && !is_copyof_validated()) {
+    return NULL;
+  }
+
+  assert(in(TypeFunc::Control) != NULL &&
+         in(TypeFunc::Memory) != NULL &&
+         in(ArrayCopyNode::Src) != NULL &&
+         in(ArrayCopyNode::Dest) != NULL &&
+         in(ArrayCopyNode::Length) != NULL &&
+         ((in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::DestPos) != NULL) ||
+          is_clonebasic()), "broken inputs");
+
+  if (in(TypeFunc::Control)->is_top() ||
+      in(TypeFunc::Memory)->is_top() ||
+      phase->type(in(ArrayCopyNode::Src)) == Type::TOP ||
+      phase->type(in(ArrayCopyNode::Dest)) == Type::TOP ||
+      (in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::SrcPos)->is_top()) ||
+      (in(ArrayCopyNode::DestPos) != NULL && in(ArrayCopyNode::DestPos)->is_top())) {
+    return NULL;
+  }
+
+  int count = get_count(phase);
+
+  if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
+    return NULL;
+  }
+
+  Node* mem = try_clone_instance(phase, can_reshape, count);
+  if (mem != NULL) {
+    return mem;
+  }
+
+  Node* adr_src = NULL;
+  Node* base_src = NULL;
+  Node* adr_dest = NULL;
+  Node* base_dest = NULL;
+  BasicType copy_type = T_ILLEGAL;
+  const Type* value_type = NULL;
+  bool disjoint_bases = false;
+
+  if (!prepare_array_copy(phase, can_reshape,
+                          adr_src, base_src, adr_dest, base_dest,
+                          copy_type, value_type, disjoint_bases)) {
+    return NULL;
+  }
+
+  Node* src = in(ArrayCopyNode::Src);
+  Node* dest = in(ArrayCopyNode::Dest);
+  const TypePtr* atp_src = get_address_type(phase, src);
+  const TypePtr* atp_dest = get_address_type(phase, dest);
+  uint alias_idx_src = phase->C->get_alias_index(atp_src);
+  uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
+
+  Node *in_mem = in(TypeFunc::Memory);
+  Node *start_mem_src = in_mem;
+  Node *start_mem_dest = in_mem;
+  if (in_mem->is_MergeMem()) {
+    start_mem_src = in_mem->as_MergeMem()->memory_at(alias_idx_src);
+    start_mem_dest = in_mem->as_MergeMem()->memory_at(alias_idx_dest);
+  }
+
+
+  if (can_reshape) {
+    assert(!phase->is_IterGVN()->delay_transform(), "cannot delay transforms");
+    phase->is_IterGVN()->set_delay_transform(true);
+  }
+
+  Node* backward_ctl = phase->C->top();
+  Node* forward_ctl = phase->C->top();
+  array_copy_test_overlap(phase, can_reshape, disjoint_bases, count, forward_ctl, backward_ctl);
+
+  Node* forward_mem = array_copy_forward(phase, can_reshape, forward_ctl,
+                                         start_mem_src, start_mem_dest,
+                                         atp_src, atp_dest,
+                                         adr_src, base_src, adr_dest, base_dest,
+                                         copy_type, value_type, count);
+
+  Node* backward_mem = array_copy_backward(phase, can_reshape, backward_ctl,
+                                           start_mem_src, start_mem_dest,
+                                           atp_src, atp_dest,
+                                           adr_src, base_src, adr_dest, base_dest,
+                                           copy_type, value_type, count);
+
+  Node* ctl = NULL;
+  if (!forward_ctl->is_top() && !backward_ctl->is_top()) {
+    ctl = new RegionNode(3);
+    mem = new PhiNode(ctl, Type::MEMORY, atp_dest);
+    ctl->init_req(1, forward_ctl);
+    mem->init_req(1, forward_mem);
+    ctl->init_req(2, backward_ctl);
+    mem->init_req(2, backward_mem);
+    ctl = phase->transform(ctl);
+    mem = phase->transform(mem);
+  } else if (!forward_ctl->is_top()) {
+    ctl = forward_ctl;
+    mem = forward_mem;
+  } else {
+    assert(!backward_ctl->is_top(), "no copy?");
+    ctl = backward_ctl;
+    mem = backward_mem;
+  }
+
+  if (can_reshape) {
+    assert(phase->is_IterGVN()->delay_transform(), "should be delaying transforms");
+    phase->is_IterGVN()->set_delay_transform(false);
+  }
+
+  MergeMemNode* out_mem = MergeMemNode::make(in_mem);
+  out_mem->set_memory_at(alias_idx_dest, mem);
+  mem = out_mem;
+
+  if (!finish_transform(phase, can_reshape, ctl, mem)) {
+    return NULL;
+  }
+
+  return mem;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/arraycopynode.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,164 @@
+/*
+ * 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_OPTO_ARRAYCOPYNODE_HPP
+#define SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
+
+#include "opto/callnode.hpp"
+
+class GraphKit;
+
+class ArrayCopyNode : public CallNode {
+private:
+
+  // What kind of arraycopy variant is this?
+  enum {
+    None,            // not set yet
+    ArrayCopy,       // System.arraycopy()
+    CloneBasic,      // A clone that can be copied by 64 bit chunks
+    CloneOop,        // An oop array clone
+    CopyOf,          // Arrays.copyOf()
+    CopyOfRange      // Arrays.copyOfRange()
+  } _kind;
+
+#ifndef PRODUCT
+  static const char* _kind_names[CopyOfRange+1];
+#endif
+  // Is the alloc obtained with
+  // AllocateArrayNode::Ideal_array_allocation() tighly coupled
+  // (arraycopy follows immediately the allocation)?
+  // We cache the result of LibraryCallKit::tightly_coupled_allocation
+  // here because it's much easier to find whether there's a tightly
+  // couple allocation at parse time than at macro expansion time. At
+  // macro expansion time, for every use of the allocation node we
+  // would need to figure out whether it happens after the arraycopy (and
+  // can be ignored) or between the allocation and the arraycopy. At
+  // parse time, it's straightforward because whatever happens after
+  // the arraycopy is not parsed yet so doesn't exist when
+  // LibraryCallKit::tightly_coupled_allocation() is called.
+  bool _alloc_tightly_coupled;
+
+  bool _arguments_validated;
+
+  static const TypeFunc* arraycopy_type() {
+    const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
+    fields[Src]       = TypeInstPtr::BOTTOM;
+    fields[SrcPos]    = TypeInt::INT;
+    fields[Dest]      = TypeInstPtr::BOTTOM;
+    fields[DestPos]   = TypeInt::INT;
+    fields[Length]    = TypeInt::INT;
+    fields[SrcLen]    = TypeInt::INT;
+    fields[DestLen]   = TypeInt::INT;
+    fields[SrcKlass]  = TypeKlassPtr::BOTTOM;
+    fields[DestKlass] = TypeKlassPtr::BOTTOM;
+    const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
+
+    // create result type (range)
+    fields = TypeTuple::fields(0);
+
+    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
+
+    return TypeFunc::make(domain, range);
+  }
+
+  ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
+
+  intptr_t get_length_if_constant(PhaseGVN *phase) const;
+  int get_count(PhaseGVN *phase) const;
+  static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
+
+  Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
+  Node* conv_I2X_offset(PhaseGVN *phase, Node* offset, const TypeAryPtr* ary_t);
+  bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+                          Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
+                          BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
+  void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
+                               bool disjoint_bases, int count,
+                               Node*& forward_ctl, Node*& backward_ctl);
+  Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+                           Node* start_mem_src, Node* start_mem_dest,
+                           const TypePtr* atp_src, const TypePtr* atp_dest,
+                           Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+                           BasicType copy_type, const Type* value_type, int count);
+  Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+                            Node *start_mem_src, Node* start_mem_dest,
+                            const TypePtr* atp_src, const TypePtr* atp_dest,
+                            Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+                            BasicType copy_type, const Type* value_type, int count);
+  bool finish_transform(PhaseGVN *phase, bool can_reshape,
+                        Node* ctl, Node *mem);
+
+public:
+
+  enum {
+    Src   = TypeFunc::Parms,
+    SrcPos,
+    Dest,
+    DestPos,
+    Length,
+    SrcLen,
+    DestLen,
+    SrcKlass,
+    DestKlass,
+    ParmLimit
+  };
+
+  static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
+                             Node* src, Node* src_offset,
+                             Node* dest,  Node* dest_offset,
+                             Node* length,
+                             bool alloc_tightly_coupled,
+                             Node* src_klass = NULL, Node* dest_klass = NULL,
+                             Node* src_length = NULL, Node* dest_length = NULL);
+
+  void connect_outputs(GraphKit* kit);
+
+  bool is_arraycopy()             const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
+  bool is_arraycopy_validated()   const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
+  bool is_clonebasic()            const  { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
+  bool is_cloneoop()              const  { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
+  bool is_copyof()                const  { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
+  bool is_copyof_validated()      const  { assert(_kind != None, "should bet set"); return _kind == CopyOf && _arguments_validated; }
+  bool is_copyofrange()           const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
+  bool is_copyofrange_validated() const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange && _arguments_validated; }
+
+  void set_arraycopy(bool validated)   { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
+  void set_clonebasic()                { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
+  void set_cloneoop()                  { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
+  void set_copyof(bool validated)      { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = validated; }
+  void set_copyofrange(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = validated; }
+
+  virtual int Opcode() const;
+  virtual uint size_of() const; // Size is bigger
+  virtual bool guaranteed_safepoint()  { return false; }
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+
+  bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
+
+#ifndef PRODUCT
+  virtual void dump_spec(outputStream *st) const;
+#endif
+};
+
+#endif // SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
--- a/hotspot/src/share/vm/opto/callnode.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1875,194 +1875,3 @@
     log->tail(tag);
   }
 }
-
-ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
-  : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
-    _alloc_tightly_coupled(alloc_tightly_coupled),
-    _kind(None),
-    _arguments_validated(false) {
-  init_class_id(Class_ArrayCopy);
-  init_flags(Flag_is_macro);
-  C->add_macro_node(this);
-}
-
-uint ArrayCopyNode::size_of() const { return sizeof(*this); }
-
-ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
-                                   Node* src, Node* src_offset,
-                                   Node* dest, Node* dest_offset,
-                                   Node* length,
-                                   bool alloc_tightly_coupled,
-                                   Node* src_klass, Node* dest_klass,
-                                   Node* src_length, Node* dest_length) {
-
-  ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
-  Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
-
-  ac->init_req(ArrayCopyNode::Src, src);
-  ac->init_req(ArrayCopyNode::SrcPos, src_offset);
-  ac->init_req(ArrayCopyNode::Dest, dest);
-  ac->init_req(ArrayCopyNode::DestPos, dest_offset);
-  ac->init_req(ArrayCopyNode::Length, length);
-  ac->init_req(ArrayCopyNode::SrcLen, src_length);
-  ac->init_req(ArrayCopyNode::DestLen, dest_length);
-  ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
-  ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
-
-  if (may_throw) {
-    ac->set_req(TypeFunc::I_O , kit->i_o());
-    kit->add_safepoint_edges(ac, false);
-  }
-
-  return ac;
-}
-
-void ArrayCopyNode::connect_outputs(GraphKit* kit) {
-  kit->set_all_memory_call(this, true);
-  kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
-  kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
-  kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
-  kit->set_all_memory_call(this);
-}
-
-#ifndef PRODUCT
-const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
-void ArrayCopyNode::dump_spec(outputStream *st) const {
-  CallNode::dump_spec(st);
-  st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
-}
-#endif
-
-int ArrayCopyNode::get_count(PhaseGVN *phase) const {
-  Node* src = in(ArrayCopyNode::Src);
-  const Type* src_type = phase->type(src);
-
-  assert(is_clonebasic(), "unexpected arraycopy type");
-  if (src_type->isa_instptr()) {
-    const TypeInstPtr* inst_src = src_type->is_instptr();
-    ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
-    // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
-    // fields into account. They are rare anyway so easier to simply
-    // skip instances with injected fields.
-    if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
-      return -1;
-    }
-    int nb_fields = ik->nof_nonstatic_fields();
-    return nb_fields;
-  }
-  return -1;
-}
-
-Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
-  assert(is_clonebasic(), "unexpected arraycopy type");
-
-  Node* src = in(ArrayCopyNode::Src);
-  Node* dest = in(ArrayCopyNode::Dest);
-  Node* ctl = in(TypeFunc::Control);
-  Node* in_mem = in(TypeFunc::Memory);
-
-  const Type* src_type = phase->type(src);
-  const Type* dest_type = phase->type(dest);
-
-  assert(src->is_AddP(), "should be base + off");
-  assert(dest->is_AddP(), "should be base + off");
-  Node* base_src = src->in(AddPNode::Base);
-  Node* base_dest = dest->in(AddPNode::Base);
-
-  MergeMemNode* mem = MergeMemNode::make(in_mem);
-
-  const TypeInstPtr* inst_src = src_type->is_instptr();
-
-  if (!inst_src->klass_is_exact()) {
-    ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
-    assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
-    phase->C->dependencies()->assert_leaf_type(ik);
-  }
-
-  ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
-  assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
-
-  for (int i = 0; i < count; i++) {
-    ciField* field = ik->nonstatic_field_at(i);
-    int fieldidx = phase->C->alias_type(field)->index();
-    const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
-    Node* off = phase->MakeConX(field->offset());
-    Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
-    Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
-    BasicType bt = field->layout_type();
-
-    const Type *type;
-    if (bt == T_OBJECT) {
-      if (!field->type()->is_loaded()) {
-        type = TypeInstPtr::BOTTOM;
-      } else {
-        ciType* field_klass = field->type();
-        type = TypeOopPtr::make_from_klass(field_klass->as_klass());
-      }
-    } else {
-      type = Type::get_const_basic_type(bt);
-    }
-
-    Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
-    v = phase->transform(v);
-    Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
-    s = phase->transform(s);
-    mem->set_memory_at(fieldidx, s);
-  }
-
-  if (!finish_transform(phase, can_reshape, ctl, mem)) {
-    return NULL;
-  }
-
-  return mem;
-}
-
-bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
-                                     Node* ctl, Node *mem) {
-  if (can_reshape) {
-    PhaseIterGVN* igvn = phase->is_IterGVN();
-    assert(is_clonebasic(), "unexpected arraycopy type");
-    Node* out_mem = proj_out(TypeFunc::Memory);
-
-    if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
-        out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
-      assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
-      return false;
-    }
-
-    igvn->replace_node(out_mem->raw_out(0), mem);
-
-    Node* out_ctl = proj_out(TypeFunc::Control);
-    igvn->replace_node(out_ctl, ctl);
-  }
-  return true;
-}
-
-
-Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
-  if (remove_dead_region(phase, can_reshape))  return this;
-
-  if (StressArrayCopyMacroNode && !can_reshape) return NULL;
-
-  // See if it's a small array copy and we can inline it as
-  // loads/stores
-  // Here we can only do:
-  // - clone for which we don't need to do card marking
-
-  if (!is_clonebasic()) {
-    return NULL;
-  }
-
-  if (in(TypeFunc::Control)->is_top() || in(TypeFunc::Memory)->is_top()) {
-    return NULL;
-  }
-
-  int count = get_count(phase);
-
-  if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
-    return NULL;
-  }
-
-  Node* mem = try_clone_instance(phase, can_reshape, count);
-  return mem;
-}
--- a/hotspot/src/share/vm/opto/callnode.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/callnode.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1083,117 +1083,4 @@
 #endif
 };
 
-class GraphKit;
-
-class ArrayCopyNode : public CallNode {
-private:
-
-  // What kind of arraycopy variant is this?
-  enum {
-    None,            // not set yet
-    ArrayCopy,       // System.arraycopy()
-    CloneBasic,      // A clone that can be copied by 64 bit chunks
-    CloneOop,        // An oop array clone
-    CopyOf,          // Arrays.copyOf()
-    CopyOfRange      // Arrays.copyOfRange()
-  } _kind;
-
-#ifndef PRODUCT
-  static const char* _kind_names[CopyOfRange+1];
-#endif
-  // Is the alloc obtained with
-  // AllocateArrayNode::Ideal_array_allocation() tighly coupled
-  // (arraycopy follows immediately the allocation)?
-  // We cache the result of LibraryCallKit::tightly_coupled_allocation
-  // here because it's much easier to find whether there's a tightly
-  // couple allocation at parse time than at macro expansion time. At
-  // macro expansion time, for every use of the allocation node we
-  // would need to figure out whether it happens after the arraycopy (and
-  // can be ignored) or between the allocation and the arraycopy. At
-  // parse time, it's straightforward because whatever happens after
-  // the arraycopy is not parsed yet so doesn't exist when
-  // LibraryCallKit::tightly_coupled_allocation() is called.
-  bool _alloc_tightly_coupled;
-
-  bool _arguments_validated;
-
-  static const TypeFunc* arraycopy_type() {
-    const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
-    fields[Src]       = TypeInstPtr::BOTTOM;
-    fields[SrcPos]    = TypeInt::INT;
-    fields[Dest]      = TypeInstPtr::BOTTOM;
-    fields[DestPos]   = TypeInt::INT;
-    fields[Length]    = TypeInt::INT;
-    fields[SrcLen]    = TypeInt::INT;
-    fields[DestLen]   = TypeInt::INT;
-    fields[SrcKlass]  = TypeKlassPtr::BOTTOM;
-    fields[DestKlass] = TypeKlassPtr::BOTTOM;
-    const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
-
-    // create result type (range)
-    fields = TypeTuple::fields(0);
-
-    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
-
-    return TypeFunc::make(domain, range);
-  }
-
-  ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
-
-  int get_count(PhaseGVN *phase) const;
-  static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
-
-  Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
-  bool finish_transform(PhaseGVN *phase, bool can_reshape,
-                        Node* ctl, Node *mem);
-
-public:
-
-  enum {
-    Src   = TypeFunc::Parms,
-    SrcPos,
-    Dest,
-    DestPos,
-    Length,
-    SrcLen,
-    DestLen,
-    SrcKlass,
-    DestKlass,
-    ParmLimit
-  };
-
-  static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
-                             Node* src, Node* src_offset,
-                             Node* dest,  Node* dest_offset,
-                             Node* length,
-                             bool alloc_tightly_coupled,
-                             Node* src_klass = NULL, Node* dest_klass = NULL,
-                             Node* src_length = NULL, Node* dest_length = NULL);
-
-  void connect_outputs(GraphKit* kit);
-
-  bool is_arraycopy()             const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
-  bool is_arraycopy_validated()   const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
-  bool is_clonebasic()            const  { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
-  bool is_cloneoop()              const  { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
-  bool is_copyof()                const  { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
-  bool is_copyofrange()           const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
-
-  void set_arraycopy(bool validated)   { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
-  void set_clonebasic()                { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
-  void set_cloneoop()                  { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
-  void set_copyof()                    { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = false; }
-  void set_copyofrange()               { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = false; }
-
-  virtual int Opcode() const;
-  virtual uint size_of() const; // Size is bigger
-  virtual bool guaranteed_safepoint()  { return false; }
-  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
-
-  bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
-
-#ifndef PRODUCT
-  virtual void dump_spec(outputStream *st) const;
-#endif
-};
 #endif // SHARE_VM_OPTO_CALLNODE_HPP
--- a/hotspot/src/share/vm/opto/classes.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/classes.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
 #include "opto/callnode.hpp"
 #include "opto/castnode.hpp"
 #include "opto/cfgnode.hpp"
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -42,6 +42,7 @@
 #include "opto/chaitin.hpp"
 #include "opto/compile.hpp"
 #include "opto/connode.hpp"
+#include "opto/convertnode.hpp"
 #include "opto/divnode.hpp"
 #include "opto/escape.hpp"
 #include "opto/idealGraphPrinter.hpp"
@@ -3867,6 +3868,26 @@
   return SSC_full_test;
 }
 
+Node* Compile::conv_I2X_index(PhaseGVN *phase, Node* idx, const TypeInt* sizetype) {
+#ifdef _LP64
+  // The scaled index operand to AddP must be a clean 64-bit value.
+  // Java allows a 32-bit int to be incremented to a negative
+  // value, which appears in a 64-bit register as a large
+  // positive number.  Using that large positive number as an
+  // operand in pointer arithmetic has bad consequences.
+  // On the other hand, 32-bit overflow is rare, and the possibility
+  // can often be excluded, if we annotate the ConvI2L node with
+  // a type assertion that its value is known to be a small positive
+  // number.  (The prior range check has ensured this.)
+  // This assertion is used by ConvI2LNode::Ideal.
+  int index_max = max_jint - 1;  // array size is max_jint, index is one less
+  if (sizetype != NULL)  index_max = sizetype->_hi - 1;
+  const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
+  idx = phase->transform(new ConvI2LNode(idx, lidxtype));
+#endif
+  return idx;
+}
+
 // The message about the current inlining is accumulated in
 // _print_inlining_stream and transfered into the _print_inlining_list
 // once we know whether inlining succeeds or not. For regular
--- a/hotspot/src/share/vm/opto/compile.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -74,6 +74,7 @@
 class JVMState;
 class Type;
 class TypeData;
+class TypeInt;
 class TypePtr;
 class TypeOopPtr;
 class TypeFunc;
@@ -1221,6 +1222,8 @@
   enum { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
   int static_subtype_check(ciKlass* superk, ciKlass* subk);
 
+  static Node* conv_I2X_index(PhaseGVN *phase, Node* offset, const TypeInt* sizetype);
+
   // Auxiliary method for randomized fuzzing/stressing
   static bool randomized_select(int count);
 };
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1660,22 +1660,7 @@
 
   // must be correct type for alignment purposes
   Node* base  = basic_plus_adr(ary, header);
-#ifdef _LP64
-  // The scaled index operand to AddP must be a clean 64-bit value.
-  // Java allows a 32-bit int to be incremented to a negative
-  // value, which appears in a 64-bit register as a large
-  // positive number.  Using that large positive number as an
-  // operand in pointer arithmetic has bad consequences.
-  // On the other hand, 32-bit overflow is rare, and the possibility
-  // can often be excluded, if we annotate the ConvI2L node with
-  // a type assertion that its value is known to be a small positive
-  // number.  (The prior range check has ensured this.)
-  // This assertion is used by ConvI2LNode::Ideal.
-  int index_max = max_jint - 1;  // array size is max_jint, index is one less
-  if (sizetype != NULL)  index_max = sizetype->_hi - 1;
-  const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
-  idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) );
-#endif
+  idx = Compile::conv_I2X_index(&_gvn, idx, sizetype);
   Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
   return basic_plus_adr(ary, base, scale);
 }
@@ -3759,7 +3744,8 @@
 
 Node* GraphKit::byte_map_base_node() {
   // Get base of card map
-  CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set());
+  CardTableModRefBS* ct =
+    barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code");
   if (ct->byte_map_base != NULL) {
     return makecon(TypeRawPtr::make((address)ct->byte_map_base));
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -30,6 +30,7 @@
 #include "compiler/compileLog.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
 #include "opto/callGenerator.hpp"
 #include "opto/castnode.hpp"
 #include "opto/cfgnode.hpp"
@@ -3867,26 +3868,65 @@
       Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
       Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
 
-      newcopy = new_array(klass_node, length, 0);  // no arguments to push
-
       // Generate a direct call to the right arraycopy function(s).
       // We know the copy is disjoint but we might not know if the
       // oop stores need checking.
       // Extreme case:  Arrays.copyOf((Integer[])x, 10, String[].class).
       // This will fail a store-check if x contains any non-nulls.
 
-      Node* alloc = tightly_coupled_allocation(newcopy, NULL);
-
-      ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, alloc != NULL,
+      // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
+      // loads/stores but it is legal only if we're sure the
+      // Arrays.copyOf would succeed. So we need all input arguments
+      // to the copyOf to be validated, including that the copy to the
+      // new array won't trigger an ArrayStoreException. That subtype
+      // check can be optimized if we know something on the type of
+      // the input array from type speculation.
+      if (_gvn.type(klass_node)->singleton()) {
+        ciKlass* subk   = _gvn.type(load_object_klass(original))->is_klassptr()->klass();
+        ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
+
+        int test = C->static_subtype_check(superk, subk);
+        if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
+          const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();
+          if (t_original->speculative_type() != NULL) {
+            original = maybe_cast_profiled_obj(original, t_original->speculative_type(), true);
+          }
+        }
+      }
+
+      bool validated = false;
+      // Reason_class_check rather than Reason_intrinsic because we
+      // want to intrinsify even if this traps.
+      if (!too_many_traps(Deoptimization::Reason_class_check)) {
+        Node* not_subtype_ctrl = gen_subtype_check(load_object_klass(original),
+                                                   klass_node);
+
+        if (not_subtype_ctrl != top()) {
+          PreserveJVMState pjvms(this);
+          set_control(not_subtype_ctrl);
+          uncommon_trap(Deoptimization::Reason_class_check,
+                        Deoptimization::Action_make_not_entrant);
+          assert(stopped(), "Should be stopped");
+        }
+        validated = true;
+      }
+
+      newcopy = new_array(klass_node, length, 0);  // no arguments to push
+
+      ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true,
                                               load_object_klass(original), klass_node);
       if (!is_copyOfRange) {
-        ac->set_copyof();
+        ac->set_copyof(validated);
       } else {
-        ac->set_copyofrange();
+        ac->set_copyofrange(validated);
       }
       Node* n = _gvn.transform(ac);
-      assert(n == ac, "cannot disappear");
-      ac->connect_outputs(this);
+      if (n == ac) {
+        ac->connect_outputs(this);
+      } else {
+        assert(validated, "shouldn't transform if all arguments not validated");
+        set_all_memory(n);
+      }
     }
   } // original reexecute is set back here
 
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -2032,7 +2032,7 @@
     // Hopefully, compiler will optimize for powers of 2.
     Node *ctrl = get_ctrl(main_limit);
     Node *stride = cl->stride();
-    Node *init = cl->init_trip();
+    Node *init = cl->init_trip()->uncast();
     Node *span = new SubINode(main_limit,init);
     register_new_node(span,ctrl);
     Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1));
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "opto/arraycopynode.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "opto/convertnode.hpp"
 #include "opto/graphKit.hpp"
@@ -519,7 +520,7 @@
     // Test S[] against D[], not S against D, because (probably)
     // the secondary supertype cache is less busy for S[] than S.
     // This usually only matters when D is an interface.
-    Node* not_subtype_ctrl = ac->is_arraycopy_validated() ? top() :
+    Node* not_subtype_ctrl = (ac->is_arraycopy_validated() || ac->is_copyof_validated() || ac->is_copyofrange_validated()) ? top() :
       Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
     // Plug failing path into checked_oop_disjoint_arraycopy
     if (not_subtype_ctrl != top()) {
--- a/hotspot/src/share/vm/opto/type.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/opto/type.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -974,21 +974,10 @@
 
 //------------------------------eq---------------------------------------------
 // Structural equality check for Type representations
-bool TypeF::eq( const Type *t ) const {
-  if( g_isnan(_f) ||
-      g_isnan(t->getf()) ) {
-    // One or both are NANs.  If both are NANs return true, else false.
-    return (g_isnan(_f) && g_isnan(t->getf()));
-  }
-  if (_f == t->getf()) {
-    // (NaN is impossible at this point, since it is not equal even to itself)
-    if (_f == 0.0) {
-      // difference between positive and negative zero
-      if (jint_cast(_f) != jint_cast(t->getf()))  return false;
-    }
-    return true;
-  }
-  return false;
+bool TypeF::eq(const Type *t) const {
+  // Bitwise comparison to distinguish between +/-0. These values must be treated
+  // as different to be consistent with C1 and the interpreter.
+  return (jint_cast(_f) == jint_cast(t->getf()));
 }
 
 //------------------------------hash-------------------------------------------
@@ -1089,21 +1078,10 @@
 
 //------------------------------eq---------------------------------------------
 // Structural equality check for Type representations
-bool TypeD::eq( const Type *t ) const {
-  if( g_isnan(_d) ||
-      g_isnan(t->getd()) ) {
-    // One or both are NANs.  If both are NANs return true, else false.
-    return (g_isnan(_d) && g_isnan(t->getd()));
-  }
-  if (_d == t->getd()) {
-    // (NaN is impossible at this point, since it is not equal even to itself)
-    if (_d == 0.0) {
-      // difference between positive and negative zero
-      if (jlong_cast(_d) != jlong_cast(t->getd()))  return false;
-    }
-    return true;
-  }
-  return false;
+bool TypeD::eq(const Type *t) const {
+  // Bitwise comparison to distinguish between +/-0. These values must be treated
+  // as different to be consistent with C1 and the interpreter.
+  return (jlong_cast(_d) == jlong_cast(t->getd()));
 }
 
 //------------------------------hash-------------------------------------------
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -782,9 +782,13 @@
           Method* idnum_owner = scratch_class->method_with_idnum(old_num);
           if (idnum_owner != NULL) {
             // There is already a method assigned this idnum -- switch them
+            // Take current and original idnum from the new_method
             idnum_owner->set_method_idnum(new_num);
+            idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
           }
+          // Take current and original idnum from the old_method
           k_new_method->set_method_idnum(old_num);
+          k_new_method->set_orig_method_idnum(k_old_method->orig_method_idnum());
           if (thread->has_pending_exception()) {
             return JVMTI_ERROR_OUT_OF_MEMORY;
           }
@@ -817,9 +821,12 @@
         Method* idnum_owner = scratch_class->method_with_idnum(num);
         if (idnum_owner != NULL) {
           // There is already a method assigned this idnum -- switch them
+          // Take current and original idnum from the new_method
           idnum_owner->set_method_idnum(new_num);
+          idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
         }
         k_new_method->set_method_idnum(num);
+        k_new_method->set_orig_method_idnum(num);
         if (thread->has_pending_exception()) {
           return JVMTI_ERROR_OUT_OF_MEMORY;
         }
@@ -3327,6 +3334,7 @@
   // This is a very busy routine. We don't want too much tracing
   // printed out.
   bool trace_name_printed = false;
+  InstanceKlass *the_class = InstanceKlass::cast(_the_class_oop);
 
   // Very noisy: only enable this call if you are trying to determine
   // that a specific class gets found by this routine.
@@ -3338,10 +3346,8 @@
   // If the class being redefined is java.lang.Object, we need to fix all
   // array class vtables also
   if (k->oop_is_array() && _the_class_oop == SystemDictionary::Object_klass()) {
-    k->vtable()->adjust_method_entries(_matching_old_methods,
-                                       _matching_new_methods,
-                                       _matching_methods_length,
-                                       &trace_name_printed);
+    k->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+
   } else if (k->oop_is_instance()) {
     HandleMark hm(_thread);
     InstanceKlass *ik = InstanceKlass::cast(k);
@@ -3383,14 +3389,9 @@
         || ik->is_subtype_of(_the_class_oop))) {
       // ik->vtable() creates a wrapper object; rm cleans it up
       ResourceMark rm(_thread);
-      ik->vtable()->adjust_method_entries(_matching_old_methods,
-                                          _matching_new_methods,
-                                          _matching_methods_length,
-                                          &trace_name_printed);
-      ik->adjust_default_methods(_matching_old_methods,
-                                 _matching_new_methods,
-                                 _matching_methods_length,
-                                 &trace_name_printed);
+
+      ik->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+      ik->adjust_default_methods(the_class, &trace_name_printed);
     }
 
     // If the current class has an itable and we are either redefining an
@@ -3405,10 +3406,8 @@
         || ik->is_subclass_of(_the_class_oop))) {
       // ik->itable() creates a wrapper object; rm cleans it up
       ResourceMark rm(_thread);
-      ik->itable()->adjust_method_entries(_matching_old_methods,
-                                          _matching_new_methods,
-                                          _matching_methods_length,
-                                          &trace_name_printed);
+
+      ik->itable()->adjust_method_entries(the_class, &trace_name_printed);
     }
 
     // The constant pools in other classes (other_cp) can refer to
@@ -3432,10 +3431,7 @@
       other_cp = constantPoolHandle(ik->constants());
       cp_cache = other_cp->cache();
       if (cp_cache != NULL) {
-        cp_cache->adjust_method_entries(_matching_old_methods,
-                                        _matching_new_methods,
-                                        _matching_methods_length,
-                                        &trace_name_printed);
+        cp_cache->adjust_method_entries(the_class, &trace_name_printed);
       }
     }
 
@@ -3578,6 +3574,7 @@
 
       // obsolete methods need a unique idnum so they become new entries in
       // the jmethodID cache in InstanceKlass
+      assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
       u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
       if (num != ConstMethod::UNSET_IDNUM) {
         old_method->set_method_idnum(num);
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -289,7 +289,12 @@
 
 // Create MDO if necessary.
 void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
-  if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
+  if (mh->is_native() ||
+      mh->is_abstract() ||
+      mh->is_accessor() ||
+      mh->is_constant_getter()) {
+    return;
+  }
   if (mh->method_data() == NULL) {
     Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
   }
--- a/hotspot/src/share/vm/runtime/java.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Wed Jul 05 20:24:03 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
@@ -421,9 +421,11 @@
     os::infinite_sleep();
   }
 
-  // Terminate watcher thread - must before disenrolling any periodic task
-  if (PeriodicTask::num_tasks() > 0)
+  // Stop the WatcherThread. We do this before disenrolling various
+  // PeriodicTasks to reduce the likelihood of races.
+  if (PeriodicTask::num_tasks() > 0) {
     WatcherThread::stop();
+  }
 
   // Print statistics gathered (profiling ...)
   if (Arguments::has_profile()) {
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -724,6 +724,7 @@
 // state of the code cache if it's requested.
 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
   if (PrintMethodFlushing) {
+    ResourceMark rm;
     stringStream s;
     // Dump code cache state into a buffer before locking the tty,
     // because log_state() will use locks causing lock conflicts.
@@ -741,6 +742,7 @@
   }
 
   if (LogCompilation && (xtty != NULL)) {
+    ResourceMark rm;
     stringStream s;
     // Dump code cache state into a buffer before locking the tty,
     // because log_state() will use locks causing lock conflicts.
--- a/hotspot/src/share/vm/runtime/task.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/task.cpp	Wed Jul 05 20:24:03 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
@@ -47,6 +47,8 @@
 #endif
 
 void PeriodicTask::real_time_tick(int delay_time) {
+  assert(Thread::current()->is_Watcher_thread(), "must be WatcherThread");
+
 #ifndef PRODUCT
   if (ProfilerCheckIntervals) {
     _ticks++;
@@ -60,6 +62,8 @@
 #endif
 
   {
+    // The WatcherThread does not participate in the safepoint protocol
+    // for the PeriodicTask_lock because it is not a JavaThread.
     MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
     int orig_num_tasks = _num_tasks;
 
@@ -74,8 +78,7 @@
 }
 
 int PeriodicTask::time_to_wait() {
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
-                     NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+  assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
 
   if (_num_tasks == 0) {
     return 0; // sleep until shutdown or a task is enrolled
@@ -98,14 +101,19 @@
 }
 
 PeriodicTask::~PeriodicTask() {
+  // This PeriodicTask may have already been disenrolled by a call
+  // to disenroll() before the PeriodicTask was deleted.
   disenroll();
 }
 
-/* enroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// enroll the current PeriodicTask
 void PeriodicTask::enroll() {
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
-                     NULL : PeriodicTask_lock);
+  // Follow normal safepoint aware lock enter protocol if the caller does
+  // not already own the PeriodicTask_lock. Otherwise, we don't try to
+  // enter it again because VM internal Mutexes do not support recursion.
+  //
+  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+                                                      : PeriodicTask_lock);
 
   if (_num_tasks == PeriodicTask::max_tasks) {
     fatal("Overflow in PeriodicTask table");
@@ -113,18 +121,21 @@
   _tasks[_num_tasks++] = this;
 
   WatcherThread* thread = WatcherThread::watcher_thread();
-  if (thread) {
+  if (thread != NULL) {
     thread->unpark();
   } else {
     WatcherThread::start();
   }
 }
 
-/* disenroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// disenroll the current PeriodicTask
 void PeriodicTask::disenroll() {
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
-                     NULL : PeriodicTask_lock);
+  // Follow normal safepoint aware lock enter protocol if the caller does
+  // not already own the PeriodicTask_lock. Otherwise, we don't try to
+  // enter it again because VM internal Mutexes do not support recursion.
+  //
+  MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+                                                      : PeriodicTask_lock);
 
   int index;
   for(index = 0; index < _num_tasks && _tasks[index] != this; index++)
--- a/hotspot/src/share/vm/runtime/task.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/task.hpp	Wed Jul 05 20:24:03 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
@@ -54,6 +54,7 @@
 
   static int _num_tasks;
   static PeriodicTask* _tasks[PeriodicTask::max_tasks];
+  // Can only be called by the WatcherThread
   static void real_time_tick(int delay_time);
 
 #ifndef PRODUCT
@@ -98,6 +99,7 @@
 
   // Calculate when the next periodic task will fire.
   // Called by the WatcherThread's run method.
+  // Requires the PeriodicTask_lock.
   static int time_to_wait();
 
   // The task to perform at each period
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -1161,6 +1161,10 @@
   va_end(ap);
 }
 
+void NamedThread::initialize_named_thread() {
+  set_native_thread_name(name());
+}
+
 void NamedThread::print_on(outputStream* st) const {
   st->print("\"%s\" ", name());
   Thread::print_on(st);
@@ -1197,8 +1201,15 @@
 }
 
 int WatcherThread::sleep() const {
+  // The WatcherThread does not participate in the safepoint protocol
+  // for the PeriodicTask_lock because it is not a JavaThread.
   MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
 
+  if (_should_terminate) {
+    // check for termination before we do any housekeeping or wait
+    return 0;  // we did not sleep.
+  }
+
   // remaining will be zero if there are no tasks,
   // causing the WatcherThread to sleep until a task is
   // enrolled
@@ -1211,8 +1222,9 @@
 
   jlong time_before_loop = os::javaTimeNanos();
 
-  for (;;) {
-    bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag, remaining);
+  while (true) {
+    bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag,
+                                            remaining);
     jlong now = os::javaTimeNanos();
 
     if (remaining == 0) {
@@ -1253,7 +1265,7 @@
   this->initialize_thread_local_storage();
   this->set_native_thread_name(this->name());
   this->set_active_handles(JNIHandleBlock::allocate_block());
-  while (!_should_terminate) {
+  while (true) {
     assert(watcher_thread() == Thread::current(), "thread consistency check");
     assert(watcher_thread() == this, "thread consistency check");
 
@@ -1289,6 +1301,11 @@
       }
     }
 
+    if (_should_terminate) {
+      // check for termination before posting the next tick
+      break;
+    }
+
     PeriodicTask::real_time_tick(time_waited);
   }
 
@@ -1319,27 +1336,19 @@
 }
 
 void WatcherThread::stop() {
-  // Get the PeriodicTask_lock if we can. If we cannot, then the
-  // WatcherThread is using it and we don't want to block on that lock
-  // here because that might cause a safepoint deadlock depending on
-  // what the current WatcherThread tasks are doing.
-  bool have_lock = PeriodicTask_lock->try_lock();
-
-  _should_terminate = true;
-  OrderAccess::fence();  // ensure WatcherThread sees update in main loop
-
-  if (have_lock) {
+  {
+    // Follow normal safepoint aware lock enter protocol since the
+    // WatcherThread is stopped by another JavaThread.
+    MutexLocker ml(PeriodicTask_lock);
+    _should_terminate = true;
+
     WatcherThread* watcher = watcher_thread();
     if (watcher != NULL) {
-      // If we managed to get the lock, then we should unpark the
-      // WatcherThread so that it can see we want it to stop.
+      // unpark the WatcherThread so it can see that it should terminate
       watcher->unpark();
     }
-
-    PeriodicTask_lock->unlock();
   }
 
-  // it is ok to take late safepoints here, if needed
   MutexLocker mu(Terminator_lock);
 
   while (watcher_thread() != NULL) {
@@ -1359,9 +1368,7 @@
 }
 
 void WatcherThread::unpark() {
-  MutexLockerEx ml(PeriodicTask_lock->owned_by_self()
-                   ? NULL
-                   : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+  assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
   PeriodicTask_lock->notify();
 }
 
@@ -3558,8 +3565,8 @@
   }
 
   {
-    MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
-    // Make sure the watcher thread can be started by WatcherThread::start()
+    MutexLocker ml(PeriodicTask_lock);
+    // Make sure the WatcherThread can be started by WatcherThread::start()
     // or by dynamic enrollment.
     WatcherThread::make_startable();
     // Start up the WatcherThread if there are any periodic tasks
--- a/hotspot/src/share/vm/runtime/thread.hpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 05 20:24:03 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
@@ -667,6 +667,7 @@
   ~NamedThread();
   // May only be called once per thread.
   void set_name(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
+  void initialize_named_thread();
   virtual bool is_Named_thread() const { return true; }
   virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
   JavaThread *processed_thread() { return _processed_thread; }
@@ -701,7 +702,8 @@
   static WatcherThread* _watcher_thread;
 
   static bool _startable;
-  volatile static bool _should_terminate; // updated without holding lock
+  // volatile due to at least one lock-free read
+  volatile static bool _should_terminate;
 
   os::WatcherThreadCrashProtection* _crash_protection;
  public:
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -487,7 +487,6 @@
                                                                                                                                      \
   unchecked_nonstatic_field(ageTable,          sizes,                                         sizeof(ageTable::sizes))               \
                                                                                                                                      \
-  nonstatic_field(BarrierSet,                  _kind,                                         BarrierSet::Name)                      \
   nonstatic_field(BlockOffsetTable,            _bottom,                                       HeapWord*)                             \
   nonstatic_field(BlockOffsetTable,            _end,                                          HeapWord*)                             \
                                                                                                                                      \
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -243,7 +243,7 @@
   assert(this == vm_thread(), "check");
 
   this->initialize_thread_local_storage();
-  this->set_native_thread_name(this->name());
+  this->initialize_named_thread();
   this->record_stack_base_and_size();
   // Notify_lock wait checks on active_handles() to rewait in
   // case of spurious wakeup, it should wait on the last
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp	Wed Jul 05 20:24:03 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.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -446,7 +446,7 @@
     CreateIntToPtr(
       CreateAdd(
         LLVMValue::intptr_constant(
-          (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
+          (intptr_t) (barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base)),
         CreateLShr(
           CreatePtrToInt(field, SharkType::intptr_type()),
           LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * 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_UTILITIES_FAKERTTISUPPORT_HPP
+#define SHARE_VM_UTILITIES_FAKERTTISUPPORT_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/debug.hpp"
+
+// Provides support for checked downcasts in a hierarchy of classes.
+// The base class provides a member of this type, specialized on that
+// base class and an associated tag type.  Tags are small non-negative
+// integer values uniquely associated with distinct classes in the
+// hierarchy.  A tag type is often an enum type.
+//
+// The concrete class specifies the concrete tag.
+//
+// The tag set specifies the set of classes in the derivation
+// sequence.  Classes in the derivation sequence add their associated
+// tag during construction.  Given the tag associated with a class, an
+// object is an instance of that class if the tag is included in the
+// object's set of recorded tags.
+//
+// A tag T is present in a tag set if the T'th bit of the tag set is
+// one.
+//
+// Note: The representation of a tag set being uintx sets an upper
+// bound on the size of a class hierarchy this utility can be used
+// with.
+template<typename T, typename TagType>
+class FakeRttiSupport VALUE_OBJ_CLASS_SPEC {
+public:
+  // Construct with the indicated concrete tag, and include the
+  // concrete tag in the associated tag set.
+  explicit FakeRttiSupport(TagType concrete_tag) :
+    _tag_set(tag_bit(concrete_tag)), _concrete_tag(concrete_tag) { }
+
+  // Construct with the indicated concrete tag and tag set.
+  // Note: This constructor is public only to allow clients to set up
+  // "unusual" (or perhaps buggy) fake RTTI configurations.
+  FakeRttiSupport(TagType concrete_tag, uintx tag_set) :
+    _tag_set(tag_set), _concrete_tag(validate_tag(concrete_tag)) { }
+
+  // Get the concrete tag.
+  TagType concrete_tag() const { return _concrete_tag; }
+
+  // Test whether tag is in the tag set.
+  bool has_tag(TagType tag) const {
+    return (_tag_set & tag_bit(tag)) != 0;
+  }
+
+  // Return a new support object which is the same as this, except tag
+  // has been added to the tag set.  The tag must not already be
+  // present in the tag set.
+  FakeRttiSupport add_tag(TagType tag) const {
+    uintx tbit = tag_bit(tag);
+    assert((_tag_set & tbit) == 0,
+           err_msg("Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT,
+                   (uintx)tag, _tag_set));
+    return FakeRttiSupport(_concrete_tag, _tag_set | tbit);
+  }
+
+private:
+  uintx _tag_set;
+  TagType _concrete_tag;
+
+  static uintx tag_bit(TagType tag) {
+    return ((uintx)1) << validate_tag(tag);
+  }
+
+  static TagType validate_tag(uintx tag) {
+    // Type of tag is not TagType to dodge useless MacOSX compiler warning.
+    assert(tag < (sizeof(uintx) * BitsPerByte),
+           err_msg("Tag " UINTX_FORMAT " is too large", tag));
+    return static_cast<TagType>(tag);
+  }
+};
+
+#endif // include guard
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Jul 05 20:24:03 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
@@ -247,6 +247,7 @@
 void GangWorker::initialize() {
   this->initialize_thread_local_storage();
   this->record_stack_base_and_size();
+  this->initialize_named_thread();
   assert(_gang != NULL, "No gang to run in");
   os::set_priority(this, NearMaxPriority);
   if (TraceWorkGang) {
--- a/hotspot/test/TEST.groups	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/TEST.groups	Wed Jul 05 20:24:03 2017 +0200
@@ -114,7 +114,9 @@
   compiler/c2/7047069/Test7047069.java \
   runtime/6294277/SourceDebugExtension.java \
   runtime/ClassFile/JsrRewriting.java \
-  runtime/ClassFile/OomWhileParsingRepeatedJsr.java
+  runtime/ClassFile/OomWhileParsingRepeatedJsr.java \
+  runtime/SharedArchiveFile/LimitSharedSizes.java \
+  runtime/SharedArchiveFile/SpaceUtilizationCheck.java
 
 # Compact 3 adds further tests to compact2
 #
@@ -387,35 +389,7 @@
   -compiler/runtime/6826736
 
 hotspot_compiler_closed = \
-  closed/compiler/c1/ \
-  closed/compiler/c2/ \
-  closed/compiler/codegen/ \
-  closed/compiler/escapeAnalysis/ \
-  closed/compiler/interpreter/ \
-  closed/compiler/jsr292/ \
-  closed/compiler/loopopts/ \
-  closed/compiler/oracle/ \
-  closed/compiler/runtime/ \
-  closed/compiler/symantec/ \
-  -closed/compiler/c1/4477197 \
-  -closed/compiler/c1/5040872 \
-  -closed/compiler/c1/6507107 \
-  -closed/compiler/c2/4344895 \
-  -closed/compiler/c2/4485006 \
-  -closed/compiler/c2/4523683 \
-  -closed/compiler/c2/4620290 \
-  -closed/compiler/c2/4998314 \
-  -closed/compiler/c2/6329104 \
-  -closed/compiler/c2/6434117 \
-  -closed/compiler/c2/6547163 \
-  -closed/compiler/c2/6563987 \
-  -closed/compiler/c2/6595044 \
-  -closed/compiler/codegen/6440479 \
-  -closed/compiler/codegen/6603011 \
-  -closed/compiler/interpreter/5034475 \
-  -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \
-  -closed/compiler/loopopts/4463485 \
-  -closed/compiler/loopopts/8021898
+  sanity/ExecuteInternalVMTests.java
 
 hotspot_gc = \
   sanity/ExecuteInternalVMTests.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * 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 8073792
+ * @summary assert broken when array size becomes known during igvn
+ * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCloneBadAssert.m TestArrayCloneBadAssert
+ *
+ */
+
+public class TestArrayCloneBadAssert {
+
+    static final int[] array = new int[5];
+
+    static int[] m(int[] arr) {
+        int i = 0;
+        for (; i < 2; i++) {
+        }
+        if (i == 2) {
+            arr = array;
+        }
+        return arr.clone();
+    }
+
+    static public void main(String[] args) {
+        int[] arr = new int[5];
+        m(arr);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,617 @@
+/*
+ * 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 6912521
+ * @summary small array copy as loads/stores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ *
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+public class TestArrayCopyAsLoadsStores {
+
+    public enum ArraySrc {
+        SMALL,
+        LARGE,
+        ZERO
+    }
+
+    public enum ArrayDst {
+        NONE,
+        NEW,
+        SRC
+    }
+
+    static class A {
+    }
+
+    static class B extends A {
+    }
+
+    static final A[] small_a_src = new A[5];
+    static final A[] large_a_src = new A[10];
+    static final A[] zero_a_src = new A[0];
+    static final int[] small_int_src = new int[5];
+    static final int[] large_int_src = new int[10];
+    static final int[] zero_int_src = new int[0];
+    static final Object[] small_object_src = new Object[5];
+    static Object src;
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Args {
+        ArraySrc src();
+        ArrayDst dst() default ArrayDst.NONE;
+        int[] extra_args() default {};
+    }
+
+    // array clone should be compiled as loads/stores
+    @Args(src=ArraySrc.SMALL)
+    static A[] m1() throws CloneNotSupportedException {
+        return (A[])small_a_src.clone();
+    }
+
+    @Args(src=ArraySrc.SMALL)
+    static int[] m2() throws CloneNotSupportedException {
+        return (int[])small_int_src.clone();
+    }
+
+    // new array allocation should be optimized out
+    @Args(src=ArraySrc.SMALL)
+    static int m3() throws CloneNotSupportedException {
+        int[] array_clone = (int[])small_int_src.clone();
+        return array_clone[0] + array_clone[1] + array_clone[2] +
+            array_clone[3] + array_clone[4];
+    }
+
+    // should not be compiled as loads/stores
+    @Args(src=ArraySrc.LARGE)
+    static int[] m4() throws CloneNotSupportedException {
+        return (int[])large_int_src.clone();
+    }
+
+    // check that array of length 0 is handled correctly
+    @Args(src=ArraySrc.ZERO)
+    static int[] m5() throws CloneNotSupportedException {
+        return (int[])zero_int_src.clone();
+    }
+
+    // array copy should be compiled as loads/stores
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+    static void m6(int[] src, int[] dest) {
+        System.arraycopy(src, 0, dest, 0, 5);
+    }
+
+    // array copy should not be compiled as loads/stores
+    @Args(src=ArraySrc.LARGE, dst=ArrayDst.NEW)
+    static void m7(int[] src, int[] dest) {
+        System.arraycopy(src, 0, dest, 0, 10);
+    }
+
+    // array copy should be compiled as loads/stores
+    @Args(src=ArraySrc.SMALL)
+    static A[] m8(A[] src) {
+        src[0] = src[0]; // force null check
+        A[] dest = new A[5];
+        System.arraycopy(src, 0, dest, 0, 5);
+        return dest;
+    }
+
+    // array copy should not be compiled as loads/stores: we would
+    // need to emit GC barriers
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+    static void m9(A[] src, A[] dest) {
+        System.arraycopy(src, 0, dest, 0, 5);
+    }
+
+    // overlapping array regions: copy backward
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+    static void m10(int[] src, int[] dest) {
+        System.arraycopy(src, 0, dest, 1, 4);
+    }
+
+    static boolean m10_check(int[] src, int[] dest) {
+        boolean failure = false;
+        for (int i = 0; i < 5; i++) {
+            int j = Math.max(i - 1, 0);
+            if (dest[i] != src[j]) {
+                System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+                failure = true;
+            }
+        }
+        return failure;
+    }
+
+    // overlapping array regions: copy forward
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+    static void m11(int[] src, int[] dest) {
+        System.arraycopy(src, 1, dest, 0, 4);
+    }
+
+    static boolean m11_check(int[] src, int[] dest) {
+        boolean failure = false;
+        for (int i = 0; i < 5; i++) {
+            int j = Math.min(i + 1, 4);
+            if (dest[i] != src[j]) {
+                System.out.println("Test m11 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+                failure = true;
+            }
+        }
+        return failure;
+    }
+
+    // overlapping array region with unknown src/dest offsets: compiled code must include both forward and backward copies
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+    static void m12(int[] src, int[] dest, int srcPos, int destPos) {
+        System.arraycopy(src, srcPos, dest, destPos, 4);
+    }
+
+    static boolean m12_check(int[] src, int[] dest) {
+        boolean failure = false;
+        for (int i = 0; i < 5; i++) {
+            int j = Math.max(i - 1, 0);
+            if (dest[i] != src[j]) {
+                System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+                failure = true;
+            }
+        }
+        return failure;
+    }
+
+    // Array allocation and copy should optimize out
+    @Args(src=ArraySrc.SMALL)
+    static int m13(int[] src) {
+        int[] dest = new int[5];
+        System.arraycopy(src, 0, dest, 0, 5);
+        return dest[0] + dest[1] + dest[2] + dest[3] + dest[4];
+    }
+
+    // Check that copy of length 0 is handled correctly
+    @Args(src=ArraySrc.ZERO, dst=ArrayDst.NEW)
+    static void m14(int[] src, int[] dest) {
+        System.arraycopy(src, 0, dest, 0, 0);
+    }
+
+    // copyOf should compile to loads/stores
+    @Args(src=ArraySrc.SMALL)
+    static A[] m15() {
+        return Arrays.copyOf(small_a_src, 5, A[].class);
+    }
+
+    static Object[] helper16(int i) {
+        Object[] arr = null;
+        if ((i%2) == 0) {
+            arr = small_a_src;
+        } else {
+            arr = small_object_src;
+        }
+        return arr;
+    }
+
+    // CopyOf may need subtype check
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+    static A[] m16(A[] unused_src, int i) {
+        Object[] arr = helper16(i);
+        return Arrays.copyOf(arr, 5, A[].class);
+    }
+
+    static Object[] helper17_1(int i) {
+        Object[] arr = null;
+        if ((i%2) == 0) {
+            arr = small_a_src;
+        } else {
+            arr = small_object_src;
+        }
+        return arr;
+    }
+
+    static A[] helper17_2(Object[] arr) {
+        return Arrays.copyOf(arr, 5, A[].class);
+    }
+
+    // CopyOf may leverage type speculation
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+    static A[] m17(A[] unused_src, int i) {
+        Object[] arr = helper17_1(i);
+        return helper17_2(arr);
+    }
+
+    static Object[] helper18_1(int i) {
+        Object[] arr = null;
+        if ((i%2) == 0) {
+            arr = small_a_src;
+        } else {
+            arr = small_object_src;
+        }
+        return arr;
+    }
+
+    static Object[] helper18_2(Object[] arr) {
+        return Arrays.copyOf(arr, 5, Object[].class);
+    }
+
+    // CopyOf should not attempt to use type speculation if it's not needed
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+    static Object[] m18(A[] unused_src, int i) {
+        Object[] arr = helper18_1(i);
+        return helper18_2(arr);
+    }
+
+    static Object[] helper19(int i) {
+        Object[] arr = null;
+        if ((i%2) == 0) {
+            arr = small_a_src;
+        } else {
+            arr = small_object_src;
+        }
+        return arr;
+    }
+
+    // CopyOf may need subtype check. Test is run to make type check
+    // fail and cause deoptimization. Next compilation should not
+    // compile as loads/stores because the first compilation
+    // deoptimized.
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+    static A[] m19(A[] unused_src, int i) {
+        Object[] arr = helper19(i);
+        return Arrays.copyOf(arr, 5, A[].class);
+    }
+
+    // copyOf for large array should not compile to loads/stores
+    @Args(src=ArraySrc.LARGE)
+    static A[] m20() {
+        return Arrays.copyOf(large_a_src, 10, A[].class);
+    }
+
+    // check zero length copyOf is handled correctly
+    @Args(src=ArraySrc.ZERO)
+    static A[] m21() {
+        return Arrays.copyOf(zero_a_src, 0, A[].class);
+    }
+
+    // Run with srcPos=0 for a 1st compile, then with incorrect value
+    // of srcPos to cause deoptimization, then with srcPos=0 for a 2nd
+    // compile. The 2nd compile shouldn't turn arraycopy into
+    // loads/stores because input arguments are no longer known to be
+    // valid.
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW, extra_args={0})
+    static void m22(int[] src, int[] dest, int srcPos) {
+        System.arraycopy(src, srcPos, dest, 0, 5);
+    }
+
+    // copyOfRange should compile to loads/stores
+    @Args(src=ArraySrc.SMALL)
+    static A[] m23() {
+        return Arrays.copyOfRange(small_a_src, 1, 4, A[].class);
+    }
+
+    static boolean m23_check(A[] src, A[] dest) {
+        boolean failure = false;
+        for (int i = 0; i < 3; i++) {
+            if (src[i+1] != dest[i]) {
+                System.out.println("Test m23 failed for " + i + " src[" + (i+1) +"]=" + dest[i] + ", dest[" + i + "]=" + dest[i]);
+                failure = true;
+            }
+        }
+        return failure;
+    }
+
+    // array copy should be compiled as loads/stores. Invoke then with
+    // incompatible array type to verify we don't allow a forbidden
+    // arraycopy to happen.
+    @Args(src=ArraySrc.SMALL)
+    static A[] m24(Object[] src) {
+        src[0] = src[0]; // force null check
+        A[] dest = new A[5];
+        System.arraycopy(src, 0, dest, 0, 5);
+        return dest;
+    }
+
+    // overlapping array region with unknown src/dest offsets but
+    // length 1: compiled code doesn't need both forward and backward
+    // copies
+    @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+    static void m25(int[] src, int[] dest, int srcPos, int destPos) {
+        System.arraycopy(src, srcPos, dest, destPos, 1);
+    }
+
+    static boolean m25_check(int[] src, int[] dest) {
+        boolean failure = false;
+        if (dest[1] != src[0]) {
+            System.out.println("Test m10 failed for src[0]=" + src[0] + ", dest[1]=" + dest[1]);
+            return true;
+        }
+        return false;
+    }
+
+    final HashMap<String,Method> tests = new HashMap<>();
+    {
+        for (Method m : this.getClass().getDeclaredMethods()) {
+            if (m.getName().matches("m[0-9]+(_check)?")) {
+                assert(Modifier.isStatic(m.getModifiers())) : m;
+                tests.put(m.getName(), m);
+            }
+        }
+    }
+
+    boolean success = true;
+
+    void doTest(String name) throws Exception {
+        Method m = tests.get(name);
+        Method m_check = tests.get(name + "_check");
+        Class[] paramTypes = m.getParameterTypes();
+        Object[] params = new Object[paramTypes.length];
+        Class retType = m.getReturnType();
+        boolean isIntArray = (retType.isPrimitive() && !retType.equals(Void.TYPE)) ||
+            (retType.equals(Void.TYPE) && paramTypes[0].getComponentType().isPrimitive()) ||
+            (retType.isArray() && retType.getComponentType().isPrimitive());
+
+        Args args = m.getAnnotation(Args.class);
+
+        Object src = null;
+        switch(args.src()) {
+        case SMALL: {
+            if (isIntArray) {
+                src = small_int_src;
+            } else {
+                src = small_a_src;
+            }
+            break;
+        }
+        case LARGE: {
+            if (isIntArray) {
+                src = large_int_src;
+            } else {
+                src = large_a_src;
+            }
+            break;
+        }
+        case ZERO: {
+            if (isIntArray) {
+                src = zero_int_src;
+            } else {
+                src = zero_a_src;
+            }
+            break;
+        }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            boolean failure = false;
+
+            int p = 0;
+
+            if (params.length > 0) {
+                if (isIntArray) {
+                    params[0] = ((int[])src).clone();
+                } else {
+                    params[0] = ((A[])src).clone();
+                }
+                p++;
+            }
+
+            if (params.length > 1) {
+                switch(args.dst()) {
+                case NEW: {
+                    if (isIntArray) {
+                        params[1] = new int[((int[])params[0]).length];
+                    } else {
+                        params[1] = new A[((A[])params[0]).length];
+                    }
+                    p++;
+                    break;
+                }
+                case SRC: {
+                    params[1] = params[0];
+                    p++;
+                    break;
+                }
+                case NONE: break;
+                }
+            }
+
+            for (int j = 0; j < args.extra_args().length; j++) {
+                params[p+j] = args.extra_args()[j];
+            }
+
+            Object res = m.invoke(null, params);
+
+            if (retType.isPrimitive() && !retType.equals(Void.TYPE)) {
+                int s = (int)res;
+                int sum = 0;
+                int[] int_res = (int[])src;
+                for (int j = 0; j < int_res.length; j++) {
+                    sum += int_res[j];
+                }
+                failure = (s != sum);
+                if (failure) {
+                    System.out.println("Test " + name + " failed: result = " + s + " != " + sum);
+                }
+            } else {
+                Object dest = null;
+                if (!retType.equals(Void.TYPE)) {
+                    dest = res;
+                } else {
+                    dest = params[1];
+                }
+
+                if (m_check != null) {
+                    failure = (boolean)m_check.invoke(null,  new Object[] { src, dest });
+                } else {
+                    if (isIntArray) {
+                        int[] int_res = (int[])src;
+                        int[] int_dest = (int[])dest;
+                        for (int j = 0; j < int_res.length; j++) {
+                            if (int_res[j] != int_dest[j]) {
+                                System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + int_res[j] + ", dest[" + j + "]=" + int_dest[j]);
+                                failure = true;
+                            }
+                        }
+                    } else {
+                        Object[] object_res = (Object[])src;
+                        Object[] object_dest = (Object[])dest;
+                        for (int j = 0; j < object_res.length; j++) {
+                            if (object_res[j] != object_dest[j]) {
+                                System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + object_res[j] + ", dest[" + j + "]=" + object_dest[j]);
+                                failure = true;
+                            }
+                        }
+                    }
+                }
+            }
+
+            if (failure) {
+                success = false;
+                break;
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (int i = 0; i < small_a_src.length; i++) {
+            small_a_src[i] = new A();
+        }
+
+        for (int i = 0; i < small_int_src.length; i++) {
+            small_int_src[i] = i;
+        }
+
+        for (int i = 0; i < large_int_src.length; i++) {
+            large_int_src[i] = i;
+        }
+
+        for (int i = 0; i < 5; i++) {
+            small_object_src[i] = new Object();
+        }
+
+        TestArrayCopyAsLoadsStores test = new TestArrayCopyAsLoadsStores();
+
+        test.doTest("m1");
+        test.doTest("m2");
+        test.doTest("m3");
+        test.doTest("m4");
+        test.doTest("m5");
+        test.doTest("m6");
+        test.doTest("m7");
+        test.doTest("m8");
+        test.doTest("m9");
+        test.doTest("m10");
+        test.doTest("m11");
+        test.doTest("m12");
+        test.doTest("m13");
+        test.doTest("m14");
+        test.doTest("m15");
+
+        // make both branches of the If appear taken
+        for (int i = 0; i < 20000; i++) {
+            helper16(i);
+        }
+
+        test.doTest("m16");
+
+        // load class B so type check in m17 would not be simple comparison
+        B b = new B();
+        // make both branches of the If appear taken
+        for (int i = 0; i < 20000; i++) {
+            helper17_1(i);
+        }
+
+        test.doTest("m17");
+
+        // make both branches of the If appear taken
+        for (int i = 0; i < 20000; i++) {
+            helper18_1(i);
+        }
+        test.doTest("m18");
+
+        // make both branches of the If appear taken
+        for (int i = 0; i < 20000; i++) {
+            helper19(i);
+        }
+
+        // Compile
+        for (int i = 0; i < 20000; i++) {
+            m19(null, 0);
+        }
+
+        // force deopt
+        boolean m19_exception = false;
+        for (int i = 0; i < 10; i++) {
+            try {
+                m19(null, 1);
+            } catch(ArrayStoreException ase) {
+                m19_exception = true;
+            }
+        }
+
+        if (!m19_exception) {
+            System.out.println("Test m19: exception wasn't thrown");
+            test.success = false;
+        }
+
+        test.doTest("m19");
+
+        test.doTest("m20");
+        test.doTest("m21");
+
+        // Compile
+        int[] dst = new int[small_int_src.length];
+        for (int i = 0; i < 20000; i++) {
+            m22(small_int_src, dst, 0);
+        }
+
+        // force deopt
+        for (int i = 0; i < 10; i++) {
+            try {
+                m22(small_int_src, dst, 5);
+            } catch(ArrayIndexOutOfBoundsException aioobe) {}
+        }
+
+        test.doTest("m22");
+        test.doTest("m23");
+
+        test.doTest("m24");
+        boolean m24_exception = false;
+        try {
+            m24(small_object_src);
+        } catch(ArrayStoreException ase) {
+            m24_exception = true;
+        }
+
+        if (!m24_exception) {
+            System.out.println("Test m24: exception wasn't thrown");
+            test.success = false;
+        }
+
+        test.doTest("m25");
+
+        if (!test.success) {
+            throw new RuntimeException("some tests failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,163 @@
+/*
+ * 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 8073670
+ * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest
+ */
+
+public class FloatingPointFoldingTest {
+    // Double values.
+    public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
+    public static final double DOUBLE_MINUS_INF = Double.longBitsToDouble(MINUS_INF_LONGBITS);
+
+    public static final long PLUS_INF_LONGBITS = 0x7ff0000000000000L;
+    public static final double DOUBLE_PLUS_INF = Double.longBitsToDouble(PLUS_INF_LONGBITS);
+
+    public static final long MINUS_ZERO_LONGBITS = 0x8000000000000000L;
+    public static final double DOUBLE_MINUS_ZERO = Double.longBitsToDouble(MINUS_ZERO_LONGBITS);
+
+    // We need two different NaN values. A floating point number is
+    // considered to be NaN is the sign bit is 0, all exponent bits
+    // are set to 1, and at least one bit of the exponent is not zero.
+    //
+    // As java.lang.Double.NaN is 0x7ff8000000000000L, we use
+    // 0x7ffc000000000000L as a second NaN double value.
+    public static final long NAN_LONGBITS = 0x7ffc000000000000L;
+    public static final double DOUBLE_NAN = Double.longBitsToDouble(NAN_LONGBITS);
+
+    // Float values.
+    public static final int MINUS_INF_INTBITS = 0xff800000;
+    public static final float FLOAT_MINUS_INF = Float.intBitsToFloat(MINUS_INF_INTBITS);
+
+    public static final int PLUS_INF_INTBITS = 0x7f800000;
+    public static final float FLOAT_PLUS_INF = Float.intBitsToFloat(PLUS_INF_INTBITS);
+
+    public static final int MINUS_ZERO_INTBITS = 0x80000000;
+    public static final float FLOAT_MINUS_ZERO = Float.intBitsToFloat(MINUS_ZERO_INTBITS);
+
+    // As java.lang.Float.NaN is 0x7fc00000, we use 0x7fe00000
+    // as a second NaN float value.
+    public static final int NAN_INTBITS = 0x7fe00000;
+    public static final float FLOAT_NAN = Float.intBitsToFloat(NAN_INTBITS);
+
+
+    // Double tests.
+    static void test_double_inf(long[] result) {
+        double d1 = DOUBLE_MINUS_INF;
+        double d2 = DOUBLE_PLUS_INF;
+        result[0] = Double.doubleToRawLongBits(d1);
+        result[1] = Double.doubleToRawLongBits(d2);
+    }
+
+    static void test_double_zero(long[] result) {
+        double d1 = DOUBLE_MINUS_ZERO;
+        double d2 = 0;
+        result[0] = Double.doubleToRawLongBits(d1);
+        result[1] = Double.doubleToRawLongBits(d2);
+    }
+
+    static void test_double_nan(long[] result) {
+        double d1 = DOUBLE_NAN;
+        double d2 = Double.NaN;
+        result[0] = Double.doubleToRawLongBits(d1);
+        result[1] = Double.doubleToRawLongBits(d2);
+    }
+
+    // Float tests.
+    static void test_float_inf(int[] result) {
+        float f1 = FLOAT_MINUS_INF;
+        float f2 = FLOAT_PLUS_INF;
+        result[0] = Float.floatToRawIntBits(f1);
+        result[1] = Float.floatToRawIntBits(f2);
+    }
+
+    static void test_float_zero(int[] result) {
+        float f1 = FLOAT_MINUS_ZERO;
+        float f2 = 0;
+        result[0] = Float.floatToRawIntBits(f1);
+        result[1] = Float.floatToRawIntBits(f2);
+    }
+
+    static void test_float_nan(int[] result) {
+        float f1 = FLOAT_NAN;
+        float f2 = Float.NaN;
+        result[0] = Float.floatToRawIntBits(f1);
+        result[1] = Float.floatToRawIntBits(f2);
+    }
+
+    // Check doubles.
+    static void check_double(long[] result, double d1, double d2) {
+        if (result[0] == result[1]) {
+            throw new RuntimeException("ERROR: Two different double values are considered equal. \n"
+                                       + String.format("\toriginal values: 0x%x 0x%x\n", Double.doubleToRawLongBits(d1), Double.doubleToRawLongBits(d2))
+                                       + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+        }
+    }
+
+    // Check floats.
+    static void check_float(int[] result, float f1, float f2) {
+        if (result[0] == result[1]) {
+            throw new RuntimeException("ERROR: Two different float values are considered equal. \n"
+                                       + String.format("\toriginal values: 0x%x 0x%x\n", Float.floatToRawIntBits(f1), Float.floatToRawIntBits(f2))
+                                       + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+        }
+    }
+
+    public static void main(String[] args) {
+        // Float tests.
+
+        int[] iresult = new int[2];
+
+        // -Inf and +Inf.
+        test_float_inf(iresult);
+        check_float(iresult, FLOAT_MINUS_INF, FLOAT_PLUS_INF);
+
+        // 0 and -0.
+        test_float_zero(iresult);
+        check_float(iresult, FLOAT_MINUS_ZERO, 0);
+
+        // Diferrent NaNs.
+        test_float_nan(iresult);
+        check_float(iresult, FLOAT_NAN, Float.NaN);
+
+        // Double tests.
+
+        long[] lresult = new long[2];
+
+        // -Inf and +Inf.
+        test_double_inf(lresult);
+        check_double(lresult, DOUBLE_MINUS_INF, DOUBLE_PLUS_INF);
+
+        // 0 and -0.
+        test_double_zero(lresult);
+        check_double(lresult, DOUBLE_MINUS_ZERO, 0);
+
+        // Diferrent NaNs.
+        test_double_nan(lresult);
+        check_double(lresult, DOUBLE_NAN, Double.NaN);
+    }
+}
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -51,7 +51,9 @@
 
     public static void main(String[] args) {
         for (BlobType btype : BlobType.getAvailable()) {
-            new UsageThresholdIncreasedTest(btype).runTest();
+            if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
+                new UsageThresholdIncreasedTest(btype).runTest();
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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 8073956
+ * @summary Tests C2 EA with allocated object escaping through a call.
+ * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
+ */
+public class TestEscapeThroughInvoke {
+    private A a;
+
+    public static void main(String[] args) {
+        TestEscapeThroughInvoke test = new TestEscapeThroughInvoke();
+        test.a = new A(42);
+        // Make sure run gets compiled by C2
+        for (int i = 0; i < 100_000; ++i) {
+            test.run();
+        }
+    }
+
+    private void run() {
+        // Allocate something to trigger EA
+        new Object();
+        // Create a new escaping instance of A and
+        // verify that it is always equal to 'a.saved'.
+        A escapingA = create(42);
+        a.check(escapingA);
+    }
+
+    // Create and return a new instance of A that escaped through 'A::saveInto'.
+    // The 'dummy' parameters are needed to avoid EA skipping the methods.
+    private A create(Integer dummy) {
+        A result = new A(dummy);
+        result.saveInto(a, dummy); // result escapes into 'a' here
+        return result;
+    }
+}
+
+class A {
+    private A saved;
+
+    public A(Integer dummy) { }
+
+    public void saveInto(A other, Integer dummy) {
+        other.saved = this;
+    }
+
+    public void check(A other) {
+        if (this.saved != other) {
+            throw new RuntimeException("TEST FAILED: Objects not equal.");
+        }
+    }
+}
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java	Wed Jul 05 20:24:03 2017 +0200
@@ -36,18 +36,22 @@
     public static void main(String[] args) throws Exception {
         Random r = new Random(42);
         int x = 0;
-        StringBuilder sb = new StringBuilder();
-        for(int i = 0; i < 1000000; ++i) {
-            int v = Math.abs(r.nextInt());
-            sb.append('+').append(v).append('\n');
-            x += v;
-            // To trigger the problem we must OSR in the following loop
-            // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
-            while(x < 0) x += 1000000000;
-            sb.append('=').append(x).append('\n');
-        }
-        if (sb.toString().hashCode() != 0xaba94591) {
-            throw new Exception("Unexpected result");
+        try {
+            StringBuilder sb = new StringBuilder();
+            for(int i = 0; i < 1000000; ++i) {
+                int v = Math.abs(r.nextInt());
+                sb.append('+').append(v).append('\n');
+                x += v;
+                // To trigger the problem we must OSR in the following loop
+                // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
+                while(x < 0) x += 1000000000;
+                sb.append('=').append(x).append('\n');
+            }
+            if (sb.toString().hashCode() != 0xaba94591) {
+                throw new Exception("Unexpected result");
+            }
+        } catch(OutOfMemoryError e) {
+            // small heap, ignore
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,46 @@
+/*
+ * 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 8073184
+ * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp  TestCastIINoLoopLimitCheck
+ *
+ */
+
+public class TestCastIINoLoopLimitCheck {
+
+    static void m(int i, int index, char[] buf) {
+        while (i >= 65536) {
+            i = i / 100;
+            buf [--index] = 0;
+            buf [--index] = 1;
+        }
+    }
+
+    static public void main(String[] args) {
+        m(0, 0, null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * 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 8073154
+ * @build TestProfileReturnTypePrinting
+ * @run main/othervm -XX:TypeProfileLevel=020
+ *                   -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR
+ *                   TestProfileReturnTypePrinting
+ * @summary Verify that c1's LIR that contains ProfileType node could be dumped
+ *          without a crash disregard to an exact class knowledge.
+ */
+public class TestProfileReturnTypePrinting {
+    private static final int ITERATIONS = 1_000_000;
+
+    public static void main(String args[]) {
+        for (int i = 0; i < ITERATIONS; i++) {
+            TestProfileReturnTypePrinting.testMethod(i);
+        }
+    }
+
+    private static int testMethod(int i) {
+        return TestProfileReturnTypePrinting.foo().hashCode()
+                + TestProfileReturnTypePrinting.bar(i).hashCode();
+    }
+
+    /* Exact class of returned value is known statically. */
+    private static B foo() {
+        return new B();
+    }
+
+    /* Exact class of returned value is not known statically. */
+    private static Object bar(int i) {
+        if (i % 2 == 0) {
+            return new A();
+        } else {
+            return new B();
+        }
+    }
+
+    private static class A {
+    }
+
+    private static class B extends A {
+    }
+}
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -29,6 +29,7 @@
 /**
  * @test LevelTransitionTest
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @ignore 8067651
  * @build TransitionsTestExecutor LevelTransitionTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- a/hotspot/test/gc/TestSmallHeap.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/gc/TestSmallHeap.java	Wed Jul 05 20:24:03 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 8067438
  * @requires vm.gc=="null"
  * @requires (vm.opt.AggressiveOpts=="null") | (vm.opt.AggressiveOpts=="false")
+ * @requires vm.compMode != "Xcomp"
  * @summary Verify that starting the VM with a small heap works
  * @library /testlibrary /../../test/lib
  * @build TestSmallHeap
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @key gc
  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  * @library /testlibrary
+ * @ignore 8073669
  * @build TestSoftReferencesBehaviorOnOOME
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Wed Jul 05 20:24:03 2017 +0200
@@ -47,6 +47,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
+                  "-XX:-CreateMinidumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency1",
                   "test");
@@ -55,5 +56,3 @@
         }
     }
 }
-
-
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Wed Jul 05 20:24:03 2017 +0200
@@ -47,6 +47,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
+                  "-XX:-CreateMinidumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency2",
                   "test");
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Wed Jul 05 20:24:03 2017 +0200
@@ -47,6 +47,7 @@
                   "-XX:+UnlockDiagnosticVMOptions",
                   "-XX:+WhiteBoxAPI",
                   "-XX:-TransmitErrorReport",
+                  "-XX:-CreateMinidumpOnCrash",
                   "-Xmx32m",
                   "AssertSafepointCheckConsistency3",
                   "test");
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Wed Jul 05 20:24:03 2017 +0200
@@ -47,6 +47,7 @@
                "-XX:+UnlockDiagnosticVMOptions",
                "-XX:+WhiteBoxAPI",
                "-XX:-TransmitErrorReport",
+               "-XX:-CreateMinidumpOnCrash",
                "-Xmx32m",
                "AssertSafepointCheckConsistency4",
                "test");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Thread/Fibonacci.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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
+ * @summary Calculates Fibonacci numbers "recursively" via threads and compares
+ *     the result with the classical calculation.
+ *     This test is skipped on 32-bit Windows: limited virtual space on Win-32
+ *     make this test inherently unstable on Windows with 32-bit VM data model.
+ * @requires !(os.family == "windows" & sun.arch.data.model == "32")
+ * @library /testlibrary
+ * @run main Fibonacci 15
+ */
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class Fibonacci extends Thread {
+    private int index;
+    private int value;
+    private Fibonacci left;
+    private Fibonacci right;
+
+    public Fibonacci(int i) {
+        index = i;
+    }
+
+    private int getValue() {
+        return value;
+    }
+
+    @Override
+    public void run() {
+        if (index == 0 || index == 1) {
+            // base cases, 0 Fibonacci number = 0, 1 Fibonacci number = 1
+            value = index;
+        } else {
+            // inductive cases
+            left = new Fibonacci(index - 2);
+            right = new Fibonacci(index - 1);
+            left.start();
+            right.start();
+            try {
+                left.join();
+                right.join();
+            } catch (InterruptedException e) {
+                throw new Error("InterruptedException for index " + index, e);
+            }
+            // compute and terminate
+            value = left.getValue() + right.getValue();
+        }
+    }
+
+    public static int traditionalFibonacci(int n) {
+        int n1 = 0, n2 = 1, nn = 0;
+
+        if (n == 0 || n == 1) {
+           nn = n;
+        }
+
+        for (int i = 1; i < n; ++i) {
+            nn = n2 + n1;
+            n1 = n2;
+            n2 = nn;
+        }
+        return nn;
+    }
+
+    public static void main(String[] args) throws Error,AssertionError {
+        int expected;
+        int number;
+        Fibonacci recursiveFibonacci;
+
+        if (args.length != 1) {
+            throw new Error("Error: args.length must be 1");
+        }
+
+        number = Integer.parseInt(args[0]);
+        recursiveFibonacci = new Fibonacci(number);
+
+        recursiveFibonacci.start();
+        try {
+            recursiveFibonacci.join();
+        } catch (InterruptedException e) {
+            throw new Error("InterruptedException in main thread", e);
+        }
+
+        expected = traditionalFibonacci(number);
+
+        System.out.println("Fibonacci[" + number + "] = " + expected);
+
+        Asserts.assertEQ(recursiveFibonacci.getValue(), expected,
+                          "Unexpected calculated value: " + recursiveFibonacci.getValue() + " expected " + expected );
+    }
+}
--- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -39,7 +39,7 @@
  * @library /testlibrary
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
- * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog RunGCTest
+ * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest
  */
 public class RunGCTest {
     public void run(CommandExecutor executor) {
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Wed Jul 05 20:24:03 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
@@ -23,7 +23,7 @@
 
 package sun.hotspot.tools.ctw;
 
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
 
 import java.io.*;
 import java.nio.file.Files;
@@ -55,7 +55,7 @@
 
         try {
             try {
-                if (ManagementFactoryHelper.getCompilationMXBean() == null) {
+                if (ManagementFactory.getCompilationMXBean() == null) {
                     throw new RuntimeException(
                             "CTW can not work in interpreted mode");
                 }
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Wed Jul 05 20:24:03 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
@@ -24,7 +24,7 @@
 package sun.hotspot.tools.ctw;
 
 import com.sun.management.HotSpotDiagnosticMXBean;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
 
 import java.io.File;
 import java.util.regex.Pattern;
@@ -160,7 +160,7 @@
     public static String getVMOption(String name) {
         String result;
         HotSpotDiagnosticMXBean diagnostic
-                = ManagementFactoryHelper.getDiagnosticMXBean();
+                = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         result = diagnostic.getVMOption(name).getValue();
         return result;
     }
--- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -58,7 +58,7 @@
         }
         jvmArgs.add(RandomRunner.class.getName());
         String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
-        String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getOutput().trim();
+        String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getStdout().trim();
         seedOpt.verify(etalon, cmdLineArgs);
     }
 
@@ -122,7 +122,7 @@
             String lastLineOrig = getLastLine(orig);
             String lastLine;
             try {
-                lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getOutput().trim());
+                lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getStdout().trim());
             } catch (Throwable t) {
                 throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
             }
--- a/jdk/.hgtags	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/.hgtags	Wed Jul 05 20:24:03 2017 +0200
@@ -296,3 +296,4 @@
 a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51
 607ea68032cd4a4cf2c7a7a41fcb39602d6a75e2 jdk9-b52
 6cb5f5c34009630749a40cefe116d143f0b2583e jdk9-b53
+568a62ab7d764d7c74ac1d87387dbe500662b551 jdk9-b54
--- a/jdk/make/CompileDemos.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/CompileDemos.gmk	Wed Jul 05 20:24:03 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
@@ -219,6 +219,9 @@
   # Param 7 = libs for solaris
   # Param 8 = libs for linux
   # Param 9 = extra directories with required sources
+  # Param 10 = DISABLED_WARNINGS_gcc
+  # Param 11 = DISABLED_WARNINGS_microsoft
+  # Param 12 = DISABLED_WARNINGS_clang
   BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
       $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
       $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
@@ -254,6 +257,9 @@
       LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
       OPTIMIZATION := LOW, \
       CXXFLAGS := $$($1_CXXFLAGS), \
+      DISABLED_WARNINGS_gcc := $(10), \
+      DISABLED_WARNINGS_clang := $(12), \
+      DISABLED_WARNINGS_microsoft := $(11), \
       LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
       LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
       LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
--- a/jdk/make/gendata/GendataPolicyJars.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/gendata/GendataPolicyJars.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -77,7 +77,7 @@
     $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
 
 $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \
-    $(US_EXPORT_POLICY_JAR_DEPS), \
+    DEPENDENCIES := $(US_EXPORT_POLICY_JAR_DEPS), \
     SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
     SUFFIXES := .policy, \
     JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
@@ -139,8 +139,8 @@
 	$(install-file)
 
 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
-    $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
-    $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
+    DEPENDENCIES := $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
+        $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
     SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
     SUFFIXES := .policy, \
     JAR := $(LOCAL_POLICY_JAR_LIMITED), \
@@ -148,7 +148,7 @@
     SKIP_METAINF := true))
 
 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
-    $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
+    DEPENDENCIES := $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
     SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
     SUFFIXES := .policy, \
     JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
--- a/jdk/make/gensrc/Gensrc-jdk.dev.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -32,8 +32,7 @@
 $(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
     $(filter %.properties, \
         $(call CacheFind, \
-            $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources \
-            $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+            $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources)), \
     ListResourceBundle))
 
 TARGETS += $(COMPILE_PROPERTIES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-jdk.jartool.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+    $(filter %.properties, \
+        $(call CacheFind, \
+            $(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources)), \
+    ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -25,18 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jar, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jarsigner, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.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 \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.jartool.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupLauncher,jar, \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jarsigner, \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,112 @@
+#
+# 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
+# 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 LauncherCommon.gmk
+
+$(eval $(call SetupLauncher,pack200, \
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
+
+################################################################################
+# The order of the object files on the link command line affects the size of the resulting
+# binary (at least on linux) which causes the size to differ between old and new build.
+
+UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
+    $(JDK_TOPDIR)/src/jdk.pack200/share/native/unpack200
+UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
+    -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
+
+ifeq ($(USE_EXTERNAL_LIBZ), true)
+  UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
+  UNPACKEXE_ZIPOBJS := -lz
+else
+  UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
+  UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
+
+endif
+
+UNPACKEXE_LANG := C
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  UNPACKEXE_LANG := C++
+endif
+
+# The linker on older SuSE distros (e.g. on SLES 10) complains with:
+# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
+# if feeded with a version script which contains named tags.
+ifeq ($(USING_BROKEN_SUSE_LD), yes)
+  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
+else
+  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
+    SRC := $(UNPACKEXE_SRC), \
+    LANG := $(UNPACKEXE_LANG), \
+    OPTIMIZATION := LOW, \
+    CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
+    CFLAGS_release := -DPRODUCT, \
+    CFLAGS_linux := -fPIC, \
+    CFLAGS_solaris := -KPIC, \
+    CFLAGS_macosx := -fPIC, \
+    DISABLED_WARNINGS_gcc := sign-compare unused-result format-nonliteral \
+        format-security parentheses, \
+    DISABLED_WARNINGS_microsoft := 4267 4018, \
+    MAPFILE := $(UNPACK_MAPFILE),\
+    LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
+        $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
+        $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
+        $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LDFLAGS_linux := -lc, \
+    LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
+    LDFLAGS_SUFFIX := $(LIBCXX), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
+    PROGRAM := unpack200, \
+    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
+    RC_FLAGS := $(RC_FLAGS) \
+        -D "JDK_FNAME=unpack200.exe" \
+        -D "JDK_INTERNAL_NAME=unpack200" \
+        -D "JDK_FTYPE=0x1L", \
+    DEBUG_SYMBOLS := true, \
+    MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest))
+
+ifneq ($(USE_EXTERNAL_LIBZ), true)
+
+  $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
+
+endif
+
+TARGETS += $(BUILD_UNPACKEXE)
+
+################################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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 LauncherCommon.gmk
+
+ifndef BUILD_HEADLESS_ONLY
+  $(eval $(call SetupLauncher,policytool, \
+      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
+      $(XLIBS)))
+endif
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 LauncherCommon.gmk
-
-$(eval $(call SetupLauncher,pack200, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
-
-################################################################################
-# The order of the object files on the link command line affects the size of the resulting
-# binary (at least on linux) which causes the size to differ between old and new build.
-
-UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
-    $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200
-UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
-    -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
-
-ifeq ($(USE_EXTERNAL_LIBZ), true)
-  UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
-  UNPACKEXE_ZIPOBJS := -lz
-else
-  UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
-  UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
-      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
-
-endif
-
-UNPACKEXE_LANG := C
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  UNPACKEXE_LANG := C++
-endif
-
-# The linker on older SuSE distros (e.g. on SLES 10) complains with:
-# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
-# if feeded with a version script which contains named tags.
-ifeq ($(USING_BROKEN_SUSE_LD), yes)
-  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
-else
-  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
-    SRC := $(UNPACKEXE_SRC), \
-    LANG := $(UNPACKEXE_LANG), \
-    OPTIMIZATION := LOW, \
-    CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
-    CFLAGS_release := -DPRODUCT, \
-    CFLAGS_linux := -fPIC, \
-    CFLAGS_solaris := -KPIC, \
-    CFLAGS_macosx := -fPIC, \
-    MAPFILE := $(UNPACK_MAPFILE),\
-    LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
-        $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
-        $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
-        $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_linux := -lc, \
-    LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
-    LDFLAGS_SUFFIX := $(LIBCXX), \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
-    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
-    PROGRAM := unpack200, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=unpack200.exe" \
-        -D "JDK_INTERNAL_NAME=unpack200" \
-        -D "JDK_FTYPE=0x1L", \
-    DEBUG_SYMBOLS := true, \
-    MANIFEST := $(JDK_TOPDIR)/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest))
-
-ifneq ($(USE_EXTERNAL_LIBZ), true)
-
-  $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
-
-endif
-
-TARGETS += $(BUILD_UNPACKEXE)
-
-################################################################################
--- a/jdk/make/lib/Awt2dLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 20:24:03 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
@@ -55,6 +55,9 @@
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
+    DISABLED_WARNINGS_gcc := parentheses, \
+    DISABLED_WARNINGS_clang := parentheses, \
+    DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -127,6 +130,7 @@
       CFLAGS := -xarch=sparcvis \
           $(LIBMLIB_IMAGE_V_CFLAGS) \
           $(CFLAGS_JDKLIB), \
+      DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
       MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
@@ -175,9 +179,6 @@
 
 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-endif
-
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
   LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
   LIBAWT_CFLAGS += -xarch=sparcvis
@@ -253,6 +254,11 @@
     LANG := $(LIBAWT_LANG), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+    DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
+        format-nonliteral parentheses, \
+    DISABLED_WARNINGS_clang := logical-op-parentheses, \
+    DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+    DISABLED_WARNINGS_microsoft := 4297 4244 4267, \
     ASFLAGS := $(LIBAWT_ASFLAGS), \
     MAPFILE := $(LIBAWT_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -361,6 +367,11 @@
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
             $(X_CFLAGS), \
+        DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
+            deprecated-declarations unused-result maybe-uninitialized format \
+            format-security int-to-pointer-cast parentheses, \
+        DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+            E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
@@ -417,6 +428,9 @@
         $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+    DISABLED_WARNINGS_gcc := format-nonliteral, \
+    DISABLED_WARNINGS_clang := tautological-compare, \
+    DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -495,6 +509,9 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+    DISABLED_WARNINGS_gcc := clobbered parentheses, \
+    DISABLED_WARNINGS_clang := logical-op-parentheses, \
+    DISABLED_WARNINGS_microsoft := 4267, \
     MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -563,6 +580,9 @@
             $(CUPS_CFLAGS) \
             $(X_CFLAGS) \
             $(LIBAWT_HEADLESS_CFLAGS), \
+        DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
+        DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+            E_EMPTY_TRANSLATION_UNIT, \
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -644,6 +664,11 @@
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
+    DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
+        delete-non-virtual-dtor, \
+    DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types, \
+    DISABLED_WARNINGS_solstudio := truncwarn, \
+    DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090, \
     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -876,6 +901,10 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
                 $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
+      DISABLED_WARNINGS_gcc := type-limits unused-result maybe-uninitialized, \
+      DISABLED_WARNINGS_clang := incompatible-pointer-types, \
+      DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST, \
+      DISABLED_WARNINGS_microsoft := 4244 4267, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -946,6 +975,9 @@
           $(X_CFLAGS) \
           $(X_LIBS) \
           $(LIBAWT_LWAWT_CFLAGS), \
+      DISABLED_WARNINGS_clang := incomplete-implementation \
+          deprecated-declarations objc-method-access bitwise-op-parentheses \
+          incompatible-pointer-types parentheses-equality extra-tokens, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
           -L$(INSTALL_LIBRARIES_HERE), \
--- a/jdk/make/lib/CoreLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk	Wed Jul 05 20:24:03 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
@@ -26,7 +26,7 @@
 WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
 
 ##########################################################################################
-# libfdlibm is statically linked with libjava below and not delivered into the 
+# libfdlibm is statically linked with libjava below and not delivered into the
 # product on its own.
 
 BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
@@ -48,6 +48,8 @@
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
       CFLAGS_windows_debug := -DLOGGING, \
       CFLAGS_aix := -qfloat=nomaf, \
+      DISABLED_WARNINGS_gcc := sign-compare, \
+      DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -94,6 +96,7 @@
     LANG := C, \
     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
+    DISABLED_WARNINGS_microsoft := 4244 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,6 +150,10 @@
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJAVA_CFLAGS), \
+    DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
+    DISABLED_WARNINGS_clang := int-conversion, \
+    DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+    DISABLED_WARNINGS_microsoft := 4022 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -209,6 +216,9 @@
         -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
         -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
     CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+    DISABLED_WARNINGS_gcc := parentheses, \
+    DISABLED_WARNINGS_clang := dangling-else, \
+    DISABLED_WARNINGS_microsoft := 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
     REORDER := $(BUILD_LIBZIP_REORDER), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -307,6 +317,12 @@
     LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(LIBJLI_CFLAGS), \
+    DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
+        parentheses, \
+    DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+        int-conversion, \
+    DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
+    DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -355,6 +371,7 @@
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+      DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -375,6 +392,8 @@
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+      DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+          int-conversion, \
       LDFLAGS := -nostdlib -r, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -401,4 +420,3 @@
   TARGETS += $(BUILD_LIBJLI_STATIC)
 
 endif
-
--- a/jdk/make/lib/Lib-java.security.jgss.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk	Wed Jul 05 20:24:03 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
@@ -41,6 +41,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
           $(LIBJAVA_HEADER_FLAGS) \
           -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+      DISABLED_WARNINGS_gcc := pointer-to-int-cast, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -82,6 +83,7 @@
         CFLAGS := $(CFLAGS_JDKLIB) \
             $(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
             -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+        DISABLED_WARNINGS_clang := implicit-function-declaration, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk	Wed Jul 05 20:24:03 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
@@ -54,6 +54,8 @@
           -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
       CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
           $(BUILD_LIBSUNEC_FLAGS), \
+      DISABLED_WARNINGS_gcc := sign-compare, \
+      DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsunec/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk	Wed Jul 05 20:24:03 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
@@ -39,6 +39,8 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
+    DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+    DISABLED_WARNINGS_microsoft := 4013 4267, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk	Wed Jul 05 20:24:03 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
@@ -40,6 +40,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(LIBAPPLESCRIPTENGINE_SRC) \
           -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
+      DISABLED_WARNINGS_clang := implicit-function-declaration format, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := -framework Cocoa \
@@ -71,6 +72,7 @@
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBOSX_CFLAGS), \
+      DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,65 @@
+#
+# 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
+# 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 LibCommon.gmk
+
+################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
+    LIBRARY := unpack, \
+    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+    SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/libunpack \
+        $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack, \
+    LANG := C++, \
+    OPTIMIZATION := LOW, \
+    CFLAGS := $(CXXFLAGS_JDKLIB) \
+        -DNO_ZLIB -DUNPACK_JNI -DFULL \
+        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
+        -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
+        $(LIBJAVA_HEADER_FLAGS), \
+    CFLAGS_release := -DPRODUCT, \
+    DISABLED_WARNINGS_gcc := conversion-null sign-compare format-security \
+        format-nonliteral parentheses, \
+    DISABLED_WARNINGS_solstudio := truncwarn, \
+    DISABLED_WARNINGS_microsoft := 4267 4018, \
+    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
+    LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
+        $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug \
+        jvm.lib $(WIN_JAVA_LIB), \
+    LDFLAGS_SUFFIX_unix := -ljvm $(LIBCXX) -ljava -lc, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libunpack, \
+    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
+    RC_FLAGS := $(RC_FLAGS) \
+        -D "JDK_FNAME=unpack.dll" \
+        -D "JDK_INTERNAL_NAME=unpack" \
+        -D "JDK_FTYPE=0x2L", \
+    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
+
+TARGETS += $(BUILD_LIBUNPACK)
+
+################################################################################
--- a/jdk/make/lib/Lib-jdk.runtime.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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 LibCommon.gmk
-
-################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
-    LIBRARY := unpack, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libunpack \
-        $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack, \
-    LANG := C++, \
-    OPTIMIZATION := LOW, \
-    CFLAGS := $(CXXFLAGS_JDKLIB) \
-        -DNO_ZLIB -DUNPACK_JNI -DFULL \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
-        $(LIBJAVA_HEADER_FLAGS), \
-    CFLAGS_release := -DPRODUCT, \
-    MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
-    LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
-        $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug \
-        jvm.lib $(WIN_JAVA_LIB), \
-    LDFLAGS_SUFFIX_unix := -ljvm $(LIBCXX) -ljava -lc, \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libunpack, \
-    VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
-    RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=unpack.dll" \
-        -D "JDK_INTERNAL_NAME=unpack" \
-        -D "JDK_FTYPE=0x2L", \
-    DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
-
-TARGETS += $(BUILD_LIBUNPACK)
-
-################################################################################
--- a/jdk/make/lib/NetworkingLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/NetworkingLibraries.gmk	Wed Jul 05 20:24:03 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
@@ -33,6 +33,9 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
         $(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
+    DISABLED_WARNINGS_gcc := format-nonliteral, \
+    DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
+    DISABLED_WARNINGS_microsoft := 4244 4047 4133, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/NioLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/NioLibraries.gmk	Wed Jul 05 20:24:03 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
@@ -69,6 +69,9 @@
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBNIO_CFLAGS), \
+    DISABLED_WARNINGS_gcc := type-limits, \
+    DISABLED_WARNINGS_clang := tautological-compare, \
+    DISABLED_WARNINGS_microsoft := 4244, \
     MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -92,4 +95,3 @@
 TARGETS += $(BUILD_LIBNIO)
 
 $(BUILD_LIBNIO): $(BUILD_LIBNET)
-
--- a/jdk/make/lib/PlatformLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/PlatformLibraries.gmk	Wed Jul 05 20:24:03 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
@@ -38,6 +38,7 @@
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(addprefix -I, $(LIBOSXAPP_SRC)) \
           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+      DISABLED_WARNINGS_clang := objc-method-access objc-root-class, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := \
@@ -59,4 +60,3 @@
   TARGETS += $(BUILD_LIBOSXAPP)
 
 endif
-
--- a/jdk/make/lib/SoundLibraries.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/make/lib/SoundLibraries.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -129,6 +129,8 @@
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJSOUND_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+    DISABLED_WARNINGS_clang := implicit-function-declaration \
+        deprecated-writable-strings, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -175,6 +177,7 @@
           -DUSE_PORTS=TRUE \
           -DUSE_PLATFORM_MIDI_OUT=TRUE \
           -DUSE_PLATFORM_MIDI_IN=TRUE, \
+      DISABLED_WARNINGS_gcc := parentheses, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c	Wed Jul 05 20:24:03 2017 +0200
@@ -143,7 +143,7 @@
 
         for (i = 0; i < numpcs; i++) {
             PCStackInfo pcrecord = (record->pcinfo[i]);
-            fprintf(fp, "PcDescriptor(pc=0x%lx):\n", (jint)(pcrecord.pc));
+            fprintf(fp, "PcDescriptor(pc=%p):\n", pcrecord.pc);
             print_stack_frames(&pcrecord, jvmti, fp);
         }
     }
--- a/jdk/src/demo/share/jvmti/waiters/Agent.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/demo/share/jvmti/waiters/Agent.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -111,8 +111,6 @@
 /* VM initialization and VM death calls to Agent */
 Agent::Agent(jvmtiEnv *jvmti, JNIEnv *env, jthread thread)
 {
-    jvmtiError err;
-
     stdout_message("Agent created..\n");
     stdout_message("VMInit...\n");
     /* Start monitor list */
@@ -129,8 +127,6 @@
 
 void Agent::vm_death(jvmtiEnv *jvmti, JNIEnv *env)
 {
-    jvmtiError err;
-
     /* Delete all Monitors we allocated */
     for ( int i = 0; i < (int)monitor_count; i++ ) {
         delete monitor_list[i];
--- a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, 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
@@ -45,8 +45,13 @@
  * The X509V1CertImpl class is used as a conversion wrapper around
  * sun.security.x509.X509Cert certificates when running under JDK1.1.x.
  *
+ * @deprecated This is the implementation class for the deprecated
+ *  {@code javax.security.cert.X509Certificate} class. The classes in the
+ *  {@code java.security.cert} package should be used instead.
+ *
  * @author Jeff Nisewanger
  */
+@Deprecated
 public class X509V1CertImpl extends X509Certificate implements Serializable {
     static final long serialVersionUID = -2048442350420423405L;
     private java.security.cert.X509Certificate wrappedCert;
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java	Wed Jul 05 20:24:03 2017 +0200
@@ -171,6 +171,11 @@
  * variables, first call {@link java.util.Map#clear() Map.clear()}
  * before adding environment variables.
  *
+ * <p>
+ * Unless otherwise noted, passing a {@code null} argument to a constructor
+ * or method in this class will cause a {@link NullPointerException} to be
+ * thrown.
+ *
  * @author Martin Buchholz
  * @since 1.5
  */
@@ -193,7 +198,6 @@
      * command.
      *
      * @param  command the list containing the program and its arguments
-     * @throws NullPointerException if the argument is null
      */
     public ProcessBuilder(List<String> command) {
         if (command == null)
@@ -228,8 +232,6 @@
      *
      * @param  command the list containing the program and its arguments
      * @return this process builder
-     *
-     * @throws NullPointerException if the argument is null
      */
     public ProcessBuilder command(List<String> command) {
         if (command == null)
@@ -554,7 +556,6 @@
          * }</pre>
          *
          * @param file The {@code File} for the {@code Redirect}.
-         * @throws NullPointerException if the specified file is null
          * @return a redirect to read from the specified file
          */
         public static Redirect from(final File file) {
@@ -581,7 +582,6 @@
          * }</pre>
          *
          * @param file The {@code File} for the {@code Redirect}.
-         * @throws NullPointerException if the specified file is null
          * @return a redirect to write to the specified file
          */
         public static Redirect to(final File file) {
@@ -612,7 +612,6 @@
          * }</pre>
          *
          * @param file The {@code File} for the {@code Redirect}.
-         * @throws NullPointerException if the specified file is null
          * @return a redirect to append to the specified file
          */
         public static Redirect appendTo(final File file) {
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Wed Jul 05 20:24:03 2017 +0200
@@ -266,16 +266,15 @@
      * method, passing the new replacement, after checking that the new
      * replacement is acceptable.  </p>
      *
-     * @param  newReplacement  The replacement value
-     *
+     * @param  newReplacement  The new replacement; must not be
+     *         <tt>null</tt>, must have non-zero length,
 #if[decoder]
-     *         The new replacement; must not be <tt>null</tt>
-     *         and must have non-zero length
+     *         and must not be longer than the value returned by the
+     *         {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method
 #end[decoder]
 #if[encoder]
-     *         The new replacement; must not be <tt>null</tt>, must have
-     *         non-zero length, must not be longer than the value returned by
-     *         the {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
+     *         must not be longer than the value returned by the
+     *         {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
      *         must be {@link #isLegalReplacement legal}
 #end[encoder]
      *
--- a/jdk/src/java.base/share/classes/java/security/acl/Acl.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/Acl.java	Wed Jul 05 20:24:03 2017 +0200
@@ -82,8 +82,12 @@
  * @see java.security.acl.Acl#getPermissions
  *
  * @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
 
+@Deprecated
 public interface Acl extends Owner {
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,11 @@
  * @see java.security.acl.Acl
  *
  * @author      Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public interface AclEntry extends Cloneable {
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, 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
@@ -30,7 +30,11 @@
  * non-existent ACL (Access Control List).
  *
  * @author      Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public class AclNotFoundException extends Exception {
 
     private static final long serialVersionUID = 5684295034092681791L;
--- a/jdk/src/java.base/share/classes/java/security/acl/Group.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/Group.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,11 @@
  * Principal or Group.
  *
  * @author      Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public interface Group extends Principal {
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, 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
@@ -32,7 +32,11 @@
  * @see java.security.acl.Owner#deleteOwner
  *
  * @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public class LastOwnerException extends Exception {
 
     private static final long serialVersionUID = -5141997548211140359L;
--- a/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, 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
@@ -31,7 +31,11 @@
  * the object, but the Principal attempting the modification is not an owner.
  *
  * @author      Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public class NotOwnerException extends Exception {
 
     private static final long serialVersionUID = -5555597911163362399L;
--- a/jdk/src/java.base/share/classes/java/security/acl/Owner.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/Owner.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,10 @@
  *
  * @see java.security.acl.Acl
  *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public interface Owner {
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/acl/Permission.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/Permission.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 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
@@ -31,7 +31,11 @@
  * a particular type of access to a resource.
  *
  * @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ *      and related classes since 1.2.
  */
+@Deprecated
 public interface Permission {
 
     /**
--- a/jdk/src/java.base/share/classes/java/security/acl/package-info.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/acl/package-info.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, 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
@@ -24,10 +24,12 @@
  */
 
 /**
- * The classes and interfaces in this package have been
- * superseded by classes in the java.security package.
- * See that package and, for example, java.security.Permission for details.
+ * The classes and interfaces in this package have been deprecated.
+ * The {@code java.security} package contains suitable replacements.
+ * See that package and, for example, {@code java.security.Permission}
+ * for details.
  *
  * @since 1.1
  */
+@Deprecated
 package java.security.acl;
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java	Wed Jul 05 20:24:03 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
@@ -89,7 +89,7 @@
      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
      * for information about standard algorithm names.
      * @throws NullPointerException if {@code encodedKey}
-     * or {@algorithm} is null.
+     * or {@code algorithm} is null.
      * @throws IllegalArgumentException if {@code algorithm} is
      * the empty string {@code ""}
      * @since 1.9
--- a/jdk/src/java.base/share/classes/java/time/format/Parsed.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/format/Parsed.java	Wed Jul 05 20:24:03 2017 +0200
@@ -216,7 +216,16 @@
             return (R) (date != null ? LocalDate.from(date) : null);
         } else if (query == TemporalQueries.localTime()) {
             return (R) time;
-        } else if (query == TemporalQueries.zone() || query == TemporalQueries.offset()) {
+        } else if (query == TemporalQueries.offset()) {
+            Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
+            if (offsetSecs != null) {
+                return (R) ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
+            }
+            if (zone instanceof ZoneOffset) {
+                return (R)zone;
+            }
+            return query.queryFrom(this);
+        } else if (query == TemporalQueries.zone()) {
             return query.queryFrom(this);
         } else if (query == TemporalQueries.precision()) {
             return null;  // not a complete date/time
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1183,7 +1183,7 @@
      *
      * <p> Given the regular expression <tt>dog</tt>, the input
      * <tt>"zzzdogzzzdogzzz"</tt>, and the function
-     * <tt>mr -> mr.group().toUpperCase()</tt>, an invocation of this method on
+     * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
      * a matcher for that expression would yield the string
      * <tt>"zzzDOGzzzDOGzzz"</tt>.
      *
@@ -1405,7 +1405,7 @@
      *
      * <p> Given the regular expression <tt>dog</tt>, the input
      * <tt>"zzzdogzzzdogzzz"</tt>, and the function
-     * <tt>mr -> mr.group().toUpperCase()</tt>, an invocation of this method on
+     * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
      * a matcher for that expression would yield the string
      * <tt>"zzzDOGzzzdogzzz"</tt>.
      *
--- a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Wed Jul 05 20:24:03 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
@@ -152,7 +152,11 @@
      *          {@link javax.security.cert.X509Certificate} format).
      * @exception SSLPeerUnverifiedException if the peer is not verified.
      * @see #getPeerPrincipal()
+     * @deprecated The {@link #getPeerCertificates()} method that returns an
+     *               array of {@code java.security.cert.Certificate} should
+     *               be used instead.
      */
+    @Deprecated
     public javax.security.cert.X509Certificate [] getPeerCertificateChain()
             throws SSLPeerUnverifiedException
     {
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java	Wed Jul 05 20:24:03 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
@@ -272,7 +272,11 @@
      * @exception SSLPeerUnverifiedException if the peer's identity
      *          has not been verified
      * @see #getPeerPrincipal()
+     * @deprecated The {@link #getPeerCertificates()} method that returns an
+     *               array of {@code java.security.cert.Certificate} should
+     *               be used instead.
      */
+    @Deprecated
     public javax.security.cert.X509Certificate [] getPeerCertificateChain()
             throws SSLPeerUnverifiedException;
 
--- a/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java	Wed Jul 05 20:24:03 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
@@ -57,9 +57,11 @@
  *
  * @since 1.4
  * @see X509Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  *
  * @author Hemma Prafullchandra
  */
+@Deprecated
 public abstract class Certificate {
 
     /**
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java	Wed Jul 05 20:24:03 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
@@ -38,7 +38,9 @@
  *
  * @since 1.4
  * @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public class CertificateEncodingException extends CertificateException {
 
     private static final long serialVersionUID = -8187642723048403470L;
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,9 @@
  * @author Hemma Prafullchandra
  * @since 1.4
  * @see Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public class CertificateException extends Exception {
 
     private static final long serialVersionUID = -5757213374030785290L;
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java	Wed Jul 05 20:24:03 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
@@ -40,7 +40,9 @@
  *
  * @since 1.4
  * @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public class CertificateExpiredException extends CertificateException {
 
     private static final long serialVersionUID = 5091601212177261883L;
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java	Wed Jul 05 20:24:03 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
@@ -40,7 +40,9 @@
  *
  * @since 1.4
  * @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public class CertificateNotYetValidException extends CertificateException {
 
     private static final long serialVersionUID = -8976172474266822818L;
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java	Wed Jul 05 20:24:03 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
@@ -39,7 +39,9 @@
  *
  * @since 1.4
  * @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public class CertificateParsingException extends CertificateException {
 
     private static final long serialVersionUID = -8449352422951136229L;
--- a/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java	Wed Jul 05 20:24:03 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
@@ -124,7 +124,9 @@
  * @see Certificate
  * @see java.security.cert.X509Extension
  * @see java.security.Security security properties
+ * @deprecated Use the classes in {@code java.security.cert} instead.
  */
+@Deprecated
 public abstract class X509Certificate extends Certificate {
 
     /*
--- a/jdk/src/java.base/share/classes/javax/security/cert/package-info.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/cert/package-info.java	Wed Jul 05 20:24:03 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
@@ -26,15 +26,16 @@
 /**
  * Provides classes for public key certificates.
  *
- * These classes include a simplified version of the
- * java.security.cert package.  These classes were developed
- * as part of the Java Secure Socket
+ * This package has been deprecated. These classes include a simplified
+ * version of the {@code java.security.cert} package.  These classes were
+ * developed as part of the Java Secure Socket
  * Extension (JSSE).  When JSSE was added to the J2SE version 1.4, this
  * package was added for backward-compatibility reasons only.
  *
  * New applications should not use this package, but rather
- * java.security.cert.
+ * {@code java.security.cert}.
  *
  * @since 1.4
  */
+@Deprecated
 package javax.security.cert;
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Wed Jul 05 20:24:03 2017 +0200
@@ -57,31 +57,29 @@
      * Provides the caller with the capability of performing unsafe
      * operations.
      *
-     * <p> The returned <code>Unsafe</code> object should be carefully guarded
+     * <p>The returned {@code Unsafe} object should be carefully guarded
      * by the caller, since it can be used to read and write data at arbitrary
      * memory addresses.  It must never be passed to untrusted code.
      *
-     * <p> Most methods in this class are very low-level, and correspond to a
+     * <p>Most methods in this class are very low-level, and correspond to a
      * small number of hardware instructions (on typical machines).  Compilers
      * are encouraged to optimize these methods accordingly.
      *
-     * <p> Here is a suggested idiom for using unsafe operations:
+     * <p>Here is a suggested idiom for using unsafe operations:
      *
-     * <blockquote><pre>
+     * <pre> {@code
      * class MyTrustedClass {
      *   private static final Unsafe unsafe = Unsafe.getUnsafe();
      *   ...
      *   private long myCountAddress = ...;
      *   public int getCount() { return unsafe.getByte(myCountAddress); }
-     * }
-     * </pre></blockquote>
+     * }}</pre>
+     *
+     * (It may assist compilers to make the local variable {@code final}.)
      *
-     * (It may assist compilers to make the local variable be
-     * <code>final</code>.)
-     *
-     * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkPropertiesAccess</code> method doesn't allow
-     *             access to the system properties.
+     * @throws  SecurityException  if a security manager exists and its
+     *          {@code checkPropertiesAccess} method doesn't allow
+     *          access to the system properties.
      */
     @CallerSensitive
     public static Unsafe getUnsafe() {
@@ -100,28 +98,27 @@
     /**
      * Fetches a value from a given Java variable.
      * More specifically, fetches a field or array element within the given
-     * object <code>o</code> at the given offset, or (if <code>o</code> is
-     * null) from the memory address whose numerical value is the given
-     * offset.
+     * object {@code o} at the given offset, or (if {@code o} is null)
+     * from the memory address whose numerical value is the given offset.
      * <p>
      * The results are undefined unless one of the following cases is true:
      * <ul>
      * <li>The offset was obtained from {@link #objectFieldOffset} on
      * the {@link java.lang.reflect.Field} of some Java field and the object
-     * referred to by <code>o</code> is of a class compatible with that
+     * referred to by {@code o} is of a class compatible with that
      * field's class.
      *
-     * <li>The offset and object reference <code>o</code> (either null or
+     * <li>The offset and object reference {@code o} (either null or
      * non-null) were both obtained via {@link #staticFieldOffset}
      * and {@link #staticFieldBase} (respectively) from the
      * reflective {@link Field} representation of some Java field.
      *
-     * <li>The object referred to by <code>o</code> is an array, and the offset
-     * is an integer of the form <code>B+N*S</code>, where <code>N</code> is
-     * a valid index into the array, and <code>B</code> and <code>S</code> are
+     * <li>The object referred to by {@code o} is an array, and the offset
+     * is an integer of the form {@code B+N*S}, where {@code N} is
+     * a valid index into the array, and {@code B} and {@code S} are
      * the values obtained by {@link #arrayBaseOffset} and {@link
      * #arrayIndexScale} (respectively) from the array's class.  The value
-     * referred to is the <code>N</code><em>th</em> element of the array.
+     * referred to is the {@code N}<em>th</em> element of the array.
      *
      * </ul>
      * <p>
@@ -162,7 +159,7 @@
      * is stored into that variable.
      * <p>
      * The variable must be of the same type as the method
-     * parameter <code>x</code>.
+     * parameter {@code x}.
      *
      * @param o Java heap object in which the variable resides, if any, else
      *        null
@@ -184,9 +181,9 @@
     /**
      * Stores a reference value into a given Java variable.
      * <p>
-     * Unless the reference <code>x</code> being stored is either null
+     * Unless the reference {@code x} being stored is either null
      * or matches the field type, the results are undefined.
-     * If the reference <code>o</code> is non-null, car marks or
+     * If the reference {@code o} is non-null, car marks or
      * other store barriers for that object (if the VM requires them)
      * are updated.
      * @see #putInt(Object, long, int)
@@ -272,11 +269,11 @@
      * zero, or does not point into a block obtained from {@link
      * #allocateMemory}, the results are undefined.
      *
-     * <p> If the native pointer is less than 64 bits wide, it is extended as
+     * <p>If the native pointer is less than 64 bits wide, it is extended as
      * an unsigned number to a Java long.  The pointer may be indexed by any
      * given byte offset, simply by adding that offset (as a simple integer) to
      * the long representing the pointer.  The number of bytes actually read
-     * from the target address maybe determined by consulting {@link
+     * from the target address may be determined by consulting {@link
      * #addressSize}.
      *
      * @see #allocateMemory
@@ -288,7 +285,7 @@
      * zero, or does not point into a block obtained from {@link
      * #allocateMemory}, the results are undefined.
      *
-     * <p> The number of bytes actually written at the target address maybe
+     * <p>The number of bytes actually written at the target address may be
      * determined by consulting {@link #addressSize}.
      *
      * @see #getAddress(long)
@@ -357,7 +354,7 @@
      * (usually zero).  This provides a <em>single-register</em> addressing mode,
      * as discussed in {@link #getInt(Object,long)}.
      *
-     * <p>Equivalent to <code>setMemory(null, address, bytes, value)</code>.
+     * <p>Equivalent to {@code setMemory(null, address, bytes, value)}.
      */
     public void setMemory(long address, long bytes, byte value) {
         setMemory(null, address, bytes, value);
@@ -388,7 +385,7 @@
      * block.  This provides a <em>single-register</em> addressing mode,
      * as discussed in {@link #getInt(Object,long)}.
      *
-     * Equivalent to <code>copyMemory(null, srcAddress, null, destAddress, bytes)</code>.
+     * Equivalent to {@code copyMemory(null, srcAddress, null, destAddress, bytes)}.
      */
     public void copyMemory(long srcAddress, long destAddress, long bytes) {
         copyMemory(null, srcAddress, null, destAddress, bytes);
@@ -413,7 +410,7 @@
     public static final int INVALID_FIELD_OFFSET   = -1;
 
     /**
-     * Report the location of a given field in the storage allocation of its
+     * Reports 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.
      *
@@ -433,7 +430,7 @@
     public native long objectFieldOffset(Field f);
 
     /**
-     * Report the location of a given static field, in conjunction with {@link
+     * Reports the location of a given static field, in conjunction with {@link
      * #staticFieldBase}.
      * <p>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.
@@ -452,7 +449,7 @@
     public native long staticFieldOffset(Field f);
 
     /**
-     * Report the location of a given static field, in conjunction with {@link
+     * Reports the location of a given static field, in conjunction with {@link
      * #staticFieldOffset}.
      * <p>Fetch the base "Object", if any, with which static fields of the
      * given class can be accessed via methods like {@link #getInt(Object,
@@ -464,7 +461,7 @@
     public native Object staticFieldBase(Field f);
 
     /**
-     * Detect if the given class may need to be initialized. This is often
+     * Detects if the given class may need to be initialized. This is often
      * needed in conjunction with obtaining the static field base of a
      * class.
      * @return false only if a call to {@code ensureClassInitialized} would have no effect
@@ -472,14 +469,14 @@
     public native boolean shouldBeInitialized(Class<?> c);
 
     /**
-     * Ensure the given class has been initialized. This is often
+     * Ensures the given class has been initialized. This is often
      * needed in conjunction with obtaining the static field base of a
      * class.
      */
     public native void ensureClassInitialized(Class<?> c);
 
     /**
-     * Report the offset of the first element in the storage allocation of a
+     * Reports the offset of the first element in the storage allocation of a
      * given array class.  If {@link #arrayIndexScale} returns a non-zero value
      * for the same class, you may use that scale factor, together with this
      * base offset, to form new offsets to access elements of arrays of the
@@ -527,7 +524,7 @@
             = theUnsafe.arrayBaseOffset(Object[].class);
 
     /**
-     * Report the scale factor for addressing elements in the storage
+     * Reports 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, long)}, so the scale factor for such classes is reported
@@ -576,7 +573,7 @@
             = theUnsafe.arrayIndexScale(Object[].class);
 
     /**
-     * Report the size in bytes of a native pointer, as stored via {@link
+     * Reports the size in bytes of a native pointer, as stored via {@link
      * #putAddress}.  This value will be either 4 or 8.  Note that the sizes of
      * other primitive types (as stored in native memory blocks) is determined
      * fully by their information content.
@@ -587,7 +584,7 @@
     public static final int ADDRESS_SIZE = theUnsafe.addressSize();
 
     /**
-     * Report the size in bytes of a native memory page (whatever that is).
+     * Reports the size in bytes of a native memory page (whatever that is).
      * This value will always be a power of two.
      */
     public native int pageSize();
@@ -596,7 +593,7 @@
     /// random trusted operations from JNI:
 
     /**
-     * Tell the VM to define a class, without security checks.  By default, the
+     * Tells the VM to define a class, without security checks.  By default, the
      * class loader and protection domain come from the caller's class.
      */
     public native Class<?> defineClass(String name, byte[] b, int off, int len,
@@ -604,7 +601,7 @@
                                        ProtectionDomain protectionDomain);
 
     /**
-     * Define a class but do not make it known to the class loader or system dictionary.
+     * Defines a class but does not make it known to the class loader or system dictionary.
      * <p>
      * For each CP entry, the corresponding CP patch must either be null or have
      * the a format that matches its tag:
@@ -621,38 +618,38 @@
      */
     public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
 
-
-    /** Allocate an instance but do not run any constructor.
-        Initializes the class if it has not yet been. */
+    /**
+     * Allocates an instance but does not run any constructor.
+     * Initializes the class if it has not yet been.
+     */
     public native Object allocateInstance(Class<?> cls)
         throws InstantiationException;
 
-    /** Throw the exception without telling the verifier. */
+    /** Throws the exception without telling the verifier. */
     public native void throwException(Throwable ee);
 
-
     /**
-     * Atomically update Java variable to <tt>x</tt> if it is currently
-     * holding <tt>expected</tt>.
-     * @return <tt>true</tt> if successful
+     * Atomically updates Java variable to {@code x} if it is currently
+     * holding {@code expected}.
+     * @return {@code true} if successful
      */
     public final native boolean compareAndSwapObject(Object o, long offset,
                                                      Object expected,
                                                      Object x);
 
     /**
-     * Atomically update Java variable to <tt>x</tt> if it is currently
-     * holding <tt>expected</tt>.
-     * @return <tt>true</tt> if successful
+     * Atomically updates Java variable to {@code x} if it is currently
+     * holding {@code expected}.
+     * @return {@code true} if successful
      */
     public final native boolean compareAndSwapInt(Object o, long offset,
                                                   int expected,
                                                   int x);
 
     /**
-     * Atomically update Java variable to <tt>x</tt> if it is currently
-     * holding <tt>expected</tt>.
-     * @return <tt>true</tt> if successful
+     * Atomically updates Java variable to {@code x} if it is currently
+     * holding {@code expected}.
+     * @return {@code true} if successful
      */
     public final native boolean compareAndSwapLong(Object o, long offset,
                                                    long expected,
@@ -736,28 +733,28 @@
     public native void    putOrderedLong(Object o, long offset, long x);
 
     /**
-     * Unblock the given thread blocked on <tt>park</tt>, or, if it is
-     * not blocked, cause the subsequent call to <tt>park</tt> not to
+     * Unblocks the given thread blocked on {@code park}, or, if it is
+     * not blocked, causes the subsequent call to {@code park} not to
      * block.  Note: this operation is "unsafe" solely because the
      * caller must somehow ensure that the thread has not been
      * destroyed. Nothing special is usually required to ensure this
      * when called from Java (in which there will ordinarily be a live
      * reference to the thread) but this is not nearly-automatically
      * so when calling from native code.
+     *
      * @param thread the thread to unpark.
-     *
      */
     public native void unpark(Object thread);
 
     /**
-     * Block current thread, returning when a balancing
-     * <tt>unpark</tt> occurs, or a balancing <tt>unpark</tt> has
+     * Blocks current thread, returning when a balancing
+     * {@code unpark} occurs, or a balancing {@code unpark} has
      * already occurred, or the thread is interrupted, or, if not
      * absolute and time is not zero, the given time nanoseconds have
      * elapsed, or if absolute, the given deadline in milliseconds
      * since Epoch has passed, or spuriously (i.e., returning for no
      * "reason"). Note: This operation is in the Unsafe class only
-     * because <tt>unpark</tt> is, so it would be strange to place it
+     * because {@code unpark} is, so it would be strange to place it
      * elsewhere.
      */
     public native void park(boolean isAbsolute, long time);
@@ -765,8 +762,8 @@
     /**
      * Gets the load average in the system run queue assigned
      * to the available processors averaged over various periods of time.
-     * This method retrieves the given <tt>nelem</tt> samples and
-     * assigns to the elements of the given <tt>loadavg</tt> array.
+     * This method retrieves the given {@code nelem} samples and
+     * assigns to the elements of the given {@code loadavg} array.
      * The system imposes a maximum of 3 samples, representing
      * averages over the last 1,  5,  and  15 minutes, respectively.
      *
@@ -784,8 +781,8 @@
 
     /**
      * Atomically adds the given value to the current value of a field
-     * or array element within the given object <code>o</code>
-     * at the given <code>offset</code>.
+     * or array element within the given object {@code o}
+     * at the given {@code offset}.
      *
      * @param o object/array to update the field/element in
      * @param offset field/element offset
@@ -803,8 +800,8 @@
 
     /**
      * Atomically adds the given value to the current value of a field
-     * or array element within the given object <code>o</code>
-     * at the given <code>offset</code>.
+     * or array element within the given object {@code o}
+     * at the given {@code offset}.
      *
      * @param o object/array to update the field/element in
      * @param offset field/element offset
@@ -822,8 +819,8 @@
 
     /**
      * Atomically exchanges the given value with the current value of
-     * a field or array element within the given object <code>o</code>
-     * at the given <code>offset</code>.
+     * a field or array element within the given object {@code o}
+     * at the given {@code offset}.
      *
      * @param o object/array to update the field/element in
      * @param offset field/element offset
@@ -841,8 +838,8 @@
 
     /**
      * Atomically exchanges the given value with the current value of
-     * a field or array element within the given object <code>o</code>
-     * at the given <code>offset</code>.
+     * a field or array element within the given object {@code o}
+     * at the given {@code offset}.
      *
      * @param o object/array to update the field/element in
      * @param offset field/element offset
@@ -861,7 +858,7 @@
     /**
      * Atomically exchanges the given reference value with the current
      * reference value of a field or array element within the given
-     * object <code>o</code> at the given <code>offset</code>.
+     * object {@code o} at the given {@code offset}.
      *
      * @param o object/array to update the field/element in
      * @param offset field/element offset
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -244,7 +244,9 @@
     public java.security.cert.Certificate[] getServerCertificates()
             throws SSLPeerUnverifiedException {
         if (cachedResponse != null) {
-            List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
+            List<java.security.cert.Certificate> l =
+                    ((SecureCacheResponse)cachedResponse)
+                            .getServerCertificateChain();
             if (l == null) {
                 return null;
             } else {
@@ -262,7 +264,12 @@
     /**
      * Returns the server's X.509 certificate chain, or null if
      * the server did not authenticate.
+     *
+     * @deprecated This method returns the deprecated
+     *  {@code javax.security.cert.X509Certificate} type.
+     *  Use {@code getServerCertificates()} instead.
      */
+    @Deprecated
     public javax.security.cert.X509Certificate[] getServerCertificateChain()
             throws SSLPeerUnverifiedException {
         if (cachedResponse != null) {
@@ -271,7 +278,7 @@
         if (http == null) {
             throw new IllegalStateException("connection not yet open");
         } else {
-            return ((HttpsClient)http).getServerCertificateChain ();
+            return ((HttpsClient)http).getServerCertificateChain();
         }
     }
 
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -699,7 +699,12 @@
     /**
      * Returns the X.509 certificate chain with which the server
      * authenticated itself, or null if the server did not authenticate.
+     *
+     * @deprecated This method returns the deprecated
+     *  {@code javax.security.cert.X509Certificate} type.
+     *  Use {@code getServerCertificates()} instead.
      */
+    @Deprecated
     javax.security.cert.X509Certificate [] getServerCertificateChain()
             throws SSLPeerUnverifiedException
     {
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -204,7 +204,12 @@
      * NOTE: This method is not necessary for the version of this class
      * implementing javax.net.ssl.HttpsURLConnection, but provided for
      * compatibility with the com.sun.net.ssl.HttpsURLConnection version.
+     *
+     * @deprecated This method returns the deprecated
+     *  {@code javax.security.cert.X509Certificate} type.
+     *  Use {@code getServerCertificates()} instead.
      */
+    @Deprecated
     public javax.security.cert.X509Certificate[] getServerCertificateChain() {
         try {
             return delegate.getServerCertificateChain();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1569,6 +1569,9 @@
     /*
      * Returns the subject alternative name of the specified type in the
      * subjectAltNames extension of a certificate.
+     *
+     * Note that only those subjectAltName types that use String data
+     * should be passed into this function.
      */
     private static Collection<String> getSubjectAltNames(
             Collection<List<?>> subjectAltNames, int type) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Wed Jul 05 20:24:03 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
@@ -464,8 +464,13 @@
      *
      * @return array of peer X.509 certs, with the peer's own cert
      *  first in the chain, and with the "root" CA last.
+     *
+     * @deprecated This method returns the deprecated
+     *  {@code javax.security.cert.X509Certificate} type.
+     *  Use {@code getPeerCertificates()} instead.
      */
     @Override
+    @Deprecated
     public javax.security.cert.X509Certificate[] getPeerCertificateChain()
             throws SSLPeerUnverifiedException {
         //
--- a/jdk/src/java.base/share/native/libjli/java.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.c	Wed Jul 05 20:24:03 2017 +0200
@@ -661,15 +661,24 @@
          * arguments are for the application (i.e. the main class name, or
          * the -jar argument).
          */
-        if ((i > 0 && *arg != '-')
-                || JLI_StrCmp(arg, "-version") == 0
-                || JLI_StrCmp(arg, "-fullversion") == 0
-                || JLI_StrCmp(arg, "-help") == 0
-                || JLI_StrCmp(arg, "-?") == 0
-                || JLI_StrCmp(arg, "-jar") == 0
-                || JLI_StrCmp(arg, "-X") == 0
-                ) {
-            return;
+        if (i > 0) {
+            char *prev = argv[i - 1];
+            // skip non-dash arg preceded by class path specifiers
+            if (*arg != '-' &&
+                    ((JLI_StrCmp(prev, "-cp") == 0
+                    || JLI_StrCmp(prev, "-classpath") == 0))) {
+                continue;
+            }
+
+            if (*arg != '-'
+                    || JLI_StrCmp(arg, "-version") == 0
+                    || JLI_StrCmp(arg, "-fullversion") == 0
+                    || JLI_StrCmp(arg, "-help") == 0
+                    || JLI_StrCmp(arg, "-?") == 0
+                    || JLI_StrCmp(arg, "-jar") == 0
+                    || JLI_StrCmp(arg, "-X") == 0) {
+                return;
+            }
         }
         /*
          * The following case checks for "-XX:NativeMemoryTracking=value".
--- a/jdk/src/java.base/share/native/libjli/manifest_info.h	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/manifest_info.h	Wed Jul 05 20:24:03 2017 +0200
@@ -32,13 +32,16 @@
  * Zip file header signatures
  */
 #define SIGSIZ 4                    /* size of all header signatures */
-#define LOCSIG 0x04034b50L          /* "PK\003\004" */
-#define EXTSIG 0x08074b50L          /* "PK\007\008" */
-#define CENSIG 0x02014b50L          /* "PK\001\002" */
-#define ENDSIG 0x06054b50L          /* "PK\005\006" */
 
-#define ZIP64_ENDSIG 0x06064b50L    /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L    /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+  (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
+
 /*
  * Header sizes including signatures
  */
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c	Wed Jul 05 20:24:03 2017 +0200
@@ -138,7 +138,7 @@
         return -1;
     if ((bytes = read(fd, ep, ZIP64_LOCHDR)) < 0)
         return -1;
-    if (GETSIG(ep) == ZIP64_LOCSIG)
+    if (ZIP64_LOCSIG_AT(ep))
        return end64pos;
     return -1;
 }
@@ -176,7 +176,7 @@
         return (-1);
     if ((bytes = read(fd, eb, ENDHDR)) < 0)
         return (-1);
-    if (GETSIG(eb) == ENDSIG) {
+    if (ENDSIG_AT(eb)) {
         return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
     }
 
@@ -200,14 +200,11 @@
 
     /*
      * Search backwards from the end of file stopping when the END header
-     * signature is found. (The first condition of the "if" is just a
-     * fast fail, because the GETSIG macro isn't always cheap.  The
-     * final condition protects against false positives.)
+     * signature is found.
      */
     endpos = &buffer[bytes];
     for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
-        if ((*cp == (ENDSIG & 0xFF)) && (GETSIG(cp) == ENDSIG) &&
-          (cp + ENDHDR + ENDCOM(cp) == endpos)) {
+        if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
             (void) memcpy(eb, cp, ENDHDR);
             free(buffer);
             pos = flen - (endpos - cp);
@@ -267,7 +264,7 @@
         if ((bytes = read(fd, buffer, MINREAD)) < 0) {
             return (-1);
         }
-        if (GETSIG(buffer) != ZIP64_ENDSIG) {
+        if (!ZIP64_ENDSIG_AT(buffer)) {
             return -1;
         }
         if ((offset = ZIP64_ENDOFF(buffer)) < (jlong)0) {
@@ -356,7 +353,7 @@
      * Loop through the Central Directory Headers. Note that a valid zip/jar
      * must have an ENDHDR (with ENDSIG) after the Central Directory.
      */
-    while (GETSIG(p) == CENSIG) {
+    while (CENSIG_AT(p)) {
 
         /*
          * If a complete header isn't in the buffer, shift the contents
@@ -403,7 +400,7 @@
                 free(buffer);
                 return (-1);
             }
-            if (GETSIG(locbuf) != LOCSIG) {
+            if (!LOCSIG_AT(locbuf)) {
                 free(buffer);
                 return (-1);
             }
--- a/jdk/src/java.base/share/native/libzip/zip_util.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c	Wed Jul 05 20:24:03 2017 +0200
@@ -281,9 +281,9 @@
     return (cenpos >= 0 &&
             locpos >= 0 &&
             readFullyAt(zip->zfd, buf, sizeof(buf), cenpos) != -1 &&
-            GETSIG(buf) == CENSIG &&
+            CENSIG_AT(buf) &&
             readFullyAt(zip->zfd, buf, sizeof(buf), locpos) != -1 &&
-            GETSIG(buf) == LOCSIG);
+            LOCSIG_AT(buf));
 }
 
 /*
@@ -674,7 +674,7 @@
         method = CENHOW(cp);
         nlen   = CENNAM(cp);
 
-        if (GETSIG(cp) != CENSIG)
+        if (!CENSIG_AT(cp))
             ZIP_FORMAT_ERROR("invalid CEN header (bad signature)");
         if (CENFLG(cp) & 1)
             ZIP_FORMAT_ERROR("invalid CEN header (encrypted entry)");
@@ -827,10 +827,7 @@
 
     // Assumption, zfd refers to start of file. Trivially, reuse errbuf.
     if (readFully(zfd, errbuf, 4) != -1) {  // errors will be handled later
-        if (GETSIG(errbuf) == LOCSIG)
-            zip->locsig = JNI_TRUE;
-        else
-            zip->locsig = JNI_FALSE;
+        zip->locsig = LOCSIG_AT(errbuf) ? JNI_TRUE : JNI_FALSE;
     }
 
     len = zip->len = IO_Lseek(zfd, 0, SEEK_END);
@@ -1284,7 +1281,7 @@
             zip->msg = "error reading zip file";
             return -1;
         }
-        if (GETSIG(loc) != LOCSIG) {
+        if (!LOCSIG_AT(loc)) {
             zip->msg = "invalid LOC header (bad signature)";
             return -1;
         }
--- a/jdk/src/java.base/share/native/libzip/zip_util.h	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h	Wed Jul 05 20:24:03 2017 +0200
@@ -33,13 +33,14 @@
 /*
  * Header signatures
  */
-#define LOCSIG 0x04034b50L          /* "PK\003\004" */
-#define EXTSIG 0x08074b50L          /* "PK\007\008" */
-#define CENSIG 0x02014b50L          /* "PK\001\002" */
-#define ENDSIG 0x06054b50L          /* "PK\005\006" */
-
-#define ZIP64_ENDSIG 0x06064b50L    /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L    /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+  (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p)       PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
 
 /*
  * Header sizes including signatures
--- a/jdk/src/java.base/unix/native/launcher/jexec.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/unix/native/launcher/jexec.c	Wed Jul 05 20:24:03 2017 +0200
@@ -323,7 +323,7 @@
             result = BAD_MAGIC_MSG;
 
             // be sure the file is at least a ZIP file
-            if (GETSIG(buf) == LOCSIG) {
+            if (LOCSIG_AT(buf)) {
 
                 off_t flen  = LOCNAM(buf);
                 off_t xlen  = LOCEXT(buf);
--- a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Wed Jul 05 20:24:03 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
@@ -28,6 +28,7 @@
 #include <winsock2.h>           /* needed for htonl */
 #include <iprtrmib.h>
 #include <assert.h>
+#include <limits.h>
 
 #include "java_net_NetworkInterface.h"
 #include "jni_util.h"
@@ -70,7 +71,7 @@
 
 #endif
 
-static int bufsize = 1024;
+static int bufsize = 4096;
 
 /*
  * return an array of IP_ADAPTER_ADDRESSES containing one element
@@ -102,7 +103,11 @@
     ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
 
     if (ret == ERROR_BUFFER_OVERFLOW) {
-        IP_ADAPTER_ADDRESSES * newAdapterInfo =
+        IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+        if (len  < (ULONG_MAX - bufsize)) {
+            len = len + bufsize;
+        }
+        newAdapterInfo =
             (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
         if (newAdapterInfo == NULL) {
             free(adapterInfo);
@@ -113,7 +118,6 @@
 
         adapterInfo = newAdapterInfo;
 
-        bufsize = len;
         ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
 
@@ -176,7 +180,11 @@
     flags |= GAA_FLAG_INCLUDE_PREFIX;
     val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     if (val == ERROR_BUFFER_OVERFLOW) {
-        IP_ADAPTER_ADDRESSES * newAdapterInfo =
+        IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+        if (len  < (ULONG_MAX - bufsize)) {
+            len = len + bufsize;
+        }
+        newAdapterInfo =
                 (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
         if (newAdapterInfo == NULL) {
             free(adapterInfo);
@@ -187,7 +195,6 @@
 
         adapterInfo = newAdapterInfo;
 
-        bufsize = len;
         val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
 
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java	Wed Jul 05 20:24:03 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
@@ -489,6 +489,8 @@
      *       <tt>MAX_VALUE_LENGTH</tt>.
      * @throws IllegalStateException if this node (or an ancestor) has been
      *         removed with the {@link #removeNode()} method.
+     * @throws IllegalArgumentException if either the key or the value contain
+     *         the null control character, code point U+0000.
      */
     public abstract void put(String key, String value);
 
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, 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
@@ -49,6 +49,13 @@
  */
 class FileSystemPreferences extends AbstractPreferences {
 
+    /**
+     * The code point U+0000, assigned to the null control character, is the
+     * only character encoded in Unicode and ISO/IEC 10646 that is always
+     * invalid in any XML 1.0 and 1.1 document.
+     */
+    private static final String CODE_POINT_U0000 = String.valueOf('\u0000');
+
     static {
         PrivilegedAction<Void> load = () -> {
             System.loadLibrary("prefs");
@@ -525,6 +532,11 @@
     }
 
     protected void putSpi(String key, String value) {
+        if (key.indexOf(CODE_POINT_U0000) != -1) {
+            throw new IllegalArgumentException("Key contains code point U+0000");
+        } else if (value.indexOf(CODE_POINT_U0000) != -1) {
+            throw new IllegalArgumentException("Value contains code point U+0000");
+        }
         initCacheIfNecessary();
         changeLog.add(new Put(key, value));
         prefsCache.put(key, value);
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -52,7 +52,7 @@
  * <pre>
  *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
  *   Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
- *   List<Reference> references = Collections.singletonList(ref);
+ *   List&lt;Reference&gt; references = Collections.singletonList(ref);
  *   Manifest manifest = factory.newManifest(references, "manifest-1");
  * </pre>
  *
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java	Wed Jul 05 20:24:03 2017 +0200
@@ -65,7 +65,7 @@
  * <pre>
  *   XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
  *   Manifest manifest = fac.newManifest(references);
- *   List<XMLStructure> content = Collections.singletonList(manifest);
+ *   List&lt;XMLStructure&gt; content = Collections.singletonList(manifest);
  *   XMLObject object = factory.newXMLObject(content, "object-1", null, null);
  * </pre>
  *
--- a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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 com.sun.jarsigner;
-
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-
-/**
- * This class defines a content signing service.
- * Implementations must be instantiable using a zero-argument constructor.
- *
- * @since 1.5
- * @author Vincent Ryan
- */
-
-@jdk.Exported
-public abstract class ContentSigner {
-
-    /**
-     * Generates a PKCS #7 signed data message.
-     * This method is used when the signature has already been generated.
-     * The signature, the signer's details, and optionally a signature
-     * timestamp and the content that was signed, are all packaged into a
-     * signed data message.
-     *
-     * @param parameters The non-null input parameters.
-     * @param omitContent true if the content should be omitted from the
-     *         signed data message. Otherwise the content is included.
-     * @param applyTimestamp true if the signature should be timestamped.
-     *         Otherwise timestamping is not performed.
-     * @return A PKCS #7 signed data message.
-     * @throws NoSuchAlgorithmException The exception is thrown if the signature
-     *         algorithm is unrecognised.
-     * @throws CertificateException The exception is thrown if an error occurs
-     *         while processing the signer's certificate or the TSA's
-     *         certificate.
-     * @throws IOException The exception is thrown if an error occurs while
-     *         generating the signature timestamp or while generating the signed
-     *         data message.
-     * @throws NullPointerException The exception is thrown if parameters is
-     *         null.
-     */
-    public abstract byte[] generateSignedData(
-        ContentSignerParameters parameters, boolean omitContent,
-        boolean applyTimestamp)
-            throws NoSuchAlgorithmException, CertificateException, IOException;
-}
--- a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2003, 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 com.sun.jarsigner;
-
-import java.net.URI;
-import java.security.cert.X509Certificate;
-import java.util.zip.ZipFile;
-
-/**
- * This interface encapsulates the parameters for a ContentSigner object.
- *
- * @since 1.5
- * @author Vincent Ryan
- */
-@jdk.Exported
-public interface ContentSignerParameters {
-
-    /**
-     * Retrieves the command-line arguments passed to the jarsigner tool.
-     *
-     * @return The command-line arguments. May be null.
-     */
-    public String[] getCommandLine();
-
-    /**
-     * Retrieves the identifier for a Timestamping Authority (TSA).
-     *
-     * @return The TSA identifier. May be null.
-     */
-    public URI getTimestampingAuthority();
-
-    /**
-     * Retrieves the certificate for a Timestamping Authority (TSA).
-     *
-     * @return The TSA certificate. May be null.
-     */
-    public X509Certificate getTimestampingAuthorityCertificate();
-
-    /**
-     * Retrieves the TSAPolicyID for a Timestamping Authority (TSA).
-     *
-     * @return The TSAPolicyID. May be null.
-     */
-    public default String getTSAPolicyID() {
-        return null;
-    }
-
-    /**
-     * Retreives the message digest algorithm that is used to generate
-     * the message imprint to be sent to the TSA server.
-     *
-     * @since 1.9
-     * @return The non-null string of the message digest algorithm name.
-     */
-    public default String getTSADigestAlg() {
-        return "SHA-256";
-    }
-
-    /**
-     * Retrieves the JAR file's signature.
-     *
-     * @return The non-null array of signature bytes.
-     */
-    public byte[] getSignature();
-
-    /**
-     * Retrieves the name of the signature algorithm.
-     *
-     * @return The non-null string name of the signature algorithm.
-     */
-    public String getSignatureAlgorithm();
-
-    /**
-     * Retrieves the signer's X.509 certificate chain.
-     *
-     * @return The non-null array of X.509 public-key certificates.
-     */
-    public X509Certificate[] getSignerCertificateChain();
-
-    /**
-     * Retrieves the content that was signed.
-     * The content is the JAR file's signature file.
-     *
-     * @return The content bytes. May be null.
-     */
-    public byte[] getContent();
-
-    /**
-     * Retrieves the original source ZIP file before it was signed.
-     *
-     * @return The original ZIP file. May be null.
-     */
-    public ZipFile getSource();
-}
--- a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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.
- */
-/**
- * This package comprises the interfaces and classes used to define the
- * signing mechanism used by the <tt>jarsigner</tt> tool.
- * <p>
- * Clients may override the default signing mechanism of the <tt>jarsigner</tt>
- * tool by supplying an alternative implementation of
- * {@link com.sun.jarsigner.ContentSigner}.
- */
-
-@jdk.Exported
-package com.sun.jarsigner;
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2571 +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 sun.security.tools.jarsigner;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-import java.util.jar.*;
-import java.math.BigInteger;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.Collator;
-import java.text.MessageFormat;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.security.cert.CertificateException;
-import java.security.*;
-import java.lang.reflect.Constructor;
-
-import com.sun.jarsigner.ContentSigner;
-import com.sun.jarsigner.ContentSignerParameters;
-import java.net.SocketTimeoutException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.cert.CertPath;
-import java.security.cert.CertPathValidator;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.PKIXParameters;
-import java.security.cert.TrustAnchor;
-import java.util.Map.Entry;
-import sun.security.tools.KeyStoreUtil;
-import sun.security.tools.PathList;
-import sun.security.x509.*;
-import sun.security.util.*;
-import java.util.Base64;
-
-
-/**
- * <p>The jarsigner utility.
- *
- * The exit codes for the main method are:
- *
- * 0: success
- * 1: any error that the jar cannot be signed or verified, including:
- *      keystore loading error
- *      TSP communication error
- *      jarsigner command line error...
- * otherwise: error codes from -strict
- *
- * @author Roland Schemers
- * @author Jan Luehe
- */
-
-public class Main {
-
-    // for i18n
-    private static final java.util.ResourceBundle rb =
-        java.util.ResourceBundle.getBundle
-        ("sun.security.tools.jarsigner.Resources");
-    private static final Collator collator = Collator.getInstance();
-    static {
-        // this is for case insensitive string comparisions
-        collator.setStrength(Collator.PRIMARY);
-    }
-
-    private static final String META_INF = "META-INF/";
-
-    private static final Class<?>[] PARAM_STRING = { String.class };
-
-    private static final String NONE = "NONE";
-    private static final String P11KEYSTORE = "PKCS11";
-
-    private static final long SIX_MONTHS = 180*24*60*60*1000L; //milliseconds
-
-    // Attention:
-    // This is the entry that get launched by the security tool jarsigner.
-    public static void main(String args[]) throws Exception {
-        Main js = new Main();
-        js.run(args);
-    }
-
-    static final String VERSION = "1.0";
-
-    static final int IN_KEYSTORE = 0x01;        // signer is in keystore
-    static final int IN_SCOPE = 0x02;
-    static final int NOT_ALIAS = 0x04;          // alias list is NOT empty and
-                                                // signer is not in alias list
-    static final int SIGNED_BY_ALIAS = 0x08;    // signer is in alias list
-
-    X509Certificate[] certChain;    // signer's cert chain (when composing)
-    PrivateKey privateKey;          // private key
-    KeyStore store;                 // the keystore specified by -keystore
-                                    // or the default keystore, never null
-
-    String keystore; // key store file
-    boolean nullStream = false; // null keystore input stream (NONE)
-    boolean token = false; // token-based keystore
-    String jarfile;  // jar files to sign or verify
-    String alias;    // alias to sign jar with
-    List<String> ckaliases = new ArrayList<>(); // aliases in -verify
-    char[] storepass; // keystore password
-    boolean protectedPath; // protected authentication path
-    String storetype; // keystore type
-    String providerName; // provider name
-    Vector<String> providers = null; // list of providers
-    // arguments for provider constructors
-    HashMap<String,String> providerArgs = new HashMap<>();
-    char[] keypass; // private key password
-    String sigfile; // name of .SF file
-    String sigalg; // name of signature algorithm
-    String digestalg = "SHA-256"; // name of digest algorithm
-    String signedjar; // output filename
-    String tsaUrl; // location of the Timestamping Authority
-    String tsaAlias; // alias for the Timestamping Authority's certificate
-    String altCertChain; // file to read alternative cert chain from
-    String tSAPolicyID;
-    String tSADigestAlg = "SHA-256";
-    boolean verify = false; // verify the jar
-    String verbose = null; // verbose output when signing/verifying
-    boolean showcerts = false; // show certs when verifying
-    boolean debug = false; // debug
-    boolean signManifest = true; // "sign" the whole manifest
-    boolean externalSF = true; // leave the .SF out of the PKCS7 block
-    boolean strict = false;  // treat warnings as error
-
-    // read zip entry raw bytes
-    private ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
-    private byte[] buffer = new byte[8192];
-    private ContentSigner signingMechanism = null;
-    private String altSignerClass = null;
-    private String altSignerClasspath = null;
-    private ZipFile zipFile = null;
-
-    // Informational warnings
-    private boolean hasExpiringCert = false;
-    private boolean noTimestamp = false;
-    private Date expireDate = new Date(0L);     // used in noTimestamp warning
-
-    // Severe warnings
-    private boolean hasExpiredCert = false;
-    private boolean notYetValidCert = false;
-    private boolean chainNotValidated = false;
-    private boolean notSignedByAlias = false;
-    private boolean aliasNotInStore = false;
-    private boolean hasUnsignedEntry = false;
-    private boolean badKeyUsage = false;
-    private boolean badExtendedKeyUsage = false;
-    private boolean badNetscapeCertType = false;
-
-    CertificateFactory certificateFactory;
-    CertPathValidator validator;
-    PKIXParameters pkixParameters;
-
-    public void run(String args[]) {
-        try {
-            args = parseArgs(args);
-
-            // Try to load and install the specified providers
-            if (providers != null) {
-                ClassLoader cl = ClassLoader.getSystemClassLoader();
-                Enumeration<String> e = providers.elements();
-                while (e.hasMoreElements()) {
-                    String provName = e.nextElement();
-                    Class<?> provClass;
-                    if (cl != null) {
-                        provClass = cl.loadClass(provName);
-                    } else {
-                        provClass = Class.forName(provName);
-                    }
-
-                    String provArg = providerArgs.get(provName);
-                    Object obj;
-                    if (provArg == null) {
-                        obj = provClass.newInstance();
-                    } else {
-                        Constructor<?> c =
-                                provClass.getConstructor(PARAM_STRING);
-                        obj = c.newInstance(provArg);
-                    }
-
-                    if (!(obj instanceof Provider)) {
-                        MessageFormat form = new MessageFormat(rb.getString
-                            ("provName.not.a.provider"));
-                        Object[] source = {provName};
-                        throw new Exception(form.format(source));
-                    }
-                    Security.addProvider((Provider)obj);
-                }
-            }
-
-            if (verify) {
-                try {
-                    loadKeyStore(keystore, false);
-                } catch (Exception e) {
-                    if ((keystore != null) || (storepass != null)) {
-                        System.out.println(rb.getString("jarsigner.error.") +
-                                        e.getMessage());
-                        System.exit(1);
-                    }
-                }
-                /*              if (debug) {
-                    SignatureFileVerifier.setDebug(true);
-                    ManifestEntryVerifier.setDebug(true);
-                }
-                */
-                verifyJar(jarfile);
-            } else {
-                loadKeyStore(keystore, true);
-                getAliasInfo(alias);
-
-                // load the alternative signing mechanism
-                if (altSignerClass != null) {
-                    signingMechanism = loadSigningMechanism(altSignerClass,
-                        altSignerClasspath);
-                }
-                signJar(jarfile, alias, args);
-            }
-        } catch (Exception e) {
-            System.out.println(rb.getString("jarsigner.error.") + e);
-            if (debug) {
-                e.printStackTrace();
-            }
-            System.exit(1);
-        } finally {
-            // zero-out private key password
-            if (keypass != null) {
-                Arrays.fill(keypass, ' ');
-                keypass = null;
-            }
-            // zero-out keystore password
-            if (storepass != null) {
-                Arrays.fill(storepass, ' ');
-                storepass = null;
-            }
-        }
-
-        if (strict) {
-            int exitCode = 0;
-            if (chainNotValidated || hasExpiredCert || notYetValidCert) {
-                exitCode |= 4;
-            }
-            if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType) {
-                exitCode |= 8;
-            }
-            if (hasUnsignedEntry) {
-                exitCode |= 16;
-            }
-            if (notSignedByAlias || aliasNotInStore) {
-                exitCode |= 32;
-            }
-            if (exitCode != 0) {
-                System.exit(exitCode);
-            }
-        }
-    }
-
-    /*
-     * Parse command line arguments.
-     */
-    String[] parseArgs(String args[]) throws Exception {
-        /* parse flags */
-        int n = 0;
-
-        if (args.length == 0) fullusage();
-
-        String confFile = null;
-        String command = "-sign";
-        for (n=0; n < args.length; n++) {
-            if (collator.compare(args[n], "-verify") == 0) {
-                command = "-verify";
-            } else if (collator.compare(args[n], "-conf") == 0) {
-                if (n == args.length - 1) {
-                    usageNoArg();
-                }
-                confFile = args[++n];
-            }
-        }
-
-        if (confFile != null) {
-            args = KeyStoreUtil.expandArgs(
-                    "jarsigner", confFile, command, null, args);
-        }
-
-        debug = Arrays.stream(args).anyMatch(
-                x -> collator.compare(x, "-debug") == 0);
-
-        if (debug) {
-            // No need to localize debug output
-            System.out.println("Command line args: " +
-                    Arrays.toString(args));
-        }
-
-        for (n=0; n < args.length; n++) {
-
-            String flags = args[n];
-            String modifier = null;
-
-            if (flags.startsWith("-")) {
-                int pos = flags.indexOf(':');
-                if (pos > 0) {
-                    modifier = flags.substring(pos+1);
-                    flags = flags.substring(0, pos);
-                }
-            }
-
-            if (!flags.startsWith("-")) {
-                if (jarfile == null) {
-                    jarfile = flags;
-                } else {
-                    alias = flags;
-                    ckaliases.add(alias);
-                }
-            } else if (collator.compare(flags, "-conf") == 0) {
-                if (++n == args.length) usageNoArg();
-            } else if (collator.compare(flags, "-keystore") == 0) {
-                if (++n == args.length) usageNoArg();
-                keystore = args[n];
-            } else if (collator.compare(flags, "-storepass") ==0) {
-                if (++n == args.length) usageNoArg();
-                storepass = getPass(modifier, args[n]);
-            } else if (collator.compare(flags, "-storetype") ==0) {
-                if (++n == args.length) usageNoArg();
-                storetype = args[n];
-            } else if (collator.compare(flags, "-providerName") ==0) {
-                if (++n == args.length) usageNoArg();
-                providerName = args[n];
-            } else if ((collator.compare(flags, "-provider") == 0) ||
-                        (collator.compare(flags, "-providerClass") == 0)) {
-                if (++n == args.length) usageNoArg();
-                if (providers == null) {
-                    providers = new Vector<String>(3);
-                }
-                providers.add(args[n]);
-
-                if (args.length > (n+1)) {
-                    flags = args[n+1];
-                    if (collator.compare(flags, "-providerArg") == 0) {
-                        if (args.length == (n+2)) usageNoArg();
-                        providerArgs.put(args[n], args[n+2]);
-                        n += 2;
-                    }
-                }
-            } else if (collator.compare(flags, "-protected") ==0) {
-                protectedPath = true;
-            } else if (collator.compare(flags, "-certchain") ==0) {
-                if (++n == args.length) usageNoArg();
-                altCertChain = args[n];
-            } else if (collator.compare(flags, "-tsapolicyid") ==0) {
-                if (++n == args.length) usageNoArg();
-                tSAPolicyID = args[n];
-            } else if (collator.compare(flags, "-tsadigestalg") ==0) {
-                if (++n == args.length) usageNoArg();
-                tSADigestAlg = args[n];
-            } else if (collator.compare(flags, "-debug") ==0) {
-                // Already processed
-            } else if (collator.compare(flags, "-keypass") ==0) {
-                if (++n == args.length) usageNoArg();
-                keypass = getPass(modifier, args[n]);
-            } else if (collator.compare(flags, "-sigfile") ==0) {
-                if (++n == args.length) usageNoArg();
-                sigfile = args[n];
-            } else if (collator.compare(flags, "-signedjar") ==0) {
-                if (++n == args.length) usageNoArg();
-                signedjar = args[n];
-            } else if (collator.compare(flags, "-tsa") ==0) {
-                if (++n == args.length) usageNoArg();
-                tsaUrl = args[n];
-            } else if (collator.compare(flags, "-tsacert") ==0) {
-                if (++n == args.length) usageNoArg();
-                tsaAlias = args[n];
-            } else if (collator.compare(flags, "-altsigner") ==0) {
-                if (++n == args.length) usageNoArg();
-                altSignerClass = args[n];
-            } else if (collator.compare(flags, "-altsignerpath") ==0) {
-                if (++n == args.length) usageNoArg();
-                altSignerClasspath = args[n];
-            } else if (collator.compare(flags, "-sectionsonly") ==0) {
-                signManifest = false;
-            } else if (collator.compare(flags, "-internalsf") ==0) {
-                externalSF = false;
-            } else if (collator.compare(flags, "-verify") ==0) {
-                verify = true;
-            } else if (collator.compare(flags, "-verbose") ==0) {
-                verbose = (modifier != null) ? modifier : "all";
-            } else if (collator.compare(flags, "-sigalg") ==0) {
-                if (++n == args.length) usageNoArg();
-                sigalg = args[n];
-            } else if (collator.compare(flags, "-digestalg") ==0) {
-                if (++n == args.length) usageNoArg();
-                digestalg = args[n];
-            } else if (collator.compare(flags, "-certs") ==0) {
-                showcerts = true;
-            } else if (collator.compare(flags, "-strict") ==0) {
-                strict = true;
-            } else if (collator.compare(flags, "-h") == 0 ||
-                        collator.compare(flags, "-help") == 0) {
-                fullusage();
-            } else {
-                System.err.println(
-                        rb.getString("Illegal.option.") + flags);
-                usage();
-            }
-        }
-
-        // -certs must always be specified with -verbose
-        if (verbose == null) showcerts = false;
-
-        if (jarfile == null) {
-            System.err.println(rb.getString("Please.specify.jarfile.name"));
-            usage();
-        }
-        if (!verify && alias == null) {
-            System.err.println(rb.getString("Please.specify.alias.name"));
-            usage();
-        }
-        if (!verify && ckaliases.size() > 1) {
-            System.err.println(rb.getString("Only.one.alias.can.be.specified"));
-            usage();
-        }
-
-        if (storetype == null) {
-            storetype = KeyStore.getDefaultType();
-        }
-        storetype = KeyStoreUtil.niceStoreTypeName(storetype);
-
-        try {
-            if (signedjar != null && new File(signedjar).getCanonicalPath().equals(
-                    new File(jarfile).getCanonicalPath())) {
-                signedjar = null;
-            }
-        } catch (IOException ioe) {
-            // File system error?
-            // Just ignore it.
-        }
-
-        if (P11KEYSTORE.equalsIgnoreCase(storetype) ||
-                KeyStoreUtil.isWindowsKeyStore(storetype)) {
-            token = true;
-            if (keystore == null) {
-                keystore = NONE;
-            }
-        }
-
-        if (NONE.equals(keystore)) {
-            nullStream = true;
-        }
-
-        if (token && !nullStream) {
-            System.err.println(MessageFormat.format(rb.getString
-                (".keystore.must.be.NONE.if.storetype.is.{0}"), storetype));
-            usage();
-        }
-
-        if (token && keypass != null) {
-            System.err.println(MessageFormat.format(rb.getString
-                (".keypass.can.not.be.specified.if.storetype.is.{0}"), storetype));
-            usage();
-        }
-
-        if (protectedPath) {
-            if (storepass != null || keypass != null) {
-                System.err.println(rb.getString
-                        ("If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified"));
-                usage();
-            }
-        }
-        if (KeyStoreUtil.isWindowsKeyStore(storetype)) {
-            if (storepass != null || keypass != null) {
-                System.err.println(rb.getString
-                        ("If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified"));
-                usage();
-            }
-        }
-        return args;
-    }
-
-    static char[] getPass(String modifier, String arg) {
-        char[] output = KeyStoreUtil.getPassWithModifier(modifier, arg, rb);
-        if (output != null) return output;
-        usage();
-        return null;    // Useless, usage() already exit
-    }
-
-    static void usageNoArg() {
-        System.out.println(rb.getString("Option.lacks.argument"));
-        usage();
-    }
-
-    static void usage() {
-        System.out.println();
-        System.out.println(rb.getString("Please.type.jarsigner.help.for.usage"));
-        System.exit(1);
-    }
-
-    static void fullusage() {
-        System.out.println(rb.getString
-                ("Usage.jarsigner.options.jar.file.alias"));
-        System.out.println(rb.getString
-                (".jarsigner.verify.options.jar.file.alias."));
-        System.out.println();
-        System.out.println(rb.getString
-                (".keystore.url.keystore.location"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".storepass.password.password.for.keystore.integrity"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".storetype.type.keystore.type"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".keypass.password.password.for.private.key.if.different."));
-        System.out.println();
-        System.out.println(rb.getString
-                (".certchain.file.name.of.alternative.certchain.file"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".sigfile.file.name.of.SF.DSA.file"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".signedjar.file.name.of.signed.JAR.file"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".digestalg.algorithm.name.of.digest.algorithm"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".sigalg.algorithm.name.of.signature.algorithm"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".verify.verify.a.signed.JAR.file"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".verbose.suboptions.verbose.output.when.signing.verifying."));
-        System.out.println(rb.getString
-                (".suboptions.can.be.all.grouped.or.summary"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".certs.display.certificates.when.verbose.and.verifying"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".tsa.url.location.of.the.Timestamping.Authority"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".tsacert.alias.public.key.certificate.for.Timestamping.Authority"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".tsapolicyid.tsapolicyid.for.Timestamping.Authority"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".tsadigestalg.algorithm.of.digest.data.in.timestamping.request"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".altsigner.class.class.name.of.an.alternative.signing.mechanism"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".internalsf.include.the.SF.file.inside.the.signature.block"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".sectionsonly.don.t.compute.hash.of.entire.manifest"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".protected.keystore.has.protected.authentication.path"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".providerName.name.provider.name"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".providerClass.class.name.of.cryptographic.service.provider.s"));
-        System.out.println(rb.getString
-                (".providerArg.arg.master.class.file.and.constructor.argument"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".strict.treat.warnings.as.errors"));
-        System.out.println();
-        System.out.println(rb.getString
-                (".conf.url.specify.a.pre.configured.options.file"));
-        System.out.println();
-
-        System.exit(0);
-    }
-
-    void verifyJar(String jarName)
-        throws Exception
-    {
-        boolean anySigned = false;  // if there exists entry inside jar signed
-        JarFile jf = null;
-
-        try {
-            jf = new JarFile(jarName, true);
-            Vector<JarEntry> entriesVec = new Vector<>();
-            byte[] buffer = new byte[8192];
-
-            Enumeration<JarEntry> entries = jf.entries();
-            while (entries.hasMoreElements()) {
-                JarEntry je = entries.nextElement();
-                entriesVec.addElement(je);
-                InputStream is = null;
-                try {
-                    is = jf.getInputStream(je);
-                    int n;
-                    while ((n = is.read(buffer, 0, buffer.length)) != -1) {
-                        // we just read. this will throw a SecurityException
-                        // if  a signature/digest check fails.
-                    }
-                } finally {
-                    if (is != null) {
-                        is.close();
-                    }
-                }
-            }
-
-            Manifest man = jf.getManifest();
-
-            // The map to record display info, only used when -verbose provided
-            //      key: signer info string
-            //      value: the list of files with common key
-            Map<String,List<String>> output = new LinkedHashMap<>();
-
-            if (man != null) {
-                if (verbose != null) System.out.println();
-                Enumeration<JarEntry> e = entriesVec.elements();
-
-                String tab = rb.getString("6SPACE");
-
-                while (e.hasMoreElements()) {
-                    JarEntry je = e.nextElement();
-                    String name = je.getName();
-                    CodeSigner[] signers = je.getCodeSigners();
-                    boolean isSigned = (signers != null);
-                    anySigned |= isSigned;
-                    hasUnsignedEntry |= !je.isDirectory() && !isSigned
-                                        && !signatureRelated(name);
-
-                    int inStoreOrScope = inKeyStore(signers);
-
-                    boolean inStore = (inStoreOrScope & IN_KEYSTORE) != 0;
-                    boolean inScope = (inStoreOrScope & IN_SCOPE) != 0;
-
-                    notSignedByAlias |= (inStoreOrScope & NOT_ALIAS) != 0;
-                    if (keystore != null) {
-                        aliasNotInStore |= isSigned && (!inStore && !inScope);
-                    }
-
-                    // Only used when -verbose provided
-                    StringBuffer sb = null;
-                    if (verbose != null) {
-                        sb = new StringBuffer();
-                        boolean inManifest =
-                            ((man.getAttributes(name) != null) ||
-                             (man.getAttributes("./"+name) != null) ||
-                             (man.getAttributes("/"+name) != null));
-                        sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
-                                .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
-                                .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
-                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
-                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
-                                .append(rb.getString("SPACE"));
-                        sb.append('|');
-                    }
-
-                    // When -certs provided, display info has extra empty
-                    // lines at the beginning and end.
-                    if (isSigned) {
-                        if (showcerts) sb.append('\n');
-                        for (CodeSigner signer: signers) {
-                            // signerInfo() must be called even if -verbose
-                            // not provided. The method updates various
-                            // warning flags.
-                            String si = signerInfo(signer, tab);
-                            if (showcerts) {
-                                sb.append(si);
-                                sb.append('\n');
-                            }
-                        }
-                    } else if (showcerts && !verbose.equals("all")) {
-                        // Print no info for unsigned entries when -verbose:all,
-                        // to be consistent with old behavior.
-                        if (signatureRelated(name)) {
-                            sb.append('\n')
-                                    .append(tab)
-                                    .append(rb
-                                            .getString(".Signature.related.entries."))
-                                    .append("\n\n");
-                        } else {
-                            sb.append('\n').append(tab)
-                                    .append(rb.getString(".Unsigned.entries."))
-                                    .append("\n\n");
-                        }
-                    }
-
-                    if (verbose != null) {
-                        String label = sb.toString();
-                        if (signatureRelated(name)) {
-                            // Entries inside META-INF and other unsigned
-                            // entries are grouped separately.
-                            label = "-" + label;
-                        }
-
-                        // The label finally contains 2 parts separated by '|':
-                        // The legend displayed before the entry names, and
-                        // the cert info (if -certs specified).
-
-                        if (!output.containsKey(label)) {
-                            output.put(label, new ArrayList<String>());
-                        }
-
-                        StringBuilder fb = new StringBuilder();
-                        String s = Long.toString(je.getSize());
-                        for (int i = 6 - s.length(); i > 0; --i) {
-                            fb.append(' ');
-                        }
-                        fb.append(s).append(' ').
-                                append(new Date(je.getTime()).toString());
-                        fb.append(' ').append(name);
-
-                        output.get(label).add(fb.toString());
-                    }
-                }
-            }
-            if (verbose != null) {
-                for (Entry<String,List<String>> s: output.entrySet()) {
-                    List<String> files = s.getValue();
-                    String key = s.getKey();
-                    if (key.charAt(0) == '-') { // the signature-related group
-                        key = key.substring(1);
-                    }
-                    int pipe = key.indexOf('|');
-                    if (verbose.equals("all")) {
-                        for (String f: files) {
-                            System.out.println(key.substring(0, pipe) + f);
-                            System.out.printf(key.substring(pipe+1));
-                        }
-                    } else {
-                        if (verbose.equals("grouped")) {
-                            for (String f: files) {
-                                System.out.println(key.substring(0, pipe) + f);
-                            }
-                        } else if (verbose.equals("summary")) {
-                            System.out.print(key.substring(0, pipe));
-                            if (files.size() > 1) {
-                                System.out.println(files.get(0) + " " +
-                                        String.format(rb.getString(
-                                        ".and.d.more."), files.size()-1));
-                            } else {
-                                System.out.println(files.get(0));
-                            }
-                        }
-                        System.out.printf(key.substring(pipe+1));
-                    }
-                }
-                System.out.println();
-                System.out.println(rb.getString(
-                    ".s.signature.was.verified."));
-                System.out.println(rb.getString(
-                    ".m.entry.is.listed.in.manifest"));
-                System.out.println(rb.getString(
-                    ".k.at.least.one.certificate.was.found.in.keystore"));
-                System.out.println(rb.getString(
-                    ".i.at.least.one.certificate.was.found.in.identity.scope"));
-                if (ckaliases.size() > 0) {
-                    System.out.println(rb.getString(
-                        ".X.not.signed.by.specified.alias.es."));
-                }
-                System.out.println();
-            }
-            if (man == null)
-                System.out.println(rb.getString("no.manifest."));
-
-            if (!anySigned) {
-                System.out.println(rb.getString(
-                      "jar.is.unsigned.signatures.missing.or.not.parsable."));
-            } else {
-                boolean warningAppeared = false;
-                boolean errorAppeared = false;
-                if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
-                        notYetValidCert || chainNotValidated || hasExpiredCert ||
-                        hasUnsignedEntry ||
-                        aliasNotInStore || notSignedByAlias) {
-
-                    if (strict) {
-                        System.out.println(rb.getString("jar.verified.with.signer.errors."));
-                        System.out.println();
-                        System.out.println(rb.getString("Error."));
-                        errorAppeared = true;
-                    } else {
-                        System.out.println(rb.getString("jar.verified."));
-                        System.out.println();
-                        System.out.println(rb.getString("Warning."));
-                        warningAppeared = true;
-                    }
-
-                    if (badKeyUsage) {
-                        System.out.println(
-                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
-                    }
-
-                    if (badExtendedKeyUsage) {
-                        System.out.println(
-                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
-                    }
-
-                    if (badNetscapeCertType) {
-                        System.out.println(
-                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
-                    }
-
-                    if (hasUnsignedEntry) {
-                        System.out.println(rb.getString(
-                            "This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked."));
-                    }
-                    if (hasExpiredCert) {
-                        System.out.println(rb.getString(
-                            "This.jar.contains.entries.whose.signer.certificate.has.expired."));
-                    }
-                    if (notYetValidCert) {
-                        System.out.println(rb.getString(
-                            "This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid."));
-                    }
-
-                    if (chainNotValidated) {
-                        System.out.println(
-                                rb.getString("This.jar.contains.entries.whose.certificate.chain.is.not.validated."));
-                    }
-
-                    if (notSignedByAlias) {
-                        System.out.println(
-                                rb.getString("This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es."));
-                    }
-
-                    if (aliasNotInStore) {
-                        System.out.println(rb.getString("This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore."));
-                    }
-                } else {
-                    System.out.println(rb.getString("jar.verified."));
-                }
-                if (hasExpiringCert || noTimestamp) {
-                    if (!warningAppeared) {
-                        System.out.println();
-                        System.out.println(rb.getString("Warning."));
-                        warningAppeared = true;
-                    }
-                    if (hasExpiringCert) {
-                        System.out.println(rb.getString(
-                                "This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months."));
-                    }
-                    if (noTimestamp) {
-                        System.out.println(
-                                String.format(rb.getString("no.timestamp.verifying"), expireDate));
-                    }
-                }
-                if (warningAppeared || errorAppeared) {
-                    if (! (verbose != null && showcerts)) {
-                        System.out.println();
-                        System.out.println(rb.getString(
-                                "Re.run.with.the.verbose.and.certs.options.for.more.details."));
-                    }
-                }
-            }
-            return;
-        } catch (Exception e) {
-            System.out.println(rb.getString("jarsigner.") + e);
-            if (debug) {
-                e.printStackTrace();
-            }
-        } finally { // close the resource
-            if (jf != null) {
-                jf.close();
-            }
-        }
-
-        System.exit(1);
-    }
-
-    private static MessageFormat validityTimeForm = null;
-    private static MessageFormat notYetTimeForm = null;
-    private static MessageFormat expiredTimeForm = null;
-    private static MessageFormat expiringTimeForm = null;
-
-    /*
-     * Display some details about a certificate:
-     *
-     * [<tab>] <cert-type> [", " <subject-DN>] [" (" <keystore-entry-alias> ")"]
-     * [<validity-period> | <expiry-warning>]
-     *
-     * Note: no newline character at the end
-     */
-    String printCert(String tab, Certificate c, boolean checkValidityPeriod,
-        Date timestamp, boolean checkUsage) {
-
-        StringBuilder certStr = new StringBuilder();
-        String space = rb.getString("SPACE");
-        X509Certificate x509Cert = null;
-
-        if (c instanceof X509Certificate) {
-            x509Cert = (X509Certificate) c;
-            certStr.append(tab).append(x509Cert.getType())
-                .append(rb.getString("COMMA"))
-                .append(x509Cert.getSubjectDN().getName());
-        } else {
-            certStr.append(tab).append(c.getType());
-        }
-
-        String alias = storeHash.get(c);
-        if (alias != null) {
-            certStr.append(space).append(alias);
-        }
-
-        if (checkValidityPeriod && x509Cert != null) {
-
-            certStr.append("\n").append(tab).append("[");
-            Date notAfter = x509Cert.getNotAfter();
-            try {
-                boolean printValidity = true;
-                if (timestamp == null) {
-                    if (expireDate.getTime() == 0 || expireDate.after(notAfter)) {
-                        expireDate = notAfter;
-                    }
-                    x509Cert.checkValidity();
-                    // test if cert will expire within six months
-                    if (notAfter.getTime() < System.currentTimeMillis() + SIX_MONTHS) {
-                        hasExpiringCert = true;
-                        if (expiringTimeForm == null) {
-                            expiringTimeForm = new MessageFormat(
-                                rb.getString("certificate.will.expire.on"));
-                        }
-                        Object[] source = { notAfter };
-                        certStr.append(expiringTimeForm.format(source));
-                        printValidity = false;
-                    }
-                } else {
-                    x509Cert.checkValidity(timestamp);
-                }
-                if (printValidity) {
-                    if (validityTimeForm == null) {
-                        validityTimeForm = new MessageFormat(
-                            rb.getString("certificate.is.valid.from"));
-                    }
-                    Object[] source = { x509Cert.getNotBefore(), notAfter };
-                    certStr.append(validityTimeForm.format(source));
-                }
-            } catch (CertificateExpiredException cee) {
-                hasExpiredCert = true;
-
-                if (expiredTimeForm == null) {
-                    expiredTimeForm = new MessageFormat(
-                        rb.getString("certificate.expired.on"));
-                }
-                Object[] source = { notAfter };
-                certStr.append(expiredTimeForm.format(source));
-
-            } catch (CertificateNotYetValidException cnyve) {
-                notYetValidCert = true;
-
-                if (notYetTimeForm == null) {
-                    notYetTimeForm = new MessageFormat(
-                        rb.getString("certificate.is.not.valid.until"));
-                }
-                Object[] source = { x509Cert.getNotBefore() };
-                certStr.append(notYetTimeForm.format(source));
-            }
-            certStr.append("]");
-
-            if (checkUsage) {
-                boolean[] bad = new boolean[3];
-                checkCertUsage(x509Cert, bad);
-                if (bad[0] || bad[1] || bad[2]) {
-                    String x = "";
-                    if (bad[0]) {
-                        x ="KeyUsage";
-                    }
-                    if (bad[1]) {
-                        if (x.length() > 0) x = x + ", ";
-                        x = x + "ExtendedKeyUsage";
-                    }
-                    if (bad[2]) {
-                        if (x.length() > 0) x = x + ", ";
-                        x = x + "NetscapeCertType";
-                    }
-                    certStr.append("\n").append(tab)
-                        .append(MessageFormat.format(rb.getString(
-                        ".{0}.extension.does.not.support.code.signing."), x));
-                }
-            }
-        }
-        return certStr.toString();
-    }
-
-    private static MessageFormat signTimeForm = null;
-
-    private String printTimestamp(String tab, Timestamp timestamp) {
-
-        if (signTimeForm == null) {
-            signTimeForm =
-                new MessageFormat(rb.getString("entry.was.signed.on"));
-        }
-        Object[] source = { timestamp.getTimestamp() };
-
-        return new StringBuilder().append(tab).append("[")
-            .append(signTimeForm.format(source)).append("]").toString();
-    }
-
-    private Map<CodeSigner,Integer> cacheForInKS = new IdentityHashMap<>();
-
-    private int inKeyStoreForOneSigner(CodeSigner signer) {
-        if (cacheForInKS.containsKey(signer)) {
-            return cacheForInKS.get(signer);
-        }
-
-        boolean found = false;
-        int result = 0;
-        List<? extends Certificate> certs = signer.getSignerCertPath().getCertificates();
-        for (Certificate c : certs) {
-            String alias = storeHash.get(c);
-            if (alias != null) {
-                if (alias.startsWith("(")) {
-                    result |= IN_KEYSTORE;
-                } else if (alias.startsWith("[")) {
-                    result |= IN_SCOPE;
-                }
-                if (ckaliases.contains(alias.substring(1, alias.length() - 1))) {
-                    result |= SIGNED_BY_ALIAS;
-                }
-            } else {
-                if (store != null) {
-                    try {
-                        alias = store.getCertificateAlias(c);
-                    } catch (KeyStoreException kse) {
-                        // never happens, because keystore has been loaded
-                    }
-                    if (alias != null) {
-                        storeHash.put(c, "(" + alias + ")");
-                        found = true;
-                        result |= IN_KEYSTORE;
-                    }
-                }
-                if (ckaliases.contains(alias)) {
-                    result |= SIGNED_BY_ALIAS;
-                }
-            }
-        }
-        cacheForInKS.put(signer, result);
-        return result;
-    }
-
-    Hashtable<Certificate, String> storeHash = new Hashtable<>();
-
-    int inKeyStore(CodeSigner[] signers) {
-
-        if (signers == null)
-            return 0;
-
-        int output = 0;
-
-        for (CodeSigner signer: signers) {
-            int result = inKeyStoreForOneSigner(signer);
-            output |= result;
-        }
-        if (ckaliases.size() > 0 && (output & SIGNED_BY_ALIAS) == 0) {
-            output |= NOT_ALIAS;
-        }
-        return output;
-    }
-
-    void signJar(String jarName, String alias, String[] args)
-        throws Exception {
-        boolean aliasUsed = false;
-        X509Certificate tsaCert = null;
-
-        if (sigfile == null) {
-            sigfile = alias;
-            aliasUsed = true;
-        }
-
-        if (sigfile.length() > 8) {
-            sigfile = sigfile.substring(0, 8).toUpperCase(Locale.ENGLISH);
-        } else {
-            sigfile = sigfile.toUpperCase(Locale.ENGLISH);
-        }
-
-        StringBuilder tmpSigFile = new StringBuilder(sigfile.length());
-        for (int j = 0; j < sigfile.length(); j++) {
-            char c = sigfile.charAt(j);
-            if (!
-                ((c>= 'A' && c<= 'Z') ||
-                (c>= '0' && c<= '9') ||
-                (c == '-') ||
-                (c == '_'))) {
-                if (aliasUsed) {
-                    // convert illegal characters from the alias to be _'s
-                    c = '_';
-                } else {
-                 throw new
-                   RuntimeException(rb.getString
-                        ("signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or."));
-                }
-            }
-            tmpSigFile.append(c);
-        }
-
-        sigfile = tmpSigFile.toString();
-
-        String tmpJarName;
-        if (signedjar == null) tmpJarName = jarName+".sig";
-        else tmpJarName = signedjar;
-
-        File jarFile = new File(jarName);
-        File signedJarFile = new File(tmpJarName);
-
-        // Open the jar (zip) file
-        try {
-            zipFile = new ZipFile(jarName);
-        } catch (IOException ioe) {
-            error(rb.getString("unable.to.open.jar.file.")+jarName, ioe);
-        }
-
-        FileOutputStream fos = null;
-        try {
-            fos = new FileOutputStream(signedJarFile);
-        } catch (IOException ioe) {
-            error(rb.getString("unable.to.create.")+tmpJarName, ioe);
-        }
-
-        PrintStream ps = new PrintStream(fos);
-        ZipOutputStream zos = new ZipOutputStream(ps);
-
-        /* First guess at what they might be - we don't xclude RSA ones. */
-        String sfFilename = (META_INF + sigfile + ".SF").toUpperCase(Locale.ENGLISH);
-        String bkFilename = (META_INF + sigfile + ".DSA").toUpperCase(Locale.ENGLISH);
-
-        Manifest manifest = new Manifest();
-        Map<String,Attributes> mfEntries = manifest.getEntries();
-
-        // The Attributes of manifest before updating
-        Attributes oldAttr = null;
-
-        boolean mfModified = false;
-        boolean mfCreated = false;
-        byte[] mfRawBytes = null;
-
-        try {
-            MessageDigest digests[] = { MessageDigest.getInstance(digestalg) };
-
-            // Check if manifest exists
-            ZipEntry mfFile;
-            if ((mfFile = getManifestFile(zipFile)) != null) {
-                // Manifest exists. Read its raw bytes.
-                mfRawBytes = getBytes(zipFile, mfFile);
-                manifest.read(new ByteArrayInputStream(mfRawBytes));
-                oldAttr = (Attributes)(manifest.getMainAttributes().clone());
-            } else {
-                // Create new manifest
-                Attributes mattr = manifest.getMainAttributes();
-                mattr.putValue(Attributes.Name.MANIFEST_VERSION.toString(),
-                               "1.0");
-                String javaVendor = System.getProperty("java.vendor");
-                String jdkVersion = System.getProperty("java.version");
-                mattr.putValue("Created-By", jdkVersion + " (" +javaVendor
-                               + ")");
-                mfFile = new ZipEntry(JarFile.MANIFEST_NAME);
-                mfCreated = true;
-            }
-
-            /*
-             * For each entry in jar
-             * (except for signature-related META-INF entries),
-             * do the following:
-             *
-             * - if entry is not contained in manifest, add it to manifest;
-             * - if entry is contained in manifest, calculate its hash and
-             *   compare it with the one in the manifest; if they are
-             *   different, replace the hash in the manifest with the newly
-             *   generated one. (This may invalidate existing signatures!)
-             */
-            Vector<ZipEntry> mfFiles = new Vector<>();
-
-            boolean wasSigned = false;
-
-            for (Enumeration<? extends ZipEntry> enum_=zipFile.entries();
-                        enum_.hasMoreElements();) {
-                ZipEntry ze = enum_.nextElement();
-
-                if (ze.getName().startsWith(META_INF)) {
-                    // Store META-INF files in vector, so they can be written
-                    // out first
-                    mfFiles.addElement(ze);
-
-                    if (SignatureFileVerifier.isBlockOrSF(
-                            ze.getName().toUpperCase(Locale.ENGLISH))) {
-                        wasSigned = true;
-                    }
-
-                    if (signatureRelated(ze.getName())) {
-                        // ignore signature-related and manifest files
-                        continue;
-                    }
-                }
-
-                if (manifest.getAttributes(ze.getName()) != null) {
-                    // jar entry is contained in manifest, check and
-                    // possibly update its digest attributes
-                    if (updateDigests(ze, zipFile, digests,
-                                      manifest) == true) {
-                        mfModified = true;
-                    }
-                } else if (!ze.isDirectory()) {
-                    // Add entry to manifest
-                    Attributes attrs = getDigestAttributes(ze, zipFile,
-                                                           digests);
-                    mfEntries.put(ze.getName(), attrs);
-                    mfModified = true;
-                }
-            }
-
-            // Recalculate the manifest raw bytes if necessary
-            if (mfModified) {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                manifest.write(baos);
-                if (wasSigned) {
-                    byte[] newBytes = baos.toByteArray();
-                    if (mfRawBytes != null
-                            && oldAttr.equals(manifest.getMainAttributes())) {
-
-                        /*
-                         * Note:
-                         *
-                         * The Attributes object is based on HashMap and can handle
-                         * continuation columns. Therefore, even if the contents are
-                         * not changed (in a Map view), the bytes that it write()
-                         * may be different from the original bytes that it read()
-                         * from. Since the signature on the main attributes is based
-                         * on raw bytes, we must retain the exact bytes.
-                         */
-
-                        int newPos = findHeaderEnd(newBytes);
-                        int oldPos = findHeaderEnd(mfRawBytes);
-
-                        if (newPos == oldPos) {
-                            System.arraycopy(mfRawBytes, 0, newBytes, 0, oldPos);
-                        } else {
-                            // cat oldHead newTail > newBytes
-                            byte[] lastBytes = new byte[oldPos +
-                                    newBytes.length - newPos];
-                            System.arraycopy(mfRawBytes, 0, lastBytes, 0, oldPos);
-                            System.arraycopy(newBytes, newPos, lastBytes, oldPos,
-                                    newBytes.length - newPos);
-                            newBytes = lastBytes;
-                        }
-                    }
-                    mfRawBytes = newBytes;
-                } else {
-                    mfRawBytes = baos.toByteArray();
-                }
-            }
-
-            // Write out the manifest
-            if (mfModified) {
-                // manifest file has new length
-                mfFile = new ZipEntry(JarFile.MANIFEST_NAME);
-            }
-            if (verbose != null) {
-                if (mfCreated) {
-                    System.out.println(rb.getString(".adding.") +
-                                        mfFile.getName());
-                } else if (mfModified) {
-                    System.out.println(rb.getString(".updating.") +
-                                        mfFile.getName());
-                }
-            }
-            zos.putNextEntry(mfFile);
-            zos.write(mfRawBytes);
-
-            // Calculate SignatureFile (".SF") and SignatureBlockFile
-            ManifestDigester manDig = new ManifestDigester(mfRawBytes);
-            SignatureFile sf = new SignatureFile(digests, manifest, manDig,
-                                                 sigfile, signManifest);
-
-            if (tsaAlias != null) {
-                tsaCert = getTsaCert(tsaAlias);
-            }
-
-            if (tsaUrl == null && tsaCert == null) {
-                noTimestamp = true;
-            }
-
-            SignatureFile.Block block = null;
-
-            try {
-                block =
-                    sf.generateBlock(privateKey, sigalg, certChain,
-                        externalSF, tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg,
-                        signingMechanism, args, zipFile);
-            } catch (SocketTimeoutException e) {
-                // Provide a helpful message when TSA is beyond a firewall
-                error(rb.getString("unable.to.sign.jar.") +
-                rb.getString("no.response.from.the.Timestamping.Authority.") +
-                "\n  -J-Dhttp.proxyHost=<hostname>" +
-                "\n  -J-Dhttp.proxyPort=<portnumber>\n" +
-                rb.getString("or") +
-                "\n  -J-Dhttps.proxyHost=<hostname> " +
-                "\n  -J-Dhttps.proxyPort=<portnumber> ", e);
-            }
-
-            sfFilename = sf.getMetaName();
-            bkFilename = block.getMetaName();
-
-            ZipEntry sfFile = new ZipEntry(sfFilename);
-            ZipEntry bkFile = new ZipEntry(bkFilename);
-
-            long time = System.currentTimeMillis();
-            sfFile.setTime(time);
-            bkFile.setTime(time);
-
-            // signature file
-            zos.putNextEntry(sfFile);
-            sf.write(zos);
-            if (verbose != null) {
-                if (zipFile.getEntry(sfFilename) != null) {
-                    System.out.println(rb.getString(".updating.") +
-                                sfFilename);
-                } else {
-                    System.out.println(rb.getString(".adding.") +
-                                sfFilename);
-                }
-            }
-
-            if (verbose != null) {
-                if (tsaUrl != null || tsaCert != null) {
-                    System.out.println(
-                        rb.getString("requesting.a.signature.timestamp"));
-                }
-                if (tsaUrl != null) {
-                    System.out.println(rb.getString("TSA.location.") + tsaUrl);
-                }
-                if (tsaCert != null) {
-                    URI tsaURI = TimestampedSigner.getTimestampingURI(tsaCert);
-                    if (tsaURI != null) {
-                        System.out.println(rb.getString("TSA.location.") +
-                            tsaURI);
-                    }
-                    System.out.println(rb.getString("TSA.certificate.") +
-                        printCert("", tsaCert, false, null, false));
-                }
-                if (signingMechanism != null) {
-                    System.out.println(
-                        rb.getString("using.an.alternative.signing.mechanism"));
-                }
-            }
-
-            // signature block file
-            zos.putNextEntry(bkFile);
-            block.write(zos);
-            if (verbose != null) {
-                if (zipFile.getEntry(bkFilename) != null) {
-                    System.out.println(rb.getString(".updating.") +
-                        bkFilename);
-                } else {
-                    System.out.println(rb.getString(".adding.") +
-                        bkFilename);
-                }
-            }
-
-            // Write out all other META-INF files that we stored in the
-            // vector
-            for (int i=0; i<mfFiles.size(); i++) {
-                ZipEntry ze = mfFiles.elementAt(i);
-                if (!ze.getName().equalsIgnoreCase(JarFile.MANIFEST_NAME)
-                    && !ze.getName().equalsIgnoreCase(sfFilename)
-                    && !ze.getName().equalsIgnoreCase(bkFilename)) {
-                    writeEntry(zipFile, zos, ze);
-                }
-            }
-
-            // Write out all other files
-            for (Enumeration<? extends ZipEntry> enum_=zipFile.entries();
-                        enum_.hasMoreElements();) {
-                ZipEntry ze = enum_.nextElement();
-
-                if (!ze.getName().startsWith(META_INF)) {
-                    if (verbose != null) {
-                        if (manifest.getAttributes(ze.getName()) != null)
-                          System.out.println(rb.getString(".signing.") +
-                                ze.getName());
-                        else
-                          System.out.println(rb.getString(".adding.") +
-                                ze.getName());
-                    }
-                    writeEntry(zipFile, zos, ze);
-                }
-            }
-        } catch(IOException ioe) {
-            error(rb.getString("unable.to.sign.jar.")+ioe, ioe);
-        } finally {
-            // close the resouces
-            if (zipFile != null) {
-                zipFile.close();
-                zipFile = null;
-            }
-
-            if (zos != null) {
-                zos.close();
-            }
-        }
-
-        // no IOException thrown in the follow try clause, so disable
-        // the try clause.
-        // try {
-            if (signedjar == null) {
-                // attempt an atomic rename. If that fails,
-                // rename the original jar file, then the signed
-                // one, then delete the original.
-                if (!signedJarFile.renameTo(jarFile)) {
-                    File origJar = new File(jarName+".orig");
-
-                    if (jarFile.renameTo(origJar)) {
-                        if (signedJarFile.renameTo(jarFile)) {
-                            origJar.delete();
-                        } else {
-                            MessageFormat form = new MessageFormat(rb.getString
-                        ("attempt.to.rename.signedJarFile.to.jarFile.failed"));
-                            Object[] source = {signedJarFile, jarFile};
-                            error(form.format(source));
-                        }
-                    } else {
-                        MessageFormat form = new MessageFormat(rb.getString
-                            ("attempt.to.rename.jarFile.to.origJar.failed"));
-                        Object[] source = {jarFile, origJar};
-                        error(form.format(source));
-                    }
-                }
-            }
-
-            boolean warningAppeared = false;
-            if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
-                    notYetValidCert || chainNotValidated || hasExpiredCert) {
-                if (strict) {
-                    System.out.println(rb.getString("jar.signed.with.signer.errors."));
-                    System.out.println();
-                    System.out.println(rb.getString("Error."));
-                } else {
-                    System.out.println(rb.getString("jar.signed."));
-                    System.out.println();
-                    System.out.println(rb.getString("Warning."));
-                    warningAppeared = true;
-                }
-
-                if (badKeyUsage) {
-                    System.out.println(
-                        rb.getString("The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
-                }
-
-                if (badExtendedKeyUsage) {
-                    System.out.println(
-                        rb.getString("The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
-                }
-
-                if (badNetscapeCertType) {
-                    System.out.println(
-                        rb.getString("The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
-                }
-
-                if (hasExpiredCert) {
-                    System.out.println(
-                        rb.getString("The.signer.certificate.has.expired."));
-                } else if (notYetValidCert) {
-                    System.out.println(
-                        rb.getString("The.signer.certificate.is.not.yet.valid."));
-                }
-
-                if (chainNotValidated) {
-                    System.out.println(
-                            rb.getString("The.signer.s.certificate.chain.is.not.validated."));
-                }
-            } else {
-                System.out.println(rb.getString("jar.signed."));
-            }
-            if (hasExpiringCert || noTimestamp) {
-                if (!warningAppeared) {
-                    System.out.println();
-                    System.out.println(rb.getString("Warning."));
-                }
-
-                if (hasExpiringCert) {
-                    System.out.println(
-                            rb.getString("The.signer.certificate.will.expire.within.six.months."));
-                }
-
-                if (noTimestamp) {
-                    System.out.println(
-                            String.format(rb.getString("no.timestamp.signing"), expireDate));
-                }
-            }
-
-        // no IOException thrown in the above try clause, so disable
-        // the catch clause.
-        // } catch(IOException ioe) {
-        //     error(rb.getString("unable.to.sign.jar.")+ioe, ioe);
-        // }
-    }
-
-    /**
-     * Find the length of header inside bs. The header is a multiple (>=0)
-     * lines of attributes plus an empty line. The empty line is included
-     * in the header.
-     */
-    @SuppressWarnings("fallthrough")
-    private int findHeaderEnd(byte[] bs) {
-        // Initial state true to deal with empty header
-        boolean newline = true;     // just met a newline
-        int len = bs.length;
-        for (int i=0; i<len; i++) {
-            switch (bs[i]) {
-                case '\r':
-                    if (i < len - 1 && bs[i+1] == '\n') i++;
-                    // fallthrough
-                case '\n':
-                    if (newline) return i+1;    //+1 to get length
-                    newline = true;
-                    break;
-                default:
-                    newline = false;
-            }
-        }
-        // If header end is not found, it means the MANIFEST.MF has only
-        // the main attributes section and it does not end with 2 newlines.
-        // Returns the whole length so that it can be completely replaced.
-        return len;
-    }
-
-    /**
-     * signature-related files include:
-     * . META-INF/MANIFEST.MF
-     * . META-INF/SIG-*
-     * . META-INF/*.SF
-     * . META-INF/*.DSA
-     * . META-INF/*.RSA
-     * . META-INF/*.EC
-     */
-    private boolean signatureRelated(String name) {
-        return SignatureFileVerifier.isSigningRelated(name);
-    }
-
-    Map<CodeSigner,String> cacheForSignerInfo = new IdentityHashMap<>();
-
-    /**
-     * Returns a string of singer info, with a newline at the end
-     */
-    private String signerInfo(CodeSigner signer, String tab) {
-        if (cacheForSignerInfo.containsKey(signer)) {
-            return cacheForSignerInfo.get(signer);
-        }
-        StringBuilder sb = new StringBuilder();
-        List<? extends Certificate> certs = signer.getSignerCertPath().getCertificates();
-        // display the signature timestamp, if present
-        Date timestamp;
-        Timestamp ts = signer.getTimestamp();
-        if (ts != null) {
-            sb.append(printTimestamp(tab, ts));
-            sb.append('\n');
-            timestamp = ts.getTimestamp();
-        } else {
-            timestamp = null;
-            noTimestamp = true;
-        }
-        // display the certificate(sb). The first one is end-entity cert and
-        // its KeyUsage should be checked.
-        boolean first = true;
-        for (Certificate c : certs) {
-            sb.append(printCert(tab, c, true, timestamp, first));
-            sb.append('\n');
-            first = false;
-        }
-        try {
-            validateCertChain(certs);
-        } catch (Exception e) {
-            if (debug) {
-                e.printStackTrace();
-            }
-            if (e.getCause() != null &&
-                    (e.getCause() instanceof CertificateExpiredException ||
-                     e.getCause() instanceof CertificateNotYetValidException)) {
-                // No more warning, we alreay have hasExpiredCert or notYetValidCert
-            } else {
-                chainNotValidated = true;
-                sb.append(tab).append(rb.getString(".CertPath.not.validated."))
-                        .append(e.getLocalizedMessage()).append("]\n"); // TODO
-            }
-        }
-        String result = sb.toString();
-        cacheForSignerInfo.put(signer, result);
-        return result;
-    }
-
-    private void writeEntry(ZipFile zf, ZipOutputStream os, ZipEntry ze)
-    throws IOException
-    {
-        ZipEntry ze2 = new ZipEntry(ze.getName());
-        ze2.setMethod(ze.getMethod());
-        ze2.setTime(ze.getTime());
-        ze2.setComment(ze.getComment());
-        ze2.setExtra(ze.getExtra());
-        if (ze.getMethod() == ZipEntry.STORED) {
-            ze2.setSize(ze.getSize());
-            ze2.setCrc(ze.getCrc());
-        }
-        os.putNextEntry(ze2);
-        writeBytes(zf, ze, os);
-    }
-
-    /**
-     * Writes all the bytes for a given entry to the specified output stream.
-     */
-    private synchronized void writeBytes
-        (ZipFile zf, ZipEntry ze, ZipOutputStream os) throws IOException {
-        int n;
-
-        InputStream is = null;
-        try {
-            is = zf.getInputStream(ze);
-            long left = ze.getSize();
-
-            while((left > 0) && (n = is.read(buffer, 0, buffer.length)) != -1) {
-                os.write(buffer, 0, n);
-                left -= n;
-            }
-        } finally {
-            if (is != null) {
-                is.close();
-            }
-        }
-    }
-
-    void loadKeyStore(String keyStoreName, boolean prompt) {
-
-        if (!nullStream && keyStoreName == null) {
-            keyStoreName = System.getProperty("user.home") + File.separator
-                + ".keystore";
-        }
-
-        try {
-
-            certificateFactory = CertificateFactory.getInstance("X.509");
-            validator = CertPathValidator.getInstance("PKIX");
-            Set<TrustAnchor> tas = new HashSet<>();
-            try {
-                KeyStore caks = KeyStoreUtil.getCacertsKeyStore();
-                if (caks != null) {
-                    Enumeration<String> aliases = caks.aliases();
-                    while (aliases.hasMoreElements()) {
-                        String a = aliases.nextElement();
-                        try {
-                            tas.add(new TrustAnchor((X509Certificate)caks.getCertificate(a), null));
-                        } catch (Exception e2) {
-                            // ignore, when a SecretkeyEntry does not include a cert
-                        }
-                    }
-                }
-            } catch (Exception e) {
-                // Ignore, if cacerts cannot be loaded
-            }
-
-            if (providerName == null) {
-                store = KeyStore.getInstance(storetype);
-            } else {
-                store = KeyStore.getInstance(storetype, providerName);
-            }
-
-            // Get pass phrase
-            // XXX need to disable echo; on UNIX, call getpass(char *prompt)Z
-            // and on NT call ??
-            if (token && storepass == null && !protectedPath
-                    && !KeyStoreUtil.isWindowsKeyStore(storetype)) {
-                storepass = getPass
-                        (rb.getString("Enter.Passphrase.for.keystore."));
-            } else if (!token && storepass == null && prompt) {
-                storepass = getPass
-                        (rb.getString("Enter.Passphrase.for.keystore."));
-            }
-
-            try {
-                if (nullStream) {
-                    store.load(null, storepass);
-                } else {
-                    keyStoreName = keyStoreName.replace(File.separatorChar, '/');
-                    URL url = null;
-                    try {
-                        url = new URL(keyStoreName);
-                    } catch (java.net.MalformedURLException e) {
-                        // try as file
-                        url = new File(keyStoreName).toURI().toURL();
-                    }
-                    InputStream is = null;
-                    try {
-                        is = url.openStream();
-                        store.load(is, storepass);
-                    } finally {
-                        if (is != null) {
-                            is.close();
-                        }
-                    }
-                }
-                Enumeration<String> aliases = store.aliases();
-                while (aliases.hasMoreElements()) {
-                    String a = aliases.nextElement();
-                    try {
-                        X509Certificate c = (X509Certificate)store.getCertificate(a);
-                        // Only add TrustedCertificateEntry and self-signed
-                        // PrivateKeyEntry
-                        if (store.isCertificateEntry(a) ||
-                                c.getSubjectDN().equals(c.getIssuerDN())) {
-                            tas.add(new TrustAnchor(c, null));
-                        }
-                    } catch (Exception e2) {
-                        // ignore, when a SecretkeyEntry does not include a cert
-                    }
-                }
-            } finally {
-                try {
-                    pkixParameters = new PKIXParameters(tas);
-                    pkixParameters.setRevocationEnabled(false);
-                } catch (InvalidAlgorithmParameterException ex) {
-                    // Only if tas is empty
-                }
-            }
-        } catch (IOException ioe) {
-            throw new RuntimeException(rb.getString("keystore.load.") +
-                                        ioe.getMessage());
-        } catch (java.security.cert.CertificateException ce) {
-            throw new RuntimeException(rb.getString("certificate.exception.") +
-                                        ce.getMessage());
-        } catch (NoSuchProviderException pe) {
-            throw new RuntimeException(rb.getString("keystore.load.") +
-                                        pe.getMessage());
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new RuntimeException(rb.getString("keystore.load.") +
-                                        nsae.getMessage());
-        } catch (KeyStoreException kse) {
-            throw new RuntimeException
-                (rb.getString("unable.to.instantiate.keystore.class.") +
-                kse.getMessage());
-        }
-    }
-
-    X509Certificate getTsaCert(String alias) {
-
-        java.security.cert.Certificate cs = null;
-
-        try {
-            cs = store.getCertificate(alias);
-        } catch (KeyStoreException kse) {
-            // this never happens, because keystore has been loaded
-        }
-        if (cs == null || (!(cs instanceof X509Certificate))) {
-            MessageFormat form = new MessageFormat(rb.getString
-                ("Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the"));
-            Object[] source = {alias, alias};
-            error(form.format(source));
-        }
-        return (X509Certificate) cs;
-    }
-
-    /**
-     * Check if userCert is designed to be a code signer
-     * @param userCert the certificate to be examined
-     * @param bad 3 booleans to show if the KeyUsage, ExtendedKeyUsage,
-     *            NetscapeCertType has codeSigning flag turned on.
-     *            If null, the class field badKeyUsage, badExtendedKeyUsage,
-     *            badNetscapeCertType will be set.
-     */
-    void checkCertUsage(X509Certificate userCert, boolean[] bad) {
-
-        // Can act as a signer?
-        // 1. if KeyUsage, then [0:digitalSignature] or
-        //    [1:nonRepudiation] should be true
-        // 2. if ExtendedKeyUsage, then should contains ANY or CODE_SIGNING
-        // 3. if NetscapeCertType, then should contains OBJECT_SIGNING
-        // 1,2,3 must be true
-
-        if (bad != null) {
-            bad[0] = bad[1] = bad[2] = false;
-        }
-
-        boolean[] keyUsage = userCert.getKeyUsage();
-        if (keyUsage != null) {
-            keyUsage = Arrays.copyOf(keyUsage, 9);
-            if (!keyUsage[0] && !keyUsage[1]) {
-                if (bad != null) {
-                    bad[0] = true;
-                    badKeyUsage = true;
-                }
-            }
-        }
-
-        try {
-            List<String> xKeyUsage = userCert.getExtendedKeyUsage();
-            if (xKeyUsage != null) {
-                if (!xKeyUsage.contains("2.5.29.37.0") // anyExtendedKeyUsage
-                        && !xKeyUsage.contains("1.3.6.1.5.5.7.3.3")) {  // codeSigning
-                    if (bad != null) {
-                        bad[1] = true;
-                        badExtendedKeyUsage = true;
-                    }
-                }
-            }
-        } catch (java.security.cert.CertificateParsingException e) {
-            // shouldn't happen
-        }
-
-        try {
-            // OID_NETSCAPE_CERT_TYPE
-            byte[] netscapeEx = userCert.getExtensionValue
-                    ("2.16.840.1.113730.1.1");
-            if (netscapeEx != null) {
-                DerInputStream in = new DerInputStream(netscapeEx);
-                byte[] encoded = in.getOctetString();
-                encoded = new DerValue(encoded).getUnalignedBitString()
-                        .toByteArray();
-
-                NetscapeCertTypeExtension extn =
-                        new NetscapeCertTypeExtension(encoded);
-
-                Boolean val = extn.get(NetscapeCertTypeExtension.OBJECT_SIGNING);
-                if (!val) {
-                    if (bad != null) {
-                        bad[2] = true;
-                        badNetscapeCertType = true;
-                    }
-                }
-            }
-        } catch (IOException e) {
-            //
-        }
-    }
-
-    void getAliasInfo(String alias) {
-
-        Key key = null;
-
-        try {
-            java.security.cert.Certificate[] cs = null;
-            if (altCertChain != null) {
-                try (FileInputStream fis = new FileInputStream(altCertChain)) {
-                    cs = CertificateFactory.getInstance("X.509").
-                            generateCertificates(fis).
-                            toArray(new Certificate[0]);
-                } catch (FileNotFoundException ex) {
-                    error(rb.getString("File.specified.by.certchain.does.not.exist"));
-                } catch (CertificateException | IOException ex) {
-                    error(rb.getString("Cannot.restore.certchain.from.file.specified"));
-                }
-            } else {
-                try {
-                    cs = store.getCertificateChain(alias);
-                } catch (KeyStoreException kse) {
-                    // this never happens, because keystore has been loaded
-                }
-            }
-            if (cs == null || cs.length == 0) {
-                if (altCertChain != null) {
-                    error(rb.getString
-                            ("Certificate.chain.not.found.in.the.file.specified."));
-                } else {
-                    MessageFormat form = new MessageFormat(rb.getString
-                        ("Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and"));
-                    Object[] source = {alias, alias};
-                    error(form.format(source));
-                }
-            }
-
-            certChain = new X509Certificate[cs.length];
-            for (int i=0; i<cs.length; i++) {
-                if (!(cs[i] instanceof X509Certificate)) {
-                    error(rb.getString
-                        ("found.non.X.509.certificate.in.signer.s.chain"));
-                }
-                certChain[i] = (X509Certificate)cs[i];
-            }
-
-            // We don't meant to print anything, the next call
-            // checks validity and keyUsage etc
-            printCert("", certChain[0], true, null, true);
-
-            try {
-                validateCertChain(Arrays.asList(certChain));
-            } catch (Exception e) {
-                if (debug) {
-                    e.printStackTrace();
-                }
-                if (e.getCause() != null &&
-                        (e.getCause() instanceof CertificateExpiredException ||
-                        e.getCause() instanceof CertificateNotYetValidException)) {
-                    // No more warning, we alreay have hasExpiredCert or notYetValidCert
-                } else {
-                    chainNotValidated = true;
-                }
-            }
-
-            try {
-                if (!token && keypass == null)
-                    key = store.getKey(alias, storepass);
-                else
-                    key = store.getKey(alias, keypass);
-            } catch (UnrecoverableKeyException e) {
-                if (token) {
-                    throw e;
-                } else if (keypass == null) {
-                    // Did not work out, so prompt user for key password
-                    MessageFormat form = new MessageFormat(rb.getString
-                        ("Enter.key.password.for.alias."));
-                    Object[] source = {alias};
-                    keypass = getPass(form.format(source));
-                    key = store.getKey(alias, keypass);
-                }
-            }
-        } catch (NoSuchAlgorithmException e) {
-            error(e.getMessage());
-        } catch (UnrecoverableKeyException e) {
-            error(rb.getString("unable.to.recover.key.from.keystore"));
-        } catch (KeyStoreException kse) {
-            // this never happens, because keystore has been loaded
-        }
-
-        if (!(key instanceof PrivateKey)) {
-            MessageFormat form = new MessageFormat(rb.getString
-                ("key.associated.with.alias.not.a.private.key"));
-            Object[] source = {alias};
-            error(form.format(source));
-        } else {
-            privateKey = (PrivateKey)key;
-        }
-    }
-
-    void error(String message)
-    {
-        System.out.println(rb.getString("jarsigner.")+message);
-        System.exit(1);
-    }
-
-
-    void error(String message, Exception e)
-    {
-        System.out.println(rb.getString("jarsigner.")+message);
-        if (debug) {
-            e.printStackTrace();
-        }
-        System.exit(1);
-    }
-
-    void validateCertChain(List<? extends Certificate> certs) throws Exception {
-        int cpLen = 0;
-        out: for (; cpLen<certs.size(); cpLen++) {
-            for (TrustAnchor ta: pkixParameters.getTrustAnchors()) {
-                if (ta.getTrustedCert().equals(certs.get(cpLen))) {
-                    break out;
-                }
-            }
-        }
-        if (cpLen > 0) {
-            CertPath cp = certificateFactory.generateCertPath(
-                    (cpLen == certs.size())? certs: certs.subList(0, cpLen));
-            validator.validate(cp, pkixParameters);
-        }
-    }
-
-    char[] getPass(String prompt)
-    {
-        System.err.print(prompt);
-        System.err.flush();
-        try {
-            char[] pass = Password.readPassword(System.in);
-
-            if (pass == null) {
-                error(rb.getString("you.must.enter.key.password"));
-            } else {
-                return pass;
-            }
-        } catch (IOException ioe) {
-            error(rb.getString("unable.to.read.password.")+ioe.getMessage());
-        }
-        // this shouldn't happen
-        return null;
-    }
-
-    /*
-     * Reads all the bytes for a given zip entry.
-     */
-    private synchronized byte[] getBytes(ZipFile zf,
-                                         ZipEntry ze) throws IOException {
-        int n;
-
-        InputStream is = null;
-        try {
-            is = zf.getInputStream(ze);
-            baos.reset();
-            long left = ze.getSize();
-
-            while((left > 0) && (n = is.read(buffer, 0, buffer.length)) != -1) {
-                baos.write(buffer, 0, n);
-                left -= n;
-            }
-        } finally {
-            if (is != null) {
-                is.close();
-            }
-        }
-
-        return baos.toByteArray();
-    }
-
-    /*
-     * Returns manifest entry from given jar file, or null if given jar file
-     * does not have a manifest entry.
-     */
-    private ZipEntry getManifestFile(ZipFile zf) {
-        ZipEntry ze = zf.getEntry(JarFile.MANIFEST_NAME);
-        if (ze == null) {
-            // Check all entries for matching name
-            Enumeration<? extends ZipEntry> enum_ = zf.entries();
-            while (enum_.hasMoreElements() && ze == null) {
-                ze = enum_.nextElement();
-                if (!JarFile.MANIFEST_NAME.equalsIgnoreCase
-                    (ze.getName())) {
-                    ze = null;
-                }
-            }
-        }
-        return ze;
-    }
-
-    /*
-     * Computes the digests of a zip entry, and returns them as an array
-     * of base64-encoded strings.
-     */
-    private synchronized String[] getDigests(ZipEntry ze, ZipFile zf,
-                                             MessageDigest[] digests)
-        throws IOException {
-
-        int n, i;
-        InputStream is = null;
-        try {
-            is = zf.getInputStream(ze);
-            long left = ze.getSize();
-            while((left > 0)
-                && (n = is.read(buffer, 0, buffer.length)) != -1) {
-                for (i=0; i<digests.length; i++) {
-                    digests[i].update(buffer, 0, n);
-                }
-                left -= n;
-            }
-        } finally {
-            if (is != null) {
-                is.close();
-            }
-        }
-
-        // complete the digests
-        String[] base64Digests = new String[digests.length];
-        for (i=0; i<digests.length; i++) {
-            base64Digests[i] = Base64.getEncoder().encodeToString(digests[i].digest());
-        }
-        return base64Digests;
-    }
-
-    /*
-     * Computes the digests of a zip entry, and returns them as a list of
-     * attributes
-     */
-    private Attributes getDigestAttributes(ZipEntry ze, ZipFile zf,
-                                           MessageDigest[] digests)
-        throws IOException {
-
-        String[] base64Digests = getDigests(ze, zf, digests);
-        Attributes attrs = new Attributes();
-
-        for (int i=0; i<digests.length; i++) {
-            attrs.putValue(digests[i].getAlgorithm()+"-Digest",
-                           base64Digests[i]);
-        }
-        return attrs;
-    }
-
-    /*
-     * Updates the digest attributes of a manifest entry, by adding or
-     * replacing digest values.
-     * A digest value is added if the manifest entry does not contain a digest
-     * for that particular algorithm.
-     * A digest value is replaced if it is obsolete.
-     *
-     * Returns true if the manifest entry has been changed, and false
-     * otherwise.
-     */
-    private boolean updateDigests(ZipEntry ze, ZipFile zf,
-                                  MessageDigest[] digests,
-                                  Manifest mf) throws IOException {
-        boolean update = false;
-
-        Attributes attrs = mf.getAttributes(ze.getName());
-        String[] base64Digests = getDigests(ze, zf, digests);
-
-        for (int i=0; i<digests.length; i++) {
-            // The entry name to be written into attrs
-            String name = null;
-            try {
-                // Find if the digest already exists
-                AlgorithmId aid = AlgorithmId.get(digests[i].getAlgorithm());
-                for (Object key: attrs.keySet()) {
-                    if (key instanceof Attributes.Name) {
-                        String n = ((Attributes.Name)key).toString();
-                        if (n.toUpperCase(Locale.ENGLISH).endsWith("-DIGEST")) {
-                            String tmp = n.substring(0, n.length() - 7);
-                            if (AlgorithmId.get(tmp).equals(aid)) {
-                                name = n;
-                                break;
-                            }
-                        }
-                    }
-                }
-            } catch (NoSuchAlgorithmException nsae) {
-                // Ignored. Writing new digest entry.
-            }
-
-            if (name == null) {
-                name = digests[i].getAlgorithm()+"-Digest";
-                attrs.putValue(name, base64Digests[i]);
-                update=true;
-            } else {
-                // compare digests, and replace the one in the manifest
-                // if they are different
-                String mfDigest = attrs.getValue(name);
-                if (!mfDigest.equalsIgnoreCase(base64Digests[i])) {
-                    attrs.putValue(name, base64Digests[i]);
-                    update=true;
-                }
-            }
-        }
-        return update;
-    }
-
-    /*
-     * Try to load the specified signing mechanism.
-     * The URL class loader is used.
-     */
-    private ContentSigner loadSigningMechanism(String signerClassName,
-        String signerClassPath) throws Exception {
-
-        // construct class loader
-        String cpString = null;   // make sure env.class.path defaults to dot
-
-        // do prepends to get correct ordering
-        cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
-        cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
-        cpString = PathList.appendPath(signerClassPath, cpString);
-        URL[] urls = PathList.pathToURLs(cpString);
-        ClassLoader appClassLoader = new URLClassLoader(urls);
-
-        // attempt to find signer
-        Class<?> signerClass = appClassLoader.loadClass(signerClassName);
-
-        // Check that it implements ContentSigner
-        Object signer = signerClass.newInstance();
-        if (!(signer instanceof ContentSigner)) {
-            MessageFormat form = new MessageFormat(
-                rb.getString("signerClass.is.not.a.signing.mechanism"));
-            Object[] source = {signerClass.getName()};
-            throw new IllegalArgumentException(form.format(source));
-        }
-        return (ContentSigner)signer;
-    }
-}
-
-class SignatureFile {
-
-    /** SignatureFile */
-    Manifest sf;
-
-    /** .SF base name */
-    String baseName;
-
-    public SignatureFile(MessageDigest digests[],
-                         Manifest mf,
-                         ManifestDigester md,
-                         String baseName,
-                         boolean signManifest)
-
-    {
-        this.baseName = baseName;
-
-        String version = System.getProperty("java.version");
-        String javaVendor = System.getProperty("java.vendor");
-
-        sf = new Manifest();
-        Attributes mattr = sf.getMainAttributes();
-
-        mattr.putValue(Attributes.Name.SIGNATURE_VERSION.toString(), "1.0");
-        mattr.putValue("Created-By", version + " (" + javaVendor + ")");
-
-        if (signManifest) {
-            // sign the whole manifest
-            for (int i=0; i < digests.length; i++) {
-                mattr.putValue(digests[i].getAlgorithm()+"-Digest-Manifest",
-                               Base64.getEncoder().encodeToString(md.manifestDigest(digests[i])));
-            }
-        }
-
-        // create digest of the manifest main attributes
-        ManifestDigester.Entry mde =
-                md.get(ManifestDigester.MF_MAIN_ATTRS, false);
-        if (mde != null) {
-            for (int i=0; i < digests.length; i++) {
-                mattr.putValue(digests[i].getAlgorithm() +
-                        "-Digest-" + ManifestDigester.MF_MAIN_ATTRS,
-                        Base64.getEncoder().encodeToString(mde.digest(digests[i])));
-            }
-        } else {
-            throw new IllegalStateException
-                ("ManifestDigester failed to create " +
-                "Manifest-Main-Attribute entry");
-        }
-
-        /* go through the manifest entries and create the digests */
-
-        Map<String,Attributes> entries = sf.getEntries();
-        Iterator<Map.Entry<String,Attributes>> mit =
-                                mf.getEntries().entrySet().iterator();
-        while(mit.hasNext()) {
-            Map.Entry<String,Attributes> e = mit.next();
-            String name = e.getKey();
-            mde = md.get(name, false);
-            if (mde != null) {
-                Attributes attr = new Attributes();
-                for (int i=0; i < digests.length; i++) {
-                    attr.putValue(digests[i].getAlgorithm()+"-Digest",
-                                  Base64.getEncoder().encodeToString(mde.digest(digests[i])));
-                }
-                entries.put(name, attr);
-            }
-        }
-    }
-
-    /**
-     * Writes the SignatureFile to the specified OutputStream.
-     *
-     * @param out the output stream
-     * @exception IOException if an I/O error has occurred
-     */
-
-    public void write(OutputStream out) throws IOException
-    {
-        sf.write(out);
-    }
-
-    /**
-     * get .SF file name
-     */
-    public String getMetaName()
-    {
-        return "META-INF/"+ baseName + ".SF";
-    }
-
-    /**
-     * get base file name
-     */
-    public String getBaseName()
-    {
-        return baseName;
-    }
-
-    /*
-     * Generate a signed data block.
-     * If a URL or a certificate (containing a URL) for a Timestamping
-     * Authority is supplied then a signature timestamp is generated and
-     * inserted into the signed data block.
-     *
-     * @param sigalg signature algorithm to use, or null to use default
-     * @param tsaUrl The location of the Timestamping Authority. If null
-     *               then no timestamp is requested.
-     * @param tsaCert The certificate for the Timestamping Authority. If null
-     *               then no timestamp is requested.
-     * @param signingMechanism The signing mechanism to use.
-     * @param args The command-line arguments to jarsigner.
-     * @param zipFile The original source Zip file.
-     */
-    public Block generateBlock(PrivateKey privateKey,
-                               String sigalg,
-                               X509Certificate[] certChain,
-                               boolean externalSF, String tsaUrl,
-                               X509Certificate tsaCert,
-                               String tSAPolicyID,
-                               String tSADigestAlg,
-                               ContentSigner signingMechanism,
-                               String[] args, ZipFile zipFile)
-        throws NoSuchAlgorithmException, InvalidKeyException, IOException,
-            SignatureException, CertificateException
-    {
-        return new Block(this, privateKey, sigalg, certChain, externalSF,
-                tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg, signingMechanism, args, zipFile);
-    }
-
-
-    public static class Block {
-
-        private byte[] block;
-        private String blockFileName;
-
-        /*
-         * Construct a new signature block.
-         */
-        Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
-            X509Certificate[] certChain, boolean externalSF, String tsaUrl,
-            X509Certificate tsaCert, String tSAPolicyID, String tSADigestAlg,
-            ContentSigner signingMechanism, String[] args, ZipFile zipFile)
-            throws NoSuchAlgorithmException, InvalidKeyException, IOException,
-            SignatureException, CertificateException {
-
-            Principal issuerName = certChain[0].getIssuerDN();
-            if (!(issuerName instanceof X500Name)) {
-                // must extract the original encoded form of DN for subsequent
-                // name comparison checks (converting to a String and back to
-                // an encoded DN could cause the types of String attribute
-                // values to be changed)
-                X509CertInfo tbsCert = new
-                    X509CertInfo(certChain[0].getTBSCertificate());
-                issuerName = (Principal)
-                    tbsCert.get(X509CertInfo.ISSUER + "." +
-                                X509CertInfo.DN_NAME);
-                }
-            BigInteger serial = certChain[0].getSerialNumber();
-
-            String signatureAlgorithm;
-            String keyAlgorithm = privateKey.getAlgorithm();
-            /*
-             * If no signature algorithm was specified, we choose a
-             * default that is compatible with the private key algorithm.
-             */
-            if (sigalg == null) {
-
-                if (keyAlgorithm.equalsIgnoreCase("DSA"))
-                    signatureAlgorithm = "SHA256withDSA";
-                else if (keyAlgorithm.equalsIgnoreCase("RSA"))
-                    signatureAlgorithm = "SHA256withRSA";
-                else if (keyAlgorithm.equalsIgnoreCase("EC"))
-                    signatureAlgorithm = "SHA256withECDSA";
-                else
-                    throw new RuntimeException("private key is not a DSA or "
-                                               + "RSA key");
-            } else {
-                signatureAlgorithm = sigalg;
-            }
-
-            // check common invalid key/signature algorithm combinations
-            String sigAlgUpperCase = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
-            if ((sigAlgUpperCase.endsWith("WITHRSA") &&
-                !keyAlgorithm.equalsIgnoreCase("RSA")) ||
-                (sigAlgUpperCase.endsWith("WITHECDSA") &&
-                !keyAlgorithm.equalsIgnoreCase("EC")) ||
-                (sigAlgUpperCase.endsWith("WITHDSA") &&
-                !keyAlgorithm.equalsIgnoreCase("DSA"))) {
-                throw new SignatureException
-                    ("private key algorithm is not compatible with signature algorithm");
-            }
-
-            blockFileName = "META-INF/"+sfg.getBaseName()+"."+keyAlgorithm;
-
-            AlgorithmId sigAlg = AlgorithmId.get(signatureAlgorithm);
-            AlgorithmId digEncrAlg = AlgorithmId.get(keyAlgorithm);
-
-            Signature sig = Signature.getInstance(signatureAlgorithm);
-            sig.initSign(privateKey);
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            sfg.write(baos);
-
-            byte[] content = baos.toByteArray();
-
-            sig.update(content);
-            byte[] signature = sig.sign();
-
-            // Timestamp the signature and generate the signature block file
-            if (signingMechanism == null) {
-                signingMechanism = new TimestampedSigner();
-            }
-            URI tsaUri = null;
-            try {
-                if (tsaUrl != null) {
-                    tsaUri = new URI(tsaUrl);
-                }
-            } catch (URISyntaxException e) {
-                throw new IOException(e);
-            }
-
-            // Assemble parameters for the signing mechanism
-            ContentSignerParameters params =
-                new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID,
-                        tSADigestAlg, signature,
-                    signatureAlgorithm, certChain, content, zipFile);
-
-            // Generate the signature block
-            block = signingMechanism.generateSignedData(
-                    params, externalSF, (tsaUrl != null || tsaCert != null));
-        }
-
-        /*
-         * get block file name.
-         */
-        public String getMetaName()
-        {
-            return blockFileName;
-        }
-
-        /**
-         * Writes the block file to the specified OutputStream.
-         *
-         * @param out the output stream
-         * @exception IOException if an I/O error has occurred
-         */
-
-        public void write(OutputStream out) throws IOException
-        {
-            out.write(block);
-        }
-    }
-}
-
-
-/*
- * This object encapsulates the parameters used to perform content signing.
- */
-class JarSignerParameters implements ContentSignerParameters {
-
-    private String[] args;
-    private URI tsa;
-    private X509Certificate tsaCertificate;
-    private byte[] signature;
-    private String signatureAlgorithm;
-    private X509Certificate[] signerCertificateChain;
-    private byte[] content;
-    private ZipFile source;
-    private String tSAPolicyID;
-    private String tSADigestAlg;
-
-    /**
-     * Create a new object.
-     */
-    JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
-        String tSAPolicyID, String tSADigestAlg,
-        byte[] signature, String signatureAlgorithm,
-        X509Certificate[] signerCertificateChain, byte[] content,
-        ZipFile source) {
-
-        if (signature == null || signatureAlgorithm == null ||
-            signerCertificateChain == null || tSADigestAlg == null) {
-            throw new NullPointerException();
-        }
-        this.args = args;
-        this.tsa = tsa;
-        this.tsaCertificate = tsaCertificate;
-        this.tSAPolicyID = tSAPolicyID;
-        this.tSADigestAlg = tSADigestAlg;
-        this.signature = signature;
-        this.signatureAlgorithm = signatureAlgorithm;
-        this.signerCertificateChain = signerCertificateChain;
-        this.content = content;
-        this.source = source;
-    }
-
-    /**
-     * Retrieves the command-line arguments.
-     *
-     * @return The command-line arguments. May be null.
-     */
-    public String[] getCommandLine() {
-        return args;
-    }
-
-    /**
-     * Retrieves the identifier for a Timestamping Authority (TSA).
-     *
-     * @return The TSA identifier. May be null.
-     */
-    public URI getTimestampingAuthority() {
-        return tsa;
-    }
-
-    /**
-     * Retrieves the certificate for a Timestamping Authority (TSA).
-     *
-     * @return The TSA certificate. May be null.
-     */
-    public X509Certificate getTimestampingAuthorityCertificate() {
-        return tsaCertificate;
-    }
-
-    public String getTSAPolicyID() {
-        return tSAPolicyID;
-    }
-
-    public String getTSADigestAlg() {
-        return tSADigestAlg;
-    }
-
-    /**
-     * Retrieves the signature.
-     *
-     * @return The non-null signature bytes.
-     */
-    public byte[] getSignature() {
-        return signature;
-    }
-
-    /**
-     * Retrieves the name of the signature algorithm.
-     *
-     * @return The non-null string name of the signature algorithm.
-     */
-    public String getSignatureAlgorithm() {
-        return signatureAlgorithm;
-    }
-
-    /**
-     * Retrieves the signer's X.509 certificate chain.
-     *
-     * @return The non-null array of X.509 public-key certificates.
-     */
-    public X509Certificate[] getSignerCertificateChain() {
-        return signerCertificateChain;
-    }
-
-    /**
-     * Retrieves the content that was signed.
-     *
-     * @return The content bytes. May be null.
-     */
-    public byte[] getContent() {
-        return content;
-    }
-
-    /**
-     * Retrieves the original source ZIP file before it was signed.
-     *
-     * @return The original ZIP file. May be null.
-     */
-    public ZipFile getSource() {
-        return source;
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,261 +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.
- */
-
-package sun.security.tools.jarsigner;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for JarSigner.
- *
- */
-public class Resources extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-
-        // shared (from jarsigner)
-        {"SPACE", " "},
-        {"2SPACE", "  "},
-        {"6SPACE", "      "},
-        {"COMMA", ", "},
-
-        {"provName.not.a.provider", "{0} not a provider"},
-        {"signerClass.is.not.a.signing.mechanism", "{0} is not a signing mechanism"},
-        {"jarsigner.error.", "jarsigner error: "},
-        {"Illegal.option.", "Illegal option: "},
-        {".keystore.must.be.NONE.if.storetype.is.{0}",
-                "-keystore must be NONE if -storetype is {0}"},
-        {".keypass.can.not.be.specified.if.storetype.is.{0}",
-                "-keypass can not be specified if -storetype is {0}"},
-        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
-                "If -protected is specified, then -storepass and -keypass must not be specified"},
-        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
-                 "If keystore is not password protected, then -storepass and -keypass must not be specified"},
-        {"Usage.jarsigner.options.jar.file.alias",
-                "Usage: jarsigner [options] jar-file alias"},
-        {".jarsigner.verify.options.jar.file.alias.",
-                "       jarsigner -verify [options] jar-file [alias...]"},
-        {".keystore.url.keystore.location",
-                "[-keystore <url>]           keystore location"},
-        {".storepass.password.password.for.keystore.integrity",
-            "[-storepass <password>]     password for keystore integrity"},
-        {".storetype.type.keystore.type",
-                "[-storetype <type>]         keystore type"},
-        {".keypass.password.password.for.private.key.if.different.",
-                "[-keypass <password>]       password for private key (if different)"},
-        {".certchain.file.name.of.alternative.certchain.file",
-                "[-certchain <file>]         name of alternative certchain file"},
-        {".sigfile.file.name.of.SF.DSA.file",
-                "[-sigfile <file>]           name of .SF/.DSA file"},
-        {".signedjar.file.name.of.signed.JAR.file",
-                "[-signedjar <file>]         name of signed JAR file"},
-        {".digestalg.algorithm.name.of.digest.algorithm",
-                "[-digestalg <algorithm>]    name of digest algorithm"},
-        {".sigalg.algorithm.name.of.signature.algorithm",
-                "[-sigalg <algorithm>]       name of signature algorithm"},
-        {".verify.verify.a.signed.JAR.file",
-                "[-verify]                   verify a signed JAR file"},
-        {".verbose.suboptions.verbose.output.when.signing.verifying.",
-                "[-verbose[:suboptions]]     verbose output when signing/verifying."},
-        {".suboptions.can.be.all.grouped.or.summary",
-                "                            suboptions can be all, grouped or summary"},
-        {".certs.display.certificates.when.verbose.and.verifying",
-                "[-certs]                    display certificates when verbose and verifying"},
-        {".tsa.url.location.of.the.Timestamping.Authority",
-                "[-tsa <url>]                location of the Timestamping Authority"},
-        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
-                "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
-        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
-                "[-tsapolicyid <oid>]        TSAPolicyID for Timestamping Authority"},
-        {".tsadigestalg.algorithm.of.digest.data.in.timestamping.request",
-                "[-tsadigestalg <algorithm>] algorithm of digest data in timestamping request"},
-        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
-                "[-altsigner <class>]        class name of an alternative signing mechanism"},
-        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
-                "[-altsignerpath <pathlist>] location of an alternative signing mechanism"},
-        {".internalsf.include.the.SF.file.inside.the.signature.block",
-                "[-internalsf]               include the .SF file inside the signature block"},
-        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
-                "[-sectionsonly]             don't compute hash of entire manifest"},
-        {".protected.keystore.has.protected.authentication.path",
-                "[-protected]                keystore has protected authentication path"},
-        {".providerName.name.provider.name",
-                "[-providerName <name>]      provider name"},
-        {".providerClass.class.name.of.cryptographic.service.provider.s",
-                "[-providerClass <class>     name of cryptographic service provider's"},
-        {".providerArg.arg.master.class.file.and.constructor.argument",
-                "  [-providerArg <arg>]] ... master class file and constructor argument"},
-        {".strict.treat.warnings.as.errors",
-                "[-strict]                   treat warnings as errors"},
-        {".conf.url.specify.a.pre.configured.options.file",
-                "[-conf <url>]               specify a pre-configured options file"},
-        {"Option.lacks.argument", "Option lacks argument"},
-        {"Please.type.jarsigner.help.for.usage", "Please type jarsigner -help for usage"},
-        {"Please.specify.jarfile.name", "Please specify jarfile name"},
-        {"Please.specify.alias.name", "Please specify alias name"},
-        {"Only.one.alias.can.be.specified", "Only one alias can be specified"},
-        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
-                 "This jar contains signed entries which are not signed by the specified alias(es)."},
-        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
-                  "This jar contains signed entries that are not signed by alias in this keystore."},
-        {"s", "s"},
-        {"m", "m"},
-        {"k", "k"},
-        {"i", "i"},
-        {".and.d.more.", "(and %d more)"},
-        {".s.signature.was.verified.",
-                "  s = signature was verified "},
-        {".m.entry.is.listed.in.manifest",
-                "  m = entry is listed in manifest"},
-        {".k.at.least.one.certificate.was.found.in.keystore",
-                "  k = at least one certificate was found in keystore"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = at least one certificate was found in identity scope"},
-        {".X.not.signed.by.specified.alias.es.",
-                "  X = not signed by specified alias(es)"},
-        {"no.manifest.", "no manifest."},
-        {".Signature.related.entries.","(Signature related entries)"},
-        {".Unsigned.entries.", "(Unsigned entries)"},
-        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
-                "jar is unsigned. (signatures missing or not parsable)"},
-        {"jar.signed.", "jar signed."},
-        {"jar.signed.with.signer.errors.", "jar signed, with signer errors."},
-        {"jar.verified.", "jar verified."},
-        {"jar.verified.with.signer.errors.", "jar verified, with signer errors."},
-        {"jarsigner.", "jarsigner: "},
-        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
-                "signature filename must consist of the following characters: A-Z, 0-9, _ or -"},
-        {"unable.to.open.jar.file.", "unable to open jar file: "},
-        {"unable.to.create.", "unable to create: "},
-        {".adding.", "   adding: "},
-        {".updating.", " updating: "},
-        {".signing.", "  signing: "},
-        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
-                "attempt to rename {0} to {1} failed"},
-        {"attempt.to.rename.jarFile.to.origJar.failed",
-                "attempt to rename {0} to {1} failed"},
-        {"unable.to.sign.jar.", "unable to sign jar: "},
-        {"Enter.Passphrase.for.keystore.", "Enter Passphrase for keystore: "},
-        {"keystore.load.", "keystore load: "},
-        {"certificate.exception.", "certificate exception: "},
-        {"unable.to.instantiate.keystore.class.",
-                "unable to instantiate keystore class: "},
-        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
-                "Certificate chain not found for: {0}.  {1} must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."},
-        {"File.specified.by.certchain.does.not.exist",
-                "File specified by -certchain does not exist"},
-        {"Cannot.restore.certchain.from.file.specified",
-                "Cannot restore certchain from file specified"},
-        {"Certificate.chain.not.found.in.the.file.specified.",
-                "Certificate chain not found in the file specified."},
-        {"found.non.X.509.certificate.in.signer.s.chain",
-                "found non-X.509 certificate in signer's chain"},
-        {"incomplete.certificate.chain", "incomplete certificate chain"},
-        {"Enter.key.password.for.alias.", "Enter key password for {0}: "},
-        {"unable.to.recover.key.from.keystore",
-                "unable to recover key from keystore"},
-        {"key.associated.with.alias.not.a.private.key",
-                "key associated with {0} not a private key"},
-        {"you.must.enter.key.password", "you must enter key password"},
-        {"unable.to.read.password.", "unable to read password: "},
-        {"certificate.is.valid.from", "certificate is valid from {0} to {1}"},
-        {"certificate.expired.on", "certificate expired on {0}"},
-        {"certificate.is.not.valid.until",
-                "certificate is not valid until {0}"},
-        {"certificate.will.expire.on", "certificate will expire on {0}"},
-        {".CertPath.not.validated.", "[CertPath not validated: "},
-        {"requesting.a.signature.timestamp",
-                "requesting a signature timestamp"},
-        {"TSA.location.", "TSA location: "},
-        {"TSA.certificate.", "TSA certificate: "},
-        {"no.response.from.the.Timestamping.Authority.",
-                "no response from the Timestamping Authority. When connecting"
-                + " from behind a firewall an HTTP or HTTPS proxy may need to"
-                + " be specified. Supply the following options to jarsigner:"},
-        {"or", "or"},
-        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
-                "Certificate not found for: {0}.  {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."},
-        {"using.an.alternative.signing.mechanism",
-                "using an alternative signing mechanism"},
-        {"entry.was.signed.on", "entry was signed on {0}"},
-        {"Warning.", "Warning: "},
-        {"Error.", "Error: "},
-        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
-                "This jar contains unsigned entries which have not been integrity-checked. "},
-        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
-                "This jar contains entries whose signer certificate has expired. "},
-        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
-                "This jar contains entries whose signer certificate will expire within six months. "},
-        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
-                "This jar contains entries whose signer certificate is not yet valid. "},
-        {"Re.run.with.the.verbose.option.for.more.details.",
-                "Re-run with the -verbose option for more details."},
-        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
-                "Re-run with the -verbose and -certs options for more details."},
-        {"The.signer.certificate.has.expired.",
-                "The signer certificate has expired."},
-        {"The.signer.certificate.will.expire.within.six.months.",
-                "The signer certificate will expire within six months."},
-        {"The.signer.certificate.is.not.yet.valid.",
-                "The signer certificate is not yet valid."},
-        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "The signer certificate's KeyUsage extension doesn't allow code signing."},
-        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "The signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
-        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "The signer certificate's NetscapeCertType extension doesn't allow code signing."},
-        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing."},
-        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
-        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing."},
-        {".{0}.extension.does.not.support.code.signing.",
-                 "[{0} extension does not support code signing]"},
-        {"The.signer.s.certificate.chain.is.not.validated.",
-                "The signer's certificate chain is not validated."},
-        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
-                 "This jar contains entries whose certificate chain is not validated."},
-        {"no.timestamp.signing",
-                "No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (%1$tY-%1$tm-%1$td) or after any future revocation date."},
-        {"no.timestamp.verifying",
-                "This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (%1$tY-%1$tm-%1$td) or after any future revocation date."},
-        {"Unknown.password.type.", "Unknown password type: "},
-        {"Cannot.find.environment.variable.",
-                "Cannot find environment variable: "},
-        {"Cannot.find.file.", "Cannot find file: "},
-    };
-
-    /**
-     * 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.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +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.jarsigner;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for JarSigner.
- *
- */
-public class Resources_ja extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-
-        // shared (from jarsigner)
-        {"SPACE", " "},
-        {"2SPACE", "  "},
-        {"6SPACE", "      "},
-        {"COMMA", ", "},
-
-        {"provName.not.a.provider", "{0}\u306F\u30D7\u30ED\u30D0\u30A4\u30C0\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
-        {"signerClass.is.not.a.signing.mechanism", "{0}\u306F\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
-        {"jarsigner.error.", "jarsigner\u30A8\u30E9\u30FC: "},
-        {"Illegal.option.", "\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: "},
-        {".keystore.must.be.NONE.if.storetype.is.{0}",
-                "-storetype\u304C{0}\u306E\u5834\u5408\u3001-keystore\u306FNONE\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
-        {".keypass.can.not.be.specified.if.storetype.is.{0}",
-                "-storetype\u304C{0}\u306E\u5834\u5408\u3001-keypass\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"},
-        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
-                "-protected\u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u306F\u3001-storepass\u304A\u3088\u3073-keypass\u3092\u6307\u5B9A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044"},
-        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
-                 "\u30AD\u30FC\u30B9\u30C8\u30A2\u304C\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u4FDD\u8B77\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001-storepass\u304A\u3088\u3073-keypass\u3092\u6307\u5B9A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044"},
-        {"Usage.jarsigner.options.jar.file.alias",
-                "\u4F7F\u7528\u65B9\u6CD5: jarsigner [options] jar-file alias"},
-        {".jarsigner.verify.options.jar.file.alias.",
-                "       jarsigner -verify [options] jar-file [alias...]"},
-        {".keystore.url.keystore.location",
-                "[-keystore <url>]           \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u4F4D\u7F6E"},
-        {".storepass.password.password.for.keystore.integrity",
-            "[-storepass <password>]     \u30AD\u30FC\u30B9\u30C8\u30A2\u6574\u5408\u6027\u306E\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9"},
-        {".storetype.type.keystore.type",
-                "[-storetype <type>]         \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u578B"},
-        {".keypass.password.password.for.private.key.if.different.",
-                "[-keypass <password>]       \u79D8\u5BC6\u9375\u306E\u30D1\u30B9\u30EF\u30FC\u30C9(\u7570\u306A\u308B\u5834\u5408)"},
-        {".certchain.file.name.of.alternative.certchain.file",
-                "[-certchain <file>]         \u4EE3\u66FF\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
-        {".sigfile.file.name.of.SF.DSA.file",
-                "[-sigfile <file>]           .SF/.DSA\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
-        {".signedjar.file.name.of.signed.JAR.file",
-                "[-signedjar <file>]         \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
-        {".digestalg.algorithm.name.of.digest.algorithm",
-                "[-digestalg <algorithm>]    \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
-        {".sigalg.algorithm.name.of.signature.algorithm",
-                "[-sigalg <algorithm>]       \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
-        {".verify.verify.a.signed.JAR.file",
-                "[-verify]                   \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"},
-        {".verbose.suboptions.verbose.output.when.signing.verifying.",
-                "[-verbose[:suboptions]]     \u7F72\u540D/\u691C\u8A3C\u6642\u306E\u8A73\u7D30\u51FA\u529B\u3002"},
-        {".suboptions.can.be.all.grouped.or.summary",
-                "                            \u30B5\u30D6\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u3001all\u3001grouped\u307E\u305F\u306Fsummary\u3092\u4F7F\u7528\u3067\u304D\u307E\u3059"},
-        {".certs.display.certificates.when.verbose.and.verifying",
-                "[-certs]                    \u8A73\u7D30\u51FA\u529B\u304A\u3088\u3073\u691C\u8A3C\u6642\u306B\u8A3C\u660E\u66F8\u3092\u8868\u793A"},
-        {".tsa.url.location.of.the.Timestamping.Authority",
-                "[-tsa <url>]                \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u5834\u6240"},
-        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
-                "[-tsacert <alias>]          \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u516C\u958B\u9375\u8A3C\u660E\u66F8"},
-        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
-                "[-tsapolicyid <oid>]        \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306ETSAPolicyID"},
-        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
-                "[-altsigner <class>]        \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u30AF\u30E9\u30B9\u540D"},
-        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
-                "[-altsignerpath <pathlist>] \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u5834\u6240"},
-        {".internalsf.include.the.SF.file.inside.the.signature.block",
-                "[-internalsf]               \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
-        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
-                "[-sectionsonly]             \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"},
-        {".protected.keystore.has.protected.authentication.path",
-                "[-protected]                \u30AD\u30FC\u30B9\u30C8\u30A2\u306B\u306F\u4FDD\u8B77\u3055\u308C\u305F\u8A8D\u8A3C\u30D1\u30B9\u304C\u3042\u308B"},
-        {".providerName.name.provider.name",
-                "[-providerName <name>]      \u30D7\u30ED\u30D0\u30A4\u30C0\u540D"},
-        {".providerClass.class.name.of.cryptographic.service.provider.s",
-                "[-providerClass <class>     \u6697\u53F7\u5316\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u306E\u540D\u524D"},
-        {".providerArg.arg.master.class.file.and.constructor.argument",
-                "  [-providerArg <arg>]] ... \u30DE\u30B9\u30BF\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3068\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570"},
-        {".strict.treat.warnings.as.errors",
-                "[-strict]                   \u8B66\u544A\u3092\u30A8\u30E9\u30FC\u3068\u3057\u3066\u51E6\u7406"},
-        {"Option.lacks.argument", "\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093"},
-        {"Please.type.jarsigner.help.for.usage", "\u4F7F\u7528\u65B9\u6CD5\u306B\u3064\u3044\u3066\u306Fjarsigner -help\u3068\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},
-        {"Please.specify.jarfile.name", "jarfile\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"},
-        {"Please.specify.alias.name", "\u5225\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"},
-        {"Only.one.alias.can.be.specified", "\u5225\u540D\u306F1\u3064\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059"},
-        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
-                 "\u3053\u306Ejar\u306B\u542B\u307E\u308C\u308B\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA\u306F\u3001\u6307\u5B9A\u3055\u308C\u305F\u5225\u540D\u306B\u3088\u3063\u3066\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
-        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
-                  "\u3053\u306Ejar\u306B\u542B\u307E\u308C\u308B\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA\u306F\u3001\u3053\u306E\u30AD\u30FC\u30B9\u30C8\u30A2\u5185\u306E\u5225\u540D\u306B\u3088\u3063\u3066\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
-        {"s", "s"},
-        {"m", "m"},
-        {"k", "k"},
-        {"i", "i"},
-        {".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
-        {".s.signature.was.verified.",
-                "  s=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
-        {".m.entry.is.listed.in.manifest",
-                "  m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
-        {".k.at.least.one.certificate.was.found.in.keystore",
-                "  k=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30AD\u30FC\u30B9\u30C8\u30A2\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
-        {".X.not.signed.by.specified.alias.es.",
-                "  X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
-        {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
-        {".Signature.related.entries.","(\u30B7\u30B0\u30CD\u30C1\u30E3\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
-        {".Unsigned.entries.", "(\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA)"},
-        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
-                "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
-        {"jar.verified.", "jar\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F\u3002"},
-        {"jarsigner.", "jarsigner: "},
-        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
-                "\u30B7\u30B0\u30CD\u30C1\u30E3\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
-        {"unable.to.open.jar.file.", "\u6B21\u306Ejar\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093: "},
-        {"unable.to.create.", "\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093: "},
-        {".adding.", "   \u8FFD\u52A0\u4E2D: "},
-        {".updating.", " \u66F4\u65B0\u4E2D: "},
-        {".signing.", "  \u7F72\u540D\u4E2D: "},
-        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
-                "{0}\u306E\u540D\u524D\u3092{1}\u306B\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u304C\u5931\u6557\u3057\u307E\u3057\u305F"},
-        {"attempt.to.rename.jarFile.to.origJar.failed",
-                "{0}\u306E\u540D\u524D\u3092{1}\u306B\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u304C\u5931\u6557\u3057\u307E\u3057\u305F"},
-        {"unable.to.sign.jar.", "jar\u306B\u7F72\u540D\u3067\u304D\u307E\u305B\u3093: "},
-        {"Enter.Passphrase.for.keystore.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
-        {"keystore.load.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30ED\u30FC\u30C9: "},
-        {"certificate.exception.", "\u8A3C\u660E\u66F8\u4F8B\u5916: "},
-        {"unable.to.instantiate.keystore.class.",
-                "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093: "},
-        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
-                "\u6B21\u306E\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}\u3002{1}\u306F\u3001\u79D8\u5BC6\u9375\u304A\u3088\u3073\u5BFE\u5FDC\u3059\u308B\u516C\u958B\u9375\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u3092\u542B\u3080\u6709\u52B9\u306AKeyStore\u9375\u30A8\u30F3\u30C8\u30EA\u3092\u53C2\u7167\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
-        {"File.specified.by.certchain.does.not.exist",
-                "-certchain\u3067\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057\u307E\u305B\u3093"},
-        {"Cannot.restore.certchain.from.file.specified",
-                "\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u3092\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093"},
-        {"Certificate.chain.not.found.in.the.file.specified.",
-                "\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u306F\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002"},
-        {"found.non.X.509.certificate.in.signer.s.chain",
-                "\u7F72\u540D\u8005\u306E\u9023\u9396\u5185\u3067\u975EX.509\u8A3C\u660E\u66F8\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
-        {"incomplete.certificate.chain", "\u4E0D\u5B8C\u5168\u306A\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3"},
-        {"Enter.key.password.for.alias.", "{0}\u306E\u9375\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
-        {"unable.to.recover.key.from.keystore",
-                "\u30AD\u30FC\u30B9\u30C8\u30A2\u304B\u3089\u9375\u3092\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093"},
-        {"key.associated.with.alias.not.a.private.key",
-                "{0}\u3068\u95A2\u9023\u4ED8\u3051\u3089\u308C\u305F\u9375\u306F\u3001\u79D8\u5BC6\u9375\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
-        {"you.must.enter.key.password", "\u9375\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
-        {"unable.to.read.password.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093: "},
-        {"certificate.is.valid.from", "\u8A3C\u660E\u66F8\u306F{0}\u304B\u3089{1}\u307E\u3067\u6709\u52B9\u3067\u3059"},
-        {"certificate.expired.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3057\u305F"},
-        {"certificate.is.not.valid.until",
-                "\u8A3C\u660E\u66F8\u306F{0}\u307E\u3067\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
-        {"certificate.will.expire.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3059"},
-        {".CertPath.not.validated.", "[CertPath\u304C\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "},
-        {"requesting.a.signature.timestamp",
-                "\u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
-        {"TSA.location.", "TSA\u306E\u5834\u6240: "},
-        {"TSA.certificate.", "TSA\u8A3C\u660E\u66F8: "},
-        {"no.response.from.the.Timestamping.Authority.",
-                "\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u304B\u3089\u306E\u30EC\u30B9\u30DD\u30F3\u30B9\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB\u3092\u4ECB\u3057\u3066\u63A5\u7D9A\u3059\u308B\u3068\u304D\u306F\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066HTTP\u307E\u305F\u306FHTTPS\u30D7\u30ED\u30AD\u30B7\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002jarsigner\u306B\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044:"},
-        {"or", "\u307E\u305F\u306F"},
-        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
-                "\u8A3C\u660E\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F: {0}\u3002{1}\u306F\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306EX.509\u516C\u958B\u9375\u8A3C\u660E\u66F8\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u6709\u52B9\u306AKeyStore\u30A8\u30F3\u30C8\u30EA\u3092\u53C2\u7167\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
-        {"using.an.alternative.signing.mechanism",
-                "\u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u4F7F\u7528"},
-        {"entry.was.signed.on", "\u30A8\u30F3\u30C8\u30EA\u306F{0}\u306B\u7F72\u540D\u3055\u308C\u307E\u3057\u305F"},
-        {"Warning.", "\u8B66\u544A: "},
-        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
-                "\u3053\u306Ejar\u306B\u306F\u3001\u6574\u5408\u6027\u30C1\u30A7\u30C3\u30AF\u3092\u3057\u3066\u3044\u306A\u3044\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
-                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C\u671F\u9650\u5207\u308C\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
-                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C6\u304B\u6708\u4EE5\u5185\u306B\u671F\u9650\u5207\u308C\u3068\u306A\u308B\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
-                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C\u307E\u3060\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
-        {"Re.run.with.the.verbose.option.for.more.details.",
-                "\u8A73\u7D30\u306F\u3001-verbose\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
-                "\u8A73\u7D30\u306F\u3001-verbose\u304A\u3088\u3073-certs\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-        {"The.signer.certificate.has.expired.",
-                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F\u671F\u9650\u5207\u308C\u3067\u3059\u3002"},
-        {"The.signer.certificate.will.expire.within.six.months.",
-                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F6\u304B\u6708\u4EE5\u5185\u306B\u671F\u9650\u5207\u308C\u306B\u306A\u308A\u307E\u3059\u3002"},
-        {"The.signer.certificate.is.not.yet.valid.",
-                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F\u307E\u3060\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093\u3002"},
-        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EKeyUsage\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
-        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EExtendedKeyUsage\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
-        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306ENetscapeCertType\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EKeyUsage\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EExtendedKeyUsage\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306ENetscapeCertType\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
-        {".{0}.extension.does.not.support.code.signing.",
-                 "[{0}\u62E1\u5F35\u6A5F\u80FD\u306F\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093]"},
-        {"The.signer.s.certificate.chain.is.not.validated.",
-                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u307E\u3060\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
-        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
-                 "\u3053\u306Ejar\u306B\u306F\u3001\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u307E\u3060\u691C\u8A3C\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
-        {"Unknown.password.type.", "\u4E0D\u660E\u306A\u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30BF\u30A4\u30D7: "},
-        {"Cannot.find.environment.variable.",
-                "\u74B0\u5883\u5909\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "},
-        {"Cannot.find.file.", "\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "},
-    };
-
-    /**
-     * 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.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +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.jarsigner;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for JarSigner.
- *
- */
-public class Resources_zh_CN extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-
-        // shared (from jarsigner)
-        {"SPACE", " "},
-        {"2SPACE", "  "},
-        {"6SPACE", "      "},
-        {"COMMA", ", "},
-
-        {"provName.not.a.provider", "{0}\u4E0D\u662F\u63D0\u4F9B\u65B9"},
-        {"signerClass.is.not.a.signing.mechanism", "{0}\u4E0D\u662F\u7B7E\u540D\u673A\u5236"},
-        {"jarsigner.error.", "jarsigner \u9519\u8BEF: "},
-        {"Illegal.option.", "\u975E\u6CD5\u9009\u9879: "},
-        {".keystore.must.be.NONE.if.storetype.is.{0}",
-                "\u5982\u679C -storetype \u4E3A {0}, \u5219 -keystore \u5FC5\u987B\u4E3A NONE"},
-        {".keypass.can.not.be.specified.if.storetype.is.{0}",
-                "\u5982\u679C -storetype \u4E3A {0}, \u5219\u4E0D\u80FD\u6307\u5B9A -keypass"},
-        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
-                "\u5982\u679C\u6307\u5B9A\u4E86 -protected, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
-        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
-                 "\u5982\u679C\u5BC6\u94A5\u5E93\u672A\u53D7\u53E3\u4EE4\u4FDD\u62A4, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
-        {"Usage.jarsigner.options.jar.file.alias",
-                "\u7528\u6CD5: jarsigner [\u9009\u9879] jar-file \u522B\u540D"},
-        {".jarsigner.verify.options.jar.file.alias.",
-                "       jarsigner -verify [\u9009\u9879] jar-file [\u522B\u540D...]"},
-        {".keystore.url.keystore.location",
-                "[-keystore <url>]           \u5BC6\u94A5\u5E93\u4F4D\u7F6E"},
-        {".storepass.password.password.for.keystore.integrity",
-            "[-storepass <\u53E3\u4EE4>]         \u7528\u4E8E\u5BC6\u94A5\u5E93\u5B8C\u6574\u6027\u7684\u53E3\u4EE4"},
-        {".storetype.type.keystore.type",
-                "[-storetype <\u7C7B\u578B>]         \u5BC6\u94A5\u5E93\u7C7B\u578B"},
-        {".keypass.password.password.for.private.key.if.different.",
-                "[-keypass <\u53E3\u4EE4>]           \u79C1\u6709\u5BC6\u94A5\u7684\u53E3\u4EE4 (\u5982\u679C\u4E0D\u540C)"},
-        {".certchain.file.name.of.alternative.certchain.file",
-                "[-certchain <\u6587\u4EF6>]         \u66FF\u4EE3 certchain \u6587\u4EF6\u7684\u540D\u79F0"},
-        {".sigfile.file.name.of.SF.DSA.file",
-                "[-sigfile <\u6587\u4EF6>]           .SF/.DSA \u6587\u4EF6\u7684\u540D\u79F0"},
-        {".signedjar.file.name.of.signed.JAR.file",
-                "[-signedjar <\u6587\u4EF6>]         \u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6\u7684\u540D\u79F0"},
-        {".digestalg.algorithm.name.of.digest.algorithm",
-                "[-digestalg <\u7B97\u6CD5>]        \u6458\u8981\u7B97\u6CD5\u7684\u540D\u79F0"},
-        {".sigalg.algorithm.name.of.signature.algorithm",
-                "[-sigalg <\u7B97\u6CD5>]           \u7B7E\u540D\u7B97\u6CD5\u7684\u540D\u79F0"},
-        {".verify.verify.a.signed.JAR.file",
-                "[-verify]                   \u9A8C\u8BC1\u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6"},
-        {".verbose.suboptions.verbose.output.when.signing.verifying.",
-                "[-verbose[:suboptions]]     \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
-        {".suboptions.can.be.all.grouped.or.summary",
-                "                            \u5B50\u9009\u9879\u53EF\u4EE5\u662F all, grouped \u6216 summary"},
-        {".certs.display.certificates.when.verbose.and.verifying",
-                "[-certs]                    \u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u548C\u9A8C\u8BC1\u65F6\u663E\u793A\u8BC1\u4E66"},
-        {".tsa.url.location.of.the.Timestamping.Authority",
-                "[-tsa <url>]                \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u4F4D\u7F6E"},
-        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
-                "[-tsacert <\u522B\u540D>]           \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66"},
-        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
-                "[-tsapolicyid <oid>]        \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 TSAPolicyID"},
-        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
-                "[-altsigner <\u7C7B>]           \u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236\u7684\u7C7B\u540D"},
-        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
-                "[-altsignerpath <\u8DEF\u5F84\u5217\u8868>] \u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236\u7684\u4F4D\u7F6E"},
-        {".internalsf.include.the.SF.file.inside.the.signature.block",
-                "[-internalsf]               \u5728\u7B7E\u540D\u5757\u5185\u5305\u542B .SF \u6587\u4EF6"},
-        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
-                "[-sectionsonly]             \u4E0D\u8BA1\u7B97\u6574\u4E2A\u6E05\u5355\u7684\u6563\u5217"},
-        {".protected.keystore.has.protected.authentication.path",
-                "[-protected]                \u5BC6\u94A5\u5E93\u5177\u6709\u53D7\u4FDD\u62A4\u9A8C\u8BC1\u8DEF\u5F84"},
-        {".providerName.name.provider.name",
-                "[-providerName <\u540D\u79F0>]      \u63D0\u4F9B\u65B9\u540D\u79F0"},
-        {".providerClass.class.name.of.cryptographic.service.provider.s",
-                "[-providerClass <\u7C7B>        \u52A0\u5BC6\u670D\u52A1\u63D0\u4F9B\u65B9\u7684\u540D\u79F0"},
-        {".providerArg.arg.master.class.file.and.constructor.argument",
-                "  [-providerArg <\u53C2\u6570>]]... \u4E3B\u7C7B\u6587\u4EF6\u548C\u6784\u9020\u5668\u53C2\u6570"},
-        {".strict.treat.warnings.as.errors",
-                "[-strict]                   \u5C06\u8B66\u544A\u89C6\u4E3A\u9519\u8BEF"},
-        {"Option.lacks.argument", "\u9009\u9879\u7F3A\u5C11\u53C2\u6570"},
-        {"Please.type.jarsigner.help.for.usage", "\u8BF7\u952E\u5165 jarsigner -help \u4EE5\u4E86\u89E3\u7528\u6CD5"},
-        {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jarfile \u540D\u79F0"},
-        {"Please.specify.alias.name", "\u8BF7\u6307\u5B9A\u522B\u540D"},
-        {"Only.one.alias.can.be.specified", "\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A\u522B\u540D"},
-        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
-                 "\u6B64 jar \u5305\u542B\u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D\u7684\u5DF2\u7B7E\u540D\u6761\u76EE\u3002"},
-        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
-                  "\u6B64 jar \u5305\u542B\u672A\u7531\u6B64\u5BC6\u94A5\u5E93\u4E2D\u7684\u522B\u540D\u7B7E\u540D\u7684\u5DF2\u7B7E\u540D\u6761\u76EE\u3002"},
-        {"s", "s"},
-        {"m", "m"},
-        {"k", "k"},
-        {"i", "i"},
-        {".and.d.more.", "(%d \u53CA\u4EE5\u4E0A)"},
-        {".s.signature.was.verified.",
-                "  s = \u5DF2\u9A8C\u8BC1\u7B7E\u540D "},
-        {".m.entry.is.listed.in.manifest",
-                "  m = \u5728\u6E05\u5355\u4E2D\u5217\u51FA\u6761\u76EE"},
-        {".k.at.least.one.certificate.was.found.in.keystore",
-                "  k = \u5728\u5BC6\u94A5\u5E93\u4E2D\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = \u5728\u8EAB\u4EFD\u4F5C\u7528\u57DF\u5185\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
-        {".X.not.signed.by.specified.alias.es.",
-                "  X = \u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D"},
-        {"no.manifest.", "\u6CA1\u6709\u6E05\u5355\u3002"},
-        {".Signature.related.entries.","(\u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6761\u76EE)"},
-        {".Unsigned.entries.", "(\u672A\u7B7E\u540D\u6761\u76EE)"},
-        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
-                "jar \u672A\u7B7E\u540D\u3002(\u7F3A\u5C11\u7B7E\u540D\u6216\u65E0\u6CD5\u89E3\u6790\u7B7E\u540D)"},
-        {"jar.verified.", "jar \u5DF2\u9A8C\u8BC1\u3002"},
-        {"jarsigner.", "jarsigner: "},
-        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
-                "\u7B7E\u540D\u6587\u4EF6\u540D\u5FC5\u987B\u5305\u542B\u4EE5\u4E0B\u5B57\u7B26: A-Z, 0-9, _ \u6216 -"},
-        {"unable.to.open.jar.file.", "\u65E0\u6CD5\u6253\u5F00 jar \u6587\u4EF6: "},
-        {"unable.to.create.", "\u65E0\u6CD5\u521B\u5EFA: "},
-        {".adding.", "   \u6B63\u5728\u6DFB\u52A0: "},
-        {".updating.", " \u6B63\u5728\u66F4\u65B0: "},
-        {".signing.", "  \u6B63\u5728\u7B7E\u540D: "},
-        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
-                "\u5C1D\u8BD5\u5C06{0}\u91CD\u547D\u540D\u4E3A{1}\u65F6\u5931\u8D25"},
-        {"attempt.to.rename.jarFile.to.origJar.failed",
-                "\u5C1D\u8BD5\u5C06{0}\u91CD\u547D\u540D\u4E3A{1}\u65F6\u5931\u8D25"},
-        {"unable.to.sign.jar.", "\u65E0\u6CD5\u5BF9 jar \u8FDB\u884C\u7B7E\u540D: "},
-        {"Enter.Passphrase.for.keystore.", "\u8F93\u5165\u5BC6\u94A5\u5E93\u7684\u5BC6\u7801\u77ED\u8BED: "},
-        {"keystore.load.", "\u5BC6\u94A5\u5E93\u52A0\u8F7D: "},
-        {"certificate.exception.", "\u8BC1\u4E66\u5F02\u5E38\u9519\u8BEF: "},
-        {"unable.to.instantiate.keystore.class.",
-                "\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5BC6\u94A5\u5E93\u7C7B: "},
-        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
-                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u5BC6\u94A5\u6761\u76EE\u3002"},
-        {"File.specified.by.certchain.does.not.exist",
-                "\u7531 -certchain \u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5B58\u5728"},
-        {"Cannot.restore.certchain.from.file.specified",
-                "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F certchain"},
-        {"Certificate.chain.not.found.in.the.file.specified.",
-                "\u5728\u6307\u5B9A\u7684\u6587\u4EF6\u4E2D\u627E\u4E0D\u5230\u8BC1\u4E66\u94FE\u3002"},
-        {"found.non.X.509.certificate.in.signer.s.chain",
-                "\u5728\u7B7E\u540D\u8005\u7684\u94FE\u4E2D\u627E\u5230\u975E X.509 \u8BC1\u4E66"},
-        {"incomplete.certificate.chain", "\u8BC1\u4E66\u94FE\u4E0D\u5B8C\u6574"},
-        {"Enter.key.password.for.alias.", "\u8F93\u5165{0}\u7684\u5BC6\u94A5\u53E3\u4EE4: "},
-        {"unable.to.recover.key.from.keystore",
-                "\u65E0\u6CD5\u4ECE\u5BC6\u94A5\u5E93\u4E2D\u6062\u590D\u5BC6\u94A5"},
-        {"key.associated.with.alias.not.a.private.key",
-                "\u4E0E{0}\u5173\u8054\u7684\u5BC6\u94A5\u4E0D\u662F\u79C1\u6709\u5BC6\u94A5"},
-        {"you.must.enter.key.password", "\u5FC5\u987B\u8F93\u5165\u5BC6\u94A5\u53E3\u4EE4"},
-        {"unable.to.read.password.", "\u65E0\u6CD5\u8BFB\u53D6\u53E3\u4EE4: "},
-        {"certificate.is.valid.from", "\u8BC1\u4E66\u7684\u6709\u6548\u671F\u4E3A{0}\u81F3{1}"},
-        {"certificate.expired.on", "\u8BC1\u4E66\u5230\u671F\u65E5\u671F\u4E3A {0}"},
-        {"certificate.is.not.valid.until",
-                "\u76F4\u5230{0}, \u8BC1\u4E66\u624D\u6709\u6548"},
-        {"certificate.will.expire.on", "\u8BC1\u4E66\u5C06\u5728{0}\u5230\u671F"},
-        {".CertPath.not.validated.", "[CertPath \u672A\u9A8C\u8BC1: "},
-        {"requesting.a.signature.timestamp",
-                "\u6B63\u5728\u8BF7\u6C42\u7B7E\u540D\u65F6\u95F4\u6233"},
-        {"TSA.location.", "TSA \u4F4D\u7F6E: "},
-        {"TSA.certificate.", "TSA \u8BC1\u4E66: "},
-        {"no.response.from.the.Timestamping.Authority.",
-                "\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u6CA1\u6709\u54CD\u5E94\u3002\u5982\u679C\u8981\u4ECE\u9632\u706B\u5899\u540E\u9762\u8FDE\u63A5, \u5219\u53EF\u80FD\u9700\u8981\u6307\u5B9A HTTP \u6216 HTTPS \u4EE3\u7406\u3002\u8BF7\u4E3A jarsigner \u63D0\u4F9B\u4EE5\u4E0B\u9009\u9879: "},
-        {"or", "\u6216"},
-        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
-                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u6761\u76EE\u3002"},
-        {"using.an.alternative.signing.mechanism",
-                "\u6B63\u5728\u4F7F\u7528\u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236"},
-        {"entry.was.signed.on", "\u6761\u76EE\u7684\u7B7E\u540D\u65E5\u671F\u4E3A {0}"},
-        {"Warning.", "\u8B66\u544A: "},
-        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
-                "\u6B64 jar \u5305\u542B\u5C1A\u672A\u8FDB\u884C\u5B8C\u6574\u6027\u68C0\u67E5\u7684\u672A\u7B7E\u540D\u6761\u76EE\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
-                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u5DF2\u8FC7\u671F\u7684\u6761\u76EE\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
-                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u5C06\u5728\u516D\u4E2A\u6708\u5185\u8FC7\u671F\u7684\u6761\u76EE\u3002 "},
-        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
-                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u4ECD\u65E0\u6548\u7684\u6761\u76EE\u3002 "},
-        {"Re.run.with.the.verbose.option.for.more.details.",
-                "\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u4F7F\u7528 -verbose \u9009\u9879\u91CD\u65B0\u8FD0\u884C\u3002"},
-        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
-                "\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u4F7F\u7528 -verbose \u548C -certs \u9009\u9879\u91CD\u65B0\u8FD0\u884C\u3002"},
-        {"The.signer.certificate.has.expired.",
-                "\u7B7E\u540D\u8005\u8BC1\u4E66\u5DF2\u8FC7\u671F\u3002"},
-        {"The.signer.certificate.will.expire.within.six.months.",
-                "\u7B7E\u540D\u8005\u8BC1\u4E66\u5C06\u5728\u516D\u4E2A\u6708\u5185\u8FC7\u671F\u3002"},
-        {"The.signer.certificate.is.not.yet.valid.",
-                "\u7B7E\u540D\u8005\u8BC1\u4E66\u4ECD\u65E0\u6548\u3002"},
-        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 KeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
-        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 ExtendedKeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
-        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 NetscapeCertType \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 KeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
-                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 ExtendedKeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
-        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
-                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 NetscapeCertType \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
-        {".{0}.extension.does.not.support.code.signing.",
-                 "[{0} \u6269\u5C55\u4E0D\u652F\u6301\u4EE3\u7801\u7B7E\u540D]"},
-        {"The.signer.s.certificate.chain.is.not.validated.",
-                "\u7B7E\u540D\u8005\u7684\u8BC1\u4E66\u94FE\u672A\u9A8C\u8BC1\u3002"},
-        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
-                 "\u6B64 jar \u5305\u542B\u8BC1\u4E66\u94FE\u672A\u9A8C\u8BC1\u7684\u6761\u76EE\u3002"},
-        {"Unknown.password.type.", "\u672A\u77E5\u53E3\u4EE4\u7C7B\u578B: "},
-        {"Cannot.find.environment.variable.",
-                "\u627E\u4E0D\u5230\u73AF\u5883\u53D8\u91CF: "},
-        {"Cannot.find.file.", "\u627E\u4E0D\u5230\u6587\u4EF6: "},
-    };
-
-    /**
-     * 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.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2007, 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.security.tools.jarsigner;
-
-import java.io.IOException;
-import java.net.URI;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-import com.sun.jarsigner.*;
-import sun.security.pkcs.PKCS7;
-import sun.security.util.*;
-import sun.security.x509.*;
-
-/**
- * This class implements a content signing service.
- * It generates a timestamped signature for a given content according to
- * <a href="http://www.ietf.org/rfc/rfc3161.txt">RFC 3161</a>.
- * The signature along with a trusted timestamp and the signer's certificate
- * are all packaged into a standard PKCS #7 Signed Data message.
- *
- * @author Vincent Ryan
- */
-
-public final class TimestampedSigner extends ContentSigner {
-
-    /*
-     * Object identifier for the subject information access X.509 certificate
-     * extension.
-     */
-    private static final String SUBJECT_INFO_ACCESS_OID = "1.3.6.1.5.5.7.1.11";
-
-    /*
-     * Object identifier for the timestamping access descriptors.
-     */
-    private static final ObjectIdentifier AD_TIMESTAMPING_Id;
-    static {
-        ObjectIdentifier tmp = null;
-        try {
-            tmp = new ObjectIdentifier("1.3.6.1.5.5.7.48.3");
-        } catch (IOException e) {
-            // ignore
-        }
-        AD_TIMESTAMPING_Id = tmp;
-    }
-
-    /**
-     * Instantiates a content signer that supports timestamped signatures.
-     */
-    public TimestampedSigner() {
-    }
-
-    /**
-     * Generates a PKCS #7 signed data message that includes a signature
-     * timestamp.
-     * This method is used when a signature has already been generated.
-     * The signature, a signature timestamp, the signer's certificate chain,
-     * and optionally the content that was signed, are packaged into a PKCS #7
-     * signed data message.
-     *
-     * @param params The non-null input parameters.
-     * @param omitContent true if the content should be omitted from the
-     *        signed data message. Otherwise the content is included.
-     * @param applyTimestamp true if the signature should be timestamped.
-     *        Otherwise timestamping is not performed.
-     * @return A PKCS #7 signed data message including a signature timestamp.
-     * @throws NoSuchAlgorithmException The exception is thrown if the signature
-     *         algorithm is unrecognised.
-     * @throws CertificateException The exception is thrown if an error occurs
-     *         while processing the signer's certificate or the TSA's
-     *         certificate.
-     * @throws IOException The exception is thrown if an error occurs while
-     *         generating the signature timestamp or while generating the signed
-     *         data message.
-     * @throws NullPointerException The exception is thrown if parameters is
-     *         null.
-     */
-    public byte[] generateSignedData(ContentSignerParameters params,
-        boolean omitContent, boolean applyTimestamp)
-            throws NoSuchAlgorithmException, CertificateException, IOException {
-
-        if (params == null) {
-            throw new NullPointerException();
-        }
-
-        // Parse the signature algorithm to extract the digest
-        // algorithm. The expected format is:
-        //     "<digest>with<encryption>"
-        // or  "<digest>with<encryption>and<mgf>"
-        String signatureAlgorithm = params.getSignatureAlgorithm();
-
-        X509Certificate[] signerChain = params.getSignerCertificateChain();
-        byte[] signature = params.getSignature();
-
-        // Include or exclude content
-        byte[] content = (omitContent == true) ? null : params.getContent();
-
-        URI tsaURI = null;
-        if (applyTimestamp) {
-            tsaURI = params.getTimestampingAuthority();
-            if (tsaURI == null) {
-                // Examine TSA cert
-                tsaURI = getTimestampingURI(
-                    params.getTimestampingAuthorityCertificate());
-                if (tsaURI == null) {
-                    throw new CertificateException(
-                        "Subject Information Access extension not found");
-                }
-            }
-        }
-        return PKCS7.generateSignedData(signature, signerChain, content,
-                                        params.getSignatureAlgorithm(), tsaURI,
-                                        params.getTSAPolicyID(),
-                                        params.getTSADigestAlg());
-    }
-
-    /**
-     * Examine the certificate for a Subject Information Access extension
-     * (<a href="http://tools.ietf.org/html/rfc5280">RFC 5280</a>).
-     * The extension's <tt>accessMethod</tt> field should contain the object
-     * identifier defined for timestamping: 1.3.6.1.5.5.7.48.3 and its
-     * <tt>accessLocation</tt> field should contain an HTTP or HTTPS URL.
-     *
-     * @param tsaCertificate An X.509 certificate for the TSA.
-     * @return An HTTP or HTTPS URI or null if none was found.
-     */
-    public static URI getTimestampingURI(X509Certificate tsaCertificate) {
-
-        if (tsaCertificate == null) {
-            return null;
-        }
-        // Parse the extensions
-        try {
-            byte[] extensionValue =
-                tsaCertificate.getExtensionValue(SUBJECT_INFO_ACCESS_OID);
-            if (extensionValue == null) {
-                return null;
-            }
-            DerInputStream der = new DerInputStream(extensionValue);
-            der = new DerInputStream(der.getOctetString());
-            DerValue[] derValue = der.getSequence(5);
-            AccessDescription description;
-            GeneralName location;
-            URIName uri;
-            for (int i = 0; i < derValue.length; i++) {
-                description = new AccessDescription(derValue[i]);
-                if (description.getAccessMethod()
-                        .equals((Object)AD_TIMESTAMPING_Id)) {
-                    location = description.getAccessLocation();
-                    if (location.getType() == GeneralNameInterface.NAME_URI) {
-                        uri = (URIName) location.getName();
-                        if (uri.getScheme().equalsIgnoreCase("http") ||
-                                uri.getScheme().equalsIgnoreCase("https")) {
-                            return uri.getURI();
-                        }
-                    }
-                }
-            }
-        } catch (IOException ioe) {
-            // ignore
-        }
-        return null;
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_de.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_es.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_fr.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_it.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_ja.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_ko.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_sv.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java	Thu Mar 12 13:35:03 2015 -0700
+++ /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.dev/share/classes/sun/tools/jar/CommandLine.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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.tools.jar;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.io.StreamTokenizer;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Various utility methods for processing Java tool command line arguments.
- *
- *  <p><b>This is NOT part of any API supported by Oracle.  If
- *  you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class CommandLine {
-    /**
-     * Process Win32-style command files for the specified command line
-     * arguments and return the resulting arguments. A command file argument
-     * is of the form '@file' where 'file' is the name of the file whose
-     * contents are to be parsed for additional arguments. The contents of
-     * the command file are parsed using StreamTokenizer and the original
-     * '@file' argument replaced with the resulting tokens. Recursive command
-     * files are not supported. The '@' character itself can be quoted with
-     * the sequence '@@'.
-     */
-    public static String[] parse(String[] args)
-        throws IOException
-    {
-        List<String> newArgs = new ArrayList<>(args.length);
-        for (int i = 0; i < args.length; i++) {
-            String arg = args[i];
-            if (arg.length() > 1 && arg.charAt(0) == '@') {
-                arg = arg.substring(1);
-                if (arg.charAt(0) == '@') {
-                    newArgs.add(arg);
-                } else {
-                    loadCmdFile(arg, newArgs);
-                }
-            } else {
-                newArgs.add(arg);
-            }
-        }
-        return newArgs.toArray(new String[newArgs.size()]);
-    }
-
-    private static void loadCmdFile(String name, List<String> args)
-        throws IOException
-    {
-        Reader r = new BufferedReader(new FileReader(name));
-        StreamTokenizer st = new StreamTokenizer(r);
-        st.resetSyntax();
-        st.wordChars(' ', 255);
-        st.whitespaceChars(0, ' ');
-        st.commentChar('#');
-        st.quoteChar('"');
-        st.quoteChar('\'');
-        while (st.nextToken() != StreamTokenizer.TT_EOF) {
-            args.add(st.sval);
-        }
-        r.close();
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, 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.tools.jar;
-
-import java.io.IOException;
-
-public
-class JarException extends IOException {
-
-    static final long serialVersionUID = -4351820108009811497L;
-
-    public JarException() {
-        super();
-    }
-
-    public JarException(String s) {
-        super(s);
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1317 +0,0 @@
-/*
- * Copyright (c) 1996, 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.tools.jar;
-
-import java.io.*;
-import java.nio.file.Path;
-import java.nio.file.Files;
-import java.util.*;
-import java.util.zip.*;
-import java.util.jar.*;
-import java.util.jar.Pack200.*;
-import java.util.jar.Manifest;
-import java.text.MessageFormat;
-import sun.misc.JarIndex;
-import static sun.misc.JarIndex.INDEX_NAME;
-import static java.util.jar.JarFile.MANIFEST_NAME;
-import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-
-/**
- * This class implements a simple utility for creating files in the JAR
- * (Java Archive) file format. The JAR format is based on the ZIP file
- * format, with optional meta-information stored in a MANIFEST entry.
- */
-public
-class Main {
-    String program;
-    PrintStream out, err;
-    String fname, mname, ename;
-    String zname = "";
-    String[] files;
-    String rootjar = null;
-
-    // An entryName(path)->File map generated during "expand", it helps to
-    // decide whether or not an existing entry in a jar file needs to be
-    // replaced, during the "update" operation.
-    Map<String, File> entryMap = new HashMap<String, File>();
-
-    // All files need to be added/updated.
-    Set<File> entries = new LinkedHashSet<File>();
-
-    // Directories specified by "-C" operation.
-    Set<String> paths = new HashSet<String>();
-
-    /*
-     * cflag: create
-     * uflag: update
-     * xflag: xtract
-     * tflag: table
-     * vflag: verbose
-     * flag0: no zip compression (store only)
-     * Mflag: DO NOT generate a manifest file (just ZIP)
-     * iflag: generate jar index
-     * nflag: Perform jar normalization at the end
-     */
-    boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, nflag;
-
-    static final String MANIFEST_DIR = "META-INF/";
-    static final String VERSION = "1.0";
-
-    private static ResourceBundle rsrc;
-
-    /**
-     * If true, maintain compatibility with JDK releases prior to 6.0 by
-     * timestamping extracted files with the time at which they are extracted.
-     * Default is to use the time given in the archive.
-     */
-    private static final boolean useExtractionTime =
-        Boolean.getBoolean("sun.tools.jar.useExtractionTime");
-
-    /**
-     * Initialize ResourceBundle
-     */
-    static {
-        try {
-            rsrc = ResourceBundle.getBundle("sun.tools.jar.resources.jar");
-        } catch (MissingResourceException e) {
-            throw new Error("Fatal: Resource for jar is missing");
-        }
-    }
-
-    private String getMsg(String key) {
-        try {
-            return (rsrc.getString(key));
-        } catch (MissingResourceException e) {
-            throw new Error("Error in message file");
-        }
-    }
-
-    private String formatMsg(String key, String arg) {
-        String msg = getMsg(key);
-        String[] args = new String[1];
-        args[0] = arg;
-        return MessageFormat.format(msg, (Object[]) args);
-    }
-
-    private String formatMsg2(String key, String arg, String arg1) {
-        String msg = getMsg(key);
-        String[] args = new String[2];
-        args[0] = arg;
-        args[1] = arg1;
-        return MessageFormat.format(msg, (Object[]) args);
-    }
-
-    public Main(PrintStream out, PrintStream err, String program) {
-        this.out = out;
-        this.err = err;
-        this.program = program;
-    }
-
-    /**
-     * Creates a new empty temporary file in the same directory as the
-     * specified file.  A variant of File.createTempFile.
-     */
-    private static File createTempFileInSameDirectoryAs(File file)
-        throws IOException {
-        File dir = file.getParentFile();
-        if (dir == null)
-            dir = new File(".");
-        return File.createTempFile("jartmp", null, dir);
-    }
-
-    private boolean ok;
-
-    /**
-     * Starts main program with the specified arguments.
-     */
-    public synchronized boolean run(String args[]) {
-        ok = true;
-        if (!parseArgs(args)) {
-            return false;
-        }
-        try {
-            if (cflag || uflag) {
-                if (fname != null) {
-                    // The name of the zip file as it would appear as its own
-                    // zip file entry. We use this to make sure that we don't
-                    // add the zip file to itself.
-                    zname = fname.replace(File.separatorChar, '/');
-                    if (zname.startsWith("./")) {
-                        zname = zname.substring(2);
-                    }
-                }
-            }
-            if (cflag) {
-                Manifest manifest = null;
-                InputStream in = null;
-
-                if (!Mflag) {
-                    if (mname != null) {
-                        in = new FileInputStream(mname);
-                        manifest = new Manifest(new BufferedInputStream(in));
-                    } else {
-                        manifest = new Manifest();
-                    }
-                    addVersion(manifest);
-                    addCreatedBy(manifest);
-                    if (isAmbiguousMainClass(manifest)) {
-                        if (in != null) {
-                            in.close();
-                        }
-                        return false;
-                    }
-                    if (ename != null) {
-                        addMainClass(manifest, ename);
-                    }
-                }
-                OutputStream out;
-                if (fname != null) {
-                    out = new FileOutputStream(fname);
-                } else {
-                    out = new FileOutputStream(FileDescriptor.out);
-                    if (vflag) {
-                        // Disable verbose output so that it does not appear
-                        // on stdout along with file data
-                        // error("Warning: -v option ignored");
-                        vflag = false;
-                    }
-                }
-                File tmpfile = null;
-                final OutputStream finalout = out;
-                final String tmpbase = (fname == null)
-                        ? "tmpjar"
-                        : fname.substring(fname.indexOf(File.separatorChar) + 1);
-                if (nflag) {
-                    tmpfile = createTemporaryFile(tmpbase, ".jar");
-                    out = new FileOutputStream(tmpfile);
-                }
-                expand(null, files, false);
-                create(new BufferedOutputStream(out, 4096), manifest);
-                if (in != null) {
-                    in.close();
-                }
-                out.close();
-                if (nflag) {
-                    JarFile jarFile = null;
-                    File packFile = null;
-                    JarOutputStream jos = null;
-                    try {
-                        Packer packer = Pack200.newPacker();
-                        Map<String, String> p = packer.properties();
-                        p.put(Packer.EFFORT, "1"); // Minimal effort to conserve CPU
-                        jarFile = new JarFile(tmpfile.getCanonicalPath());
-                        packFile = createTemporaryFile(tmpbase, ".pack");
-                        out = new FileOutputStream(packFile);
-                        packer.pack(jarFile, out);
-                        jos = new JarOutputStream(finalout);
-                        Unpacker unpacker = Pack200.newUnpacker();
-                        unpacker.unpack(packFile, jos);
-                    } catch (IOException ioe) {
-                        fatalError(ioe);
-                    } finally {
-                        if (jarFile != null) {
-                            jarFile.close();
-                        }
-                        if (out != null) {
-                            out.close();
-                        }
-                        if (jos != null) {
-                            jos.close();
-                        }
-                        if (tmpfile != null && tmpfile.exists()) {
-                            tmpfile.delete();
-                        }
-                        if (packFile != null && packFile.exists()) {
-                            packFile.delete();
-                        }
-                    }
-                }
-            } else if (uflag) {
-                File inputFile = null, tmpFile = null;
-                FileInputStream in;
-                FileOutputStream out;
-                if (fname != null) {
-                    inputFile = new File(fname);
-                    tmpFile = createTempFileInSameDirectoryAs(inputFile);
-                    in = new FileInputStream(inputFile);
-                    out = new FileOutputStream(tmpFile);
-                } else {
-                    in = new FileInputStream(FileDescriptor.in);
-                    out = new FileOutputStream(FileDescriptor.out);
-                    vflag = false;
-                }
-                InputStream manifest = (!Mflag && (mname != null)) ?
-                    (new FileInputStream(mname)) : null;
-                expand(null, files, true);
-                boolean updateOk = update(in, new BufferedOutputStream(out),
-                                          manifest, null);
-                if (ok) {
-                    ok = updateOk;
-                }
-                in.close();
-                out.close();
-                if (manifest != null) {
-                    manifest.close();
-                }
-                if (ok && fname != null) {
-                    // on Win32, we need this delete
-                    inputFile.delete();
-                    if (!tmpFile.renameTo(inputFile)) {
-                        tmpFile.delete();
-                        throw new IOException(getMsg("error.write.file"));
-                    }
-                    tmpFile.delete();
-                }
-            } else if (tflag) {
-                replaceFSC(files);
-                // For the "list table contents" action, access using the
-                // ZipFile class is always most efficient since only a
-                // "one-finger" scan through the central directory is required.
-                if (fname != null) {
-                    list(fname, files);
-                } else {
-                    InputStream in = new FileInputStream(FileDescriptor.in);
-                    try {
-                        list(new BufferedInputStream(in), files);
-                    } finally {
-                        in.close();
-                    }
-                }
-            } else if (xflag) {
-                replaceFSC(files);
-                // For the extract action, when extracting all the entries,
-                // access using the ZipInputStream class is most efficient,
-                // since only a single sequential scan through the zip file is
-                // required.  When using the ZipFile class, a "two-finger" scan
-                // is required, but this is likely to be more efficient when a
-                // partial extract is requested.  In case the zip file has
-                // "leading garbage", we fall back from the ZipInputStream
-                // implementation to the ZipFile implementation, since only the
-                // latter can handle it.
-                if (fname != null && files != null) {
-                    extract(fname, files);
-                } else {
-                    InputStream in = (fname == null)
-                        ? new FileInputStream(FileDescriptor.in)
-                        : new FileInputStream(fname);
-                    try {
-                        if (!extract(new BufferedInputStream(in), files) && fname != null) {
-                            extract(fname, files);
-                        }
-                    } finally {
-                        in.close();
-                    }
-                }
-            } else if (iflag) {
-                genIndex(rootjar, files);
-            }
-        } catch (IOException e) {
-            fatalError(e);
-            ok = false;
-        } catch (Error ee) {
-            ee.printStackTrace();
-            ok = false;
-        } catch (Throwable t) {
-            t.printStackTrace();
-            ok = false;
-        }
-        out.flush();
-        err.flush();
-        return ok;
-    }
-
-    /**
-     * Parses command line arguments.
-     */
-    boolean parseArgs(String args[]) {
-        /* Preprocess and expand @file arguments */
-        try {
-            args = CommandLine.parse(args);
-        } catch (FileNotFoundException e) {
-            fatalError(formatMsg("error.cant.open", e.getMessage()));
-            return false;
-        } catch (IOException e) {
-            fatalError(e);
-            return false;
-        }
-        /* parse flags */
-        int count = 1;
-        try {
-            String flags = args[0];
-            if (flags.startsWith("-")) {
-                flags = flags.substring(1);
-            }
-            for (int i = 0; i < flags.length(); i++) {
-                switch (flags.charAt(i)) {
-                case 'c':
-                    if (xflag || tflag || uflag || iflag) {
-                        usageError();
-                        return false;
-                    }
-                    cflag = true;
-                    break;
-                case 'u':
-                    if (cflag || xflag || tflag || iflag) {
-                        usageError();
-                        return false;
-                    }
-                    uflag = true;
-                    break;
-                case 'x':
-                    if (cflag || uflag || tflag || iflag) {
-                        usageError();
-                        return false;
-                    }
-                    xflag = true;
-                    break;
-                case 't':
-                    if (cflag || uflag || xflag || iflag) {
-                        usageError();
-                        return false;
-                    }
-                    tflag = true;
-                    break;
-                case 'M':
-                    Mflag = true;
-                    break;
-                case 'v':
-                    vflag = true;
-                    break;
-                case 'f':
-                    fname = args[count++];
-                    break;
-                case 'm':
-                    mname = args[count++];
-                    break;
-                case '0':
-                    flag0 = true;
-                    break;
-                case 'i':
-                    if (cflag || uflag || xflag || tflag) {
-                        usageError();
-                        return false;
-                    }
-                    // do not increase the counter, files will contain rootjar
-                    rootjar = args[count++];
-                    iflag = true;
-                    break;
-                case 'n':
-                    nflag = true;
-                    break;
-                case 'e':
-                     ename = args[count++];
-                     break;
-                default:
-                    error(formatMsg("error.illegal.option",
-                                String.valueOf(flags.charAt(i))));
-                    usageError();
-                    return false;
-                }
-            }
-        } catch (ArrayIndexOutOfBoundsException e) {
-            usageError();
-            return false;
-        }
-        if (!cflag && !tflag && !xflag && !uflag && !iflag) {
-            error(getMsg("error.bad.option"));
-            usageError();
-            return false;
-        }
-        /* parse file arguments */
-        int n = args.length - count;
-        if (n > 0) {
-            int k = 0;
-            String[] nameBuf = new String[n];
-            try {
-                for (int i = count; i < args.length; i++) {
-                    if (args[i].equals("-C")) {
-                        /* change the directory */
-                        String dir = args[++i];
-                        dir = (dir.endsWith(File.separator) ?
-                               dir : (dir + File.separator));
-                        dir = dir.replace(File.separatorChar, '/');
-                        while (dir.indexOf("//") > -1) {
-                            dir = dir.replace("//", "/");
-                        }
-                        paths.add(dir.replace(File.separatorChar, '/'));
-                        nameBuf[k++] = dir + args[++i];
-                    } else {
-                        nameBuf[k++] = args[i];
-                    }
-                }
-            } catch (ArrayIndexOutOfBoundsException e) {
-                usageError();
-                return false;
-            }
-            files = new String[k];
-            System.arraycopy(nameBuf, 0, files, 0, k);
-        } else if (cflag && (mname == null)) {
-            error(getMsg("error.bad.cflag"));
-            usageError();
-            return false;
-        } else if (uflag) {
-            if ((mname != null) || (ename != null)) {
-                /* just want to update the manifest */
-                return true;
-            } else {
-                error(getMsg("error.bad.uflag"));
-                usageError();
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Expands list of files to process into full list of all files that
-     * can be found by recursively descending directories.
-     */
-    void expand(File dir, String[] files, boolean isUpdate) {
-        if (files == null) {
-            return;
-        }
-        for (int i = 0; i < files.length; i++) {
-            File f;
-            if (dir == null) {
-                f = new File(files[i]);
-            } else {
-                f = new File(dir, files[i]);
-            }
-            if (f.isFile()) {
-                if (entries.add(f)) {
-                    if (isUpdate)
-                        entryMap.put(entryName(f.getPath()), f);
-                }
-            } else if (f.isDirectory()) {
-                if (entries.add(f)) {
-                    if (isUpdate) {
-                        String dirPath = f.getPath();
-                        dirPath = (dirPath.endsWith(File.separator)) ? dirPath :
-                            (dirPath + File.separator);
-                        entryMap.put(entryName(dirPath), f);
-                    }
-                    expand(f, f.list(), isUpdate);
-                }
-            } else {
-                error(formatMsg("error.nosuch.fileordir", String.valueOf(f)));
-                ok = false;
-            }
-        }
-    }
-
-    /**
-     * Creates a new JAR file.
-     */
-    void create(OutputStream out, Manifest manifest)
-        throws IOException
-    {
-        ZipOutputStream zos = new JarOutputStream(out);
-        if (flag0) {
-            zos.setMethod(ZipOutputStream.STORED);
-        }
-        if (manifest != null) {
-            if (vflag) {
-                output(getMsg("out.added.manifest"));
-            }
-            ZipEntry e = new ZipEntry(MANIFEST_DIR);
-            e.setTime(System.currentTimeMillis());
-            e.setSize(0);
-            e.setCrc(0);
-            zos.putNextEntry(e);
-            e = new ZipEntry(MANIFEST_NAME);
-            e.setTime(System.currentTimeMillis());
-            if (flag0) {
-                crc32Manifest(e, manifest);
-            }
-            zos.putNextEntry(e);
-            manifest.write(zos);
-            zos.closeEntry();
-        }
-        for (File file: entries) {
-            addFile(zos, file);
-        }
-        zos.close();
-    }
-
-    private char toUpperCaseASCII(char c) {
-        return (c < 'a' || c > 'z') ? c : (char) (c + 'A' - 'a');
-    }
-
-    /**
-     * Compares two strings for equality, ignoring case.  The second
-     * argument must contain only upper-case ASCII characters.
-     * We don't want case comparison to be locale-dependent (else we
-     * have the notorious "turkish i bug").
-     */
-    private boolean equalsIgnoreCase(String s, String upper) {
-        assert upper.toUpperCase(java.util.Locale.ENGLISH).equals(upper);
-        int len;
-        if ((len = s.length()) != upper.length())
-            return false;
-        for (int i = 0; i < len; i++) {
-            char c1 = s.charAt(i);
-            char c2 = upper.charAt(i);
-            if (c1 != c2 && toUpperCaseASCII(c1) != c2)
-                return false;
-        }
-        return true;
-    }
-
-    /**
-     * Updates an existing jar file.
-     */
-    boolean update(InputStream in, OutputStream out,
-                   InputStream newManifest,
-                   JarIndex jarIndex) throws IOException
-    {
-        ZipInputStream zis = new ZipInputStream(in);
-        ZipOutputStream zos = new JarOutputStream(out);
-        ZipEntry e = null;
-        boolean foundManifest = false;
-        boolean updateOk = true;
-
-        if (jarIndex != null) {
-            addIndex(jarIndex, zos);
-        }
-
-        // put the old entries first, replace if necessary
-        while ((e = zis.getNextEntry()) != null) {
-            String name = e.getName();
-
-            boolean isManifestEntry = equalsIgnoreCase(name, MANIFEST_NAME);
-
-            if ((jarIndex != null && equalsIgnoreCase(name, INDEX_NAME))
-                || (Mflag && isManifestEntry)) {
-                continue;
-            } else if (isManifestEntry && ((newManifest != null) ||
-                        (ename != null))) {
-                foundManifest = true;
-                if (newManifest != null) {
-                    // Don't read from the newManifest InputStream, as we
-                    // might need it below, and we can't re-read the same data
-                    // twice.
-                    FileInputStream fis = new FileInputStream(mname);
-                    boolean ambiguous = isAmbiguousMainClass(new Manifest(fis));
-                    fis.close();
-                    if (ambiguous) {
-                        return false;
-                    }
-                }
-
-                // Update the manifest.
-                Manifest old = new Manifest(zis);
-                if (newManifest != null) {
-                    old.read(newManifest);
-                }
-                if (!updateManifest(old, zos)) {
-                    return false;
-                }
-            } else {
-                if (!entryMap.containsKey(name)) { // copy the old stuff
-                    // do our own compression
-                    ZipEntry e2 = new ZipEntry(name);
-                    e2.setMethod(e.getMethod());
-                    e2.setTime(e.getTime());
-                    e2.setComment(e.getComment());
-                    e2.setExtra(e.getExtra());
-                    if (e.getMethod() == ZipEntry.STORED) {
-                        e2.setSize(e.getSize());
-                        e2.setCrc(e.getCrc());
-                    }
-                    zos.putNextEntry(e2);
-                    copy(zis, zos);
-                } else { // replace with the new files
-                    File f = entryMap.get(name);
-                    addFile(zos, f);
-                    entryMap.remove(name);
-                    entries.remove(f);
-                }
-            }
-        }
-
-        // add the remaining new files
-        for (File f: entries) {
-            addFile(zos, f);
-        }
-        if (!foundManifest) {
-            if (newManifest != null) {
-                Manifest m = new Manifest(newManifest);
-                updateOk = !isAmbiguousMainClass(m);
-                if (updateOk) {
-                    if (!updateManifest(m, zos)) {
-                        updateOk = false;
-                    }
-                }
-            } else if (ename != null) {
-                if (!updateManifest(new Manifest(), zos)) {
-                    updateOk = false;
-                }
-            }
-        }
-        zis.close();
-        zos.close();
-        return updateOk;
-    }
-
-
-    private void addIndex(JarIndex index, ZipOutputStream zos)
-        throws IOException
-    {
-        ZipEntry e = new ZipEntry(INDEX_NAME);
-        e.setTime(System.currentTimeMillis());
-        if (flag0) {
-            CRC32OutputStream os = new CRC32OutputStream();
-            index.write(os);
-            os.updateEntry(e);
-        }
-        zos.putNextEntry(e);
-        index.write(zos);
-        zos.closeEntry();
-    }
-
-    private boolean updateManifest(Manifest m, ZipOutputStream zos)
-        throws IOException
-    {
-        addVersion(m);
-        addCreatedBy(m);
-        if (ename != null) {
-            addMainClass(m, ename);
-        }
-        ZipEntry e = new ZipEntry(MANIFEST_NAME);
-        e.setTime(System.currentTimeMillis());
-        if (flag0) {
-            crc32Manifest(e, m);
-        }
-        zos.putNextEntry(e);
-        m.write(zos);
-        if (vflag) {
-            output(getMsg("out.update.manifest"));
-        }
-        return true;
-    }
-
-
-    private String entryName(String name) {
-        name = name.replace(File.separatorChar, '/');
-        String matchPath = "";
-        for (String path : paths) {
-            if (name.startsWith(path)
-                && (path.length() > matchPath.length())) {
-                matchPath = path;
-            }
-        }
-        name = name.substring(matchPath.length());
-
-        if (name.startsWith("/")) {
-            name = name.substring(1);
-        } else if (name.startsWith("./")) {
-            name = name.substring(2);
-        }
-        return name;
-    }
-
-    private void addVersion(Manifest m) {
-        Attributes global = m.getMainAttributes();
-        if (global.getValue(Attributes.Name.MANIFEST_VERSION) == null) {
-            global.put(Attributes.Name.MANIFEST_VERSION, VERSION);
-        }
-    }
-
-    private void addCreatedBy(Manifest m) {
-        Attributes global = m.getMainAttributes();
-        if (global.getValue(new Attributes.Name("Created-By")) == null) {
-            String javaVendor = System.getProperty("java.vendor");
-            String jdkVersion = System.getProperty("java.version");
-            global.put(new Attributes.Name("Created-By"), jdkVersion + " (" +
-                        javaVendor + ")");
-        }
-    }
-
-    private void addMainClass(Manifest m, String mainApp) {
-        Attributes global = m.getMainAttributes();
-
-        // overrides any existing Main-Class attribute
-        global.put(Attributes.Name.MAIN_CLASS, mainApp);
-    }
-
-    private boolean isAmbiguousMainClass(Manifest m) {
-        if (ename != null) {
-            Attributes global = m.getMainAttributes();
-            if ((global.get(Attributes.Name.MAIN_CLASS) != null)) {
-                error(getMsg("error.bad.eflag"));
-                usageError();
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Adds a new file entry to the ZIP output stream.
-     */
-    void addFile(ZipOutputStream zos, File file) throws IOException {
-        String name = file.getPath();
-        boolean isDir = file.isDirectory();
-        if (isDir) {
-            name = name.endsWith(File.separator) ? name :
-                (name + File.separator);
-        }
-        name = entryName(name);
-
-        if (name.equals("") || name.equals(".") || name.equals(zname)) {
-            return;
-        } else if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME))
-                   && !Mflag) {
-            if (vflag) {
-                output(formatMsg("out.ignore.entry", name));
-            }
-            return;
-        }
-
-        long size = isDir ? 0 : file.length();
-
-        if (vflag) {
-            out.print(formatMsg("out.adding", name));
-        }
-        ZipEntry e = new ZipEntry(name);
-        e.setTime(file.lastModified());
-        if (size == 0) {
-            e.setMethod(ZipEntry.STORED);
-            e.setSize(0);
-            e.setCrc(0);
-        } else if (flag0) {
-            crc32File(e, file);
-        }
-        zos.putNextEntry(e);
-        if (!isDir) {
-            copy(file, zos);
-        }
-        zos.closeEntry();
-        /* report how much compression occurred. */
-        if (vflag) {
-            size = e.getSize();
-            long csize = e.getCompressedSize();
-            out.print(formatMsg2("out.size", String.valueOf(size),
-                        String.valueOf(csize)));
-            if (e.getMethod() == ZipEntry.DEFLATED) {
-                long ratio = 0;
-                if (size != 0) {
-                    ratio = ((size - csize) * 100) / size;
-                }
-                output(formatMsg("out.deflated", String.valueOf(ratio)));
-            } else {
-                output(getMsg("out.stored"));
-            }
-        }
-    }
-
-    /**
-     * A buffer for use only by copy(InputStream, OutputStream).
-     * Not as clean as allocating a new buffer as needed by copy,
-     * but significantly more efficient.
-     */
-    private byte[] copyBuf = new byte[8192];
-
-    /**
-     * Copies all bytes from the input stream to the output stream.
-     * Does not close or flush either stream.
-     *
-     * @param from the input stream to read from
-     * @param to the output stream to write to
-     * @throws IOException if an I/O error occurs
-     */
-    private void copy(InputStream from, OutputStream to) throws IOException {
-        int n;
-        while ((n = from.read(copyBuf)) != -1)
-            to.write(copyBuf, 0, n);
-    }
-
-    /**
-     * Copies all bytes from the input file to the output stream.
-     * Does not close or flush the output stream.
-     *
-     * @param from the input file to read from
-     * @param to the output stream to write to
-     * @throws IOException if an I/O error occurs
-     */
-    private void copy(File from, OutputStream to) throws IOException {
-        InputStream in = new FileInputStream(from);
-        try {
-            copy(in, to);
-        } finally {
-            in.close();
-        }
-    }
-
-    /**
-     * Copies all bytes from the input stream to the output file.
-     * Does not close the input stream.
-     *
-     * @param from the input stream to read from
-     * @param to the output file to write to
-     * @throws IOException if an I/O error occurs
-     */
-    private void copy(InputStream from, File to) throws IOException {
-        OutputStream out = new FileOutputStream(to);
-        try {
-            copy(from, out);
-        } finally {
-            out.close();
-        }
-    }
-
-    /**
-     * Computes the crc32 of a Manifest.  This is necessary when the
-     * ZipOutputStream is in STORED mode.
-     */
-    private void crc32Manifest(ZipEntry e, Manifest m) throws IOException {
-        CRC32OutputStream os = new CRC32OutputStream();
-        m.write(os);
-        os.updateEntry(e);
-    }
-
-    /**
-     * Computes the crc32 of a File.  This is necessary when the
-     * ZipOutputStream is in STORED mode.
-     */
-    private void crc32File(ZipEntry e, File f) throws IOException {
-        CRC32OutputStream os = new CRC32OutputStream();
-        copy(f, os);
-        if (os.n != f.length()) {
-            throw new JarException(formatMsg(
-                        "error.incorrect.length", f.getPath()));
-        }
-        os.updateEntry(e);
-    }
-
-    void replaceFSC(String files[]) {
-        if (files != null) {
-            for (int i = 0; i < files.length; i++) {
-                files[i] = files[i].replace(File.separatorChar, '/');
-            }
-        }
-    }
-
-    @SuppressWarnings("serial")
-    Set<ZipEntry> newDirSet() {
-        return new HashSet<ZipEntry>() {
-            public boolean add(ZipEntry e) {
-                return ((e == null || useExtractionTime) ? false : super.add(e));
-            }};
-    }
-
-    void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException {
-        for (ZipEntry ze : zes) {
-            long lastModified = ze.getTime();
-            if (lastModified != -1) {
-                File f = new File(ze.getName().replace('/', File.separatorChar));
-                f.setLastModified(lastModified);
-            }
-        }
-    }
-
-    /**
-     * Extracts specified entries from JAR file.
-     *
-     * @return whether entries were found and successfully extracted
-     * (indicating this was a zip file without "leading garbage")
-     */
-    boolean extract(InputStream in, String files[]) throws IOException {
-        ZipInputStream zis = new ZipInputStream(in);
-        ZipEntry e;
-        // Set of all directory entries specified in archive.  Disallows
-        // null entries.  Disallows all entries if using pre-6.0 behavior.
-        boolean entriesFound = false;
-        Set<ZipEntry> dirs = newDirSet();
-        while ((e = zis.getNextEntry()) != null) {
-            entriesFound = true;
-            if (files == null) {
-                dirs.add(extractFile(zis, e));
-            } else {
-                String name = e.getName();
-                for (String file : files) {
-                    if (name.startsWith(file)) {
-                        dirs.add(extractFile(zis, e));
-                        break;
-                    }
-                }
-            }
-        }
-
-        // Update timestamps of directories specified in archive with their
-        // timestamps as given in the archive.  We do this after extraction,
-        // instead of during, because creating a file in a directory changes
-        // that directory's timestamp.
-        updateLastModifiedTime(dirs);
-
-        return entriesFound;
-    }
-
-    /**
-     * Extracts specified entries from JAR file, via ZipFile.
-     */
-    void extract(String fname, String files[]) throws IOException {
-        ZipFile zf = new ZipFile(fname);
-        Set<ZipEntry> dirs = newDirSet();
-        Enumeration<? extends ZipEntry> zes = zf.entries();
-        while (zes.hasMoreElements()) {
-            ZipEntry e = zes.nextElement();
-            if (files == null) {
-                dirs.add(extractFile(zf.getInputStream(e), e));
-            } else {
-                String name = e.getName();
-                for (String file : files) {
-                    if (name.startsWith(file)) {
-                        dirs.add(extractFile(zf.getInputStream(e), e));
-                        break;
-                    }
-                }
-            }
-        }
-        zf.close();
-        updateLastModifiedTime(dirs);
-    }
-
-    /**
-     * Extracts next entry from JAR file, creating directories as needed.  If
-     * the entry is for a directory which doesn't exist prior to this
-     * invocation, returns that entry, otherwise returns null.
-     */
-    ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
-        ZipEntry rc = null;
-        String name = e.getName();
-        File f = new File(e.getName().replace('/', File.separatorChar));
-        if (e.isDirectory()) {
-            if (f.exists()) {
-                if (!f.isDirectory()) {
-                    throw new IOException(formatMsg("error.create.dir",
-                        f.getPath()));
-                }
-            } else {
-                if (!f.mkdirs()) {
-                    throw new IOException(formatMsg("error.create.dir",
-                        f.getPath()));
-                } else {
-                    rc = e;
-                }
-            }
-
-            if (vflag) {
-                output(formatMsg("out.create", name));
-            }
-        } else {
-            if (f.getParent() != null) {
-                File d = new File(f.getParent());
-                if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
-                    throw new IOException(formatMsg(
-                        "error.create.dir", d.getPath()));
-                }
-            }
-            try {
-                copy(is, f);
-            } finally {
-                if (is instanceof ZipInputStream)
-                    ((ZipInputStream)is).closeEntry();
-                else
-                    is.close();
-            }
-            if (vflag) {
-                if (e.getMethod() == ZipEntry.DEFLATED) {
-                    output(formatMsg("out.inflated", name));
-                } else {
-                    output(formatMsg("out.extracted", name));
-                }
-            }
-        }
-        if (!useExtractionTime) {
-            long lastModified = e.getTime();
-            if (lastModified != -1) {
-                f.setLastModified(lastModified);
-            }
-        }
-        return rc;
-    }
-
-    /**
-     * Lists contents of JAR file.
-     */
-    void list(InputStream in, String files[]) throws IOException {
-        ZipInputStream zis = new ZipInputStream(in);
-        ZipEntry e;
-        while ((e = zis.getNextEntry()) != null) {
-            /*
-             * In the case of a compressed (deflated) entry, the entry size
-             * is stored immediately following the entry data and cannot be
-             * determined until the entry is fully read. Therefore, we close
-             * the entry first before printing out its attributes.
-             */
-            zis.closeEntry();
-            printEntry(e, files);
-        }
-    }
-
-    /**
-     * Lists contents of JAR file, via ZipFile.
-     */
-    void list(String fname, String files[]) throws IOException {
-        ZipFile zf = new ZipFile(fname);
-        Enumeration<? extends ZipEntry> zes = zf.entries();
-        while (zes.hasMoreElements()) {
-            printEntry(zes.nextElement(), files);
-        }
-        zf.close();
-    }
-
-    /**
-     * Outputs the class index table to the INDEX.LIST file of the
-     * root jar file.
-     */
-    void dumpIndex(String rootjar, JarIndex index) throws IOException {
-        File jarFile = new File(rootjar);
-        Path jarPath = jarFile.toPath();
-        Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
-        try {
-            if (update(Files.newInputStream(jarPath),
-                       Files.newOutputStream(tmpPath),
-                       null, index)) {
-                try {
-                    Files.move(tmpPath, jarPath, REPLACE_EXISTING);
-                } catch (IOException e) {
-                    throw new IOException(getMsg("error.write.file"), e);
-                }
-            }
-        } finally {
-            Files.deleteIfExists(tmpPath);
-        }
-    }
-
-    private HashSet<String> jarPaths = new HashSet<String>();
-
-    /**
-     * Generates the transitive closure of the Class-Path attribute for
-     * the specified jar file.
-     */
-    List<String> getJarPath(String jar) throws IOException {
-        List<String> files = new ArrayList<String>();
-        files.add(jar);
-        jarPaths.add(jar);
-
-        // take out the current path
-        String path = jar.substring(0, Math.max(0, jar.lastIndexOf('/') + 1));
-
-        // class path attribute will give us jar file name with
-        // '/' as separators, so we need to change them to the
-        // appropriate one before we open the jar file.
-        JarFile rf = new JarFile(jar.replace('/', File.separatorChar));
-
-        if (rf != null) {
-            Manifest man = rf.getManifest();
-            if (man != null) {
-                Attributes attr = man.getMainAttributes();
-                if (attr != null) {
-                    String value = attr.getValue(Attributes.Name.CLASS_PATH);
-                    if (value != null) {
-                        StringTokenizer st = new StringTokenizer(value);
-                        while (st.hasMoreTokens()) {
-                            String ajar = st.nextToken();
-                            if (!ajar.endsWith("/")) {  // it is a jar file
-                                ajar = path.concat(ajar);
-                                /* check on cyclic dependency */
-                                if (! jarPaths.contains(ajar)) {
-                                    files.addAll(getJarPath(ajar));
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        rf.close();
-        return files;
-    }
-
-    /**
-     * Generates class index file for the specified root jar file.
-     */
-    void genIndex(String rootjar, String[] files) throws IOException {
-        List<String> jars = getJarPath(rootjar);
-        int njars = jars.size();
-        String[] jarfiles;
-
-        if (njars == 1 && files != null) {
-            // no class-path attribute defined in rootjar, will
-            // use command line specified list of jars
-            for (int i = 0; i < files.length; i++) {
-                jars.addAll(getJarPath(files[i]));
-            }
-            njars = jars.size();
-        }
-        jarfiles = jars.toArray(new String[njars]);
-        JarIndex index = new JarIndex(jarfiles);
-        dumpIndex(rootjar, index);
-    }
-
-    /**
-     * Prints entry information, if requested.
-     */
-    void printEntry(ZipEntry e, String[] files) throws IOException {
-        if (files == null) {
-            printEntry(e);
-        } else {
-            String name = e.getName();
-            for (String file : files) {
-                if (name.startsWith(file)) {
-                    printEntry(e);
-                    return;
-                }
-            }
-        }
-    }
-
-    /**
-     * Prints entry information.
-     */
-    void printEntry(ZipEntry e) throws IOException {
-        if (vflag) {
-            StringBuilder sb = new StringBuilder();
-            String s = Long.toString(e.getSize());
-            for (int i = 6 - s.length(); i > 0; --i) {
-                sb.append(' ');
-            }
-            sb.append(s).append(' ').append(new Date(e.getTime()).toString());
-            sb.append(' ').append(e.getName());
-            output(sb.toString());
-        } else {
-            output(e.getName());
-        }
-    }
-
-    /**
-     * Prints usage message.
-     */
-    void usageError() {
-        error(getMsg("usage"));
-    }
-
-    /**
-     * A fatal exception has been caught.  No recovery possible
-     */
-    void fatalError(Exception e) {
-        e.printStackTrace();
-    }
-
-    /**
-     * A fatal condition has been detected; message is "s".
-     * No recovery possible
-     */
-    void fatalError(String s) {
-        error(program + ": " + s);
-    }
-
-    /**
-     * Print an output message; like verbose output and the like
-     */
-    protected void output(String s) {
-        out.println(s);
-    }
-
-    /**
-     * Print an error message; like something is broken
-     */
-    protected void error(String s) {
-        err.println(s);
-    }
-
-    /**
-     * Main routine to start program.
-     */
-    public static void main(String args[]) {
-        Main jartool = new Main(System.out, System.err, "jar");
-        System.exit(jartool.run(args) ? 0 : 1);
-    }
-
-    /**
-     * An OutputStream that doesn't send its output anywhere, (but could).
-     * It's here to find the CRC32 of an input file, necessary for STORED
-     * mode in ZIP.
-     */
-    private static class CRC32OutputStream extends java.io.OutputStream {
-        final CRC32 crc = new CRC32();
-        long n = 0;
-
-        CRC32OutputStream() {}
-
-        public void write(int r) throws IOException {
-            crc.update(r);
-            n++;
-        }
-
-        public void write(byte[] b, int off, int len) throws IOException {
-            crc.update(b, off, len);
-            n += len;
-        }
-
-        /**
-         * Updates a ZipEntry which describes the data read by this
-         * output stream, in STORED mode.
-         */
-        public void updateEntry(ZipEntry e) {
-            e.setMethod(ZipEntry.STORED);
-            e.setSize(n);
-            e.setCrc(crc.getValue());
-        }
-    }
-
-    /**
-     * Attempt to create temporary file in the system-provided temporary folder, if failed attempts
-     * to create it in the same folder as the file in parameter (if any)
-     */
-    private File createTemporaryFile(String tmpbase, String suffix) {
-        File tmpfile = null;
-
-        try {
-            tmpfile = File.createTempFile(tmpbase, suffix);
-        } catch (IOException | SecurityException e) {
-            // Unable to create file due to permission violation or security exception
-        }
-        if (tmpfile == null) {
-            // Were unable to create temporary file, fall back to temporary file in the same folder
-            if (fname != null) {
-                try {
-                    File tmpfolder = new File(fname).getAbsoluteFile().getParentFile();
-                    tmpfile = File.createTempFile(fname, ".tmp" + suffix, tmpfolder);
-                } catch (IOException ioe) {
-                    // Last option failed - fall gracefully
-                    fatalError(ioe);
-                }
-            } else {
-                // No options left - we can not compress to stdout without access to the temporary folder
-                fatalError(new IOException(getMsg("error.create.tempfile")));
-            }
-        }
-        return tmpfile;
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 1996, 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.tools.jar;
-
-import java.io.*;
-import java.util.*;
-import java.security.*;
-
-import sun.net.www.MessageHeader;
-import java.util.Base64;
-
-/**
- * This is OBSOLETE. DO NOT USE THIS. Use java.util.jar.Manifest
- * instead. It has to stay here because some apps (namely HJ and HJV)
- * call directly into it.
- *
- * @author David Brown
- * @author Benjamin Renaud
- */
-
-public class Manifest {
-
-    /* list of headers that all pertain to a particular
-     * file in the archive
-     */
-    private Vector<MessageHeader> entries = new Vector<>();
-    private byte[] tmpbuf = new byte[512];
-    /* a hashtable of entries, for fast lookup */
-    private Hashtable<String, MessageHeader> tableEntries = new Hashtable<>();
-
-    static final String[] hashes = {"SHA"};
-    static final byte[] EOL = {(byte)'\r', (byte)'\n'};
-
-    static final boolean debug = false;
-    static final String VERSION = "1.0";
-    static final void debug(String s) {
-        if (debug)
-            System.out.println("man> " + s);
-    }
-
-    public Manifest() {}
-
-    public Manifest(byte[] bytes) throws IOException {
-        this(new ByteArrayInputStream(bytes), false);
-    }
-
-    public Manifest(InputStream is) throws IOException {
-        this(is, true);
-    }
-
-    /**
-     * Parse a manifest from a stream, optionally computing hashes
-     * for the files.
-     */
-    public Manifest(InputStream is, boolean compute) throws IOException {
-        if (!is.markSupported()) {
-            is = new BufferedInputStream(is);
-        }
-        /* do not rely on available() here! */
-        while (true) {
-            is.mark(1);
-            if (is.read() == -1) { // EOF
-                break;
-            }
-            is.reset();
-            MessageHeader m = new MessageHeader(is);
-            if (compute) {
-                doHashes(m);
-            }
-            addEntry(m);
-        }
-    }
-
-    /* recursively generate manifests from directory tree */
-    public Manifest(String[] files) throws IOException {
-        MessageHeader globals = new MessageHeader();
-        globals.add("Manifest-Version", VERSION);
-        String jdkVersion = System.getProperty("java.version");
-        globals.add("Created-By", "Manifest JDK "+jdkVersion);
-        addEntry(globals);
-        addFiles(null, files);
-    }
-
-    public void addEntry(MessageHeader entry) {
-        entries.addElement(entry);
-        String name = entry.findValue("Name");
-        debug("addEntry for name: "+name);
-        if (name != null) {
-            tableEntries.put(name, entry);
-        }
-    }
-
-    public MessageHeader getEntry(String name) {
-        return tableEntries.get(name);
-    }
-
-    public MessageHeader entryAt(int i) {
-        return entries.elementAt(i);
-    }
-
-    public Enumeration<MessageHeader> entries() {
-        return entries.elements();
-    }
-
-    public void addFiles(File dir, String[] files) throws IOException {
-        if (files == null)
-            return;
-        for (int i = 0; i < files.length; i++) {
-            File file;
-            if (dir == null) {
-                file = new File(files[i]);
-            } else {
-                file = new File(dir, files[i]);
-            }
-            if (file.isDirectory()) {
-                addFiles(file, file.list());
-            } else {
-                addFile(file);
-            }
-        }
-    }
-
-    /**
-     * File names are represented internally using "/";
-     * they are converted to the local format for anything else
-     */
-
-    private final String stdToLocal(String name) {
-        return name.replace('/', java.io.File.separatorChar);
-    }
-
-    private final String localToStd(String name) {
-        name = name.replace(java.io.File.separatorChar, '/');
-        if (name.startsWith("./"))
-            name = name.substring(2);
-        else if (name.startsWith("/"))
-            name = name.substring(1);
-        return name;
-    }
-
-    public void addFile(File f) throws IOException {
-        String stdName = localToStd(f.getPath());
-        if (tableEntries.get(stdName) == null) {
-            MessageHeader mh = new MessageHeader();
-            mh.add("Name", stdName);
-            addEntry(mh);
-        }
-    }
-
-    public void doHashes(MessageHeader mh) throws IOException {
-        // If unnamed or is a directory return immediately
-        String name = mh.findValue("Name");
-        if (name == null || name.endsWith("/")) {
-            return;
-        }
-
-
-        /* compute hashes, write over any other "Hash-Algorithms" (?) */
-        for (int j = 0; j < hashes.length; ++j) {
-            InputStream is = new FileInputStream(stdToLocal(name));
-            try {
-                MessageDigest dig = MessageDigest.getInstance(hashes[j]);
-
-                int len;
-                while ((len = is.read(tmpbuf, 0, tmpbuf.length)) != -1) {
-                    dig.update(tmpbuf, 0, len);
-                }
-                mh.set(hashes[j] + "-Digest", Base64.getMimeEncoder().encodeToString(dig.digest()));
-            } catch (NoSuchAlgorithmException e) {
-                throw new JarException("Digest algorithm " + hashes[j] +
-                                       " not available.");
-            } finally {
-                is.close();
-            }
-        }
-    }
-
-    /* Add a manifest file at current position in a stream
-     */
-    public void stream(OutputStream os) throws IOException {
-
-        PrintStream ps;
-        if (os instanceof PrintStream) {
-            ps = (PrintStream) os;
-        } else {
-            ps = new PrintStream(os);
-        }
-
-        /* the first header in the file should be the global one.
-         * It should say "Manifest-Version: x.x"; if not add it
-         */
-        MessageHeader globals = entries.elementAt(0);
-
-        if (globals.findValue("Manifest-Version") == null) {
-            /* Assume this is a user-defined manifest.  If it has a Name: <..>
-             * field, then it is not global, in which case we just add our own
-             * global Manifest-version: <version>
-             * If the first MessageHeader has no Name: <..>, we assume it
-             * is a global header and so prepend Manifest to it.
-             */
-            String jdkVersion = System.getProperty("java.version");
-
-            if (globals.findValue("Name") == null) {
-                globals.prepend("Manifest-Version", VERSION);
-                globals.add("Created-By", "Manifest JDK "+jdkVersion);
-            } else {
-                ps.print("Manifest-Version: "+VERSION+"\r\n"+
-                         "Created-By: "+jdkVersion+"\r\n\r\n");
-            }
-            ps.flush();
-        }
-
-        globals.print(ps);
-
-        for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = entries.elementAt(i);
-            mh.print(ps);
-        }
-    }
-
-    public static boolean isManifestName(String name) {
-
-        // remove leading /
-        if (name.charAt(0) == '/') {
-            name = name.substring(1, name.length());
-        }
-        // case insensitive
-        name = name.toUpperCase();
-
-        if (name.equals("META-INF/MANIFEST.MF")) {
-            return true;
-        }
-        return false;
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,360 +0,0 @@
-/*
- * Copyright (c) 1996, 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.tools.jar;
-
-import java.io.*;
-import java.util.*;
-import java.security.*;
-
-import sun.net.www.MessageHeader;
-import java.util.Base64;
-
-
-import sun.security.pkcs.*;
-import sun.security.x509.AlgorithmId;
-
-/**
- * <p>A signature file as defined in the <a
- * href="manifest.html">Manifest and Signature Format</a>. It has
- * essentially the same structure as a Manifest file in that it is a
- * set of RFC 822 headers (sections). The first section contains meta
- * data relevant to the entire file (i.e "Signature-Version:1.0") and
- * each subsequent section contains data relevant to specific entries:
- * entry sections.
- *
- * <p>Each entry section contains the name of an entry (which must
- * have a counterpart in the manifest). Like the manifest it contains
- * a hash, the hash of the manifest section corresponding to the
- * name. Since the manifest entry contains the hash of the data, this
- * is equivalent to a signature of the data, plus the attributes of
- * the manifest entry.
- *
- * <p>This signature file format deal with PKCS7 encoded DSA signature
- * block. It should be straightforward to extent to support other
- * algorithms.
- *
- * @author      David Brown
- * @author      Benjamin Renaud */
-
-public class SignatureFile {
-
-    /* Are we debugging? */
-    static final boolean debug = false;
-
-    /* list of headers that all pertain to a particular file in the
-     * archive */
-    private Vector<MessageHeader> entries = new Vector<>();
-
-    /* Right now we only support SHA hashes */
-    static final String[] hashes = {"SHA"};
-
-    static final void debug(String s) {
-        if (debug)
-            System.out.println("sig> " + s);
-    }
-
-    /*
-     * The manifest we're working with.  */
-    private Manifest manifest;
-
-    /*
-     * The file name for the file. This is the raw name, i.e. the
-     * extention-less 8 character name (such as MYSIGN) which wil be
-     * used to build the signature filename (MYSIGN.SF) and the block
-     * filename (MYSIGN.DSA) */
-    private String rawName;
-
-    /* The digital signature block corresponding to this signature
-     * file.  */
-    private PKCS7 signatureBlock;
-
-
-    /**
-     * Private constructor which takes a name a given signature
-     * file. The name must be extension-less and less or equal to 8
-     * character in length.  */
-    private SignatureFile(String name) throws JarException {
-
-        entries = new Vector<>();
-
-        if (name != null) {
-            if (name.length() > 8 || name.indexOf('.') != -1) {
-                throw new JarException("invalid file name");
-            }
-            rawName = name.toUpperCase(Locale.ENGLISH);
-        }
-    }
-
-    /**
-     * Private constructor which takes a name a given signature file
-     * and a new file predicate. If it is a new file, a main header
-     * will be added. */
-    private SignatureFile(String name, boolean newFile)
-    throws JarException {
-
-        this(name);
-
-        if (newFile) {
-            MessageHeader globals = new MessageHeader();
-            globals.set("Signature-Version", "1.0");
-            entries.addElement(globals);
-        }
-    }
-
-    /**
-     * Constructs a new Signature file corresponding to a given
-     * Manifest. All entries in the manifest are signed.
-     *
-     * @param manifest the manifest to use.
-     *
-     * @param name for this signature file. This should
-     * be less than 8 characters, and without a suffix (i.e.
-     * without a period in it.
-     *
-     * @exception JarException if an invalid name is passed in.
-     */
-    public SignatureFile(Manifest manifest, String name)
-    throws JarException {
-
-        this(name, true);
-
-        this.manifest = manifest;
-        Enumeration<MessageHeader> enum_ = manifest.entries();
-        while (enum_.hasMoreElements()) {
-            MessageHeader mh = enum_.nextElement();
-            String entryName = mh.findValue("Name");
-            if (entryName != null) {
-                add(entryName);
-            }
-        }
-    }
-
-    /**
-     * Constructs a new Signature file corresponding to a given
-     * Manifest. Specific entries in the manifest are signed.
-     *
-     * @param manifest the manifest to use.
-     *
-     * @param entries the entries to sign.
-     *
-     * @param filename for this signature file. This should
-     * be less than 8 characters, and without a suffix (i.e.
-     * without a period in it.
-     *
-     * @exception JarException if an invalid name is passed in.
-     */
-    public SignatureFile(Manifest manifest, String[] entries,
-                         String filename)
-    throws JarException {
-        this(filename, true);
-        this.manifest = manifest;
-        add(entries);
-    }
-
-    /**
-     * Construct a Signature file from an input stream.
-     *
-     * @exception IOException if an invalid name is passed in or if a
-     * stream exception occurs.
-     */
-    public SignatureFile(InputStream is, String filename)
-    throws IOException {
-        this(filename);
-        while (is.available() > 0) {
-            MessageHeader m = new MessageHeader(is);
-            entries.addElement(m);
-        }
-    }
-
-   /**
-     * Construct a Signature file from an input stream.
-     *
-     * @exception IOException if an invalid name is passed in or if a
-     * stream exception occurs.
-     */
-    public SignatureFile(InputStream is) throws IOException {
-        this(is, null);
-    }
-
-    public SignatureFile(byte[] bytes) throws IOException {
-        this(new ByteArrayInputStream(bytes));
-    }
-
-    /**
-     * Returns the name of the signature file, ending with a ".SF"
-     * suffix */
-    public String getName() {
-        return "META-INF/" + rawName + ".SF";
-    }
-
-    /**
-     * Returns the name of the block file, ending with a block suffix
-     * such as ".DSA". */
-    public String getBlockName() {
-        String suffix = "DSA";
-        if (signatureBlock != null) {
-            SignerInfo info = signatureBlock.getSignerInfos()[0];
-            suffix = info.getDigestEncryptionAlgorithmId().getName();
-            String temp = AlgorithmId.getEncAlgFromSigAlg(suffix);
-            if (temp != null) suffix = temp;
-        }
-        return "META-INF/" + rawName + "." + suffix;
-    }
-
-    /**
-     * Returns the signature block associated with this file.
-     */
-    public PKCS7 getBlock() {
-        return signatureBlock;
-    }
-
-    /**
-     * Sets the signature block associated with this file.
-     */
-    public void setBlock(PKCS7 block) {
-        this.signatureBlock = block;
-    }
-
-    /**
-     * Add a set of entries from the current manifest.
-     */
-    public void add(String[] entries) throws JarException {
-        for (int i = 0; i < entries.length; i++) {
-            add (entries[i]);
-        }
-    }
-
-    /**
-     * Add a specific entry from the current manifest.
-     */
-    public void add(String entry) throws JarException {
-        MessageHeader mh = manifest.getEntry(entry);
-        if (mh == null) {
-            throw new JarException("entry " + entry + " not in manifest");
-        }
-        MessageHeader smh;
-        try {
-            smh = computeEntry(mh);
-        } catch (IOException e) {
-            throw new JarException(e.getMessage());
-        }
-        entries.addElement(smh);
-    }
-
-    /**
-     * Get the entry corresponding to a given name. Returns null if
-     *the entry does not exist.
-     */
-    public MessageHeader getEntry(String name) {
-        Enumeration<MessageHeader> enum_ = entries();
-        while(enum_.hasMoreElements()) {
-            MessageHeader mh = enum_.nextElement();
-            if (name.equals(mh.findValue("Name"))) {
-                return mh;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the n-th entry. The global header is a entry 0.  */
-    public MessageHeader entryAt(int n) {
-        return entries.elementAt(n);
-    }
-
-    /**
-     * Returns an enumeration of the entries.
-     */
-    public Enumeration<MessageHeader> entries() {
-        return entries.elements();
-    }
-
-    /**
-     * Given a manifest entry, computes the signature entry for this
-     * manifest entry.
-     */
-    private MessageHeader computeEntry(MessageHeader mh) throws IOException {
-        MessageHeader smh = new MessageHeader();
-
-        String name = mh.findValue("Name");
-        if (name == null) {
-            return null;
-        }
-        smh.set("Name", name);
-
-        try {
-            for (int i = 0; i < hashes.length; ++i) {
-                MessageDigest dig = getDigest(hashes[i]);
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                PrintStream ps = new PrintStream(baos);
-                mh.print(ps);
-                byte[] headerBytes = baos.toByteArray();
-                byte[] digest = dig.digest(headerBytes);
-                smh.set(hashes[i] + "-Digest", Base64.getMimeEncoder().encodeToString(digest));
-            }
-            return smh;
-        } catch (NoSuchAlgorithmException e) {
-            throw new JarException(e.getMessage());
-        }
-    }
-
-    private Hashtable<String, MessageDigest> digests = new Hashtable<>();
-
-    private MessageDigest getDigest(String algorithm)
-    throws NoSuchAlgorithmException {
-        MessageDigest dig = digests.get(algorithm);
-        if (dig == null) {
-            dig = MessageDigest.getInstance(algorithm);
-            digests.put(algorithm, dig);
-        }
-        dig.reset();
-        return dig;
-    }
-
-
-    /**
-     * Add a signature file at current position in a stream
-     */
-    public void stream(OutputStream os) throws IOException {
-
-        /* the first header in the file should be the global one.
-         * It should say "SignatureFile-Version: x.x"; barf if not
-         */
-        MessageHeader globals = entries.elementAt(0);
-        if (globals.findValue("Signature-Version") == null) {
-            throw new JarException("Signature file requires " +
-                            "Signature-Version: 1.0 in 1st header");
-        }
-
-        PrintStream ps = new PrintStream(os);
-        globals.print(ps);
-
-        for (int i = 1; i < entries.size(); ++i) {
-            MessageHeader mh = entries.elementAt(i);
-            mh.print(ps);
-        }
-    }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=\
-     can''t open: {0} 
-error.illegal.option=\
-        Illegal option: {0}
-error.bad.option=\
-        One of options -{ctxu} must be specified.
-error.bad.cflag=\
-        'c' flag requires manifest or input files to be specified!
-error.bad.uflag=\
-        'u' flag requires manifest, 'e' flag or input files to be specified!
-error.bad.eflag=\
-	'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
-	 together!
-error.nosuch.fileordir=\
-        {0} : no such file or directory
-error.write.file=\
-        Error in writing existing jar file
-error.create.dir=\
-        {0} : could not create directory
-error.incorrect.length=\
-        incorrect length while processing: {0}
-error.create.tempfile=\
-        Could not create a temporary file
-out.added.manifest=\
-        added manifest
-out.update.manifest=\
-        updated manifest
-out.ignore.entry=\
-        ignoring entry {0}
-out.adding=\
-        adding: {0}
-out.deflated=\
-        (deflated {0}%)
-out.stored=\
-        (stored 0%)
-out.create=\
-        \ \ created: {0}
-out.extracted=\
-        extracted: {0}
-out.inflated=\
-        \ inflated: {0}
-out.size=\
-        (in = {0}) (out= {1})
-
-usage=\
-Usage: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
-Options:\n\
-\ \   -c  create new archive\n\
-\ \   -t  list table of contents for archive\n\
-\ \   -x  extract named (or all) files from archive\n\
-\ \   -u  update existing archive\n\
-\ \   -v  generate verbose output on standard output\n\
-\ \   -f  specify archive file name\n\
-\ \   -m  include manifest information from specified manifest file\n\
-\ \   -n  perform Pack200 normalization after creating a new archive\n\
-\ \   -e  specify application entry point for stand-alone application \n\
-\ \       bundled into an executable jar file\n\
-\ \   -0  store only; use no ZIP compression\n\
-\ \   -M  do not create a manifest file for the entries\n\
-\ \   -i  generate index information for the specified jar files\n\
-\ \   -C  change to the specified directory and include the following file\n\
-If any file is a directory then it is processed recursively.\n\
-The manifest file name, the archive file name and the entry point name are\n\
-specified in the same order as the 'm', 'f' and 'e' flags.\n\n\
-Example 1: to archive two class files into an archive called classes.jar: \n\
-\ \      jar cvf classes.jar Foo.class Bar.class \n\
-Example 2: use an existing manifest file 'mymanifest' and archive all the\n\
-\ \          files in the foo/ directory into 'classes.jar': \n\
-\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=\u00D6ffnen nicht m\u00F6glich: {0} 
-error.illegal.option=Ung\u00FCltige Option: {0}
-error.bad.option=Eine der Optionen -{ctxu} muss angegeben werden.
-error.bad.cflag=Kennzeichen "c" erfordert Angabe von Manifest oder Eingabedateien.
-error.bad.uflag=Kennzeichen "u" erfordert Angabe von Manifest, Kennzeichen "e" oder Eingabedateien.
-error.bad.eflag=Kennzeichen "e" und Manifest mit dem Attribut "Main-Class" k\u00F6nnen nicht zusammen angegeben\nwerden.
-error.nosuch.fileordir={0}: Datei oder Verzeichnis nicht vorhanden
-error.write.file=Fehler beim Schreiben in vorhandener JAR-Datei
-error.create.dir={0}: Verzeichnis konnte nicht erstellt werden
-error.incorrect.length=Falsche L\u00E4nge bei der Verarbeitung: {0}
-error.create.tempfile=Es konnte keine tempor\u00E4re Datei erstellt werden
-out.added.manifest=Manifest wurde hinzugef\u00FCgt
-out.update.manifest=Manifest wurde aktualisiert
-out.ignore.entry=Eintrag {0} wird ignoriert
-out.adding={0} wird hinzugef\u00FCgt
-out.deflated=({0} % verkleinert)
-out.stored=(0 % gespeichert)
-out.create=\  erstellt: {0}
-out.extracted=extrahiert: {0}
-out.inflated=\ vergr\u00F6\u00DFert: {0}
-out.size=(ein = {0}) (aus = {1})
-
-usage=Verwendung: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien ...\nOptionen:\n    -c  Neues Archiv erstellen\n    -t  Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n    -x  Benannte (oder alle) Dateien aus dem Archiv extrahieren\n    -u  Vorhandenes Archiv aktualisieren\n    -v  Ausgabe im Verbose-Modus aus Standard-Ausgabe generieren\n    -f  Dateinamen f\u00FCr Archiv angeben\n    -m  Manifest-Informationen aus angegebener Manifest-Datei einschlie\u00DFen\n    -n  Pack200-Normalisierung nach Erstellung eines neuen Archivs ausf\u00FChren\n    -e  Anwendungs-Einstiegspunkt f\u00FCr alleinstehende Anwendung angeben\n        in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt\n    -0  nur speichern; keine ZIP-Komprimierung verwenden\n    -M  keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n    -i  Index-Informationen f\u00FCr die angegebenen JAR-Dateien generieren\n    -C  zu angegebenem Verzeichnis wechseln und die folgende Datei einschlie\u00DFen\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nDie Namen der Manifest-Datei, der Archiv-Datei und des Einstiegspunkts sind\nin derselben Reihenfolge wie die Kennzeichen f\u00FCr "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren von zwei Klassendateien in einem Archiv mit dem Namen "classes.jar": \n       jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden einer vorhandenen Manifest-Datei mit dem Namen "mymanifest" und Archivieren aller\n           Dateien im Verzeichnis mit dem Namen "foo/" in die Archiv-Datei "classes.jar": \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=no se puede abrir: {0} 
-error.illegal.option=Opci\u00F3n no permitida: {0}
-error.bad.option=Se debe especificar una de las opciones -{ctxu}.
-error.bad.cflag=El indicador 'c' necesita la especificaci\u00F3n de archivos de manifiesto o de entrada.
-error.bad.uflag=El indicador 'u' necesita la especificaci\u00F3n de archivos de manifiesto, de entrada o indicador 'e'.
-error.bad.eflag=El indicador 'e' y el manifiesto con el atributo 'Main-Class' no pueden especificarse \na la vez.
-error.nosuch.fileordir={0} : no existe tal archivo o directorio
-error.write.file=Error al escribir un archivo jar existente
-error.create.dir={0} : no se ha podido crear el directorio
-error.incorrect.length=longitud incorrecta al procesar: {0}
-error.create.tempfile=No se ha podido crear el archivo temporal
-out.added.manifest=manifiesto agregado
-out.update.manifest=manifiesto actualizado
-out.ignore.entry=ignorando entrada {0}
-out.adding=agregando: {0}
-out.deflated=(desinflado {0}%)
-out.stored=(almacenado 0%)
-out.create=\  creado: {0}
-out.extracted=extra\u00EDdo: {0}
-out.inflated=\ inflado: {0}
-out.size=(entrada = {0}) (salida = {1})
-
-usage=Sintaxis: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] archivos...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x  extraer el archive mencionado (o todos) del archivo\n    -u  actualizar archive existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archive de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n    -n  realizar normalizaci\u00F3n de Pack200 despu\u00E9s de crear un nuevo archivo\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archive jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -M  no crear un archive de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=impossible d''ouvrir : {0} 
-error.illegal.option=Option non admise : {0}
-error.bad.option=Une des options -{ctxu} doit \u00EAtre sp\u00E9cifi\u00E9e.
-error.bad.cflag=L'indicateur c requiert la sp\u00E9cification d'un fichier manifeste ou d'un fichier d'entr\u00E9e.
-error.bad.uflag=L'indicateur u requiert la sp\u00E9cification d'un fichier manifeste, d'un fichier d'entr\u00E9e ou d'un indicateur e.
-error.bad.eflag=L'indicateur e et le fichier manifeste portant l'attribut Main-Class ne peuvent pas \u00EAtre sp\u00E9cifi\u00E9s \nensemble.
-error.nosuch.fileordir={0} : fichier ou r\u00E9pertoire introuvable
-error.write.file=Erreur lors de l'\u00E9criture d'un fichier JAR existant
-error.create.dir={0} : impossible de cr\u00E9er le r\u00E9pertoire
-error.incorrect.length=longueur incorrecte lors du traitement de : {0}
-error.create.tempfile=Impossible de cr\u00E9er un fichier temporaire
-out.added.manifest=manifeste ajout\u00E9
-out.update.manifest=manifeste mis \u00E0 jour
-out.ignore.entry=entr\u00E9e {0} ignor\u00E9e
-out.adding=ajout : {0}
-out.deflated=(compression : {0} %)
-out.stored=(stockage : 0 %)
-out.create=\  cr\u00E9\u00E9 : {0}
-out.extracted=extrait : {0}
-out.inflated=\ d\u00E9compress\u00E9 : {0}
-out.size=(entr\u00E9e = {0}) (sortie = {1})
-
-usage=Syntaxe : jar {ctxui}[vfmn0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n    -c  cr\u00E9e une archive\n    -t  affiche la table des mati\u00E8res de l'archive\n    -x  extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n    -u  met \u00E0 jour l'archive existante\n    -v  g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n    -f  sp\u00E9cifie le nom du fichier archive\n    -m  inclut les informations de manifeste \u00E0 partir du fichier manifeste sp\u00E9cifi\u00E9\n    -n  effectue une normalisation Pack200 apr\u00E8s la cr\u00E9ation d'une archive\n    -e  sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n        int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n    -0  stockage uniquement, pas de compression ZIP\n    -M  ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n    -i  g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n    -C  passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier d'archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n       jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n           fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n       jar cvfm classes.jar monmanifeste -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=impossibile aprire: {0} 
-error.illegal.option=Opzione non valida: {0}
-error.bad.option=\u00C8 necessario specificare una delle opzioni -{ctxu}.
-error.bad.cflag=Per il flag 'c' \u00E8 necessario specificare file manifest o di input.
-error.bad.uflag=Per il flag 'u' \u00E8 necessario specificare il flag 'e' oppure file manifest o di input.
-error.bad.eflag=Il flag 'e' e il manifest con l'attributo 'Main-Class' non possono essere specificati\ninsieme.
-error.nosuch.fileordir={0} : file o directory inesistente
-error.write.file=Errore durante la scrittura del file jar esistente
-error.create.dir={0} : impossibile creare la directory
-error.incorrect.length=lunghezza non valida durante l''elaborazione: {0}
-error.create.tempfile=Impossibile creare il file temporaneo.
-out.added.manifest=aggiunto manifest
-out.update.manifest=aggiornato manifest
-out.ignore.entry=la voce {0} sar\u00E0 ignorata
-out.adding=aggiunta in corso di: {0}
-out.deflated=(compresso {0}%)
-out.stored=(memorizzato 0%)
-out.create=\     creato: {0}
-out.extracted=estratto: {0}
-out.inflated=\ decompresso: {0}
-out.size=(in = {0}) (out = {1})
-
-usage=Uso: jar {ctxui}[vfmn0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -n  esegue la normalizzazione Pack200 dopo la creazione di un nuovo archivio\n    -e  specifica il punto di ingresso per l'applicazione standalone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open={0}\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093 
-error.illegal.option=\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
-error.bad.option=\u30AA\u30D7\u30B7\u30E7\u30F3-{ctxu}\u306E\u3046\u3061\u306E1\u3064\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-error.bad.cflag=\u30D5\u30E9\u30B0'c'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002
-error.bad.uflag=\u30D5\u30E9\u30B0'u'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304B'e'\u30D5\u30E9\u30B0\u3001\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002
-error.bad.eflag='e'\u30D5\u30E9\u30B0\u3068'Main-Class'\u5C5E\u6027\u3092\u6301\u3064\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u540C\u6642\u306B\n\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002
-error.nosuch.fileordir={0}\u3068\u3044\u3046\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u3042\u308A\u307E\u305B\u3093
-error.write.file=\u65E2\u5B58jar\u30D5\u30A1\u30A4\u30EB\u306E\u66F8\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-error.create.dir=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-error.incorrect.length={0}\u306E\u51E6\u7406\u4E2D\u306B\u4E0D\u6B63\u306A\u9577\u3055\u304C\u3042\u308A\u307E\u3057\u305F
-error.create.tempfile=\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-out.added.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F
-out.update.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F
-out.ignore.entry=\u30A8\u30F3\u30C8\u30EA{0}\u3092\u7121\u8996\u3057\u307E\u3059
-out.adding={0}\u3092\u8FFD\u52A0\u4E2D\u3067\u3059
-out.deflated=({0}%\u53CE\u7E2E\u3055\u308C\u307E\u3057\u305F)
-out.stored=(0%\u683C\u7D0D\u3055\u308C\u307E\u3057\u305F)
-out.create=\  {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
-out.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F
-out.inflated=\ {0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
-out.size=(\u5165={0})(\u51FA={1})
-
-usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n    -c  \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n    -t  \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n    -x  \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n    -u  \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n    -v  \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n    -f  \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n    -m  \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n    -n  \u65B0\u898F\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u4F5C\u6210\u5F8C\u306BPack200\u6B63\u898F\u5316\u3092\u5B9F\u884C\u3059\u308B\n    -e  \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\n        \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n    -0  \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n    -M  \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n    -i  \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n    -C  \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B: \n       jar cvf classes.jar Foo.class Bar.class \n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n           \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=\uC5F4 \uC218 \uC5C6\uC74C: {0} 
-error.illegal.option=\uC798\uBABB\uB41C \uC635\uC158: {0}
-error.bad.option=\uC635\uC158 -{ctxu} \uC911 \uD558\uB098\uB97C \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
-error.bad.cflag='c' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4!
-error.bad.uflag='u' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest, 'e' \uD50C\uB798\uADF8 \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4!
-error.bad.eflag='e' \uD50C\uB798\uADF8 \uBC0F Manifest\uB97C 'Main-Class' \uC18D\uC131\uACFC \uD568\uAED8 \uC9C0\uC815\uD560 \uC218\n\uC5C6\uC2B5\uB2C8\uB2E4!
-error.nosuch.fileordir={0}: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
-error.write.file=\uAE30\uC874 jar \uD30C\uC77C\uC5D0 \uC4F0\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
-error.create.dir={0}: \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-error.incorrect.length=\uCC98\uB9AC \uC911 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uAE38\uC774\uAC00 \uBC1C\uACAC\uB428: {0}
-error.create.tempfile=\uC784\uC2DC \uD30C\uC77C\uC744 \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-out.added.manifest=Manifest\uB97C \uCD94\uAC00\uD568
-out.update.manifest=Manifest\uB97C \uC5C5\uB370\uC774\uD2B8\uD568
-out.ignore.entry={0} \uD56D\uBAA9\uC744 \uBB34\uC2DC\uD558\uB294 \uC911
-out.adding=\uCD94\uAC00\uD558\uB294 \uC911: {0}
-out.deflated=({0}%\uB97C \uAC10\uC18C\uD568)
-out.stored=(0%\uB97C \uC800\uC7A5\uD568)
-out.create=\  \uC0DD\uC131\uB428: {0}
-out.extracted=\uCD94\uCD9C\uB428: {0}
-out.inflated=\ \uC99D\uAC00\uB428: {0}
-out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
-
-usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n    -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n    -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n    -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n    -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n    -n  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD55C \uD6C4 Pack200 \uC815\uADDC\uD654\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n    -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n        \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -0  \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n           foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvfm classes.jar mymanifest -C foo/ .
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=n\u00E3o \u00E9 poss\u00EDvel abrir: {0} 
-error.illegal.option=Op\u00E7\u00E3o inv\u00E1lida: {0}
-error.bad.option=Uma das op\u00E7\u00F5es -{ctxu} deve ser especificada.
-error.bad.cflag=flag 'c' requer que os arquivos de manifesto ou entrada sejam especificados!
-error.bad.uflag=o flag 'u' requer que arquivos de manifesto, o flag 'e' ou arquivos de entrada sejam especificados!
-error.bad.eflag=o flag 'e' e manifesto com o atributo 'Main-Class' n\u00E3o podem ser especificados \njuntos!
-error.nosuch.fileordir={0} : n\u00E3o h\u00E1 tal arquivo ou diret\u00F3rio
-error.write.file=Erro ao gravar o arquivo jar existente
-error.create.dir={0} : n\u00E3o foi poss\u00EDvel criar o diret\u00F3rio
-error.incorrect.length=largura incorreta durante o processamento: {0}
-error.create.tempfile=N\u00E3o foi poss\u00EDvel criar um arquivo tempor\u00E1rio
-out.added.manifest=manifesto adicionado
-out.update.manifest=manifesto atualizado
-out.ignore.entry=ignorando entrada {0}
-out.adding=adicionando: {0}
-out.deflated=(compactado {0}%)
-out.stored=(armazenado 0%)
-out.create=\  criado: {0}
-out.extracted=extra\u00EDdo: {0}
-out.inflated=\ inflado: {0}
-out.size=(entrada = {0}) (sa\u00EDda= {1})
-
-usage=Uso: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n    -c  cria novo arquivo compactado\n    -t  lista o sum\u00E1rio do arquivo compactado\n    -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n    -u  atualiza o arquivo compactado existente\n    -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n    -f  especifica o nome do arquivo do arquivo compactado\n    -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n    -n   executa a normaliza\u00E7\u00E3o Pack200 ap\u00F3s a cria\u00E7\u00E3o de um novo arquivo compactado\n    -e  especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o stand-alone \n        empacotada em um arquivo jar execut\u00E1vel\n    -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n    -M  n\u00E3o cria um arquivo de manifesto para as entradas\n    -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n    -C  passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n           arquivos no diret\u00F3rio foo/ na 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=kan inte \u00F6ppna: {0} 
-error.illegal.option=Otill\u00E5tet alternativ: {0}
-error.bad.option=Ett av alternativen -{ctxu} m\u00E5ste anges.
-error.bad.cflag=f\u00F6r c-flaggan m\u00E5ste manifest- eller indatafiler anges.
-error.bad.uflag=f\u00F6r u-flaggan m\u00E5ste manifest-, e-flagg- eller indatafiler anges.
-error.bad.eflag=e-flaggan och manifest med attributet Main-Class kan inte anges \ntillsammans.
-error.nosuch.fileordir={0} : det finns ingen s\u00E5dan fil eller katalog
-error.write.file=Det uppstod ett fel vid skrivning till befintlig jar-fil.
-error.create.dir={0} : kunde inte skapa n\u00E5gon katalog
-error.incorrect.length=ogiltig l\u00E4ngd vid bearbetning: {0}
-error.create.tempfile=Kunde inte skapa en tillf\u00E4llig fil
-out.added.manifest=tillagt manifestfil
-out.update.manifest=uppdaterat manifest
-out.ignore.entry=ignorerar posten {0}
-out.adding=l\u00E4gger till: {0}
-out.deflated=({0}% packat)
-out.stored=(0% lagrat)
-out.create=\  skapad: {0}
-out.extracted=extraherat: {0}
-out.inflated=\ uppackat: {0}
-out.size=(in = {0}) (ut = {1})
-
-usage=Syntax: jar {ctxui}[vfmn0Me] [jar-fil] [manifestfil] [startpunkt] [-C katalog] filer ...\nAlternativ:\n    -c  skapa nytt arkiv\n    -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n    -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n    -u  uppdatera befintligt arkiv\n    -v  generera utf\u00F6rliga utdata vid standardutmatning\n    -f  ange arkivfilens namn\n    -m  inkludera manifestinformation fr\u00E5n angivet manifest\n    -n  utf\u00F6r Pack200-normalisering efter att ha skapat ett nytt arkiv\n    -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n        som medf\u00F6ljer i en jar-programfil\n    -0  endast lagra  (ingen zip-komprimering)\n    -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n    -i  generera indexinformation f\u00F6r de angivna jar-filerna\n    -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges\ni samma ordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n           filer fr\u00E5n katalogen foo/ i classes.jar: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=\u65E0\u6CD5\u6253\u5F00: {0} 
-error.illegal.option=\u975E\u6CD5\u9009\u9879: {0}
-error.bad.option=\u5FC5\u987B\u6307\u5B9A {ctxu} \u4E2D\u7684\u4EFB\u4E00\u9009\u9879\u3002
-error.bad.cflag='c' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355\u6216\u8F93\u5165\u6587\u4EF6!
-error.bad.uflag='u' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355, 'e' \u6807\u8BB0\u6216\u8F93\u5165\u6587\u4EF6!
-error.bad.eflag=\u4E0D\u80FD\u540C\u65F6\u6307\u5B9A 'e' \u6807\u8BB0\u548C\u5177\u6709 'Main-Class' \u5C5E\u6027\u7684\n\u6E05\u5355!
-error.nosuch.fileordir={0}: \u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6\u6216\u76EE\u5F55
-error.write.file=\u5199\u5165\u73B0\u6709\u7684 jar \u6587\u4EF6\u65F6\u51FA\u9519
-error.create.dir={0}: \u65E0\u6CD5\u521B\u5EFA\u76EE\u5F55
-error.incorrect.length=\u5904\u7406\u65F6\u9047\u5230\u4E0D\u6B63\u786E\u7684\u957F\u5EA6: {0}
-error.create.tempfile=\u65E0\u6CD5\u521B\u5EFA\u4E34\u65F6\u6587\u4EF6
-out.added.manifest=\u5DF2\u6DFB\u52A0\u6E05\u5355
-out.update.manifest=\u5DF2\u66F4\u65B0\u6E05\u5355
-out.ignore.entry=\u6B63\u5728\u5FFD\u7565\u6761\u76EE{0}
-out.adding=\u6B63\u5728\u6DFB\u52A0: {0}
-out.deflated=(\u538B\u7F29\u4E86 {0}%)
-out.stored=(\u5B58\u50A8\u4E86 0%)
-out.create=\  \u5DF2\u521B\u5EFA: {0}
-out.extracted=\u5DF2\u63D0\u53D6: {0}
-out.inflated=\  \u5DF2\u89E3\u538B: {0}
-out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
-
-usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879:\n    -c  \u521B\u5EFA\u65B0\u6863\u6848\n    -t  \u5217\u51FA\u6863\u6848\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u6863\u6848\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u6863\u6848\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -n  \u521B\u5EFA\u65B0\u6863\u6848\u540E\u6267\u884C Pack200 \u89C4\u8303\u5316\n    -e  \u4E3A\u7ED1\u5B9A\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u4EFB\u4F55 ZIP \u538B\u7F29\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u4EE5\u4E0B\u6587\u4EF6\n\u5982\u679C\u4EFB\u4F55\u6587\u4EF6\u4E3A\u76EE\u5F55, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u6863\u6848\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u6863\u6848\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 1999, 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.
-#
-
-error.cant.open=\u7121\u6CD5\u958B\u555F: {0} 
-error.illegal.option=\u7121\u6548\u7684\u9078\u9805: {0}
-error.bad.option=\u5176\u4E2D\u4E00\u500B\u9078\u9805 -{ctxu} \u5FC5\u9808\u52A0\u4EE5\u6307\u5B9A\u3002
-error.bad.cflag='c' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u6216\u8F38\u5165\u6A94\u6848\uFF01
-error.bad.uflag='u' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u3001'e' \u65D7\u6A19\u6216\u8F38\u5165\u6A94\u6848\uFF01
-error.bad.eflag=\u7121\u6CD5\u540C\u6642\u6307\u5B9A 'e' \u65D7\u6A19\u548C\u5177\u6709 'Main-Class' \u5C6C\u6027\u7684\n\u8CC7\u8A0A\u6E05\u55AE\uFF01
-error.nosuch.fileordir={0} : \u6C92\u6709\u9019\u985E\u6A94\u6848\u6216\u76EE\u9304
-error.write.file=\u5BEB\u5165\u73FE\u6709\u7684 jar \u6A94\u6848\u6642\u767C\u751F\u932F\u8AA4
-error.create.dir={0} : \u7121\u6CD5\u5EFA\u7ACB\u76EE\u9304
-error.incorrect.length=\u8655\u7406 {0} \u6642\u9577\u5EA6\u4E0D\u6B63\u78BA
-error.create.tempfile=\u7121\u6CD5\u5EFA\u7ACB\u66AB\u5B58\u6A94\u6848
-out.added.manifest=\u5DF2\u65B0\u589E\u8CC7\u8A0A\u6E05\u55AE
-out.update.manifest=\u5DF2\u66F4\u65B0\u8CC7\u8A0A\u6E05\u55AE
-out.ignore.entry=\u5FFD\u7565\u9805\u76EE {0}
-out.adding=\u65B0\u589E: {0}
-out.deflated=(\u58D3\u7E2E {0}%)
-out.stored=(\u5132\u5B58 0%)
-out.create=\  \u5EFA\u7ACB: {0}
-out.extracted=\u64F7\u53D6: {0}
-out.inflated=\ \u64F4\u5C55: {0}
-out.size=\ (\u8B80={0})(\u5BEB={1})
-
-usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n    -c  \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n    -t  \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n    -x  \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n    -u  \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n    -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n    -f  \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n    -m  \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n    -n  \u5728\u5EFA\u7ACB\u65B0\u6B78\u6A94\u4E4B\u5F8C\u57F7\u884C Pack200 \u6B63\u898F\u5316\n    -e  \u70BA\u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\u7684\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\n        \u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n    -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n    -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n    -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n    -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n           foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * 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 com.sun.jarsigner;
+
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+
+/**
+ * This class defines a content signing service.
+ * Implementations must be instantiable using a zero-argument constructor.
+ *
+ * @since 1.5
+ * @author Vincent Ryan
+ */
+
+@jdk.Exported
+public abstract class ContentSigner {
+
+    /**
+     * Generates a PKCS #7 signed data message.
+     * This method is used when the signature has already been generated.
+     * The signature, the signer's details, and optionally a signature
+     * timestamp and the content that was signed, are all packaged into a
+     * signed data message.
+     *
+     * @param parameters The non-null input parameters.
+     * @param omitContent true if the content should be omitted from the
+     *         signed data message. Otherwise the content is included.
+     * @param applyTimestamp true if the signature should be timestamped.
+     *         Otherwise timestamping is not performed.
+     * @return A PKCS #7 signed data message.
+     * @throws NoSuchAlgorithmException The exception is thrown if the signature
+     *         algorithm is unrecognised.
+     * @throws CertificateException The exception is thrown if an error occurs
+     *         while processing the signer's certificate or the TSA's
+     *         certificate.
+     * @throws IOException The exception is thrown if an error occurs while
+     *         generating the signature timestamp or while generating the signed
+     *         data message.
+     * @throws NullPointerException The exception is thrown if parameters is
+     *         null.
+     */
+    public abstract byte[] generateSignedData(
+        ContentSignerParameters parameters, boolean omitContent,
+        boolean applyTimestamp)
+            throws NoSuchAlgorithmException, CertificateException, IOException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2003, 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 com.sun.jarsigner;
+
+import java.net.URI;
+import java.security.cert.X509Certificate;
+import java.util.zip.ZipFile;
+
+/**
+ * This interface encapsulates the parameters for a ContentSigner object.
+ *
+ * @since 1.5
+ * @author Vincent Ryan
+ */
+@jdk.Exported
+public interface ContentSignerParameters {
+
+    /**
+     * Retrieves the command-line arguments passed to the jarsigner tool.
+     *
+     * @return The command-line arguments. May be null.
+     */
+    public String[] getCommandLine();
+
+    /**
+     * Retrieves the identifier for a Timestamping Authority (TSA).
+     *
+     * @return The TSA identifier. May be null.
+     */
+    public URI getTimestampingAuthority();
+
+    /**
+     * Retrieves the certificate for a Timestamping Authority (TSA).
+     *
+     * @return The TSA certificate. May be null.
+     */
+    public X509Certificate getTimestampingAuthorityCertificate();
+
+    /**
+     * Retrieves the TSAPolicyID for a Timestamping Authority (TSA).
+     *
+     * @return The TSAPolicyID. May be null.
+     */
+    public default String getTSAPolicyID() {
+        return null;
+    }
+
+    /**
+     * Retreives the message digest algorithm that is used to generate
+     * the message imprint to be sent to the TSA server.
+     *
+     * @since 1.9
+     * @return The non-null string of the message digest algorithm name.
+     */
+    public default String getTSADigestAlg() {
+        return "SHA-256";
+    }
+
+    /**
+     * Retrieves the JAR file's signature.
+     *
+     * @return The non-null array of signature bytes.
+     */
+    public byte[] getSignature();
+
+    /**
+     * Retrieves the name of the signature algorithm.
+     *
+     * @return The non-null string name of the signature algorithm.
+     */
+    public String getSignatureAlgorithm();
+
+    /**
+     * Retrieves the signer's X.509 certificate chain.
+     *
+     * @return The non-null array of X.509 public-key certificates.
+     */
+    public X509Certificate[] getSignerCertificateChain();
+
+    /**
+     * Retrieves the content that was signed.
+     * The content is the JAR file's signature file.
+     *
+     * @return The content bytes. May be null.
+     */
+    public byte[] getContent();
+
+    /**
+     * Retrieves the original source ZIP file before it was signed.
+     *
+     * @return The original ZIP file. May be null.
+     */
+    public ZipFile getSource();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+/**
+ * This package comprises the interfaces and classes used to define the
+ * signing mechanism used by the <tt>jarsigner</tt> tool.
+ * <p>
+ * Clients may override the default signing mechanism of the <tt>jarsigner</tt>
+ * tool by supplying an alternative implementation of
+ * {@link com.sun.jarsigner.ContentSigner}.
+ */
+
+@jdk.Exported
+package com.sun.jarsigner;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,2571 @@
+/*
+ * 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 sun.security.tools.jarsigner;
+
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+import java.util.jar.*;
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.Collator;
+import java.text.MessageFormat;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.security.cert.CertificateException;
+import java.security.*;
+import java.lang.reflect.Constructor;
+
+import com.sun.jarsigner.ContentSigner;
+import com.sun.jarsigner.ContentSignerParameters;
+import java.net.SocketTimeoutException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.cert.CertPath;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.PKIXParameters;
+import java.security.cert.TrustAnchor;
+import java.util.Map.Entry;
+import sun.security.tools.KeyStoreUtil;
+import sun.security.tools.PathList;
+import sun.security.x509.*;
+import sun.security.util.*;
+import java.util.Base64;
+
+
+/**
+ * <p>The jarsigner utility.
+ *
+ * The exit codes for the main method are:
+ *
+ * 0: success
+ * 1: any error that the jar cannot be signed or verified, including:
+ *      keystore loading error
+ *      TSP communication error
+ *      jarsigner command line error...
+ * otherwise: error codes from -strict
+ *
+ * @author Roland Schemers
+ * @author Jan Luehe
+ */
+
+public class Main {
+
+    // for i18n
+    private static final java.util.ResourceBundle rb =
+        java.util.ResourceBundle.getBundle
+        ("sun.security.tools.jarsigner.Resources");
+    private static final Collator collator = Collator.getInstance();
+    static {
+        // this is for case insensitive string comparisions
+        collator.setStrength(Collator.PRIMARY);
+    }
+
+    private static final String META_INF = "META-INF/";
+
+    private static final Class<?>[] PARAM_STRING = { String.class };
+
+    private static final String NONE = "NONE";
+    private static final String P11KEYSTORE = "PKCS11";
+
+    private static final long SIX_MONTHS = 180*24*60*60*1000L; //milliseconds
+
+    // Attention:
+    // This is the entry that get launched by the security tool jarsigner.
+    public static void main(String args[]) throws Exception {
+        Main js = new Main();
+        js.run(args);
+    }
+
+    static final String VERSION = "1.0";
+
+    static final int IN_KEYSTORE = 0x01;        // signer is in keystore
+    static final int IN_SCOPE = 0x02;
+    static final int NOT_ALIAS = 0x04;          // alias list is NOT empty and
+                                                // signer is not in alias list
+    static final int SIGNED_BY_ALIAS = 0x08;    // signer is in alias list
+
+    X509Certificate[] certChain;    // signer's cert chain (when composing)
+    PrivateKey privateKey;          // private key
+    KeyStore store;                 // the keystore specified by -keystore
+                                    // or the default keystore, never null
+
+    String keystore; // key store file
+    boolean nullStream = false; // null keystore input stream (NONE)
+    boolean token = false; // token-based keystore
+    String jarfile;  // jar files to sign or verify
+    String alias;    // alias to sign jar with
+    List<String> ckaliases = new ArrayList<>(); // aliases in -verify
+    char[] storepass; // keystore password
+    boolean protectedPath; // protected authentication path
+    String storetype; // keystore type
+    String providerName; // provider name
+    Vector<String> providers = null; // list of providers
+    // arguments for provider constructors
+    HashMap<String,String> providerArgs = new HashMap<>();
+    char[] keypass; // private key password
+    String sigfile; // name of .SF file
+    String sigalg; // name of signature algorithm
+    String digestalg = "SHA-256"; // name of digest algorithm
+    String signedjar; // output filename
+    String tsaUrl; // location of the Timestamping Authority
+    String tsaAlias; // alias for the Timestamping Authority's certificate
+    String altCertChain; // file to read alternative cert chain from
+    String tSAPolicyID;
+    String tSADigestAlg = "SHA-256";
+    boolean verify = false; // verify the jar
+    String verbose = null; // verbose output when signing/verifying
+    boolean showcerts = false; // show certs when verifying
+    boolean debug = false; // debug
+    boolean signManifest = true; // "sign" the whole manifest
+    boolean externalSF = true; // leave the .SF out of the PKCS7 block
+    boolean strict = false;  // treat warnings as error
+
+    // read zip entry raw bytes
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
+    private byte[] buffer = new byte[8192];
+    private ContentSigner signingMechanism = null;
+    private String altSignerClass = null;
+    private String altSignerClasspath = null;
+    private ZipFile zipFile = null;
+
+    // Informational warnings
+    private boolean hasExpiringCert = false;
+    private boolean noTimestamp = false;
+    private Date expireDate = new Date(0L);     // used in noTimestamp warning
+
+    // Severe warnings
+    private boolean hasExpiredCert = false;
+    private boolean notYetValidCert = false;
+    private boolean chainNotValidated = false;
+    private boolean notSignedByAlias = false;
+    private boolean aliasNotInStore = false;
+    private boolean hasUnsignedEntry = false;
+    private boolean badKeyUsage = false;
+    private boolean badExtendedKeyUsage = false;
+    private boolean badNetscapeCertType = false;
+
+    CertificateFactory certificateFactory;
+    CertPathValidator validator;
+    PKIXParameters pkixParameters;
+
+    public void run(String args[]) {
+        try {
+            args = parseArgs(args);
+
+            // Try to load and install the specified providers
+            if (providers != null) {
+                ClassLoader cl = ClassLoader.getSystemClassLoader();
+                Enumeration<String> e = providers.elements();
+                while (e.hasMoreElements()) {
+                    String provName = e.nextElement();
+                    Class<?> provClass;
+                    if (cl != null) {
+                        provClass = cl.loadClass(provName);
+                    } else {
+                        provClass = Class.forName(provName);
+                    }
+
+                    String provArg = providerArgs.get(provName);
+                    Object obj;
+                    if (provArg == null) {
+                        obj = provClass.newInstance();
+                    } else {
+                        Constructor<?> c =
+                                provClass.getConstructor(PARAM_STRING);
+                        obj = c.newInstance(provArg);
+                    }
+
+                    if (!(obj instanceof Provider)) {
+                        MessageFormat form = new MessageFormat(rb.getString
+                            ("provName.not.a.provider"));
+                        Object[] source = {provName};
+                        throw new Exception(form.format(source));
+                    }
+                    Security.addProvider((Provider)obj);
+                }
+            }
+
+            if (verify) {
+                try {
+                    loadKeyStore(keystore, false);
+                } catch (Exception e) {
+                    if ((keystore != null) || (storepass != null)) {
+                        System.out.println(rb.getString("jarsigner.error.") +
+                                        e.getMessage());
+                        System.exit(1);
+                    }
+                }
+                /*              if (debug) {
+                    SignatureFileVerifier.setDebug(true);
+                    ManifestEntryVerifier.setDebug(true);
+                }
+                */
+                verifyJar(jarfile);
+            } else {
+                loadKeyStore(keystore, true);
+                getAliasInfo(alias);
+
+                // load the alternative signing mechanism
+                if (altSignerClass != null) {
+                    signingMechanism = loadSigningMechanism(altSignerClass,
+                        altSignerClasspath);
+                }
+                signJar(jarfile, alias, args);
+            }
+        } catch (Exception e) {
+            System.out.println(rb.getString("jarsigner.error.") + e);
+            if (debug) {
+                e.printStackTrace();
+            }
+            System.exit(1);
+        } finally {
+            // zero-out private key password
+            if (keypass != null) {
+                Arrays.fill(keypass, ' ');
+                keypass = null;
+            }
+            // zero-out keystore password
+            if (storepass != null) {
+                Arrays.fill(storepass, ' ');
+                storepass = null;
+            }
+        }
+
+        if (strict) {
+            int exitCode = 0;
+            if (chainNotValidated || hasExpiredCert || notYetValidCert) {
+                exitCode |= 4;
+            }
+            if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType) {
+                exitCode |= 8;
+            }
+            if (hasUnsignedEntry) {
+                exitCode |= 16;
+            }
+            if (notSignedByAlias || aliasNotInStore) {
+                exitCode |= 32;
+            }
+            if (exitCode != 0) {
+                System.exit(exitCode);
+            }
+        }
+    }
+
+    /*
+     * Parse command line arguments.
+     */
+    String[] parseArgs(String args[]) throws Exception {
+        /* parse flags */
+        int n = 0;
+
+        if (args.length == 0) fullusage();
+
+        String confFile = null;
+        String command = "-sign";
+        for (n=0; n < args.length; n++) {
+            if (collator.compare(args[n], "-verify") == 0) {
+                command = "-verify";
+            } else if (collator.compare(args[n], "-conf") == 0) {
+                if (n == args.length - 1) {
+                    usageNoArg();
+                }
+                confFile = args[++n];
+            }
+        }
+
+        if (confFile != null) {
+            args = KeyStoreUtil.expandArgs(
+                    "jarsigner", confFile, command, null, args);
+        }
+
+        debug = Arrays.stream(args).anyMatch(
+                x -> collator.compare(x, "-debug") == 0);
+
+        if (debug) {
+            // No need to localize debug output
+            System.out.println("Command line args: " +
+                    Arrays.toString(args));
+        }
+
+        for (n=0; n < args.length; n++) {
+
+            String flags = args[n];
+            String modifier = null;
+
+            if (flags.startsWith("-")) {
+                int pos = flags.indexOf(':');
+                if (pos > 0) {
+                    modifier = flags.substring(pos+1);
+                    flags = flags.substring(0, pos);
+                }
+            }
+
+            if (!flags.startsWith("-")) {
+                if (jarfile == null) {
+                    jarfile = flags;
+                } else {
+                    alias = flags;
+                    ckaliases.add(alias);
+                }
+            } else if (collator.compare(flags, "-conf") == 0) {
+                if (++n == args.length) usageNoArg();
+            } else if (collator.compare(flags, "-keystore") == 0) {
+                if (++n == args.length) usageNoArg();
+                keystore = args[n];
+            } else if (collator.compare(flags, "-storepass") ==0) {
+                if (++n == args.length) usageNoArg();
+                storepass = getPass(modifier, args[n]);
+            } else if (collator.compare(flags, "-storetype") ==0) {
+                if (++n == args.length) usageNoArg();
+                storetype = args[n];
+            } else if (collator.compare(flags, "-providerName") ==0) {
+                if (++n == args.length) usageNoArg();
+                providerName = args[n];
+            } else if ((collator.compare(flags, "-provider") == 0) ||
+                        (collator.compare(flags, "-providerClass") == 0)) {
+                if (++n == args.length) usageNoArg();
+                if (providers == null) {
+                    providers = new Vector<String>(3);
+                }
+                providers.add(args[n]);
+
+                if (args.length > (n+1)) {
+                    flags = args[n+1];
+                    if (collator.compare(flags, "-providerArg") == 0) {
+                        if (args.length == (n+2)) usageNoArg();
+                        providerArgs.put(args[n], args[n+2]);
+                        n += 2;
+                    }
+                }
+            } else if (collator.compare(flags, "-protected") ==0) {
+                protectedPath = true;
+            } else if (collator.compare(flags, "-certchain") ==0) {
+                if (++n == args.length) usageNoArg();
+                altCertChain = args[n];
+            } else if (collator.compare(flags, "-tsapolicyid") ==0) {
+                if (++n == args.length) usageNoArg();
+                tSAPolicyID = args[n];
+            } else if (collator.compare(flags, "-tsadigestalg") ==0) {
+                if (++n == args.length) usageNoArg();
+                tSADigestAlg = args[n];
+            } else if (collator.compare(flags, "-debug") ==0) {
+                // Already processed
+            } else if (collator.compare(flags, "-keypass") ==0) {
+                if (++n == args.length) usageNoArg();
+                keypass = getPass(modifier, args[n]);
+            } else if (collator.compare(flags, "-sigfile") ==0) {
+                if (++n == args.length) usageNoArg();
+                sigfile = args[n];
+            } else if (collator.compare(flags, "-signedjar") ==0) {
+                if (++n == args.length) usageNoArg();
+                signedjar = args[n];
+            } else if (collator.compare(flags, "-tsa") ==0) {
+                if (++n == args.length) usageNoArg();
+                tsaUrl = args[n];
+            } else if (collator.compare(flags, "-tsacert") ==0) {
+                if (++n == args.length) usageNoArg();
+                tsaAlias = args[n];
+            } else if (collator.compare(flags, "-altsigner") ==0) {
+                if (++n == args.length) usageNoArg();
+                altSignerClass = args[n];
+            } else if (collator.compare(flags, "-altsignerpath") ==0) {
+                if (++n == args.length) usageNoArg();
+                altSignerClasspath = args[n];
+            } else if (collator.compare(flags, "-sectionsonly") ==0) {
+                signManifest = false;
+            } else if (collator.compare(flags, "-internalsf") ==0) {
+                externalSF = false;
+            } else if (collator.compare(flags, "-verify") ==0) {
+                verify = true;
+            } else if (collator.compare(flags, "-verbose") ==0) {
+                verbose = (modifier != null) ? modifier : "all";
+            } else if (collator.compare(flags, "-sigalg") ==0) {
+                if (++n == args.length) usageNoArg();
+                sigalg = args[n];
+            } else if (collator.compare(flags, "-digestalg") ==0) {
+                if (++n == args.length) usageNoArg();
+                digestalg = args[n];
+            } else if (collator.compare(flags, "-certs") ==0) {
+                showcerts = true;
+            } else if (collator.compare(flags, "-strict") ==0) {
+                strict = true;
+            } else if (collator.compare(flags, "-h") == 0 ||
+                        collator.compare(flags, "-help") == 0) {
+                fullusage();
+            } else {
+                System.err.println(
+                        rb.getString("Illegal.option.") + flags);
+                usage();
+            }
+        }
+
+        // -certs must always be specified with -verbose
+        if (verbose == null) showcerts = false;
+
+        if (jarfile == null) {
+            System.err.println(rb.getString("Please.specify.jarfile.name"));
+            usage();
+        }
+        if (!verify && alias == null) {
+            System.err.println(rb.getString("Please.specify.alias.name"));
+            usage();
+        }
+        if (!verify && ckaliases.size() > 1) {
+            System.err.println(rb.getString("Only.one.alias.can.be.specified"));
+            usage();
+        }
+
+        if (storetype == null) {
+            storetype = KeyStore.getDefaultType();
+        }
+        storetype = KeyStoreUtil.niceStoreTypeName(storetype);
+
+        try {
+            if (signedjar != null && new File(signedjar).getCanonicalPath().equals(
+                    new File(jarfile).getCanonicalPath())) {
+                signedjar = null;
+            }
+        } catch (IOException ioe) {
+            // File system error?
+            // Just ignore it.
+        }
+
+        if (P11KEYSTORE.equalsIgnoreCase(storetype) ||
+                KeyStoreUtil.isWindowsKeyStore(storetype)) {
+            token = true;
+            if (keystore == null) {
+                keystore = NONE;
+            }
+        }
+
+        if (NONE.equals(keystore)) {
+            nullStream = true;
+        }
+
+        if (token && !nullStream) {
+            System.err.println(MessageFormat.format(rb.getString
+                (".keystore.must.be.NONE.if.storetype.is.{0}"), storetype));
+            usage();
+        }
+
+        if (token && keypass != null) {
+            System.err.println(MessageFormat.format(rb.getString
+                (".keypass.can.not.be.specified.if.storetype.is.{0}"), storetype));
+            usage();
+        }
+
+        if (protectedPath) {
+            if (storepass != null || keypass != null) {
+                System.err.println(rb.getString
+                        ("If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified"));
+                usage();
+            }
+        }
+        if (KeyStoreUtil.isWindowsKeyStore(storetype)) {
+            if (storepass != null || keypass != null) {
+                System.err.println(rb.getString
+                        ("If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified"));
+                usage();
+            }
+        }
+        return args;
+    }
+
+    static char[] getPass(String modifier, String arg) {
+        char[] output = KeyStoreUtil.getPassWithModifier(modifier, arg, rb);
+        if (output != null) return output;
+        usage();
+        return null;    // Useless, usage() already exit
+    }
+
+    static void usageNoArg() {
+        System.out.println(rb.getString("Option.lacks.argument"));
+        usage();
+    }
+
+    static void usage() {
+        System.out.println();
+        System.out.println(rb.getString("Please.type.jarsigner.help.for.usage"));
+        System.exit(1);
+    }
+
+    static void fullusage() {
+        System.out.println(rb.getString
+                ("Usage.jarsigner.options.jar.file.alias"));
+        System.out.println(rb.getString
+                (".jarsigner.verify.options.jar.file.alias."));
+        System.out.println();
+        System.out.println(rb.getString
+                (".keystore.url.keystore.location"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".storepass.password.password.for.keystore.integrity"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".storetype.type.keystore.type"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".keypass.password.password.for.private.key.if.different."));
+        System.out.println();
+        System.out.println(rb.getString
+                (".certchain.file.name.of.alternative.certchain.file"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".sigfile.file.name.of.SF.DSA.file"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".signedjar.file.name.of.signed.JAR.file"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".digestalg.algorithm.name.of.digest.algorithm"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".sigalg.algorithm.name.of.signature.algorithm"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".verify.verify.a.signed.JAR.file"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".verbose.suboptions.verbose.output.when.signing.verifying."));
+        System.out.println(rb.getString
+                (".suboptions.can.be.all.grouped.or.summary"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".certs.display.certificates.when.verbose.and.verifying"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".tsa.url.location.of.the.Timestamping.Authority"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".tsacert.alias.public.key.certificate.for.Timestamping.Authority"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".tsapolicyid.tsapolicyid.for.Timestamping.Authority"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".tsadigestalg.algorithm.of.digest.data.in.timestamping.request"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".altsigner.class.class.name.of.an.alternative.signing.mechanism"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".internalsf.include.the.SF.file.inside.the.signature.block"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".sectionsonly.don.t.compute.hash.of.entire.manifest"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".protected.keystore.has.protected.authentication.path"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".providerName.name.provider.name"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".providerClass.class.name.of.cryptographic.service.provider.s"));
+        System.out.println(rb.getString
+                (".providerArg.arg.master.class.file.and.constructor.argument"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".strict.treat.warnings.as.errors"));
+        System.out.println();
+        System.out.println(rb.getString
+                (".conf.url.specify.a.pre.configured.options.file"));
+        System.out.println();
+
+        System.exit(0);
+    }
+
+    void verifyJar(String jarName)
+        throws Exception
+    {
+        boolean anySigned = false;  // if there exists entry inside jar signed
+        JarFile jf = null;
+
+        try {
+            jf = new JarFile(jarName, true);
+            Vector<JarEntry> entriesVec = new Vector<>();
+            byte[] buffer = new byte[8192];
+
+            Enumeration<JarEntry> entries = jf.entries();
+            while (entries.hasMoreElements()) {
+                JarEntry je = entries.nextElement();
+                entriesVec.addElement(je);
+                InputStream is = null;
+                try {
+                    is = jf.getInputStream(je);
+                    int n;
+                    while ((n = is.read(buffer, 0, buffer.length)) != -1) {
+                        // we just read. this will throw a SecurityException
+                        // if  a signature/digest check fails.
+                    }
+                } finally {
+                    if (is != null) {
+                        is.close();
+                    }
+                }
+            }
+
+            Manifest man = jf.getManifest();
+
+            // The map to record display info, only used when -verbose provided
+            //      key: signer info string
+            //      value: the list of files with common key
+            Map<String,List<String>> output = new LinkedHashMap<>();
+
+            if (man != null) {
+                if (verbose != null) System.out.println();
+                Enumeration<JarEntry> e = entriesVec.elements();
+
+                String tab = rb.getString("6SPACE");
+
+                while (e.hasMoreElements()) {
+                    JarEntry je = e.nextElement();
+                    String name = je.getName();
+                    CodeSigner[] signers = je.getCodeSigners();
+                    boolean isSigned = (signers != null);
+                    anySigned |= isSigned;
+                    hasUnsignedEntry |= !je.isDirectory() && !isSigned
+                                        && !signatureRelated(name);
+
+                    int inStoreOrScope = inKeyStore(signers);
+
+                    boolean inStore = (inStoreOrScope & IN_KEYSTORE) != 0;
+                    boolean inScope = (inStoreOrScope & IN_SCOPE) != 0;
+
+                    notSignedByAlias |= (inStoreOrScope & NOT_ALIAS) != 0;
+                    if (keystore != null) {
+                        aliasNotInStore |= isSigned && (!inStore && !inScope);
+                    }
+
+                    // Only used when -verbose provided
+                    StringBuffer sb = null;
+                    if (verbose != null) {
+                        sb = new StringBuffer();
+                        boolean inManifest =
+                            ((man.getAttributes(name) != null) ||
+                             (man.getAttributes("./"+name) != null) ||
+                             (man.getAttributes("/"+name) != null));
+                        sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
+                                .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
+                                .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
+                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
+                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
+                                .append(rb.getString("SPACE"));
+                        sb.append('|');
+                    }
+
+                    // When -certs provided, display info has extra empty
+                    // lines at the beginning and end.
+                    if (isSigned) {
+                        if (showcerts) sb.append('\n');
+                        for (CodeSigner signer: signers) {
+                            // signerInfo() must be called even if -verbose
+                            // not provided. The method updates various
+                            // warning flags.
+                            String si = signerInfo(signer, tab);
+                            if (showcerts) {
+                                sb.append(si);
+                                sb.append('\n');
+                            }
+                        }
+                    } else if (showcerts && !verbose.equals("all")) {
+                        // Print no info for unsigned entries when -verbose:all,
+                        // to be consistent with old behavior.
+                        if (signatureRelated(name)) {
+                            sb.append('\n')
+                                    .append(tab)
+                                    .append(rb
+                                            .getString(".Signature.related.entries."))
+                                    .append("\n\n");
+                        } else {
+                            sb.append('\n').append(tab)
+                                    .append(rb.getString(".Unsigned.entries."))
+                                    .append("\n\n");
+                        }
+                    }
+
+                    if (verbose != null) {
+                        String label = sb.toString();
+                        if (signatureRelated(name)) {
+                            // Entries inside META-INF and other unsigned
+                            // entries are grouped separately.
+                            label = "-" + label;
+                        }
+
+                        // The label finally contains 2 parts separated by '|':
+                        // The legend displayed before the entry names, and
+                        // the cert info (if -certs specified).
+
+                        if (!output.containsKey(label)) {
+                            output.put(label, new ArrayList<String>());
+                        }
+
+                        StringBuilder fb = new StringBuilder();
+                        String s = Long.toString(je.getSize());
+                        for (int i = 6 - s.length(); i > 0; --i) {
+                            fb.append(' ');
+                        }
+                        fb.append(s).append(' ').
+                                append(new Date(je.getTime()).toString());
+                        fb.append(' ').append(name);
+
+                        output.get(label).add(fb.toString());
+                    }
+                }
+            }
+            if (verbose != null) {
+                for (Entry<String,List<String>> s: output.entrySet()) {
+                    List<String> files = s.getValue();
+                    String key = s.getKey();
+                    if (key.charAt(0) == '-') { // the signature-related group
+                        key = key.substring(1);
+                    }
+                    int pipe = key.indexOf('|');
+                    if (verbose.equals("all")) {
+                        for (String f: files) {
+                            System.out.println(key.substring(0, pipe) + f);
+                            System.out.printf(key.substring(pipe+1));
+                        }
+                    } else {
+                        if (verbose.equals("grouped")) {
+                            for (String f: files) {
+                                System.out.println(key.substring(0, pipe) + f);
+                            }
+                        } else if (verbose.equals("summary")) {
+                            System.out.print(key.substring(0, pipe));
+                            if (files.size() > 1) {
+                                System.out.println(files.get(0) + " " +
+                                        String.format(rb.getString(
+                                        ".and.d.more."), files.size()-1));
+                            } else {
+                                System.out.println(files.get(0));
+                            }
+                        }
+                        System.out.printf(key.substring(pipe+1));
+                    }
+                }
+                System.out.println();
+                System.out.println(rb.getString(
+                    ".s.signature.was.verified."));
+                System.out.println(rb.getString(
+                    ".m.entry.is.listed.in.manifest"));
+                System.out.println(rb.getString(
+                    ".k.at.least.one.certificate.was.found.in.keystore"));
+                System.out.println(rb.getString(
+                    ".i.at.least.one.certificate.was.found.in.identity.scope"));
+                if (ckaliases.size() > 0) {
+                    System.out.println(rb.getString(
+                        ".X.not.signed.by.specified.alias.es."));
+                }
+                System.out.println();
+            }
+            if (man == null)
+                System.out.println(rb.getString("no.manifest."));
+
+            if (!anySigned) {
+                System.out.println(rb.getString(
+                      "jar.is.unsigned.signatures.missing.or.not.parsable."));
+            } else {
+                boolean warningAppeared = false;
+                boolean errorAppeared = false;
+                if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
+                        notYetValidCert || chainNotValidated || hasExpiredCert ||
+                        hasUnsignedEntry ||
+                        aliasNotInStore || notSignedByAlias) {
+
+                    if (strict) {
+                        System.out.println(rb.getString("jar.verified.with.signer.errors."));
+                        System.out.println();
+                        System.out.println(rb.getString("Error."));
+                        errorAppeared = true;
+                    } else {
+                        System.out.println(rb.getString("jar.verified."));
+                        System.out.println();
+                        System.out.println(rb.getString("Warning."));
+                        warningAppeared = true;
+                    }
+
+                    if (badKeyUsage) {
+                        System.out.println(
+                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
+                    }
+
+                    if (badExtendedKeyUsage) {
+                        System.out.println(
+                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
+                    }
+
+                    if (badNetscapeCertType) {
+                        System.out.println(
+                            rb.getString("This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
+                    }
+
+                    if (hasUnsignedEntry) {
+                        System.out.println(rb.getString(
+                            "This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked."));
+                    }
+                    if (hasExpiredCert) {
+                        System.out.println(rb.getString(
+                            "This.jar.contains.entries.whose.signer.certificate.has.expired."));
+                    }
+                    if (notYetValidCert) {
+                        System.out.println(rb.getString(
+                            "This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid."));
+                    }
+
+                    if (chainNotValidated) {
+                        System.out.println(
+                                rb.getString("This.jar.contains.entries.whose.certificate.chain.is.not.validated."));
+                    }
+
+                    if (notSignedByAlias) {
+                        System.out.println(
+                                rb.getString("This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es."));
+                    }
+
+                    if (aliasNotInStore) {
+                        System.out.println(rb.getString("This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore."));
+                    }
+                } else {
+                    System.out.println(rb.getString("jar.verified."));
+                }
+                if (hasExpiringCert || noTimestamp) {
+                    if (!warningAppeared) {
+                        System.out.println();
+                        System.out.println(rb.getString("Warning."));
+                        warningAppeared = true;
+                    }
+                    if (hasExpiringCert) {
+                        System.out.println(rb.getString(
+                                "This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months."));
+                    }
+                    if (noTimestamp) {
+                        System.out.println(
+                                String.format(rb.getString("no.timestamp.verifying"), expireDate));
+                    }
+                }
+                if (warningAppeared || errorAppeared) {
+                    if (! (verbose != null && showcerts)) {
+                        System.out.println();
+                        System.out.println(rb.getString(
+                                "Re.run.with.the.verbose.and.certs.options.for.more.details."));
+                    }
+                }
+            }
+            return;
+        } catch (Exception e) {
+            System.out.println(rb.getString("jarsigner.") + e);
+            if (debug) {
+                e.printStackTrace();
+            }
+        } finally { // close the resource
+            if (jf != null) {
+                jf.close();
+            }
+        }
+
+        System.exit(1);
+    }
+
+    private static MessageFormat validityTimeForm = null;
+    private static MessageFormat notYetTimeForm = null;
+    private static MessageFormat expiredTimeForm = null;
+    private static MessageFormat expiringTimeForm = null;
+
+    /*
+     * Display some details about a certificate:
+     *
+     * [<tab>] <cert-type> [", " <subject-DN>] [" (" <keystore-entry-alias> ")"]
+     * [<validity-period> | <expiry-warning>]
+     *
+     * Note: no newline character at the end
+     */
+    String printCert(String tab, Certificate c, boolean checkValidityPeriod,
+        Date timestamp, boolean checkUsage) {
+
+        StringBuilder certStr = new StringBuilder();
+        String space = rb.getString("SPACE");
+        X509Certificate x509Cert = null;
+
+        if (c instanceof X509Certificate) {
+            x509Cert = (X509Certificate) c;
+            certStr.append(tab).append(x509Cert.getType())
+                .append(rb.getString("COMMA"))
+                .append(x509Cert.getSubjectDN().getName());
+        } else {
+            certStr.append(tab).append(c.getType());
+        }
+
+        String alias = storeHash.get(c);
+        if (alias != null) {
+            certStr.append(space).append(alias);
+        }
+
+        if (checkValidityPeriod && x509Cert != null) {
+
+            certStr.append("\n").append(tab).append("[");
+            Date notAfter = x509Cert.getNotAfter();
+            try {
+                boolean printValidity = true;
+                if (timestamp == null) {
+                    if (expireDate.getTime() == 0 || expireDate.after(notAfter)) {
+                        expireDate = notAfter;
+                    }
+                    x509Cert.checkValidity();
+                    // test if cert will expire within six months
+                    if (notAfter.getTime() < System.currentTimeMillis() + SIX_MONTHS) {
+                        hasExpiringCert = true;
+                        if (expiringTimeForm == null) {
+                            expiringTimeForm = new MessageFormat(
+                                rb.getString("certificate.will.expire.on"));
+                        }
+                        Object[] source = { notAfter };
+                        certStr.append(expiringTimeForm.format(source));
+                        printValidity = false;
+                    }
+                } else {
+                    x509Cert.checkValidity(timestamp);
+                }
+                if (printValidity) {
+                    if (validityTimeForm == null) {
+                        validityTimeForm = new MessageFormat(
+                            rb.getString("certificate.is.valid.from"));
+                    }
+                    Object[] source = { x509Cert.getNotBefore(), notAfter };
+                    certStr.append(validityTimeForm.format(source));
+                }
+            } catch (CertificateExpiredException cee) {
+                hasExpiredCert = true;
+
+                if (expiredTimeForm == null) {
+                    expiredTimeForm = new MessageFormat(
+                        rb.getString("certificate.expired.on"));
+                }
+                Object[] source = { notAfter };
+                certStr.append(expiredTimeForm.format(source));
+
+            } catch (CertificateNotYetValidException cnyve) {
+                notYetValidCert = true;
+
+                if (notYetTimeForm == null) {
+                    notYetTimeForm = new MessageFormat(
+                        rb.getString("certificate.is.not.valid.until"));
+                }
+                Object[] source = { x509Cert.getNotBefore() };
+                certStr.append(notYetTimeForm.format(source));
+            }
+            certStr.append("]");
+
+            if (checkUsage) {
+                boolean[] bad = new boolean[3];
+                checkCertUsage(x509Cert, bad);
+                if (bad[0] || bad[1] || bad[2]) {
+                    String x = "";
+                    if (bad[0]) {
+                        x ="KeyUsage";
+                    }
+                    if (bad[1]) {
+                        if (x.length() > 0) x = x + ", ";
+                        x = x + "ExtendedKeyUsage";
+                    }
+                    if (bad[2]) {
+                        if (x.length() > 0) x = x + ", ";
+                        x = x + "NetscapeCertType";
+                    }
+                    certStr.append("\n").append(tab)
+                        .append(MessageFormat.format(rb.getString(
+                        ".{0}.extension.does.not.support.code.signing."), x));
+                }
+            }
+        }
+        return certStr.toString();
+    }
+
+    private static MessageFormat signTimeForm = null;
+
+    private String printTimestamp(String tab, Timestamp timestamp) {
+
+        if (signTimeForm == null) {
+            signTimeForm =
+                new MessageFormat(rb.getString("entry.was.signed.on"));
+        }
+        Object[] source = { timestamp.getTimestamp() };
+
+        return new StringBuilder().append(tab).append("[")
+            .append(signTimeForm.format(source)).append("]").toString();
+    }
+
+    private Map<CodeSigner,Integer> cacheForInKS = new IdentityHashMap<>();
+
+    private int inKeyStoreForOneSigner(CodeSigner signer) {
+        if (cacheForInKS.containsKey(signer)) {
+            return cacheForInKS.get(signer);
+        }
+
+        boolean found = false;
+        int result = 0;
+        List<? extends Certificate> certs = signer.getSignerCertPath().getCertificates();
+        for (Certificate c : certs) {
+            String alias = storeHash.get(c);
+            if (alias != null) {
+                if (alias.startsWith("(")) {
+                    result |= IN_KEYSTORE;
+                } else if (alias.startsWith("[")) {
+                    result |= IN_SCOPE;
+                }
+                if (ckaliases.contains(alias.substring(1, alias.length() - 1))) {
+                    result |= SIGNED_BY_ALIAS;
+                }
+            } else {
+                if (store != null) {
+                    try {
+                        alias = store.getCertificateAlias(c);
+                    } catch (KeyStoreException kse) {
+                        // never happens, because keystore has been loaded
+                    }
+                    if (alias != null) {
+                        storeHash.put(c, "(" + alias + ")");
+                        found = true;
+                        result |= IN_KEYSTORE;
+                    }
+                }
+                if (ckaliases.contains(alias)) {
+                    result |= SIGNED_BY_ALIAS;
+                }
+            }
+        }
+        cacheForInKS.put(signer, result);
+        return result;
+    }
+
+    Hashtable<Certificate, String> storeHash = new Hashtable<>();
+
+    int inKeyStore(CodeSigner[] signers) {
+
+        if (signers == null)
+            return 0;
+
+        int output = 0;
+
+        for (CodeSigner signer: signers) {
+            int result = inKeyStoreForOneSigner(signer);
+            output |= result;
+        }
+        if (ckaliases.size() > 0 && (output & SIGNED_BY_ALIAS) == 0) {
+            output |= NOT_ALIAS;
+        }
+        return output;
+    }
+
+    void signJar(String jarName, String alias, String[] args)
+        throws Exception {
+        boolean aliasUsed = false;
+        X509Certificate tsaCert = null;
+
+        if (sigfile == null) {
+            sigfile = alias;
+            aliasUsed = true;
+        }
+
+        if (sigfile.length() > 8) {
+            sigfile = sigfile.substring(0, 8).toUpperCase(Locale.ENGLISH);
+        } else {
+            sigfile = sigfile.toUpperCase(Locale.ENGLISH);
+        }
+
+        StringBuilder tmpSigFile = new StringBuilder(sigfile.length());
+        for (int j = 0; j < sigfile.length(); j++) {
+            char c = sigfile.charAt(j);
+            if (!
+                ((c>= 'A' && c<= 'Z') ||
+                (c>= '0' && c<= '9') ||
+                (c == '-') ||
+                (c == '_'))) {
+                if (aliasUsed) {
+                    // convert illegal characters from the alias to be _'s
+                    c = '_';
+                } else {
+                 throw new
+                   RuntimeException(rb.getString
+                        ("signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or."));
+                }
+            }
+            tmpSigFile.append(c);
+        }
+
+        sigfile = tmpSigFile.toString();
+
+        String tmpJarName;
+        if (signedjar == null) tmpJarName = jarName+".sig";
+        else tmpJarName = signedjar;
+
+        File jarFile = new File(jarName);
+        File signedJarFile = new File(tmpJarName);
+
+        // Open the jar (zip) file
+        try {
+            zipFile = new ZipFile(jarName);
+        } catch (IOException ioe) {
+            error(rb.getString("unable.to.open.jar.file.")+jarName, ioe);
+        }
+
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(signedJarFile);
+        } catch (IOException ioe) {
+            error(rb.getString("unable.to.create.")+tmpJarName, ioe);
+        }
+
+        PrintStream ps = new PrintStream(fos);
+        ZipOutputStream zos = new ZipOutputStream(ps);
+
+        /* First guess at what they might be - we don't xclude RSA ones. */
+        String sfFilename = (META_INF + sigfile + ".SF").toUpperCase(Locale.ENGLISH);
+        String bkFilename = (META_INF + sigfile + ".DSA").toUpperCase(Locale.ENGLISH);
+
+        Manifest manifest = new Manifest();
+        Map<String,Attributes> mfEntries = manifest.getEntries();
+
+        // The Attributes of manifest before updating
+        Attributes oldAttr = null;
+
+        boolean mfModified = false;
+        boolean mfCreated = false;
+        byte[] mfRawBytes = null;
+
+        try {
+            MessageDigest digests[] = { MessageDigest.getInstance(digestalg) };
+
+            // Check if manifest exists
+            ZipEntry mfFile;
+            if ((mfFile = getManifestFile(zipFile)) != null) {
+                // Manifest exists. Read its raw bytes.
+                mfRawBytes = getBytes(zipFile, mfFile);
+                manifest.read(new ByteArrayInputStream(mfRawBytes));
+                oldAttr = (Attributes)(manifest.getMainAttributes().clone());
+            } else {
+                // Create new manifest
+                Attributes mattr = manifest.getMainAttributes();
+                mattr.putValue(Attributes.Name.MANIFEST_VERSION.toString(),
+                               "1.0");
+                String javaVendor = System.getProperty("java.vendor");
+                String jdkVersion = System.getProperty("java.version");
+                mattr.putValue("Created-By", jdkVersion + " (" +javaVendor
+                               + ")");
+                mfFile = new ZipEntry(JarFile.MANIFEST_NAME);
+                mfCreated = true;
+            }
+
+            /*
+             * For each entry in jar
+             * (except for signature-related META-INF entries),
+             * do the following:
+             *
+             * - if entry is not contained in manifest, add it to manifest;
+             * - if entry is contained in manifest, calculate its hash and
+             *   compare it with the one in the manifest; if they are
+             *   different, replace the hash in the manifest with the newly
+             *   generated one. (This may invalidate existing signatures!)
+             */
+            Vector<ZipEntry> mfFiles = new Vector<>();
+
+            boolean wasSigned = false;
+
+            for (Enumeration<? extends ZipEntry> enum_=zipFile.entries();
+                        enum_.hasMoreElements();) {
+                ZipEntry ze = enum_.nextElement();
+
+                if (ze.getName().startsWith(META_INF)) {
+                    // Store META-INF files in vector, so they can be written
+                    // out first
+                    mfFiles.addElement(ze);
+
+                    if (SignatureFileVerifier.isBlockOrSF(
+                            ze.getName().toUpperCase(Locale.ENGLISH))) {
+                        wasSigned = true;
+                    }
+
+                    if (signatureRelated(ze.getName())) {
+                        // ignore signature-related and manifest files
+                        continue;
+                    }
+                }
+
+                if (manifest.getAttributes(ze.getName()) != null) {
+                    // jar entry is contained in manifest, check and
+                    // possibly update its digest attributes
+                    if (updateDigests(ze, zipFile, digests,
+                                      manifest) == true) {
+                        mfModified = true;
+                    }
+                } else if (!ze.isDirectory()) {
+                    // Add entry to manifest
+                    Attributes attrs = getDigestAttributes(ze, zipFile,
+                                                           digests);
+                    mfEntries.put(ze.getName(), attrs);
+                    mfModified = true;
+                }
+            }
+
+            // Recalculate the manifest raw bytes if necessary
+            if (mfModified) {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                manifest.write(baos);
+                if (wasSigned) {
+                    byte[] newBytes = baos.toByteArray();
+                    if (mfRawBytes != null
+                            && oldAttr.equals(manifest.getMainAttributes())) {
+
+                        /*
+                         * Note:
+                         *
+                         * The Attributes object is based on HashMap and can handle
+                         * continuation columns. Therefore, even if the contents are
+                         * not changed (in a Map view), the bytes that it write()
+                         * may be different from the original bytes that it read()
+                         * from. Since the signature on the main attributes is based
+                         * on raw bytes, we must retain the exact bytes.
+                         */
+
+                        int newPos = findHeaderEnd(newBytes);
+                        int oldPos = findHeaderEnd(mfRawBytes);
+
+                        if (newPos == oldPos) {
+                            System.arraycopy(mfRawBytes, 0, newBytes, 0, oldPos);
+                        } else {
+                            // cat oldHead newTail > newBytes
+                            byte[] lastBytes = new byte[oldPos +
+                                    newBytes.length - newPos];
+                            System.arraycopy(mfRawBytes, 0, lastBytes, 0, oldPos);
+                            System.arraycopy(newBytes, newPos, lastBytes, oldPos,
+                                    newBytes.length - newPos);
+                            newBytes = lastBytes;
+                        }
+                    }
+                    mfRawBytes = newBytes;
+                } else {
+                    mfRawBytes = baos.toByteArray();
+                }
+            }
+
+            // Write out the manifest
+            if (mfModified) {
+                // manifest file has new length
+                mfFile = new ZipEntry(JarFile.MANIFEST_NAME);
+            }
+            if (verbose != null) {
+                if (mfCreated) {
+                    System.out.println(rb.getString(".adding.") +
+                                        mfFile.getName());
+                } else if (mfModified) {
+                    System.out.println(rb.getString(".updating.") +
+                                        mfFile.getName());
+                }
+            }
+            zos.putNextEntry(mfFile);
+            zos.write(mfRawBytes);
+
+            // Calculate SignatureFile (".SF") and SignatureBlockFile
+            ManifestDigester manDig = new ManifestDigester(mfRawBytes);
+            SignatureFile sf = new SignatureFile(digests, manifest, manDig,
+                                                 sigfile, signManifest);
+
+            if (tsaAlias != null) {
+                tsaCert = getTsaCert(tsaAlias);
+            }
+
+            if (tsaUrl == null && tsaCert == null) {
+                noTimestamp = true;
+            }
+
+            SignatureFile.Block block = null;
+
+            try {
+                block =
+                    sf.generateBlock(privateKey, sigalg, certChain,
+                        externalSF, tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg,
+                        signingMechanism, args, zipFile);
+            } catch (SocketTimeoutException e) {
+                // Provide a helpful message when TSA is beyond a firewall
+                error(rb.getString("unable.to.sign.jar.") +
+                rb.getString("no.response.from.the.Timestamping.Authority.") +
+                "\n  -J-Dhttp.proxyHost=<hostname>" +
+                "\n  -J-Dhttp.proxyPort=<portnumber>\n" +
+                rb.getString("or") +
+                "\n  -J-Dhttps.proxyHost=<hostname> " +
+                "\n  -J-Dhttps.proxyPort=<portnumber> ", e);
+            }
+
+            sfFilename = sf.getMetaName();
+            bkFilename = block.getMetaName();
+
+            ZipEntry sfFile = new ZipEntry(sfFilename);
+            ZipEntry bkFile = new ZipEntry(bkFilename);
+
+            long time = System.currentTimeMillis();
+            sfFile.setTime(time);
+            bkFile.setTime(time);
+
+            // signature file
+            zos.putNextEntry(sfFile);
+            sf.write(zos);
+            if (verbose != null) {
+                if (zipFile.getEntry(sfFilename) != null) {
+                    System.out.println(rb.getString(".updating.") +
+                                sfFilename);
+                } else {
+                    System.out.println(rb.getString(".adding.") +
+                                sfFilename);
+                }
+            }
+
+            if (verbose != null) {
+                if (tsaUrl != null || tsaCert != null) {
+                    System.out.println(
+                        rb.getString("requesting.a.signature.timestamp"));
+                }
+                if (tsaUrl != null) {
+                    System.out.println(rb.getString("TSA.location.") + tsaUrl);
+                }
+                if (tsaCert != null) {
+                    URI tsaURI = TimestampedSigner.getTimestampingURI(tsaCert);
+                    if (tsaURI != null) {
+                        System.out.println(rb.getString("TSA.location.") +
+                            tsaURI);
+                    }
+                    System.out.println(rb.getString("TSA.certificate.") +
+                        printCert("", tsaCert, false, null, false));
+                }
+                if (signingMechanism != null) {
+                    System.out.println(
+                        rb.getString("using.an.alternative.signing.mechanism"));
+                }
+            }
+
+            // signature block file
+            zos.putNextEntry(bkFile);
+            block.write(zos);
+            if (verbose != null) {
+                if (zipFile.getEntry(bkFilename) != null) {
+                    System.out.println(rb.getString(".updating.") +
+                        bkFilename);
+                } else {
+                    System.out.println(rb.getString(".adding.") +
+                        bkFilename);
+                }
+            }
+
+            // Write out all other META-INF files that we stored in the
+            // vector
+            for (int i=0; i<mfFiles.size(); i++) {
+                ZipEntry ze = mfFiles.elementAt(i);
+                if (!ze.getName().equalsIgnoreCase(JarFile.MANIFEST_NAME)
+                    && !ze.getName().equalsIgnoreCase(sfFilename)
+                    && !ze.getName().equalsIgnoreCase(bkFilename)) {
+                    writeEntry(zipFile, zos, ze);
+                }
+            }
+
+            // Write out all other files
+            for (Enumeration<? extends ZipEntry> enum_=zipFile.entries();
+                        enum_.hasMoreElements();) {
+                ZipEntry ze = enum_.nextElement();
+
+                if (!ze.getName().startsWith(META_INF)) {
+                    if (verbose != null) {
+                        if (manifest.getAttributes(ze.getName()) != null)
+                          System.out.println(rb.getString(".signing.") +
+                                ze.getName());
+                        else
+                          System.out.println(rb.getString(".adding.") +
+                                ze.getName());
+                    }
+                    writeEntry(zipFile, zos, ze);
+                }
+            }
+        } catch(IOException ioe) {
+            error(rb.getString("unable.to.sign.jar.")+ioe, ioe);
+        } finally {
+            // close the resouces
+            if (zipFile != null) {
+                zipFile.close();
+                zipFile = null;
+            }
+
+            if (zos != null) {
+                zos.close();
+            }
+        }
+
+        // no IOException thrown in the follow try clause, so disable
+        // the try clause.
+        // try {
+            if (signedjar == null) {
+                // attempt an atomic rename. If that fails,
+                // rename the original jar file, then the signed
+                // one, then delete the original.
+                if (!signedJarFile.renameTo(jarFile)) {
+                    File origJar = new File(jarName+".orig");
+
+                    if (jarFile.renameTo(origJar)) {
+                        if (signedJarFile.renameTo(jarFile)) {
+                            origJar.delete();
+                        } else {
+                            MessageFormat form = new MessageFormat(rb.getString
+                        ("attempt.to.rename.signedJarFile.to.jarFile.failed"));
+                            Object[] source = {signedJarFile, jarFile};
+                            error(form.format(source));
+                        }
+                    } else {
+                        MessageFormat form = new MessageFormat(rb.getString
+                            ("attempt.to.rename.jarFile.to.origJar.failed"));
+                        Object[] source = {jarFile, origJar};
+                        error(form.format(source));
+                    }
+                }
+            }
+
+            boolean warningAppeared = false;
+            if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
+                    notYetValidCert || chainNotValidated || hasExpiredCert) {
+                if (strict) {
+                    System.out.println(rb.getString("jar.signed.with.signer.errors."));
+                    System.out.println();
+                    System.out.println(rb.getString("Error."));
+                } else {
+                    System.out.println(rb.getString("jar.signed."));
+                    System.out.println();
+                    System.out.println(rb.getString("Warning."));
+                    warningAppeared = true;
+                }
+
+                if (badKeyUsage) {
+                    System.out.println(
+                        rb.getString("The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing."));
+                }
+
+                if (badExtendedKeyUsage) {
+                    System.out.println(
+                        rb.getString("The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing."));
+                }
+
+                if (badNetscapeCertType) {
+                    System.out.println(
+                        rb.getString("The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing."));
+                }
+
+                if (hasExpiredCert) {
+                    System.out.println(
+                        rb.getString("The.signer.certificate.has.expired."));
+                } else if (notYetValidCert) {
+                    System.out.println(
+                        rb.getString("The.signer.certificate.is.not.yet.valid."));
+                }
+
+                if (chainNotValidated) {
+                    System.out.println(
+                            rb.getString("The.signer.s.certificate.chain.is.not.validated."));
+                }
+            } else {
+                System.out.println(rb.getString("jar.signed."));
+            }
+            if (hasExpiringCert || noTimestamp) {
+                if (!warningAppeared) {
+                    System.out.println();
+                    System.out.println(rb.getString("Warning."));
+                }
+
+                if (hasExpiringCert) {
+                    System.out.println(
+                            rb.getString("The.signer.certificate.will.expire.within.six.months."));
+                }
+
+                if (noTimestamp) {
+                    System.out.println(
+                            String.format(rb.getString("no.timestamp.signing"), expireDate));
+                }
+            }
+
+        // no IOException thrown in the above try clause, so disable
+        // the catch clause.
+        // } catch(IOException ioe) {
+        //     error(rb.getString("unable.to.sign.jar.")+ioe, ioe);
+        // }
+    }
+
+    /**
+     * Find the length of header inside bs. The header is a multiple (>=0)
+     * lines of attributes plus an empty line. The empty line is included
+     * in the header.
+     */
+    @SuppressWarnings("fallthrough")
+    private int findHeaderEnd(byte[] bs) {
+        // Initial state true to deal with empty header
+        boolean newline = true;     // just met a newline
+        int len = bs.length;
+        for (int i=0; i<len; i++) {
+            switch (bs[i]) {
+                case '\r':
+                    if (i < len - 1 && bs[i+1] == '\n') i++;
+                    // fallthrough
+                case '\n':
+                    if (newline) return i+1;    //+1 to get length
+                    newline = true;
+                    break;
+                default:
+                    newline = false;
+            }
+        }
+        // If header end is not found, it means the MANIFEST.MF has only
+        // the main attributes section and it does not end with 2 newlines.
+        // Returns the whole length so that it can be completely replaced.
+        return len;
+    }
+
+    /**
+     * signature-related files include:
+     * . META-INF/MANIFEST.MF
+     * . META-INF/SIG-*
+     * . META-INF/*.SF
+     * . META-INF/*.DSA
+     * . META-INF/*.RSA
+     * . META-INF/*.EC
+     */
+    private boolean signatureRelated(String name) {
+        return SignatureFileVerifier.isSigningRelated(name);
+    }
+
+    Map<CodeSigner,String> cacheForSignerInfo = new IdentityHashMap<>();
+
+    /**
+     * Returns a string of singer info, with a newline at the end
+     */
+    private String signerInfo(CodeSigner signer, String tab) {
+        if (cacheForSignerInfo.containsKey(signer)) {
+            return cacheForSignerInfo.get(signer);
+        }
+        StringBuilder sb = new StringBuilder();
+        List<? extends Certificate> certs = signer.getSignerCertPath().getCertificates();
+        // display the signature timestamp, if present
+        Date timestamp;
+        Timestamp ts = signer.getTimestamp();
+        if (ts != null) {
+            sb.append(printTimestamp(tab, ts));
+            sb.append('\n');
+            timestamp = ts.getTimestamp();
+        } else {
+            timestamp = null;
+            noTimestamp = true;
+        }
+        // display the certificate(sb). The first one is end-entity cert and
+        // its KeyUsage should be checked.
+        boolean first = true;
+        for (Certificate c : certs) {
+            sb.append(printCert(tab, c, true, timestamp, first));
+            sb.append('\n');
+            first = false;
+        }
+        try {
+            validateCertChain(certs);
+        } catch (Exception e) {
+            if (debug) {
+                e.printStackTrace();
+            }
+            if (e.getCause() != null &&
+                    (e.getCause() instanceof CertificateExpiredException ||
+                     e.getCause() instanceof CertificateNotYetValidException)) {
+                // No more warning, we alreay have hasExpiredCert or notYetValidCert
+            } else {
+                chainNotValidated = true;
+                sb.append(tab).append(rb.getString(".CertPath.not.validated."))
+                        .append(e.getLocalizedMessage()).append("]\n"); // TODO
+            }
+        }
+        String result = sb.toString();
+        cacheForSignerInfo.put(signer, result);
+        return result;
+    }
+
+    private void writeEntry(ZipFile zf, ZipOutputStream os, ZipEntry ze)
+    throws IOException
+    {
+        ZipEntry ze2 = new ZipEntry(ze.getName());
+        ze2.setMethod(ze.getMethod());
+        ze2.setTime(ze.getTime());
+        ze2.setComment(ze.getComment());
+        ze2.setExtra(ze.getExtra());
+        if (ze.getMethod() == ZipEntry.STORED) {
+            ze2.setSize(ze.getSize());
+            ze2.setCrc(ze.getCrc());
+        }
+        os.putNextEntry(ze2);
+        writeBytes(zf, ze, os);
+    }
+
+    /**
+     * Writes all the bytes for a given entry to the specified output stream.
+     */
+    private synchronized void writeBytes
+        (ZipFile zf, ZipEntry ze, ZipOutputStream os) throws IOException {
+        int n;
+
+        InputStream is = null;
+        try {
+            is = zf.getInputStream(ze);
+            long left = ze.getSize();
+
+            while((left > 0) && (n = is.read(buffer, 0, buffer.length)) != -1) {
+                os.write(buffer, 0, n);
+                left -= n;
+            }
+        } finally {
+            if (is != null) {
+                is.close();
+            }
+        }
+    }
+
+    void loadKeyStore(String keyStoreName, boolean prompt) {
+
+        if (!nullStream && keyStoreName == null) {
+            keyStoreName = System.getProperty("user.home") + File.separator
+                + ".keystore";
+        }
+
+        try {
+
+            certificateFactory = CertificateFactory.getInstance("X.509");
+            validator = CertPathValidator.getInstance("PKIX");
+            Set<TrustAnchor> tas = new HashSet<>();
+            try {
+                KeyStore caks = KeyStoreUtil.getCacertsKeyStore();
+                if (caks != null) {
+                    Enumeration<String> aliases = caks.aliases();
+                    while (aliases.hasMoreElements()) {
+                        String a = aliases.nextElement();
+                        try {
+                            tas.add(new TrustAnchor((X509Certificate)caks.getCertificate(a), null));
+                        } catch (Exception e2) {
+                            // ignore, when a SecretkeyEntry does not include a cert
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                // Ignore, if cacerts cannot be loaded
+            }
+
+            if (providerName == null) {
+                store = KeyStore.getInstance(storetype);
+            } else {
+                store = KeyStore.getInstance(storetype, providerName);
+            }
+
+            // Get pass phrase
+            // XXX need to disable echo; on UNIX, call getpass(char *prompt)Z
+            // and on NT call ??
+            if (token && storepass == null && !protectedPath
+                    && !KeyStoreUtil.isWindowsKeyStore(storetype)) {
+                storepass = getPass
+                        (rb.getString("Enter.Passphrase.for.keystore."));
+            } else if (!token && storepass == null && prompt) {
+                storepass = getPass
+                        (rb.getString("Enter.Passphrase.for.keystore."));
+            }
+
+            try {
+                if (nullStream) {
+                    store.load(null, storepass);
+                } else {
+                    keyStoreName = keyStoreName.replace(File.separatorChar, '/');
+                    URL url = null;
+                    try {
+                        url = new URL(keyStoreName);
+                    } catch (java.net.MalformedURLException e) {
+                        // try as file
+                        url = new File(keyStoreName).toURI().toURL();
+                    }
+                    InputStream is = null;
+                    try {
+                        is = url.openStream();
+                        store.load(is, storepass);
+                    } finally {
+                        if (is != null) {
+                            is.close();
+                        }
+                    }
+                }
+                Enumeration<String> aliases = store.aliases();
+                while (aliases.hasMoreElements()) {
+                    String a = aliases.nextElement();
+                    try {
+                        X509Certificate c = (X509Certificate)store.getCertificate(a);
+                        // Only add TrustedCertificateEntry and self-signed
+                        // PrivateKeyEntry
+                        if (store.isCertificateEntry(a) ||
+                                c.getSubjectDN().equals(c.getIssuerDN())) {
+                            tas.add(new TrustAnchor(c, null));
+                        }
+                    } catch (Exception e2) {
+                        // ignore, when a SecretkeyEntry does not include a cert
+                    }
+                }
+            } finally {
+                try {
+                    pkixParameters = new PKIXParameters(tas);
+                    pkixParameters.setRevocationEnabled(false);
+                } catch (InvalidAlgorithmParameterException ex) {
+                    // Only if tas is empty
+                }
+            }
+        } catch (IOException ioe) {
+            throw new RuntimeException(rb.getString("keystore.load.") +
+                                        ioe.getMessage());
+        } catch (java.security.cert.CertificateException ce) {
+            throw new RuntimeException(rb.getString("certificate.exception.") +
+                                        ce.getMessage());
+        } catch (NoSuchProviderException pe) {
+            throw new RuntimeException(rb.getString("keystore.load.") +
+                                        pe.getMessage());
+        } catch (NoSuchAlgorithmException nsae) {
+            throw new RuntimeException(rb.getString("keystore.load.") +
+                                        nsae.getMessage());
+        } catch (KeyStoreException kse) {
+            throw new RuntimeException
+                (rb.getString("unable.to.instantiate.keystore.class.") +
+                kse.getMessage());
+        }
+    }
+
+    X509Certificate getTsaCert(String alias) {
+
+        java.security.cert.Certificate cs = null;
+
+        try {
+            cs = store.getCertificate(alias);
+        } catch (KeyStoreException kse) {
+            // this never happens, because keystore has been loaded
+        }
+        if (cs == null || (!(cs instanceof X509Certificate))) {
+            MessageFormat form = new MessageFormat(rb.getString
+                ("Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the"));
+            Object[] source = {alias, alias};
+            error(form.format(source));
+        }
+        return (X509Certificate) cs;
+    }
+
+    /**
+     * Check if userCert is designed to be a code signer
+     * @param userCert the certificate to be examined
+     * @param bad 3 booleans to show if the KeyUsage, ExtendedKeyUsage,
+     *            NetscapeCertType has codeSigning flag turned on.
+     *            If null, the class field badKeyUsage, badExtendedKeyUsage,
+     *            badNetscapeCertType will be set.
+     */
+    void checkCertUsage(X509Certificate userCert, boolean[] bad) {
+
+        // Can act as a signer?
+        // 1. if KeyUsage, then [0:digitalSignature] or
+        //    [1:nonRepudiation] should be true
+        // 2. if ExtendedKeyUsage, then should contains ANY or CODE_SIGNING
+        // 3. if NetscapeCertType, then should contains OBJECT_SIGNING
+        // 1,2,3 must be true
+
+        if (bad != null) {
+            bad[0] = bad[1] = bad[2] = false;
+        }
+
+        boolean[] keyUsage = userCert.getKeyUsage();
+        if (keyUsage != null) {
+            keyUsage = Arrays.copyOf(keyUsage, 9);
+            if (!keyUsage[0] && !keyUsage[1]) {
+                if (bad != null) {
+                    bad[0] = true;
+                    badKeyUsage = true;
+                }
+            }
+        }
+
+        try {
+            List<String> xKeyUsage = userCert.getExtendedKeyUsage();
+            if (xKeyUsage != null) {
+                if (!xKeyUsage.contains("2.5.29.37.0") // anyExtendedKeyUsage
+                        && !xKeyUsage.contains("1.3.6.1.5.5.7.3.3")) {  // codeSigning
+                    if (bad != null) {
+                        bad[1] = true;
+                        badExtendedKeyUsage = true;
+                    }
+                }
+            }
+        } catch (java.security.cert.CertificateParsingException e) {
+            // shouldn't happen
+        }
+
+        try {
+            // OID_NETSCAPE_CERT_TYPE
+            byte[] netscapeEx = userCert.getExtensionValue
+                    ("2.16.840.1.113730.1.1");
+            if (netscapeEx != null) {
+                DerInputStream in = new DerInputStream(netscapeEx);
+                byte[] encoded = in.getOctetString();
+                encoded = new DerValue(encoded).getUnalignedBitString()
+                        .toByteArray();
+
+                NetscapeCertTypeExtension extn =
+                        new NetscapeCertTypeExtension(encoded);
+
+                Boolean val = extn.get(NetscapeCertTypeExtension.OBJECT_SIGNING);
+                if (!val) {
+                    if (bad != null) {
+                        bad[2] = true;
+                        badNetscapeCertType = true;
+                    }
+                }
+            }
+        } catch (IOException e) {
+            //
+        }
+    }
+
+    void getAliasInfo(String alias) {
+
+        Key key = null;
+
+        try {
+            java.security.cert.Certificate[] cs = null;
+            if (altCertChain != null) {
+                try (FileInputStream fis = new FileInputStream(altCertChain)) {
+                    cs = CertificateFactory.getInstance("X.509").
+                            generateCertificates(fis).
+                            toArray(new Certificate[0]);
+                } catch (FileNotFoundException ex) {
+                    error(rb.getString("File.specified.by.certchain.does.not.exist"));
+                } catch (CertificateException | IOException ex) {
+                    error(rb.getString("Cannot.restore.certchain.from.file.specified"));
+                }
+            } else {
+                try {
+                    cs = store.getCertificateChain(alias);
+                } catch (KeyStoreException kse) {
+                    // this never happens, because keystore has been loaded
+                }
+            }
+            if (cs == null || cs.length == 0) {
+                if (altCertChain != null) {
+                    error(rb.getString
+                            ("Certificate.chain.not.found.in.the.file.specified."));
+                } else {
+                    MessageFormat form = new MessageFormat(rb.getString
+                        ("Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and"));
+                    Object[] source = {alias, alias};
+                    error(form.format(source));
+                }
+            }
+
+            certChain = new X509Certificate[cs.length];
+            for (int i=0; i<cs.length; i++) {
+                if (!(cs[i] instanceof X509Certificate)) {
+                    error(rb.getString
+                        ("found.non.X.509.certificate.in.signer.s.chain"));
+                }
+                certChain[i] = (X509Certificate)cs[i];
+            }
+
+            // We don't meant to print anything, the next call
+            // checks validity and keyUsage etc
+            printCert("", certChain[0], true, null, true);
+
+            try {
+                validateCertChain(Arrays.asList(certChain));
+            } catch (Exception e) {
+                if (debug) {
+                    e.printStackTrace();
+                }
+                if (e.getCause() != null &&
+                        (e.getCause() instanceof CertificateExpiredException ||
+                        e.getCause() instanceof CertificateNotYetValidException)) {
+                    // No more warning, we alreay have hasExpiredCert or notYetValidCert
+                } else {
+                    chainNotValidated = true;
+                }
+            }
+
+            try {
+                if (!token && keypass == null)
+                    key = store.getKey(alias, storepass);
+                else
+                    key = store.getKey(alias, keypass);
+            } catch (UnrecoverableKeyException e) {
+                if (token) {
+                    throw e;
+                } else if (keypass == null) {
+                    // Did not work out, so prompt user for key password
+                    MessageFormat form = new MessageFormat(rb.getString
+                        ("Enter.key.password.for.alias."));
+                    Object[] source = {alias};
+                    keypass = getPass(form.format(source));
+                    key = store.getKey(alias, keypass);
+                }
+            }
+        } catch (NoSuchAlgorithmException e) {
+            error(e.getMessage());
+        } catch (UnrecoverableKeyException e) {
+            error(rb.getString("unable.to.recover.key.from.keystore"));
+        } catch (KeyStoreException kse) {
+            // this never happens, because keystore has been loaded
+        }
+
+        if (!(key instanceof PrivateKey)) {
+            MessageFormat form = new MessageFormat(rb.getString
+                ("key.associated.with.alias.not.a.private.key"));
+            Object[] source = {alias};
+            error(form.format(source));
+        } else {
+            privateKey = (PrivateKey)key;
+        }
+    }
+
+    void error(String message)
+    {
+        System.out.println(rb.getString("jarsigner.")+message);
+        System.exit(1);
+    }
+
+
+    void error(String message, Exception e)
+    {
+        System.out.println(rb.getString("jarsigner.")+message);
+        if (debug) {
+            e.printStackTrace();
+        }
+        System.exit(1);
+    }
+
+    void validateCertChain(List<? extends Certificate> certs) throws Exception {
+        int cpLen = 0;
+        out: for (; cpLen<certs.size(); cpLen++) {
+            for (TrustAnchor ta: pkixParameters.getTrustAnchors()) {
+                if (ta.getTrustedCert().equals(certs.get(cpLen))) {
+                    break out;
+                }
+            }
+        }
+        if (cpLen > 0) {
+            CertPath cp = certificateFactory.generateCertPath(
+                    (cpLen == certs.size())? certs: certs.subList(0, cpLen));
+            validator.validate(cp, pkixParameters);
+        }
+    }
+
+    char[] getPass(String prompt)
+    {
+        System.err.print(prompt);
+        System.err.flush();
+        try {
+            char[] pass = Password.readPassword(System.in);
+
+            if (pass == null) {
+                error(rb.getString("you.must.enter.key.password"));
+            } else {
+                return pass;
+            }
+        } catch (IOException ioe) {
+            error(rb.getString("unable.to.read.password.")+ioe.getMessage());
+        }
+        // this shouldn't happen
+        return null;
+    }
+
+    /*
+     * Reads all the bytes for a given zip entry.
+     */
+    private synchronized byte[] getBytes(ZipFile zf,
+                                         ZipEntry ze) throws IOException {
+        int n;
+
+        InputStream is = null;
+        try {
+            is = zf.getInputStream(ze);
+            baos.reset();
+            long left = ze.getSize();
+
+            while((left > 0) && (n = is.read(buffer, 0, buffer.length)) != -1) {
+                baos.write(buffer, 0, n);
+                left -= n;
+            }
+        } finally {
+            if (is != null) {
+                is.close();
+            }
+        }
+
+        return baos.toByteArray();
+    }
+
+    /*
+     * Returns manifest entry from given jar file, or null if given jar file
+     * does not have a manifest entry.
+     */
+    private ZipEntry getManifestFile(ZipFile zf) {
+        ZipEntry ze = zf.getEntry(JarFile.MANIFEST_NAME);
+        if (ze == null) {
+            // Check all entries for matching name
+            Enumeration<? extends ZipEntry> enum_ = zf.entries();
+            while (enum_.hasMoreElements() && ze == null) {
+                ze = enum_.nextElement();
+                if (!JarFile.MANIFEST_NAME.equalsIgnoreCase
+                    (ze.getName())) {
+                    ze = null;
+                }
+            }
+        }
+        return ze;
+    }
+
+    /*
+     * Computes the digests of a zip entry, and returns them as an array
+     * of base64-encoded strings.
+     */
+    private synchronized String[] getDigests(ZipEntry ze, ZipFile zf,
+                                             MessageDigest[] digests)
+        throws IOException {
+
+        int n, i;
+        InputStream is = null;
+        try {
+            is = zf.getInputStream(ze);
+            long left = ze.getSize();
+            while((left > 0)
+                && (n = is.read(buffer, 0, buffer.length)) != -1) {
+                for (i=0; i<digests.length; i++) {
+                    digests[i].update(buffer, 0, n);
+                }
+                left -= n;
+            }
+        } finally {
+            if (is != null) {
+                is.close();
+            }
+        }
+
+        // complete the digests
+        String[] base64Digests = new String[digests.length];
+        for (i=0; i<digests.length; i++) {
+            base64Digests[i] = Base64.getEncoder().encodeToString(digests[i].digest());
+        }
+        return base64Digests;
+    }
+
+    /*
+     * Computes the digests of a zip entry, and returns them as a list of
+     * attributes
+     */
+    private Attributes getDigestAttributes(ZipEntry ze, ZipFile zf,
+                                           MessageDigest[] digests)
+        throws IOException {
+
+        String[] base64Digests = getDigests(ze, zf, digests);
+        Attributes attrs = new Attributes();
+
+        for (int i=0; i<digests.length; i++) {
+            attrs.putValue(digests[i].getAlgorithm()+"-Digest",
+                           base64Digests[i]);
+        }
+        return attrs;
+    }
+
+    /*
+     * Updates the digest attributes of a manifest entry, by adding or
+     * replacing digest values.
+     * A digest value is added if the manifest entry does not contain a digest
+     * for that particular algorithm.
+     * A digest value is replaced if it is obsolete.
+     *
+     * Returns true if the manifest entry has been changed, and false
+     * otherwise.
+     */
+    private boolean updateDigests(ZipEntry ze, ZipFile zf,
+                                  MessageDigest[] digests,
+                                  Manifest mf) throws IOException {
+        boolean update = false;
+
+        Attributes attrs = mf.getAttributes(ze.getName());
+        String[] base64Digests = getDigests(ze, zf, digests);
+
+        for (int i=0; i<digests.length; i++) {
+            // The entry name to be written into attrs
+            String name = null;
+            try {
+                // Find if the digest already exists
+                AlgorithmId aid = AlgorithmId.get(digests[i].getAlgorithm());
+                for (Object key: attrs.keySet()) {
+                    if (key instanceof Attributes.Name) {
+                        String n = ((Attributes.Name)key).toString();
+                        if (n.toUpperCase(Locale.ENGLISH).endsWith("-DIGEST")) {
+                            String tmp = n.substring(0, n.length() - 7);
+                            if (AlgorithmId.get(tmp).equals(aid)) {
+                                name = n;
+                                break;
+                            }
+                        }
+                    }
+                }
+            } catch (NoSuchAlgorithmException nsae) {
+                // Ignored. Writing new digest entry.
+            }
+
+            if (name == null) {
+                name = digests[i].getAlgorithm()+"-Digest";
+                attrs.putValue(name, base64Digests[i]);
+                update=true;
+            } else {
+                // compare digests, and replace the one in the manifest
+                // if they are different
+                String mfDigest = attrs.getValue(name);
+                if (!mfDigest.equalsIgnoreCase(base64Digests[i])) {
+                    attrs.putValue(name, base64Digests[i]);
+                    update=true;
+                }
+            }
+        }
+        return update;
+    }
+
+    /*
+     * Try to load the specified signing mechanism.
+     * The URL class loader is used.
+     */
+    private ContentSigner loadSigningMechanism(String signerClassName,
+        String signerClassPath) throws Exception {
+
+        // construct class loader
+        String cpString = null;   // make sure env.class.path defaults to dot
+
+        // do prepends to get correct ordering
+        cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
+        cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
+        cpString = PathList.appendPath(signerClassPath, cpString);
+        URL[] urls = PathList.pathToURLs(cpString);
+        ClassLoader appClassLoader = new URLClassLoader(urls);
+
+        // attempt to find signer
+        Class<?> signerClass = appClassLoader.loadClass(signerClassName);
+
+        // Check that it implements ContentSigner
+        Object signer = signerClass.newInstance();
+        if (!(signer instanceof ContentSigner)) {
+            MessageFormat form = new MessageFormat(
+                rb.getString("signerClass.is.not.a.signing.mechanism"));
+            Object[] source = {signerClass.getName()};
+            throw new IllegalArgumentException(form.format(source));
+        }
+        return (ContentSigner)signer;
+    }
+}
+
+class SignatureFile {
+
+    /** SignatureFile */
+    Manifest sf;
+
+    /** .SF base name */
+    String baseName;
+
+    public SignatureFile(MessageDigest digests[],
+                         Manifest mf,
+                         ManifestDigester md,
+                         String baseName,
+                         boolean signManifest)
+
+    {
+        this.baseName = baseName;
+
+        String version = System.getProperty("java.version");
+        String javaVendor = System.getProperty("java.vendor");
+
+        sf = new Manifest();
+        Attributes mattr = sf.getMainAttributes();
+
+        mattr.putValue(Attributes.Name.SIGNATURE_VERSION.toString(), "1.0");
+        mattr.putValue("Created-By", version + " (" + javaVendor + ")");
+
+        if (signManifest) {
+            // sign the whole manifest
+            for (int i=0; i < digests.length; i++) {
+                mattr.putValue(digests[i].getAlgorithm()+"-Digest-Manifest",
+                               Base64.getEncoder().encodeToString(md.manifestDigest(digests[i])));
+            }
+        }
+
+        // create digest of the manifest main attributes
+        ManifestDigester.Entry mde =
+                md.get(ManifestDigester.MF_MAIN_ATTRS, false);
+        if (mde != null) {
+            for (int i=0; i < digests.length; i++) {
+                mattr.putValue(digests[i].getAlgorithm() +
+                        "-Digest-" + ManifestDigester.MF_MAIN_ATTRS,
+                        Base64.getEncoder().encodeToString(mde.digest(digests[i])));
+            }
+        } else {
+            throw new IllegalStateException
+                ("ManifestDigester failed to create " +
+                "Manifest-Main-Attribute entry");
+        }
+
+        /* go through the manifest entries and create the digests */
+
+        Map<String,Attributes> entries = sf.getEntries();
+        Iterator<Map.Entry<String,Attributes>> mit =
+                                mf.getEntries().entrySet().iterator();
+        while(mit.hasNext()) {
+            Map.Entry<String,Attributes> e = mit.next();
+            String name = e.getKey();
+            mde = md.get(name, false);
+            if (mde != null) {
+                Attributes attr = new Attributes();
+                for (int i=0; i < digests.length; i++) {
+                    attr.putValue(digests[i].getAlgorithm()+"-Digest",
+                                  Base64.getEncoder().encodeToString(mde.digest(digests[i])));
+                }
+                entries.put(name, attr);
+            }
+        }
+    }
+
+    /**
+     * Writes the SignatureFile to the specified OutputStream.
+     *
+     * @param out the output stream
+     * @exception IOException if an I/O error has occurred
+     */
+
+    public void write(OutputStream out) throws IOException
+    {
+        sf.write(out);
+    }
+
+    /**
+     * get .SF file name
+     */
+    public String getMetaName()
+    {
+        return "META-INF/"+ baseName + ".SF";
+    }
+
+    /**
+     * get base file name
+     */
+    public String getBaseName()
+    {
+        return baseName;
+    }
+
+    /*
+     * Generate a signed data block.
+     * If a URL or a certificate (containing a URL) for a Timestamping
+     * Authority is supplied then a signature timestamp is generated and
+     * inserted into the signed data block.
+     *
+     * @param sigalg signature algorithm to use, or null to use default
+     * @param tsaUrl The location of the Timestamping Authority. If null
+     *               then no timestamp is requested.
+     * @param tsaCert The certificate for the Timestamping Authority. If null
+     *               then no timestamp is requested.
+     * @param signingMechanism The signing mechanism to use.
+     * @param args The command-line arguments to jarsigner.
+     * @param zipFile The original source Zip file.
+     */
+    public Block generateBlock(PrivateKey privateKey,
+                               String sigalg,
+                               X509Certificate[] certChain,
+                               boolean externalSF, String tsaUrl,
+                               X509Certificate tsaCert,
+                               String tSAPolicyID,
+                               String tSADigestAlg,
+                               ContentSigner signingMechanism,
+                               String[] args, ZipFile zipFile)
+        throws NoSuchAlgorithmException, InvalidKeyException, IOException,
+            SignatureException, CertificateException
+    {
+        return new Block(this, privateKey, sigalg, certChain, externalSF,
+                tsaUrl, tsaCert, tSAPolicyID, tSADigestAlg, signingMechanism, args, zipFile);
+    }
+
+
+    public static class Block {
+
+        private byte[] block;
+        private String blockFileName;
+
+        /*
+         * Construct a new signature block.
+         */
+        Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
+            X509Certificate[] certChain, boolean externalSF, String tsaUrl,
+            X509Certificate tsaCert, String tSAPolicyID, String tSADigestAlg,
+            ContentSigner signingMechanism, String[] args, ZipFile zipFile)
+            throws NoSuchAlgorithmException, InvalidKeyException, IOException,
+            SignatureException, CertificateException {
+
+            Principal issuerName = certChain[0].getIssuerDN();
+            if (!(issuerName instanceof X500Name)) {
+                // must extract the original encoded form of DN for subsequent
+                // name comparison checks (converting to a String and back to
+                // an encoded DN could cause the types of String attribute
+                // values to be changed)
+                X509CertInfo tbsCert = new
+                    X509CertInfo(certChain[0].getTBSCertificate());
+                issuerName = (Principal)
+                    tbsCert.get(X509CertInfo.ISSUER + "." +
+                                X509CertInfo.DN_NAME);
+                }
+            BigInteger serial = certChain[0].getSerialNumber();
+
+            String signatureAlgorithm;
+            String keyAlgorithm = privateKey.getAlgorithm();
+            /*
+             * If no signature algorithm was specified, we choose a
+             * default that is compatible with the private key algorithm.
+             */
+            if (sigalg == null) {
+
+                if (keyAlgorithm.equalsIgnoreCase("DSA"))
+                    signatureAlgorithm = "SHA256withDSA";
+                else if (keyAlgorithm.equalsIgnoreCase("RSA"))
+                    signatureAlgorithm = "SHA256withRSA";
+                else if (keyAlgorithm.equalsIgnoreCase("EC"))
+                    signatureAlgorithm = "SHA256withECDSA";
+                else
+                    throw new RuntimeException("private key is not a DSA or "
+                                               + "RSA key");
+            } else {
+                signatureAlgorithm = sigalg;
+            }
+
+            // check common invalid key/signature algorithm combinations
+            String sigAlgUpperCase = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
+            if ((sigAlgUpperCase.endsWith("WITHRSA") &&
+                !keyAlgorithm.equalsIgnoreCase("RSA")) ||
+                (sigAlgUpperCase.endsWith("WITHECDSA") &&
+                !keyAlgorithm.equalsIgnoreCase("EC")) ||
+                (sigAlgUpperCase.endsWith("WITHDSA") &&
+                !keyAlgorithm.equalsIgnoreCase("DSA"))) {
+                throw new SignatureException
+                    ("private key algorithm is not compatible with signature algorithm");
+            }
+
+            blockFileName = "META-INF/"+sfg.getBaseName()+"."+keyAlgorithm;
+
+            AlgorithmId sigAlg = AlgorithmId.get(signatureAlgorithm);
+            AlgorithmId digEncrAlg = AlgorithmId.get(keyAlgorithm);
+
+            Signature sig = Signature.getInstance(signatureAlgorithm);
+            sig.initSign(privateKey);
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            sfg.write(baos);
+
+            byte[] content = baos.toByteArray();
+
+            sig.update(content);
+            byte[] signature = sig.sign();
+
+            // Timestamp the signature and generate the signature block file
+            if (signingMechanism == null) {
+                signingMechanism = new TimestampedSigner();
+            }
+            URI tsaUri = null;
+            try {
+                if (tsaUrl != null) {
+                    tsaUri = new URI(tsaUrl);
+                }
+            } catch (URISyntaxException e) {
+                throw new IOException(e);
+            }
+
+            // Assemble parameters for the signing mechanism
+            ContentSignerParameters params =
+                new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID,
+                        tSADigestAlg, signature,
+                    signatureAlgorithm, certChain, content, zipFile);
+
+            // Generate the signature block
+            block = signingMechanism.generateSignedData(
+                    params, externalSF, (tsaUrl != null || tsaCert != null));
+        }
+
+        /*
+         * get block file name.
+         */
+        public String getMetaName()
+        {
+            return blockFileName;
+        }
+
+        /**
+         * Writes the block file to the specified OutputStream.
+         *
+         * @param out the output stream
+         * @exception IOException if an I/O error has occurred
+         */
+
+        public void write(OutputStream out) throws IOException
+        {
+            out.write(block);
+        }
+    }
+}
+
+
+/*
+ * This object encapsulates the parameters used to perform content signing.
+ */
+class JarSignerParameters implements ContentSignerParameters {
+
+    private String[] args;
+    private URI tsa;
+    private X509Certificate tsaCertificate;
+    private byte[] signature;
+    private String signatureAlgorithm;
+    private X509Certificate[] signerCertificateChain;
+    private byte[] content;
+    private ZipFile source;
+    private String tSAPolicyID;
+    private String tSADigestAlg;
+
+    /**
+     * Create a new object.
+     */
+    JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
+        String tSAPolicyID, String tSADigestAlg,
+        byte[] signature, String signatureAlgorithm,
+        X509Certificate[] signerCertificateChain, byte[] content,
+        ZipFile source) {
+
+        if (signature == null || signatureAlgorithm == null ||
+            signerCertificateChain == null || tSADigestAlg == null) {
+            throw new NullPointerException();
+        }
+        this.args = args;
+        this.tsa = tsa;
+        this.tsaCertificate = tsaCertificate;
+        this.tSAPolicyID = tSAPolicyID;
+        this.tSADigestAlg = tSADigestAlg;
+        this.signature = signature;
+        this.signatureAlgorithm = signatureAlgorithm;
+        this.signerCertificateChain = signerCertificateChain;
+        this.content = content;
+        this.source = source;
+    }
+
+    /**
+     * Retrieves the command-line arguments.
+     *
+     * @return The command-line arguments. May be null.
+     */
+    public String[] getCommandLine() {
+        return args;
+    }
+
+    /**
+     * Retrieves the identifier for a Timestamping Authority (TSA).
+     *
+     * @return The TSA identifier. May be null.
+     */
+    public URI getTimestampingAuthority() {
+        return tsa;
+    }
+
+    /**
+     * Retrieves the certificate for a Timestamping Authority (TSA).
+     *
+     * @return The TSA certificate. May be null.
+     */
+    public X509Certificate getTimestampingAuthorityCertificate() {
+        return tsaCertificate;
+    }
+
+    public String getTSAPolicyID() {
+        return tSAPolicyID;
+    }
+
+    public String getTSADigestAlg() {
+        return tSADigestAlg;
+    }
+
+    /**
+     * Retrieves the signature.
+     *
+     * @return The non-null signature bytes.
+     */
+    public byte[] getSignature() {
+        return signature;
+    }
+
+    /**
+     * Retrieves the name of the signature algorithm.
+     *
+     * @return The non-null string name of the signature algorithm.
+     */
+    public String getSignatureAlgorithm() {
+        return signatureAlgorithm;
+    }
+
+    /**
+     * Retrieves the signer's X.509 certificate chain.
+     *
+     * @return The non-null array of X.509 public-key certificates.
+     */
+    public X509Certificate[] getSignerCertificateChain() {
+        return signerCertificateChain;
+    }
+
+    /**
+     * Retrieves the content that was signed.
+     *
+     * @return The content bytes. May be null.
+     */
+    public byte[] getContent() {
+        return content;
+    }
+
+    /**
+     * Retrieves the original source ZIP file before it was signed.
+     *
+     * @return The original ZIP file. May be null.
+     */
+    public ZipFile getSource() {
+        return source;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,261 @@
+/*
+ * 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.
+ */
+
+package sun.security.tools.jarsigner;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for JarSigner.
+ *
+ */
+public class Resources extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+
+        // shared (from jarsigner)
+        {"SPACE", " "},
+        {"2SPACE", "  "},
+        {"6SPACE", "      "},
+        {"COMMA", ", "},
+
+        {"provName.not.a.provider", "{0} not a provider"},
+        {"signerClass.is.not.a.signing.mechanism", "{0} is not a signing mechanism"},
+        {"jarsigner.error.", "jarsigner error: "},
+        {"Illegal.option.", "Illegal option: "},
+        {".keystore.must.be.NONE.if.storetype.is.{0}",
+                "-keystore must be NONE if -storetype is {0}"},
+        {".keypass.can.not.be.specified.if.storetype.is.{0}",
+                "-keypass can not be specified if -storetype is {0}"},
+        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
+                "If -protected is specified, then -storepass and -keypass must not be specified"},
+        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
+                 "If keystore is not password protected, then -storepass and -keypass must not be specified"},
+        {"Usage.jarsigner.options.jar.file.alias",
+                "Usage: jarsigner [options] jar-file alias"},
+        {".jarsigner.verify.options.jar.file.alias.",
+                "       jarsigner -verify [options] jar-file [alias...]"},
+        {".keystore.url.keystore.location",
+                "[-keystore <url>]           keystore location"},
+        {".storepass.password.password.for.keystore.integrity",
+            "[-storepass <password>]     password for keystore integrity"},
+        {".storetype.type.keystore.type",
+                "[-storetype <type>]         keystore type"},
+        {".keypass.password.password.for.private.key.if.different.",
+                "[-keypass <password>]       password for private key (if different)"},
+        {".certchain.file.name.of.alternative.certchain.file",
+                "[-certchain <file>]         name of alternative certchain file"},
+        {".sigfile.file.name.of.SF.DSA.file",
+                "[-sigfile <file>]           name of .SF/.DSA file"},
+        {".signedjar.file.name.of.signed.JAR.file",
+                "[-signedjar <file>]         name of signed JAR file"},
+        {".digestalg.algorithm.name.of.digest.algorithm",
+                "[-digestalg <algorithm>]    name of digest algorithm"},
+        {".sigalg.algorithm.name.of.signature.algorithm",
+                "[-sigalg <algorithm>]       name of signature algorithm"},
+        {".verify.verify.a.signed.JAR.file",
+                "[-verify]                   verify a signed JAR file"},
+        {".verbose.suboptions.verbose.output.when.signing.verifying.",
+                "[-verbose[:suboptions]]     verbose output when signing/verifying."},
+        {".suboptions.can.be.all.grouped.or.summary",
+                "                            suboptions can be all, grouped or summary"},
+        {".certs.display.certificates.when.verbose.and.verifying",
+                "[-certs]                    display certificates when verbose and verifying"},
+        {".tsa.url.location.of.the.Timestamping.Authority",
+                "[-tsa <url>]                location of the Timestamping Authority"},
+        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
+                "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
+        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
+                "[-tsapolicyid <oid>]        TSAPolicyID for Timestamping Authority"},
+        {".tsadigestalg.algorithm.of.digest.data.in.timestamping.request",
+                "[-tsadigestalg <algorithm>] algorithm of digest data in timestamping request"},
+        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
+                "[-altsigner <class>]        class name of an alternative signing mechanism"},
+        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
+                "[-altsignerpath <pathlist>] location of an alternative signing mechanism"},
+        {".internalsf.include.the.SF.file.inside.the.signature.block",
+                "[-internalsf]               include the .SF file inside the signature block"},
+        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
+                "[-sectionsonly]             don't compute hash of entire manifest"},
+        {".protected.keystore.has.protected.authentication.path",
+                "[-protected]                keystore has protected authentication path"},
+        {".providerName.name.provider.name",
+                "[-providerName <name>]      provider name"},
+        {".providerClass.class.name.of.cryptographic.service.provider.s",
+                "[-providerClass <class>     name of cryptographic service provider's"},
+        {".providerArg.arg.master.class.file.and.constructor.argument",
+                "  [-providerArg <arg>]] ... master class file and constructor argument"},
+        {".strict.treat.warnings.as.errors",
+                "[-strict]                   treat warnings as errors"},
+        {".conf.url.specify.a.pre.configured.options.file",
+                "[-conf <url>]               specify a pre-configured options file"},
+        {"Option.lacks.argument", "Option lacks argument"},
+        {"Please.type.jarsigner.help.for.usage", "Please type jarsigner -help for usage"},
+        {"Please.specify.jarfile.name", "Please specify jarfile name"},
+        {"Please.specify.alias.name", "Please specify alias name"},
+        {"Only.one.alias.can.be.specified", "Only one alias can be specified"},
+        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
+                 "This jar contains signed entries which are not signed by the specified alias(es)."},
+        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
+                  "This jar contains signed entries that are not signed by alias in this keystore."},
+        {"s", "s"},
+        {"m", "m"},
+        {"k", "k"},
+        {"i", "i"},
+        {".and.d.more.", "(and %d more)"},
+        {".s.signature.was.verified.",
+                "  s = signature was verified "},
+        {".m.entry.is.listed.in.manifest",
+                "  m = entry is listed in manifest"},
+        {".k.at.least.one.certificate.was.found.in.keystore",
+                "  k = at least one certificate was found in keystore"},
+        {".i.at.least.one.certificate.was.found.in.identity.scope",
+                "  i = at least one certificate was found in identity scope"},
+        {".X.not.signed.by.specified.alias.es.",
+                "  X = not signed by specified alias(es)"},
+        {"no.manifest.", "no manifest."},
+        {".Signature.related.entries.","(Signature related entries)"},
+        {".Unsigned.entries.", "(Unsigned entries)"},
+        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
+                "jar is unsigned. (signatures missing or not parsable)"},
+        {"jar.signed.", "jar signed."},
+        {"jar.signed.with.signer.errors.", "jar signed, with signer errors."},
+        {"jar.verified.", "jar verified."},
+        {"jar.verified.with.signer.errors.", "jar verified, with signer errors."},
+        {"jarsigner.", "jarsigner: "},
+        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
+                "signature filename must consist of the following characters: A-Z, 0-9, _ or -"},
+        {"unable.to.open.jar.file.", "unable to open jar file: "},
+        {"unable.to.create.", "unable to create: "},
+        {".adding.", "   adding: "},
+        {".updating.", " updating: "},
+        {".signing.", "  signing: "},
+        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
+                "attempt to rename {0} to {1} failed"},
+        {"attempt.to.rename.jarFile.to.origJar.failed",
+                "attempt to rename {0} to {1} failed"},
+        {"unable.to.sign.jar.", "unable to sign jar: "},
+        {"Enter.Passphrase.for.keystore.", "Enter Passphrase for keystore: "},
+        {"keystore.load.", "keystore load: "},
+        {"certificate.exception.", "certificate exception: "},
+        {"unable.to.instantiate.keystore.class.",
+                "unable to instantiate keystore class: "},
+        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
+                "Certificate chain not found for: {0}.  {1} must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."},
+        {"File.specified.by.certchain.does.not.exist",
+                "File specified by -certchain does not exist"},
+        {"Cannot.restore.certchain.from.file.specified",
+                "Cannot restore certchain from file specified"},
+        {"Certificate.chain.not.found.in.the.file.specified.",
+                "Certificate chain not found in the file specified."},
+        {"found.non.X.509.certificate.in.signer.s.chain",
+                "found non-X.509 certificate in signer's chain"},
+        {"incomplete.certificate.chain", "incomplete certificate chain"},
+        {"Enter.key.password.for.alias.", "Enter key password for {0}: "},
+        {"unable.to.recover.key.from.keystore",
+                "unable to recover key from keystore"},
+        {"key.associated.with.alias.not.a.private.key",
+                "key associated with {0} not a private key"},
+        {"you.must.enter.key.password", "you must enter key password"},
+        {"unable.to.read.password.", "unable to read password: "},
+        {"certificate.is.valid.from", "certificate is valid from {0} to {1}"},
+        {"certificate.expired.on", "certificate expired on {0}"},
+        {"certificate.is.not.valid.until",
+                "certificate is not valid until {0}"},
+        {"certificate.will.expire.on", "certificate will expire on {0}"},
+        {".CertPath.not.validated.", "[CertPath not validated: "},
+        {"requesting.a.signature.timestamp",
+                "requesting a signature timestamp"},
+        {"TSA.location.", "TSA location: "},
+        {"TSA.certificate.", "TSA certificate: "},
+        {"no.response.from.the.Timestamping.Authority.",
+                "no response from the Timestamping Authority. When connecting"
+                + " from behind a firewall an HTTP or HTTPS proxy may need to"
+                + " be specified. Supply the following options to jarsigner:"},
+        {"or", "or"},
+        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
+                "Certificate not found for: {0}.  {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."},
+        {"using.an.alternative.signing.mechanism",
+                "using an alternative signing mechanism"},
+        {"entry.was.signed.on", "entry was signed on {0}"},
+        {"Warning.", "Warning: "},
+        {"Error.", "Error: "},
+        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
+                "This jar contains unsigned entries which have not been integrity-checked. "},
+        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
+                "This jar contains entries whose signer certificate has expired. "},
+        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
+                "This jar contains entries whose signer certificate will expire within six months. "},
+        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
+                "This jar contains entries whose signer certificate is not yet valid. "},
+        {"Re.run.with.the.verbose.option.for.more.details.",
+                "Re-run with the -verbose option for more details."},
+        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
+                "Re-run with the -verbose and -certs options for more details."},
+        {"The.signer.certificate.has.expired.",
+                "The signer certificate has expired."},
+        {"The.signer.certificate.will.expire.within.six.months.",
+                "The signer certificate will expire within six months."},
+        {"The.signer.certificate.is.not.yet.valid.",
+                "The signer certificate is not yet valid."},
+        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "The signer certificate's KeyUsage extension doesn't allow code signing."},
+        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "The signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
+        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "The signer certificate's NetscapeCertType extension doesn't allow code signing."},
+        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing."},
+        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
+        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing."},
+        {".{0}.extension.does.not.support.code.signing.",
+                 "[{0} extension does not support code signing]"},
+        {"The.signer.s.certificate.chain.is.not.validated.",
+                "The signer's certificate chain is not validated."},
+        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
+                 "This jar contains entries whose certificate chain is not validated."},
+        {"no.timestamp.signing",
+                "No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (%1$tY-%1$tm-%1$td) or after any future revocation date."},
+        {"no.timestamp.verifying",
+                "This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (%1$tY-%1$tm-%1$td) or after any future revocation date."},
+        {"Unknown.password.type.", "Unknown password type: "},
+        {"Cannot.find.environment.variable.",
+                "Cannot find environment variable: "},
+        {"Cannot.find.file.", "Cannot find file: "},
+    };
+
+    /**
+     * 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.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,247 @@
+/*
+ * 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.jarsigner;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for JarSigner.
+ *
+ */
+public class Resources_ja extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+
+        // shared (from jarsigner)
+        {"SPACE", " "},
+        {"2SPACE", "  "},
+        {"6SPACE", "      "},
+        {"COMMA", ", "},
+
+        {"provName.not.a.provider", "{0}\u306F\u30D7\u30ED\u30D0\u30A4\u30C0\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
+        {"signerClass.is.not.a.signing.mechanism", "{0}\u306F\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
+        {"jarsigner.error.", "jarsigner\u30A8\u30E9\u30FC: "},
+        {"Illegal.option.", "\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: "},
+        {".keystore.must.be.NONE.if.storetype.is.{0}",
+                "-storetype\u304C{0}\u306E\u5834\u5408\u3001-keystore\u306FNONE\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
+        {".keypass.can.not.be.specified.if.storetype.is.{0}",
+                "-storetype\u304C{0}\u306E\u5834\u5408\u3001-keypass\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"},
+        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
+                "-protected\u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u306F\u3001-storepass\u304A\u3088\u3073-keypass\u3092\u6307\u5B9A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044"},
+        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
+                 "\u30AD\u30FC\u30B9\u30C8\u30A2\u304C\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u4FDD\u8B77\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001-storepass\u304A\u3088\u3073-keypass\u3092\u6307\u5B9A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044"},
+        {"Usage.jarsigner.options.jar.file.alias",
+                "\u4F7F\u7528\u65B9\u6CD5: jarsigner [options] jar-file alias"},
+        {".jarsigner.verify.options.jar.file.alias.",
+                "       jarsigner -verify [options] jar-file [alias...]"},
+        {".keystore.url.keystore.location",
+                "[-keystore <url>]           \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u4F4D\u7F6E"},
+        {".storepass.password.password.for.keystore.integrity",
+            "[-storepass <password>]     \u30AD\u30FC\u30B9\u30C8\u30A2\u6574\u5408\u6027\u306E\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9"},
+        {".storetype.type.keystore.type",
+                "[-storetype <type>]         \u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u578B"},
+        {".keypass.password.password.for.private.key.if.different.",
+                "[-keypass <password>]       \u79D8\u5BC6\u9375\u306E\u30D1\u30B9\u30EF\u30FC\u30C9(\u7570\u306A\u308B\u5834\u5408)"},
+        {".certchain.file.name.of.alternative.certchain.file",
+                "[-certchain <file>]         \u4EE3\u66FF\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
+        {".sigfile.file.name.of.SF.DSA.file",
+                "[-sigfile <file>]           .SF/.DSA\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
+        {".signedjar.file.name.of.signed.JAR.file",
+                "[-signedjar <file>]         \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D"},
+        {".digestalg.algorithm.name.of.digest.algorithm",
+                "[-digestalg <algorithm>]    \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
+        {".sigalg.algorithm.name.of.signature.algorithm",
+                "[-sigalg <algorithm>]       \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
+        {".verify.verify.a.signed.JAR.file",
+                "[-verify]                   \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"},
+        {".verbose.suboptions.verbose.output.when.signing.verifying.",
+                "[-verbose[:suboptions]]     \u7F72\u540D/\u691C\u8A3C\u6642\u306E\u8A73\u7D30\u51FA\u529B\u3002"},
+        {".suboptions.can.be.all.grouped.or.summary",
+                "                            \u30B5\u30D6\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u3001all\u3001grouped\u307E\u305F\u306Fsummary\u3092\u4F7F\u7528\u3067\u304D\u307E\u3059"},
+        {".certs.display.certificates.when.verbose.and.verifying",
+                "[-certs]                    \u8A73\u7D30\u51FA\u529B\u304A\u3088\u3073\u691C\u8A3C\u6642\u306B\u8A3C\u660E\u66F8\u3092\u8868\u793A"},
+        {".tsa.url.location.of.the.Timestamping.Authority",
+                "[-tsa <url>]                \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u5834\u6240"},
+        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
+                "[-tsacert <alias>]          \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306E\u516C\u958B\u9375\u8A3C\u660E\u66F8"},
+        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
+                "[-tsapolicyid <oid>]        \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306ETSAPolicyID"},
+        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
+                "[-altsigner <class>]        \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u30AF\u30E9\u30B9\u540D"},
+        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
+                "[-altsignerpath <pathlist>] \u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u5834\u6240"},
+        {".internalsf.include.the.SF.file.inside.the.signature.block",
+                "[-internalsf]               \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
+        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
+                "[-sectionsonly]             \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"},
+        {".protected.keystore.has.protected.authentication.path",
+                "[-protected]                \u30AD\u30FC\u30B9\u30C8\u30A2\u306B\u306F\u4FDD\u8B77\u3055\u308C\u305F\u8A8D\u8A3C\u30D1\u30B9\u304C\u3042\u308B"},
+        {".providerName.name.provider.name",
+                "[-providerName <name>]      \u30D7\u30ED\u30D0\u30A4\u30C0\u540D"},
+        {".providerClass.class.name.of.cryptographic.service.provider.s",
+                "[-providerClass <class>     \u6697\u53F7\u5316\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u306E\u540D\u524D"},
+        {".providerArg.arg.master.class.file.and.constructor.argument",
+                "  [-providerArg <arg>]] ... \u30DE\u30B9\u30BF\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3068\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570"},
+        {".strict.treat.warnings.as.errors",
+                "[-strict]                   \u8B66\u544A\u3092\u30A8\u30E9\u30FC\u3068\u3057\u3066\u51E6\u7406"},
+        {"Option.lacks.argument", "\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093"},
+        {"Please.type.jarsigner.help.for.usage", "\u4F7F\u7528\u65B9\u6CD5\u306B\u3064\u3044\u3066\u306Fjarsigner -help\u3068\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},
+        {"Please.specify.jarfile.name", "jarfile\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"},
+        {"Please.specify.alias.name", "\u5225\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044"},
+        {"Only.one.alias.can.be.specified", "\u5225\u540D\u306F1\u3064\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059"},
+        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
+                 "\u3053\u306Ejar\u306B\u542B\u307E\u308C\u308B\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA\u306F\u3001\u6307\u5B9A\u3055\u308C\u305F\u5225\u540D\u306B\u3088\u3063\u3066\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
+        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
+                  "\u3053\u306Ejar\u306B\u542B\u307E\u308C\u308B\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA\u306F\u3001\u3053\u306E\u30AD\u30FC\u30B9\u30C8\u30A2\u5185\u306E\u5225\u540D\u306B\u3088\u3063\u3066\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
+        {"s", "s"},
+        {"m", "m"},
+        {"k", "k"},
+        {"i", "i"},
+        {".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
+        {".s.signature.was.verified.",
+                "  s=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
+        {".m.entry.is.listed.in.manifest",
+                "  m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
+        {".k.at.least.one.certificate.was.found.in.keystore",
+                "  k=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30AD\u30FC\u30B9\u30C8\u30A2\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
+        {".i.at.least.one.certificate.was.found.in.identity.scope",
+                "  i=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
+        {".X.not.signed.by.specified.alias.es.",
+                "  X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
+        {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
+        {".Signature.related.entries.","(\u30B7\u30B0\u30CD\u30C1\u30E3\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
+        {".Unsigned.entries.", "(\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA)"},
+        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
+                "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
+        {"jar.verified.", "jar\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F\u3002"},
+        {"jarsigner.", "jarsigner: "},
+        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
+                "\u30B7\u30B0\u30CD\u30C1\u30E3\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
+        {"unable.to.open.jar.file.", "\u6B21\u306Ejar\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093: "},
+        {"unable.to.create.", "\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093: "},
+        {".adding.", "   \u8FFD\u52A0\u4E2D: "},
+        {".updating.", " \u66F4\u65B0\u4E2D: "},
+        {".signing.", "  \u7F72\u540D\u4E2D: "},
+        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
+                "{0}\u306E\u540D\u524D\u3092{1}\u306B\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u304C\u5931\u6557\u3057\u307E\u3057\u305F"},
+        {"attempt.to.rename.jarFile.to.origJar.failed",
+                "{0}\u306E\u540D\u524D\u3092{1}\u306B\u5909\u66F4\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u304C\u5931\u6557\u3057\u307E\u3057\u305F"},
+        {"unable.to.sign.jar.", "jar\u306B\u7F72\u540D\u3067\u304D\u307E\u305B\u3093: "},
+        {"Enter.Passphrase.for.keystore.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
+        {"keystore.load.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30ED\u30FC\u30C9: "},
+        {"certificate.exception.", "\u8A3C\u660E\u66F8\u4F8B\u5916: "},
+        {"unable.to.instantiate.keystore.class.",
+                "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093: "},
+        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
+                "\u6B21\u306E\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}\u3002{1}\u306F\u3001\u79D8\u5BC6\u9375\u304A\u3088\u3073\u5BFE\u5FDC\u3059\u308B\u516C\u958B\u9375\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u3092\u542B\u3080\u6709\u52B9\u306AKeyStore\u9375\u30A8\u30F3\u30C8\u30EA\u3092\u53C2\u7167\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
+        {"File.specified.by.certchain.does.not.exist",
+                "-certchain\u3067\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057\u307E\u305B\u3093"},
+        {"Cannot.restore.certchain.from.file.specified",
+                "\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u3092\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093"},
+        {"Certificate.chain.not.found.in.the.file.specified.",
+                "\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u306F\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002"},
+        {"found.non.X.509.certificate.in.signer.s.chain",
+                "\u7F72\u540D\u8005\u306E\u9023\u9396\u5185\u3067\u975EX.509\u8A3C\u660E\u66F8\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
+        {"incomplete.certificate.chain", "\u4E0D\u5B8C\u5168\u306A\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3"},
+        {"Enter.key.password.for.alias.", "{0}\u306E\u9375\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
+        {"unable.to.recover.key.from.keystore",
+                "\u30AD\u30FC\u30B9\u30C8\u30A2\u304B\u3089\u9375\u3092\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093"},
+        {"key.associated.with.alias.not.a.private.key",
+                "{0}\u3068\u95A2\u9023\u4ED8\u3051\u3089\u308C\u305F\u9375\u306F\u3001\u79D8\u5BC6\u9375\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
+        {"you.must.enter.key.password", "\u9375\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
+        {"unable.to.read.password.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093: "},
+        {"certificate.is.valid.from", "\u8A3C\u660E\u66F8\u306F{0}\u304B\u3089{1}\u307E\u3067\u6709\u52B9\u3067\u3059"},
+        {"certificate.expired.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3057\u305F"},
+        {"certificate.is.not.valid.until",
+                "\u8A3C\u660E\u66F8\u306F{0}\u307E\u3067\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
+        {"certificate.will.expire.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3059"},
+        {".CertPath.not.validated.", "[CertPath\u304C\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "},
+        {"requesting.a.signature.timestamp",
+                "\u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
+        {"TSA.location.", "TSA\u306E\u5834\u6240: "},
+        {"TSA.certificate.", "TSA\u8A3C\u660E\u66F8: "},
+        {"no.response.from.the.Timestamping.Authority.",
+                "\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u304B\u3089\u306E\u30EC\u30B9\u30DD\u30F3\u30B9\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30A2\u30A6\u30A9\u30FC\u30EB\u3092\u4ECB\u3057\u3066\u63A5\u7D9A\u3059\u308B\u3068\u304D\u306F\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066HTTP\u307E\u305F\u306FHTTPS\u30D7\u30ED\u30AD\u30B7\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002jarsigner\u306B\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044:"},
+        {"or", "\u307E\u305F\u306F"},
+        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
+                "\u8A3C\u660E\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F: {0}\u3002{1}\u306F\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u5C40\u306EX.509\u516C\u958B\u9375\u8A3C\u660E\u66F8\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u6709\u52B9\u306AKeyStore\u30A8\u30F3\u30C8\u30EA\u3092\u53C2\u7167\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
+        {"using.an.alternative.signing.mechanism",
+                "\u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u4F7F\u7528"},
+        {"entry.was.signed.on", "\u30A8\u30F3\u30C8\u30EA\u306F{0}\u306B\u7F72\u540D\u3055\u308C\u307E\u3057\u305F"},
+        {"Warning.", "\u8B66\u544A: "},
+        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
+                "\u3053\u306Ejar\u306B\u306F\u3001\u6574\u5408\u6027\u30C1\u30A7\u30C3\u30AF\u3092\u3057\u3066\u3044\u306A\u3044\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
+                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C\u671F\u9650\u5207\u308C\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
+                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C6\u304B\u6708\u4EE5\u5185\u306B\u671F\u9650\u5207\u308C\u3068\u306A\u308B\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
+                "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u304C\u307E\u3060\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002 "},
+        {"Re.run.with.the.verbose.option.for.more.details.",
+                "\u8A73\u7D30\u306F\u3001-verbose\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
+                "\u8A73\u7D30\u306F\u3001-verbose\u304A\u3088\u3073-certs\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+        {"The.signer.certificate.has.expired.",
+                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F\u671F\u9650\u5207\u308C\u3067\u3059\u3002"},
+        {"The.signer.certificate.will.expire.within.six.months.",
+                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F6\u304B\u6708\u4EE5\u5185\u306B\u671F\u9650\u5207\u308C\u306B\u306A\u308A\u307E\u3059\u3002"},
+        {"The.signer.certificate.is.not.yet.valid.",
+                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u306F\u307E\u3060\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093\u3002"},
+        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EKeyUsage\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
+        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EExtendedKeyUsage\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
+        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306ENetscapeCertType\u62E1\u5F35\u6A5F\u80FD\u3067\u306F\u3001\u30B3\u30FC\u30C9\u7F72\u540D\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EKeyUsage\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306EExtendedKeyUsage\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "\u3053\u306Ejar\u306B\u306F\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306ENetscapeCertType\u62E1\u5F35\u6A5F\u80FD\u304C\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u8A31\u53EF\u3057\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
+        {".{0}.extension.does.not.support.code.signing.",
+                 "[{0}\u62E1\u5F35\u6A5F\u80FD\u306F\u30B3\u30FC\u30C9\u7F72\u540D\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093]"},
+        {"The.signer.s.certificate.chain.is.not.validated.",
+                "\u7F72\u540D\u8005\u306E\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u307E\u3060\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
+        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
+                 "\u3053\u306Ejar\u306B\u306F\u3001\u8A3C\u660E\u66F8\u30C1\u30A7\u30FC\u30F3\u304C\u307E\u3060\u691C\u8A3C\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002"},
+        {"Unknown.password.type.", "\u4E0D\u660E\u306A\u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30BF\u30A4\u30D7: "},
+        {"Cannot.find.environment.variable.",
+                "\u74B0\u5883\u5909\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "},
+        {"Cannot.find.file.", "\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "},
+    };
+
+    /**
+     * 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.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,247 @@
+/*
+ * 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.jarsigner;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for JarSigner.
+ *
+ */
+public class Resources_zh_CN extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+
+        // shared (from jarsigner)
+        {"SPACE", " "},
+        {"2SPACE", "  "},
+        {"6SPACE", "      "},
+        {"COMMA", ", "},
+
+        {"provName.not.a.provider", "{0}\u4E0D\u662F\u63D0\u4F9B\u65B9"},
+        {"signerClass.is.not.a.signing.mechanism", "{0}\u4E0D\u662F\u7B7E\u540D\u673A\u5236"},
+        {"jarsigner.error.", "jarsigner \u9519\u8BEF: "},
+        {"Illegal.option.", "\u975E\u6CD5\u9009\u9879: "},
+        {".keystore.must.be.NONE.if.storetype.is.{0}",
+                "\u5982\u679C -storetype \u4E3A {0}, \u5219 -keystore \u5FC5\u987B\u4E3A NONE"},
+        {".keypass.can.not.be.specified.if.storetype.is.{0}",
+                "\u5982\u679C -storetype \u4E3A {0}, \u5219\u4E0D\u80FD\u6307\u5B9A -keypass"},
+        {"If.protected.is.specified.then.storepass.and.keypass.must.not.be.specified",
+                "\u5982\u679C\u6307\u5B9A\u4E86 -protected, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
+        {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
+                 "\u5982\u679C\u5BC6\u94A5\u5E93\u672A\u53D7\u53E3\u4EE4\u4FDD\u62A4, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
+        {"Usage.jarsigner.options.jar.file.alias",
+                "\u7528\u6CD5: jarsigner [\u9009\u9879] jar-file \u522B\u540D"},
+        {".jarsigner.verify.options.jar.file.alias.",
+                "       jarsigner -verify [\u9009\u9879] jar-file [\u522B\u540D...]"},
+        {".keystore.url.keystore.location",
+                "[-keystore <url>]           \u5BC6\u94A5\u5E93\u4F4D\u7F6E"},
+        {".storepass.password.password.for.keystore.integrity",
+            "[-storepass <\u53E3\u4EE4>]         \u7528\u4E8E\u5BC6\u94A5\u5E93\u5B8C\u6574\u6027\u7684\u53E3\u4EE4"},
+        {".storetype.type.keystore.type",
+                "[-storetype <\u7C7B\u578B>]         \u5BC6\u94A5\u5E93\u7C7B\u578B"},
+        {".keypass.password.password.for.private.key.if.different.",
+                "[-keypass <\u53E3\u4EE4>]           \u79C1\u6709\u5BC6\u94A5\u7684\u53E3\u4EE4 (\u5982\u679C\u4E0D\u540C)"},
+        {".certchain.file.name.of.alternative.certchain.file",
+                "[-certchain <\u6587\u4EF6>]         \u66FF\u4EE3 certchain \u6587\u4EF6\u7684\u540D\u79F0"},
+        {".sigfile.file.name.of.SF.DSA.file",
+                "[-sigfile <\u6587\u4EF6>]           .SF/.DSA \u6587\u4EF6\u7684\u540D\u79F0"},
+        {".signedjar.file.name.of.signed.JAR.file",
+                "[-signedjar <\u6587\u4EF6>]         \u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6\u7684\u540D\u79F0"},
+        {".digestalg.algorithm.name.of.digest.algorithm",
+                "[-digestalg <\u7B97\u6CD5>]        \u6458\u8981\u7B97\u6CD5\u7684\u540D\u79F0"},
+        {".sigalg.algorithm.name.of.signature.algorithm",
+                "[-sigalg <\u7B97\u6CD5>]           \u7B7E\u540D\u7B97\u6CD5\u7684\u540D\u79F0"},
+        {".verify.verify.a.signed.JAR.file",
+                "[-verify]                   \u9A8C\u8BC1\u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6"},
+        {".verbose.suboptions.verbose.output.when.signing.verifying.",
+                "[-verbose[:suboptions]]     \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
+        {".suboptions.can.be.all.grouped.or.summary",
+                "                            \u5B50\u9009\u9879\u53EF\u4EE5\u662F all, grouped \u6216 summary"},
+        {".certs.display.certificates.when.verbose.and.verifying",
+                "[-certs]                    \u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u548C\u9A8C\u8BC1\u65F6\u663E\u793A\u8BC1\u4E66"},
+        {".tsa.url.location.of.the.Timestamping.Authority",
+                "[-tsa <url>]                \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u4F4D\u7F6E"},
+        {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
+                "[-tsacert <\u522B\u540D>]           \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66"},
+        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
+                "[-tsapolicyid <oid>]        \u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 TSAPolicyID"},
+        {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
+                "[-altsigner <\u7C7B>]           \u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236\u7684\u7C7B\u540D"},
+        {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
+                "[-altsignerpath <\u8DEF\u5F84\u5217\u8868>] \u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236\u7684\u4F4D\u7F6E"},
+        {".internalsf.include.the.SF.file.inside.the.signature.block",
+                "[-internalsf]               \u5728\u7B7E\u540D\u5757\u5185\u5305\u542B .SF \u6587\u4EF6"},
+        {".sectionsonly.don.t.compute.hash.of.entire.manifest",
+                "[-sectionsonly]             \u4E0D\u8BA1\u7B97\u6574\u4E2A\u6E05\u5355\u7684\u6563\u5217"},
+        {".protected.keystore.has.protected.authentication.path",
+                "[-protected]                \u5BC6\u94A5\u5E93\u5177\u6709\u53D7\u4FDD\u62A4\u9A8C\u8BC1\u8DEF\u5F84"},
+        {".providerName.name.provider.name",
+                "[-providerName <\u540D\u79F0>]      \u63D0\u4F9B\u65B9\u540D\u79F0"},
+        {".providerClass.class.name.of.cryptographic.service.provider.s",
+                "[-providerClass <\u7C7B>        \u52A0\u5BC6\u670D\u52A1\u63D0\u4F9B\u65B9\u7684\u540D\u79F0"},
+        {".providerArg.arg.master.class.file.and.constructor.argument",
+                "  [-providerArg <\u53C2\u6570>]]... \u4E3B\u7C7B\u6587\u4EF6\u548C\u6784\u9020\u5668\u53C2\u6570"},
+        {".strict.treat.warnings.as.errors",
+                "[-strict]                   \u5C06\u8B66\u544A\u89C6\u4E3A\u9519\u8BEF"},
+        {"Option.lacks.argument", "\u9009\u9879\u7F3A\u5C11\u53C2\u6570"},
+        {"Please.type.jarsigner.help.for.usage", "\u8BF7\u952E\u5165 jarsigner -help \u4EE5\u4E86\u89E3\u7528\u6CD5"},
+        {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jarfile \u540D\u79F0"},
+        {"Please.specify.alias.name", "\u8BF7\u6307\u5B9A\u522B\u540D"},
+        {"Only.one.alias.can.be.specified", "\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A\u522B\u540D"},
+        {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
+                 "\u6B64 jar \u5305\u542B\u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D\u7684\u5DF2\u7B7E\u540D\u6761\u76EE\u3002"},
+        {"This.jar.contains.signed.entries.that.s.not.signed.by.alias.in.this.keystore.",
+                  "\u6B64 jar \u5305\u542B\u672A\u7531\u6B64\u5BC6\u94A5\u5E93\u4E2D\u7684\u522B\u540D\u7B7E\u540D\u7684\u5DF2\u7B7E\u540D\u6761\u76EE\u3002"},
+        {"s", "s"},
+        {"m", "m"},
+        {"k", "k"},
+        {"i", "i"},
+        {".and.d.more.", "(%d \u53CA\u4EE5\u4E0A)"},
+        {".s.signature.was.verified.",
+                "  s = \u5DF2\u9A8C\u8BC1\u7B7E\u540D "},
+        {".m.entry.is.listed.in.manifest",
+                "  m = \u5728\u6E05\u5355\u4E2D\u5217\u51FA\u6761\u76EE"},
+        {".k.at.least.one.certificate.was.found.in.keystore",
+                "  k = \u5728\u5BC6\u94A5\u5E93\u4E2D\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
+        {".i.at.least.one.certificate.was.found.in.identity.scope",
+                "  i = \u5728\u8EAB\u4EFD\u4F5C\u7528\u57DF\u5185\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
+        {".X.not.signed.by.specified.alias.es.",
+                "  X = \u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D"},
+        {"no.manifest.", "\u6CA1\u6709\u6E05\u5355\u3002"},
+        {".Signature.related.entries.","(\u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6761\u76EE)"},
+        {".Unsigned.entries.", "(\u672A\u7B7E\u540D\u6761\u76EE)"},
+        {"jar.is.unsigned.signatures.missing.or.not.parsable.",
+                "jar \u672A\u7B7E\u540D\u3002(\u7F3A\u5C11\u7B7E\u540D\u6216\u65E0\u6CD5\u89E3\u6790\u7B7E\u540D)"},
+        {"jar.verified.", "jar \u5DF2\u9A8C\u8BC1\u3002"},
+        {"jarsigner.", "jarsigner: "},
+        {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
+                "\u7B7E\u540D\u6587\u4EF6\u540D\u5FC5\u987B\u5305\u542B\u4EE5\u4E0B\u5B57\u7B26: A-Z, 0-9, _ \u6216 -"},
+        {"unable.to.open.jar.file.", "\u65E0\u6CD5\u6253\u5F00 jar \u6587\u4EF6: "},
+        {"unable.to.create.", "\u65E0\u6CD5\u521B\u5EFA: "},
+        {".adding.", "   \u6B63\u5728\u6DFB\u52A0: "},
+        {".updating.", " \u6B63\u5728\u66F4\u65B0: "},
+        {".signing.", "  \u6B63\u5728\u7B7E\u540D: "},
+        {"attempt.to.rename.signedJarFile.to.jarFile.failed",
+                "\u5C1D\u8BD5\u5C06{0}\u91CD\u547D\u540D\u4E3A{1}\u65F6\u5931\u8D25"},
+        {"attempt.to.rename.jarFile.to.origJar.failed",
+                "\u5C1D\u8BD5\u5C06{0}\u91CD\u547D\u540D\u4E3A{1}\u65F6\u5931\u8D25"},
+        {"unable.to.sign.jar.", "\u65E0\u6CD5\u5BF9 jar \u8FDB\u884C\u7B7E\u540D: "},
+        {"Enter.Passphrase.for.keystore.", "\u8F93\u5165\u5BC6\u94A5\u5E93\u7684\u5BC6\u7801\u77ED\u8BED: "},
+        {"keystore.load.", "\u5BC6\u94A5\u5E93\u52A0\u8F7D: "},
+        {"certificate.exception.", "\u8BC1\u4E66\u5F02\u5E38\u9519\u8BEF: "},
+        {"unable.to.instantiate.keystore.class.",
+                "\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5BC6\u94A5\u5E93\u7C7B: "},
+        {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
+                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u5BC6\u94A5\u6761\u76EE\u3002"},
+        {"File.specified.by.certchain.does.not.exist",
+                "\u7531 -certchain \u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5B58\u5728"},
+        {"Cannot.restore.certchain.from.file.specified",
+                "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F certchain"},
+        {"Certificate.chain.not.found.in.the.file.specified.",
+                "\u5728\u6307\u5B9A\u7684\u6587\u4EF6\u4E2D\u627E\u4E0D\u5230\u8BC1\u4E66\u94FE\u3002"},
+        {"found.non.X.509.certificate.in.signer.s.chain",
+                "\u5728\u7B7E\u540D\u8005\u7684\u94FE\u4E2D\u627E\u5230\u975E X.509 \u8BC1\u4E66"},
+        {"incomplete.certificate.chain", "\u8BC1\u4E66\u94FE\u4E0D\u5B8C\u6574"},
+        {"Enter.key.password.for.alias.", "\u8F93\u5165{0}\u7684\u5BC6\u94A5\u53E3\u4EE4: "},
+        {"unable.to.recover.key.from.keystore",
+                "\u65E0\u6CD5\u4ECE\u5BC6\u94A5\u5E93\u4E2D\u6062\u590D\u5BC6\u94A5"},
+        {"key.associated.with.alias.not.a.private.key",
+                "\u4E0E{0}\u5173\u8054\u7684\u5BC6\u94A5\u4E0D\u662F\u79C1\u6709\u5BC6\u94A5"},
+        {"you.must.enter.key.password", "\u5FC5\u987B\u8F93\u5165\u5BC6\u94A5\u53E3\u4EE4"},
+        {"unable.to.read.password.", "\u65E0\u6CD5\u8BFB\u53D6\u53E3\u4EE4: "},
+        {"certificate.is.valid.from", "\u8BC1\u4E66\u7684\u6709\u6548\u671F\u4E3A{0}\u81F3{1}"},
+        {"certificate.expired.on", "\u8BC1\u4E66\u5230\u671F\u65E5\u671F\u4E3A {0}"},
+        {"certificate.is.not.valid.until",
+                "\u76F4\u5230{0}, \u8BC1\u4E66\u624D\u6709\u6548"},
+        {"certificate.will.expire.on", "\u8BC1\u4E66\u5C06\u5728{0}\u5230\u671F"},
+        {".CertPath.not.validated.", "[CertPath \u672A\u9A8C\u8BC1: "},
+        {"requesting.a.signature.timestamp",
+                "\u6B63\u5728\u8BF7\u6C42\u7B7E\u540D\u65F6\u95F4\u6233"},
+        {"TSA.location.", "TSA \u4F4D\u7F6E: "},
+        {"TSA.certificate.", "TSA \u8BC1\u4E66: "},
+        {"no.response.from.the.Timestamping.Authority.",
+                "\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u6CA1\u6709\u54CD\u5E94\u3002\u5982\u679C\u8981\u4ECE\u9632\u706B\u5899\u540E\u9762\u8FDE\u63A5, \u5219\u53EF\u80FD\u9700\u8981\u6307\u5B9A HTTP \u6216 HTTPS \u4EE3\u7406\u3002\u8BF7\u4E3A jarsigner \u63D0\u4F9B\u4EE5\u4E0B\u9009\u9879: "},
+        {"or", "\u6216"},
+        {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
+                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u6761\u76EE\u3002"},
+        {"using.an.alternative.signing.mechanism",
+                "\u6B63\u5728\u4F7F\u7528\u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236"},
+        {"entry.was.signed.on", "\u6761\u76EE\u7684\u7B7E\u540D\u65E5\u671F\u4E3A {0}"},
+        {"Warning.", "\u8B66\u544A: "},
+        {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
+                "\u6B64 jar \u5305\u542B\u5C1A\u672A\u8FDB\u884C\u5B8C\u6574\u6027\u68C0\u67E5\u7684\u672A\u7B7E\u540D\u6761\u76EE\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
+                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u5DF2\u8FC7\u671F\u7684\u6761\u76EE\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months.",
+                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u5C06\u5728\u516D\u4E2A\u6708\u5185\u8FC7\u671F\u7684\u6761\u76EE\u3002 "},
+        {"This.jar.contains.entries.whose.signer.certificate.is.not.yet.valid.",
+                "\u6B64 jar \u5305\u542B\u7B7E\u540D\u8005\u8BC1\u4E66\u4ECD\u65E0\u6548\u7684\u6761\u76EE\u3002 "},
+        {"Re.run.with.the.verbose.option.for.more.details.",
+                "\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u4F7F\u7528 -verbose \u9009\u9879\u91CD\u65B0\u8FD0\u884C\u3002"},
+        {"Re.run.with.the.verbose.and.certs.options.for.more.details.",
+                "\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u4F7F\u7528 -verbose \u548C -certs \u9009\u9879\u91CD\u65B0\u8FD0\u884C\u3002"},
+        {"The.signer.certificate.has.expired.",
+                "\u7B7E\u540D\u8005\u8BC1\u4E66\u5DF2\u8FC7\u671F\u3002"},
+        {"The.signer.certificate.will.expire.within.six.months.",
+                "\u7B7E\u540D\u8005\u8BC1\u4E66\u5C06\u5728\u516D\u4E2A\u6708\u5185\u8FC7\u671F\u3002"},
+        {"The.signer.certificate.is.not.yet.valid.",
+                "\u7B7E\u540D\u8005\u8BC1\u4E66\u4ECD\u65E0\u6548\u3002"},
+        {"The.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 KeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
+        {"The.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 ExtendedKeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
+        {"The.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 NetscapeCertType \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.KeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 KeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.ExtendedKeyUsage.extension.doesn.t.allow.code.signing.",
+                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 ExtendedKeyUsage \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
+        {"This.jar.contains.entries.whose.signer.certificate.s.NetscapeCertType.extension.doesn.t.allow.code.signing.",
+                 "\u6B64 jar \u5305\u542B\u7531\u4E8E\u7B7E\u540D\u8005\u8BC1\u4E66\u7684 NetscapeCertType \u6269\u5C55\u800C\u65E0\u6CD5\u8FDB\u884C\u4EE3\u7801\u7B7E\u540D\u7684\u6761\u76EE\u3002"},
+        {".{0}.extension.does.not.support.code.signing.",
+                 "[{0} \u6269\u5C55\u4E0D\u652F\u6301\u4EE3\u7801\u7B7E\u540D]"},
+        {"The.signer.s.certificate.chain.is.not.validated.",
+                "\u7B7E\u540D\u8005\u7684\u8BC1\u4E66\u94FE\u672A\u9A8C\u8BC1\u3002"},
+        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.",
+                 "\u6B64 jar \u5305\u542B\u8BC1\u4E66\u94FE\u672A\u9A8C\u8BC1\u7684\u6761\u76EE\u3002"},
+        {"Unknown.password.type.", "\u672A\u77E5\u53E3\u4EE4\u7C7B\u578B: "},
+        {"Cannot.find.environment.variable.",
+                "\u627E\u4E0D\u5230\u73AF\u5883\u53D8\u91CF: "},
+        {"Cannot.find.file.", "\u627E\u4E0D\u5230\u6587\u4EF6: "},
+    };
+
+    /**
+     * 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.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2007, 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.security.tools.jarsigner;
+
+import java.io.IOException;
+import java.net.URI;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import com.sun.jarsigner.*;
+import sun.security.pkcs.PKCS7;
+import sun.security.util.*;
+import sun.security.x509.*;
+
+/**
+ * This class implements a content signing service.
+ * It generates a timestamped signature for a given content according to
+ * <a href="http://www.ietf.org/rfc/rfc3161.txt">RFC 3161</a>.
+ * The signature along with a trusted timestamp and the signer's certificate
+ * are all packaged into a standard PKCS #7 Signed Data message.
+ *
+ * @author Vincent Ryan
+ */
+
+public final class TimestampedSigner extends ContentSigner {
+
+    /*
+     * Object identifier for the subject information access X.509 certificate
+     * extension.
+     */
+    private static final String SUBJECT_INFO_ACCESS_OID = "1.3.6.1.5.5.7.1.11";
+
+    /*
+     * Object identifier for the timestamping access descriptors.
+     */
+    private static final ObjectIdentifier AD_TIMESTAMPING_Id;
+    static {
+        ObjectIdentifier tmp = null;
+        try {
+            tmp = new ObjectIdentifier("1.3.6.1.5.5.7.48.3");
+        } catch (IOException e) {
+            // ignore
+        }
+        AD_TIMESTAMPING_Id = tmp;
+    }
+
+    /**
+     * Instantiates a content signer that supports timestamped signatures.
+     */
+    public TimestampedSigner() {
+    }
+
+    /**
+     * Generates a PKCS #7 signed data message that includes a signature
+     * timestamp.
+     * This method is used when a signature has already been generated.
+     * The signature, a signature timestamp, the signer's certificate chain,
+     * and optionally the content that was signed, are packaged into a PKCS #7
+     * signed data message.
+     *
+     * @param params The non-null input parameters.
+     * @param omitContent true if the content should be omitted from the
+     *        signed data message. Otherwise the content is included.
+     * @param applyTimestamp true if the signature should be timestamped.
+     *        Otherwise timestamping is not performed.
+     * @return A PKCS #7 signed data message including a signature timestamp.
+     * @throws NoSuchAlgorithmException The exception is thrown if the signature
+     *         algorithm is unrecognised.
+     * @throws CertificateException The exception is thrown if an error occurs
+     *         while processing the signer's certificate or the TSA's
+     *         certificate.
+     * @throws IOException The exception is thrown if an error occurs while
+     *         generating the signature timestamp or while generating the signed
+     *         data message.
+     * @throws NullPointerException The exception is thrown if parameters is
+     *         null.
+     */
+    public byte[] generateSignedData(ContentSignerParameters params,
+        boolean omitContent, boolean applyTimestamp)
+            throws NoSuchAlgorithmException, CertificateException, IOException {
+
+        if (params == null) {
+            throw new NullPointerException();
+        }
+
+        // Parse the signature algorithm to extract the digest
+        // algorithm. The expected format is:
+        //     "<digest>with<encryption>"
+        // or  "<digest>with<encryption>and<mgf>"
+        String signatureAlgorithm = params.getSignatureAlgorithm();
+
+        X509Certificate[] signerChain = params.getSignerCertificateChain();
+        byte[] signature = params.getSignature();
+
+        // Include or exclude content
+        byte[] content = (omitContent == true) ? null : params.getContent();
+
+        URI tsaURI = null;
+        if (applyTimestamp) {
+            tsaURI = params.getTimestampingAuthority();
+            if (tsaURI == null) {
+                // Examine TSA cert
+                tsaURI = getTimestampingURI(
+                    params.getTimestampingAuthorityCertificate());
+                if (tsaURI == null) {
+                    throw new CertificateException(
+                        "Subject Information Access extension not found");
+                }
+            }
+        }
+        return PKCS7.generateSignedData(signature, signerChain, content,
+                                        params.getSignatureAlgorithm(), tsaURI,
+                                        params.getTSAPolicyID(),
+                                        params.getTSADigestAlg());
+    }
+
+    /**
+     * Examine the certificate for a Subject Information Access extension
+     * (<a href="http://tools.ietf.org/html/rfc5280">RFC 5280</a>).
+     * The extension's <tt>accessMethod</tt> field should contain the object
+     * identifier defined for timestamping: 1.3.6.1.5.5.7.48.3 and its
+     * <tt>accessLocation</tt> field should contain an HTTP or HTTPS URL.
+     *
+     * @param tsaCertificate An X.509 certificate for the TSA.
+     * @return An HTTP or HTTPS URI or null if none was found.
+     */
+    public static URI getTimestampingURI(X509Certificate tsaCertificate) {
+
+        if (tsaCertificate == null) {
+            return null;
+        }
+        // Parse the extensions
+        try {
+            byte[] extensionValue =
+                tsaCertificate.getExtensionValue(SUBJECT_INFO_ACCESS_OID);
+            if (extensionValue == null) {
+                return null;
+            }
+            DerInputStream der = new DerInputStream(extensionValue);
+            der = new DerInputStream(der.getOctetString());
+            DerValue[] derValue = der.getSequence(5);
+            AccessDescription description;
+            GeneralName location;
+            URIName uri;
+            for (int i = 0; i < derValue.length; i++) {
+                description = new AccessDescription(derValue[i]);
+                if (description.getAccessMethod()
+                        .equals((Object)AD_TIMESTAMPING_Id)) {
+                    location = description.getAccessLocation();
+                    if (location.getType() == GeneralNameInterface.NAME_URI) {
+                        uri = (URIName) location.getName();
+                        if (uri.getScheme().equalsIgnoreCase("http") ||
+                                uri.getScheme().equalsIgnoreCase("https")) {
+                            return uri.getURI();
+                        }
+                    }
+                }
+            }
+        } catch (IOException ioe) {
+            // ignore
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/CommandLine.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * 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.tools.jar;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.StreamTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Various utility methods for processing Java tool command line arguments.
+ *
+ *  <p><b>This is NOT part of any API supported by Oracle.  If
+ *  you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class CommandLine {
+    /**
+     * Process Win32-style command files for the specified command line
+     * arguments and return the resulting arguments. A command file argument
+     * is of the form '@file' where 'file' is the name of the file whose
+     * contents are to be parsed for additional arguments. The contents of
+     * the command file are parsed using StreamTokenizer and the original
+     * '@file' argument replaced with the resulting tokens. Recursive command
+     * files are not supported. The '@' character itself can be quoted with
+     * the sequence '@@'.
+     */
+    public static String[] parse(String[] args)
+        throws IOException
+    {
+        List<String> newArgs = new ArrayList<>(args.length);
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (arg.length() > 1 && arg.charAt(0) == '@') {
+                arg = arg.substring(1);
+                if (arg.charAt(0) == '@') {
+                    newArgs.add(arg);
+                } else {
+                    loadCmdFile(arg, newArgs);
+                }
+            } else {
+                newArgs.add(arg);
+            }
+        }
+        return newArgs.toArray(new String[newArgs.size()]);
+    }
+
+    private static void loadCmdFile(String name, List<String> args)
+        throws IOException
+    {
+        Reader r = new BufferedReader(new FileReader(name));
+        StreamTokenizer st = new StreamTokenizer(r);
+        st.resetSyntax();
+        st.wordChars(' ', 255);
+        st.whitespaceChars(0, ' ');
+        st.commentChar('#');
+        st.quoteChar('"');
+        st.quoteChar('\'');
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
+            args.add(st.sval);
+        }
+        r.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/JarException.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1996, 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.tools.jar;
+
+import java.io.IOException;
+
+public
+class JarException extends IOException {
+
+    static final long serialVersionUID = -4351820108009811497L;
+
+    public JarException() {
+        super();
+    }
+
+    public JarException(String s) {
+        super(s);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,1317 @@
+/*
+ * Copyright (c) 1996, 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.tools.jar;
+
+import java.io.*;
+import java.nio.file.Path;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.zip.*;
+import java.util.jar.*;
+import java.util.jar.Pack200.*;
+import java.util.jar.Manifest;
+import java.text.MessageFormat;
+import sun.misc.JarIndex;
+import static sun.misc.JarIndex.INDEX_NAME;
+import static java.util.jar.JarFile.MANIFEST_NAME;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+/**
+ * This class implements a simple utility for creating files in the JAR
+ * (Java Archive) file format. The JAR format is based on the ZIP file
+ * format, with optional meta-information stored in a MANIFEST entry.
+ */
+public
+class Main {
+    String program;
+    PrintStream out, err;
+    String fname, mname, ename;
+    String zname = "";
+    String[] files;
+    String rootjar = null;
+
+    // An entryName(path)->File map generated during "expand", it helps to
+    // decide whether or not an existing entry in a jar file needs to be
+    // replaced, during the "update" operation.
+    Map<String, File> entryMap = new HashMap<String, File>();
+
+    // All files need to be added/updated.
+    Set<File> entries = new LinkedHashSet<File>();
+
+    // Directories specified by "-C" operation.
+    Set<String> paths = new HashSet<String>();
+
+    /*
+     * cflag: create
+     * uflag: update
+     * xflag: xtract
+     * tflag: table
+     * vflag: verbose
+     * flag0: no zip compression (store only)
+     * Mflag: DO NOT generate a manifest file (just ZIP)
+     * iflag: generate jar index
+     * nflag: Perform jar normalization at the end
+     */
+    boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, nflag;
+
+    static final String MANIFEST_DIR = "META-INF/";
+    static final String VERSION = "1.0";
+
+    private static ResourceBundle rsrc;
+
+    /**
+     * If true, maintain compatibility with JDK releases prior to 6.0 by
+     * timestamping extracted files with the time at which they are extracted.
+     * Default is to use the time given in the archive.
+     */
+    private static final boolean useExtractionTime =
+        Boolean.getBoolean("sun.tools.jar.useExtractionTime");
+
+    /**
+     * Initialize ResourceBundle
+     */
+    static {
+        try {
+            rsrc = ResourceBundle.getBundle("sun.tools.jar.resources.jar");
+        } catch (MissingResourceException e) {
+            throw new Error("Fatal: Resource for jar is missing");
+        }
+    }
+
+    private String getMsg(String key) {
+        try {
+            return (rsrc.getString(key));
+        } catch (MissingResourceException e) {
+            throw new Error("Error in message file");
+        }
+    }
+
+    private String formatMsg(String key, String arg) {
+        String msg = getMsg(key);
+        String[] args = new String[1];
+        args[0] = arg;
+        return MessageFormat.format(msg, (Object[]) args);
+    }
+
+    private String formatMsg2(String key, String arg, String arg1) {
+        String msg = getMsg(key);
+        String[] args = new String[2];
+        args[0] = arg;
+        args[1] = arg1;
+        return MessageFormat.format(msg, (Object[]) args);
+    }
+
+    public Main(PrintStream out, PrintStream err, String program) {
+        this.out = out;
+        this.err = err;
+        this.program = program;
+    }
+
+    /**
+     * Creates a new empty temporary file in the same directory as the
+     * specified file.  A variant of File.createTempFile.
+     */
+    private static File createTempFileInSameDirectoryAs(File file)
+        throws IOException {
+        File dir = file.getParentFile();
+        if (dir == null)
+            dir = new File(".");
+        return File.createTempFile("jartmp", null, dir);
+    }
+
+    private boolean ok;
+
+    /**
+     * Starts main program with the specified arguments.
+     */
+    public synchronized boolean run(String args[]) {
+        ok = true;
+        if (!parseArgs(args)) {
+            return false;
+        }
+        try {
+            if (cflag || uflag) {
+                if (fname != null) {
+                    // The name of the zip file as it would appear as its own
+                    // zip file entry. We use this to make sure that we don't
+                    // add the zip file to itself.
+                    zname = fname.replace(File.separatorChar, '/');
+                    if (zname.startsWith("./")) {
+                        zname = zname.substring(2);
+                    }
+                }
+            }
+            if (cflag) {
+                Manifest manifest = null;
+                InputStream in = null;
+
+                if (!Mflag) {
+                    if (mname != null) {
+                        in = new FileInputStream(mname);
+                        manifest = new Manifest(new BufferedInputStream(in));
+                    } else {
+                        manifest = new Manifest();
+                    }
+                    addVersion(manifest);
+                    addCreatedBy(manifest);
+                    if (isAmbiguousMainClass(manifest)) {
+                        if (in != null) {
+                            in.close();
+                        }
+                        return false;
+                    }
+                    if (ename != null) {
+                        addMainClass(manifest, ename);
+                    }
+                }
+                OutputStream out;
+                if (fname != null) {
+                    out = new FileOutputStream(fname);
+                } else {
+                    out = new FileOutputStream(FileDescriptor.out);
+                    if (vflag) {
+                        // Disable verbose output so that it does not appear
+                        // on stdout along with file data
+                        // error("Warning: -v option ignored");
+                        vflag = false;
+                    }
+                }
+                File tmpfile = null;
+                final OutputStream finalout = out;
+                final String tmpbase = (fname == null)
+                        ? "tmpjar"
+                        : fname.substring(fname.indexOf(File.separatorChar) + 1);
+                if (nflag) {
+                    tmpfile = createTemporaryFile(tmpbase, ".jar");
+                    out = new FileOutputStream(tmpfile);
+                }
+                expand(null, files, false);
+                create(new BufferedOutputStream(out, 4096), manifest);
+                if (in != null) {
+                    in.close();
+                }
+                out.close();
+                if (nflag) {
+                    JarFile jarFile = null;
+                    File packFile = null;
+                    JarOutputStream jos = null;
+                    try {
+                        Packer packer = Pack200.newPacker();
+                        Map<String, String> p = packer.properties();
+                        p.put(Packer.EFFORT, "1"); // Minimal effort to conserve CPU
+                        jarFile = new JarFile(tmpfile.getCanonicalPath());
+                        packFile = createTemporaryFile(tmpbase, ".pack");
+                        out = new FileOutputStream(packFile);
+                        packer.pack(jarFile, out);
+                        jos = new JarOutputStream(finalout);
+                        Unpacker unpacker = Pack200.newUnpacker();
+                        unpacker.unpack(packFile, jos);
+                    } catch (IOException ioe) {
+                        fatalError(ioe);
+                    } finally {
+                        if (jarFile != null) {
+                            jarFile.close();
+                        }
+                        if (out != null) {
+                            out.close();
+                        }
+                        if (jos != null) {
+                            jos.close();
+                        }
+                        if (tmpfile != null && tmpfile.exists()) {
+                            tmpfile.delete();
+                        }
+                        if (packFile != null && packFile.exists()) {
+                            packFile.delete();
+                        }
+                    }
+                }
+            } else if (uflag) {
+                File inputFile = null, tmpFile = null;
+                FileInputStream in;
+                FileOutputStream out;
+                if (fname != null) {
+                    inputFile = new File(fname);
+                    tmpFile = createTempFileInSameDirectoryAs(inputFile);
+                    in = new FileInputStream(inputFile);
+                    out = new FileOutputStream(tmpFile);
+                } else {
+                    in = new FileInputStream(FileDescriptor.in);
+                    out = new FileOutputStream(FileDescriptor.out);
+                    vflag = false;
+                }
+                InputStream manifest = (!Mflag && (mname != null)) ?
+                    (new FileInputStream(mname)) : null;
+                expand(null, files, true);
+                boolean updateOk = update(in, new BufferedOutputStream(out),
+                                          manifest, null);
+                if (ok) {
+                    ok = updateOk;
+                }
+                in.close();
+                out.close();
+                if (manifest != null) {
+                    manifest.close();
+                }
+                if (ok && fname != null) {
+                    // on Win32, we need this delete
+                    inputFile.delete();
+                    if (!tmpFile.renameTo(inputFile)) {
+                        tmpFile.delete();
+                        throw new IOException(getMsg("error.write.file"));
+                    }
+                    tmpFile.delete();
+                }
+            } else if (tflag) {
+                replaceFSC(files);
+                // For the "list table contents" action, access using the
+                // ZipFile class is always most efficient since only a
+                // "one-finger" scan through the central directory is required.
+                if (fname != null) {
+                    list(fname, files);
+                } else {
+                    InputStream in = new FileInputStream(FileDescriptor.in);
+                    try {
+                        list(new BufferedInputStream(in), files);
+                    } finally {
+                        in.close();
+                    }
+                }
+            } else if (xflag) {
+                replaceFSC(files);
+                // For the extract action, when extracting all the entries,
+                // access using the ZipInputStream class is most efficient,
+                // since only a single sequential scan through the zip file is
+                // required.  When using the ZipFile class, a "two-finger" scan
+                // is required, but this is likely to be more efficient when a
+                // partial extract is requested.  In case the zip file has
+                // "leading garbage", we fall back from the ZipInputStream
+                // implementation to the ZipFile implementation, since only the
+                // latter can handle it.
+                if (fname != null && files != null) {
+                    extract(fname, files);
+                } else {
+                    InputStream in = (fname == null)
+                        ? new FileInputStream(FileDescriptor.in)
+                        : new FileInputStream(fname);
+                    try {
+                        if (!extract(new BufferedInputStream(in), files) && fname != null) {
+                            extract(fname, files);
+                        }
+                    } finally {
+                        in.close();
+                    }
+                }
+            } else if (iflag) {
+                genIndex(rootjar, files);
+            }
+        } catch (IOException e) {
+            fatalError(e);
+            ok = false;
+        } catch (Error ee) {
+            ee.printStackTrace();
+            ok = false;
+        } catch (Throwable t) {
+            t.printStackTrace();
+            ok = false;
+        }
+        out.flush();
+        err.flush();
+        return ok;
+    }
+
+    /**
+     * Parses command line arguments.
+     */
+    boolean parseArgs(String args[]) {
+        /* Preprocess and expand @file arguments */
+        try {
+            args = CommandLine.parse(args);
+        } catch (FileNotFoundException e) {
+            fatalError(formatMsg("error.cant.open", e.getMessage()));
+            return false;
+        } catch (IOException e) {
+            fatalError(e);
+            return false;
+        }
+        /* parse flags */
+        int count = 1;
+        try {
+            String flags = args[0];
+            if (flags.startsWith("-")) {
+                flags = flags.substring(1);
+            }
+            for (int i = 0; i < flags.length(); i++) {
+                switch (flags.charAt(i)) {
+                case 'c':
+                    if (xflag || tflag || uflag || iflag) {
+                        usageError();
+                        return false;
+                    }
+                    cflag = true;
+                    break;
+                case 'u':
+                    if (cflag || xflag || tflag || iflag) {
+                        usageError();
+                        return false;
+                    }
+                    uflag = true;
+                    break;
+                case 'x':
+                    if (cflag || uflag || tflag || iflag) {
+                        usageError();
+                        return false;
+                    }
+                    xflag = true;
+                    break;
+                case 't':
+                    if (cflag || uflag || xflag || iflag) {
+                        usageError();
+                        return false;
+                    }
+                    tflag = true;
+                    break;
+                case 'M':
+                    Mflag = true;
+                    break;
+                case 'v':
+                    vflag = true;
+                    break;
+                case 'f':
+                    fname = args[count++];
+                    break;
+                case 'm':
+                    mname = args[count++];
+                    break;
+                case '0':
+                    flag0 = true;
+                    break;
+                case 'i':
+                    if (cflag || uflag || xflag || tflag) {
+                        usageError();
+                        return false;
+                    }
+                    // do not increase the counter, files will contain rootjar
+                    rootjar = args[count++];
+                    iflag = true;
+                    break;
+                case 'n':
+                    nflag = true;
+                    break;
+                case 'e':
+                     ename = args[count++];
+                     break;
+                default:
+                    error(formatMsg("error.illegal.option",
+                                String.valueOf(flags.charAt(i))));
+                    usageError();
+                    return false;
+                }
+            }
+        } catch (ArrayIndexOutOfBoundsException e) {
+            usageError();
+            return false;
+        }
+        if (!cflag && !tflag && !xflag && !uflag && !iflag) {
+            error(getMsg("error.bad.option"));
+            usageError();
+            return false;
+        }
+        /* parse file arguments */
+        int n = args.length - count;
+        if (n > 0) {
+            int k = 0;
+            String[] nameBuf = new String[n];
+            try {
+                for (int i = count; i < args.length; i++) {
+                    if (args[i].equals("-C")) {
+                        /* change the directory */
+                        String dir = args[++i];
+                        dir = (dir.endsWith(File.separator) ?
+                               dir : (dir + File.separator));
+                        dir = dir.replace(File.separatorChar, '/');
+                        while (dir.indexOf("//") > -1) {
+                            dir = dir.replace("//", "/");
+                        }
+                        paths.add(dir.replace(File.separatorChar, '/'));
+                        nameBuf[k++] = dir + args[++i];
+                    } else {
+                        nameBuf[k++] = args[i];
+                    }
+                }
+            } catch (ArrayIndexOutOfBoundsException e) {
+                usageError();
+                return false;
+            }
+            files = new String[k];
+            System.arraycopy(nameBuf, 0, files, 0, k);
+        } else if (cflag && (mname == null)) {
+            error(getMsg("error.bad.cflag"));
+            usageError();
+            return false;
+        } else if (uflag) {
+            if ((mname != null) || (ename != null)) {
+                /* just want to update the manifest */
+                return true;
+            } else {
+                error(getMsg("error.bad.uflag"));
+                usageError();
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Expands list of files to process into full list of all files that
+     * can be found by recursively descending directories.
+     */
+    void expand(File dir, String[] files, boolean isUpdate) {
+        if (files == null) {
+            return;
+        }
+        for (int i = 0; i < files.length; i++) {
+            File f;
+            if (dir == null) {
+                f = new File(files[i]);
+            } else {
+                f = new File(dir, files[i]);
+            }
+            if (f.isFile()) {
+                if (entries.add(f)) {
+                    if (isUpdate)
+                        entryMap.put(entryName(f.getPath()), f);
+                }
+            } else if (f.isDirectory()) {
+                if (entries.add(f)) {
+                    if (isUpdate) {
+                        String dirPath = f.getPath();
+                        dirPath = (dirPath.endsWith(File.separator)) ? dirPath :
+                            (dirPath + File.separator);
+                        entryMap.put(entryName(dirPath), f);
+                    }
+                    expand(f, f.list(), isUpdate);
+                }
+            } else {
+                error(formatMsg("error.nosuch.fileordir", String.valueOf(f)));
+                ok = false;
+            }
+        }
+    }
+
+    /**
+     * Creates a new JAR file.
+     */
+    void create(OutputStream out, Manifest manifest)
+        throws IOException
+    {
+        ZipOutputStream zos = new JarOutputStream(out);
+        if (flag0) {
+            zos.setMethod(ZipOutputStream.STORED);
+        }
+        if (manifest != null) {
+            if (vflag) {
+                output(getMsg("out.added.manifest"));
+            }
+            ZipEntry e = new ZipEntry(MANIFEST_DIR);
+            e.setTime(System.currentTimeMillis());
+            e.setSize(0);
+            e.setCrc(0);
+            zos.putNextEntry(e);
+            e = new ZipEntry(MANIFEST_NAME);
+            e.setTime(System.currentTimeMillis());
+            if (flag0) {
+                crc32Manifest(e, manifest);
+            }
+            zos.putNextEntry(e);
+            manifest.write(zos);
+            zos.closeEntry();
+        }
+        for (File file: entries) {
+            addFile(zos, file);
+        }
+        zos.close();
+    }
+
+    private char toUpperCaseASCII(char c) {
+        return (c < 'a' || c > 'z') ? c : (char) (c + 'A' - 'a');
+    }
+
+    /**
+     * Compares two strings for equality, ignoring case.  The second
+     * argument must contain only upper-case ASCII characters.
+     * We don't want case comparison to be locale-dependent (else we
+     * have the notorious "turkish i bug").
+     */
+    private boolean equalsIgnoreCase(String s, String upper) {
+        assert upper.toUpperCase(java.util.Locale.ENGLISH).equals(upper);
+        int len;
+        if ((len = s.length()) != upper.length())
+            return false;
+        for (int i = 0; i < len; i++) {
+            char c1 = s.charAt(i);
+            char c2 = upper.charAt(i);
+            if (c1 != c2 && toUpperCaseASCII(c1) != c2)
+                return false;
+        }
+        return true;
+    }
+
+    /**
+     * Updates an existing jar file.
+     */
+    boolean update(InputStream in, OutputStream out,
+                   InputStream newManifest,
+                   JarIndex jarIndex) throws IOException
+    {
+        ZipInputStream zis = new ZipInputStream(in);
+        ZipOutputStream zos = new JarOutputStream(out);
+        ZipEntry e = null;
+        boolean foundManifest = false;
+        boolean updateOk = true;
+
+        if (jarIndex != null) {
+            addIndex(jarIndex, zos);
+        }
+
+        // put the old entries first, replace if necessary
+        while ((e = zis.getNextEntry()) != null) {
+            String name = e.getName();
+
+            boolean isManifestEntry = equalsIgnoreCase(name, MANIFEST_NAME);
+
+            if ((jarIndex != null && equalsIgnoreCase(name, INDEX_NAME))
+                || (Mflag && isManifestEntry)) {
+                continue;
+            } else if (isManifestEntry && ((newManifest != null) ||
+                        (ename != null))) {
+                foundManifest = true;
+                if (newManifest != null) {
+                    // Don't read from the newManifest InputStream, as we
+                    // might need it below, and we can't re-read the same data
+                    // twice.
+                    FileInputStream fis = new FileInputStream(mname);
+                    boolean ambiguous = isAmbiguousMainClass(new Manifest(fis));
+                    fis.close();
+                    if (ambiguous) {
+                        return false;
+                    }
+                }
+
+                // Update the manifest.
+                Manifest old = new Manifest(zis);
+                if (newManifest != null) {
+                    old.read(newManifest);
+                }
+                if (!updateManifest(old, zos)) {
+                    return false;
+                }
+            } else {
+                if (!entryMap.containsKey(name)) { // copy the old stuff
+                    // do our own compression
+                    ZipEntry e2 = new ZipEntry(name);
+                    e2.setMethod(e.getMethod());
+                    e2.setTime(e.getTime());
+                    e2.setComment(e.getComment());
+                    e2.setExtra(e.getExtra());
+                    if (e.getMethod() == ZipEntry.STORED) {
+                        e2.setSize(e.getSize());
+                        e2.setCrc(e.getCrc());
+                    }
+                    zos.putNextEntry(e2);
+                    copy(zis, zos);
+                } else { // replace with the new files
+                    File f = entryMap.get(name);
+                    addFile(zos, f);
+                    entryMap.remove(name);
+                    entries.remove(f);
+                }
+            }
+        }
+
+        // add the remaining new files
+        for (File f: entries) {
+            addFile(zos, f);
+        }
+        if (!foundManifest) {
+            if (newManifest != null) {
+                Manifest m = new Manifest(newManifest);
+                updateOk = !isAmbiguousMainClass(m);
+                if (updateOk) {
+                    if (!updateManifest(m, zos)) {
+                        updateOk = false;
+                    }
+                }
+            } else if (ename != null) {
+                if (!updateManifest(new Manifest(), zos)) {
+                    updateOk = false;
+                }
+            }
+        }
+        zis.close();
+        zos.close();
+        return updateOk;
+    }
+
+
+    private void addIndex(JarIndex index, ZipOutputStream zos)
+        throws IOException
+    {
+        ZipEntry e = new ZipEntry(INDEX_NAME);
+        e.setTime(System.currentTimeMillis());
+        if (flag0) {
+            CRC32OutputStream os = new CRC32OutputStream();
+            index.write(os);
+            os.updateEntry(e);
+        }
+        zos.putNextEntry(e);
+        index.write(zos);
+        zos.closeEntry();
+    }
+
+    private boolean updateManifest(Manifest m, ZipOutputStream zos)
+        throws IOException
+    {
+        addVersion(m);
+        addCreatedBy(m);
+        if (ename != null) {
+            addMainClass(m, ename);
+        }
+        ZipEntry e = new ZipEntry(MANIFEST_NAME);
+        e.setTime(System.currentTimeMillis());
+        if (flag0) {
+            crc32Manifest(e, m);
+        }
+        zos.putNextEntry(e);
+        m.write(zos);
+        if (vflag) {
+            output(getMsg("out.update.manifest"));
+        }
+        return true;
+    }
+
+
+    private String entryName(String name) {
+        name = name.replace(File.separatorChar, '/');
+        String matchPath = "";
+        for (String path : paths) {
+            if (name.startsWith(path)
+                && (path.length() > matchPath.length())) {
+                matchPath = path;
+            }
+        }
+        name = name.substring(matchPath.length());
+
+        if (name.startsWith("/")) {
+            name = name.substring(1);
+        } else if (name.startsWith("./")) {
+            name = name.substring(2);
+        }
+        return name;
+    }
+
+    private void addVersion(Manifest m) {
+        Attributes global = m.getMainAttributes();
+        if (global.getValue(Attributes.Name.MANIFEST_VERSION) == null) {
+            global.put(Attributes.Name.MANIFEST_VERSION, VERSION);
+        }
+    }
+
+    private void addCreatedBy(Manifest m) {
+        Attributes global = m.getMainAttributes();
+        if (global.getValue(new Attributes.Name("Created-By")) == null) {
+            String javaVendor = System.getProperty("java.vendor");
+            String jdkVersion = System.getProperty("java.version");
+            global.put(new Attributes.Name("Created-By"), jdkVersion + " (" +
+                        javaVendor + ")");
+        }
+    }
+
+    private void addMainClass(Manifest m, String mainApp) {
+        Attributes global = m.getMainAttributes();
+
+        // overrides any existing Main-Class attribute
+        global.put(Attributes.Name.MAIN_CLASS, mainApp);
+    }
+
+    private boolean isAmbiguousMainClass(Manifest m) {
+        if (ename != null) {
+            Attributes global = m.getMainAttributes();
+            if ((global.get(Attributes.Name.MAIN_CLASS) != null)) {
+                error(getMsg("error.bad.eflag"));
+                usageError();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Adds a new file entry to the ZIP output stream.
+     */
+    void addFile(ZipOutputStream zos, File file) throws IOException {
+        String name = file.getPath();
+        boolean isDir = file.isDirectory();
+        if (isDir) {
+            name = name.endsWith(File.separator) ? name :
+                (name + File.separator);
+        }
+        name = entryName(name);
+
+        if (name.equals("") || name.equals(".") || name.equals(zname)) {
+            return;
+        } else if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME))
+                   && !Mflag) {
+            if (vflag) {
+                output(formatMsg("out.ignore.entry", name));
+            }
+            return;
+        }
+
+        long size = isDir ? 0 : file.length();
+
+        if (vflag) {
+            out.print(formatMsg("out.adding", name));
+        }
+        ZipEntry e = new ZipEntry(name);
+        e.setTime(file.lastModified());
+        if (size == 0) {
+            e.setMethod(ZipEntry.STORED);
+            e.setSize(0);
+            e.setCrc(0);
+        } else if (flag0) {
+            crc32File(e, file);
+        }
+        zos.putNextEntry(e);
+        if (!isDir) {
+            copy(file, zos);
+        }
+        zos.closeEntry();
+        /* report how much compression occurred. */
+        if (vflag) {
+            size = e.getSize();
+            long csize = e.getCompressedSize();
+            out.print(formatMsg2("out.size", String.valueOf(size),
+                        String.valueOf(csize)));
+            if (e.getMethod() == ZipEntry.DEFLATED) {
+                long ratio = 0;
+                if (size != 0) {
+                    ratio = ((size - csize) * 100) / size;
+                }
+                output(formatMsg("out.deflated", String.valueOf(ratio)));
+            } else {
+                output(getMsg("out.stored"));
+            }
+        }
+    }
+
+    /**
+     * A buffer for use only by copy(InputStream, OutputStream).
+     * Not as clean as allocating a new buffer as needed by copy,
+     * but significantly more efficient.
+     */
+    private byte[] copyBuf = new byte[8192];
+
+    /**
+     * Copies all bytes from the input stream to the output stream.
+     * Does not close or flush either stream.
+     *
+     * @param from the input stream to read from
+     * @param to the output stream to write to
+     * @throws IOException if an I/O error occurs
+     */
+    private void copy(InputStream from, OutputStream to) throws IOException {
+        int n;
+        while ((n = from.read(copyBuf)) != -1)
+            to.write(copyBuf, 0, n);
+    }
+
+    /**
+     * Copies all bytes from the input file to the output stream.
+     * Does not close or flush the output stream.
+     *
+     * @param from the input file to read from
+     * @param to the output stream to write to
+     * @throws IOException if an I/O error occurs
+     */
+    private void copy(File from, OutputStream to) throws IOException {
+        InputStream in = new FileInputStream(from);
+        try {
+            copy(in, to);
+        } finally {
+            in.close();
+        }
+    }
+
+    /**
+     * Copies all bytes from the input stream to the output file.
+     * Does not close the input stream.
+     *
+     * @param from the input stream to read from
+     * @param to the output file to write to
+     * @throws IOException if an I/O error occurs
+     */
+    private void copy(InputStream from, File to) throws IOException {
+        OutputStream out = new FileOutputStream(to);
+        try {
+            copy(from, out);
+        } finally {
+            out.close();
+        }
+    }
+
+    /**
+     * Computes the crc32 of a Manifest.  This is necessary when the
+     * ZipOutputStream is in STORED mode.
+     */
+    private void crc32Manifest(ZipEntry e, Manifest m) throws IOException {
+        CRC32OutputStream os = new CRC32OutputStream();
+        m.write(os);
+        os.updateEntry(e);
+    }
+
+    /**
+     * Computes the crc32 of a File.  This is necessary when the
+     * ZipOutputStream is in STORED mode.
+     */
+    private void crc32File(ZipEntry e, File f) throws IOException {
+        CRC32OutputStream os = new CRC32OutputStream();
+        copy(f, os);
+        if (os.n != f.length()) {
+            throw new JarException(formatMsg(
+                        "error.incorrect.length", f.getPath()));
+        }
+        os.updateEntry(e);
+    }
+
+    void replaceFSC(String files[]) {
+        if (files != null) {
+            for (int i = 0; i < files.length; i++) {
+                files[i] = files[i].replace(File.separatorChar, '/');
+            }
+        }
+    }
+
+    @SuppressWarnings("serial")
+    Set<ZipEntry> newDirSet() {
+        return new HashSet<ZipEntry>() {
+            public boolean add(ZipEntry e) {
+                return ((e == null || useExtractionTime) ? false : super.add(e));
+            }};
+    }
+
+    void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException {
+        for (ZipEntry ze : zes) {
+            long lastModified = ze.getTime();
+            if (lastModified != -1) {
+                File f = new File(ze.getName().replace('/', File.separatorChar));
+                f.setLastModified(lastModified);
+            }
+        }
+    }
+
+    /**
+     * Extracts specified entries from JAR file.
+     *
+     * @return whether entries were found and successfully extracted
+     * (indicating this was a zip file without "leading garbage")
+     */
+    boolean extract(InputStream in, String files[]) throws IOException {
+        ZipInputStream zis = new ZipInputStream(in);
+        ZipEntry e;
+        // Set of all directory entries specified in archive.  Disallows
+        // null entries.  Disallows all entries if using pre-6.0 behavior.
+        boolean entriesFound = false;
+        Set<ZipEntry> dirs = newDirSet();
+        while ((e = zis.getNextEntry()) != null) {
+            entriesFound = true;
+            if (files == null) {
+                dirs.add(extractFile(zis, e));
+            } else {
+                String name = e.getName();
+                for (String file : files) {
+                    if (name.startsWith(file)) {
+                        dirs.add(extractFile(zis, e));
+                        break;
+                    }
+                }
+            }
+        }
+
+        // Update timestamps of directories specified in archive with their
+        // timestamps as given in the archive.  We do this after extraction,
+        // instead of during, because creating a file in a directory changes
+        // that directory's timestamp.
+        updateLastModifiedTime(dirs);
+
+        return entriesFound;
+    }
+
+    /**
+     * Extracts specified entries from JAR file, via ZipFile.
+     */
+    void extract(String fname, String files[]) throws IOException {
+        ZipFile zf = new ZipFile(fname);
+        Set<ZipEntry> dirs = newDirSet();
+        Enumeration<? extends ZipEntry> zes = zf.entries();
+        while (zes.hasMoreElements()) {
+            ZipEntry e = zes.nextElement();
+            if (files == null) {
+                dirs.add(extractFile(zf.getInputStream(e), e));
+            } else {
+                String name = e.getName();
+                for (String file : files) {
+                    if (name.startsWith(file)) {
+                        dirs.add(extractFile(zf.getInputStream(e), e));
+                        break;
+                    }
+                }
+            }
+        }
+        zf.close();
+        updateLastModifiedTime(dirs);
+    }
+
+    /**
+     * Extracts next entry from JAR file, creating directories as needed.  If
+     * the entry is for a directory which doesn't exist prior to this
+     * invocation, returns that entry, otherwise returns null.
+     */
+    ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
+        ZipEntry rc = null;
+        String name = e.getName();
+        File f = new File(e.getName().replace('/', File.separatorChar));
+        if (e.isDirectory()) {
+            if (f.exists()) {
+                if (!f.isDirectory()) {
+                    throw new IOException(formatMsg("error.create.dir",
+                        f.getPath()));
+                }
+            } else {
+                if (!f.mkdirs()) {
+                    throw new IOException(formatMsg("error.create.dir",
+                        f.getPath()));
+                } else {
+                    rc = e;
+                }
+            }
+
+            if (vflag) {
+                output(formatMsg("out.create", name));
+            }
+        } else {
+            if (f.getParent() != null) {
+                File d = new File(f.getParent());
+                if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
+                    throw new IOException(formatMsg(
+                        "error.create.dir", d.getPath()));
+                }
+            }
+            try {
+                copy(is, f);
+            } finally {
+                if (is instanceof ZipInputStream)
+                    ((ZipInputStream)is).closeEntry();
+                else
+                    is.close();
+            }
+            if (vflag) {
+                if (e.getMethod() == ZipEntry.DEFLATED) {
+                    output(formatMsg("out.inflated", name));
+                } else {
+                    output(formatMsg("out.extracted", name));
+                }
+            }
+        }
+        if (!useExtractionTime) {
+            long lastModified = e.getTime();
+            if (lastModified != -1) {
+                f.setLastModified(lastModified);
+            }
+        }
+        return rc;
+    }
+
+    /**
+     * Lists contents of JAR file.
+     */
+    void list(InputStream in, String files[]) throws IOException {
+        ZipInputStream zis = new ZipInputStream(in);
+        ZipEntry e;
+        while ((e = zis.getNextEntry()) != null) {
+            /*
+             * In the case of a compressed (deflated) entry, the entry size
+             * is stored immediately following the entry data and cannot be
+             * determined until the entry is fully read. Therefore, we close
+             * the entry first before printing out its attributes.
+             */
+            zis.closeEntry();
+            printEntry(e, files);
+        }
+    }
+
+    /**
+     * Lists contents of JAR file, via ZipFile.
+     */
+    void list(String fname, String files[]) throws IOException {
+        ZipFile zf = new ZipFile(fname);
+        Enumeration<? extends ZipEntry> zes = zf.entries();
+        while (zes.hasMoreElements()) {
+            printEntry(zes.nextElement(), files);
+        }
+        zf.close();
+    }
+
+    /**
+     * Outputs the class index table to the INDEX.LIST file of the
+     * root jar file.
+     */
+    void dumpIndex(String rootjar, JarIndex index) throws IOException {
+        File jarFile = new File(rootjar);
+        Path jarPath = jarFile.toPath();
+        Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
+        try {
+            if (update(Files.newInputStream(jarPath),
+                       Files.newOutputStream(tmpPath),
+                       null, index)) {
+                try {
+                    Files.move(tmpPath, jarPath, REPLACE_EXISTING);
+                } catch (IOException e) {
+                    throw new IOException(getMsg("error.write.file"), e);
+                }
+            }
+        } finally {
+            Files.deleteIfExists(tmpPath);
+        }
+    }
+
+    private HashSet<String> jarPaths = new HashSet<String>();
+
+    /**
+     * Generates the transitive closure of the Class-Path attribute for
+     * the specified jar file.
+     */
+    List<String> getJarPath(String jar) throws IOException {
+        List<String> files = new ArrayList<String>();
+        files.add(jar);
+        jarPaths.add(jar);
+
+        // take out the current path
+        String path = jar.substring(0, Math.max(0, jar.lastIndexOf('/') + 1));
+
+        // class path attribute will give us jar file name with
+        // '/' as separators, so we need to change them to the
+        // appropriate one before we open the jar file.
+        JarFile rf = new JarFile(jar.replace('/', File.separatorChar));
+
+        if (rf != null) {
+            Manifest man = rf.getManifest();
+            if (man != null) {
+                Attributes attr = man.getMainAttributes();
+                if (attr != null) {
+                    String value = attr.getValue(Attributes.Name.CLASS_PATH);
+                    if (value != null) {
+                        StringTokenizer st = new StringTokenizer(value);
+                        while (st.hasMoreTokens()) {
+                            String ajar = st.nextToken();
+                            if (!ajar.endsWith("/")) {  // it is a jar file
+                                ajar = path.concat(ajar);
+                                /* check on cyclic dependency */
+                                if (! jarPaths.contains(ajar)) {
+                                    files.addAll(getJarPath(ajar));
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        rf.close();
+        return files;
+    }
+
+    /**
+     * Generates class index file for the specified root jar file.
+     */
+    void genIndex(String rootjar, String[] files) throws IOException {
+        List<String> jars = getJarPath(rootjar);
+        int njars = jars.size();
+        String[] jarfiles;
+
+        if (njars == 1 && files != null) {
+            // no class-path attribute defined in rootjar, will
+            // use command line specified list of jars
+            for (int i = 0; i < files.length; i++) {
+                jars.addAll(getJarPath(files[i]));
+            }
+            njars = jars.size();
+        }
+        jarfiles = jars.toArray(new String[njars]);
+        JarIndex index = new JarIndex(jarfiles);
+        dumpIndex(rootjar, index);
+    }
+
+    /**
+     * Prints entry information, if requested.
+     */
+    void printEntry(ZipEntry e, String[] files) throws IOException {
+        if (files == null) {
+            printEntry(e);
+        } else {
+            String name = e.getName();
+            for (String file : files) {
+                if (name.startsWith(file)) {
+                    printEntry(e);
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
+     * Prints entry information.
+     */
+    void printEntry(ZipEntry e) throws IOException {
+        if (vflag) {
+            StringBuilder sb = new StringBuilder();
+            String s = Long.toString(e.getSize());
+            for (int i = 6 - s.length(); i > 0; --i) {
+                sb.append(' ');
+            }
+            sb.append(s).append(' ').append(new Date(e.getTime()).toString());
+            sb.append(' ').append(e.getName());
+            output(sb.toString());
+        } else {
+            output(e.getName());
+        }
+    }
+
+    /**
+     * Prints usage message.
+     */
+    void usageError() {
+        error(getMsg("usage"));
+    }
+
+    /**
+     * A fatal exception has been caught.  No recovery possible
+     */
+    void fatalError(Exception e) {
+        e.printStackTrace();
+    }
+
+    /**
+     * A fatal condition has been detected; message is "s".
+     * No recovery possible
+     */
+    void fatalError(String s) {
+        error(program + ": " + s);
+    }
+
+    /**
+     * Print an output message; like verbose output and the like
+     */
+    protected void output(String s) {
+        out.println(s);
+    }
+
+    /**
+     * Print an error message; like something is broken
+     */
+    protected void error(String s) {
+        err.println(s);
+    }
+
+    /**
+     * Main routine to start program.
+     */
+    public static void main(String args[]) {
+        Main jartool = new Main(System.out, System.err, "jar");
+        System.exit(jartool.run(args) ? 0 : 1);
+    }
+
+    /**
+     * An OutputStream that doesn't send its output anywhere, (but could).
+     * It's here to find the CRC32 of an input file, necessary for STORED
+     * mode in ZIP.
+     */
+    private static class CRC32OutputStream extends java.io.OutputStream {
+        final CRC32 crc = new CRC32();
+        long n = 0;
+
+        CRC32OutputStream() {}
+
+        public void write(int r) throws IOException {
+            crc.update(r);
+            n++;
+        }
+
+        public void write(byte[] b, int off, int len) throws IOException {
+            crc.update(b, off, len);
+            n += len;
+        }
+
+        /**
+         * Updates a ZipEntry which describes the data read by this
+         * output stream, in STORED mode.
+         */
+        public void updateEntry(ZipEntry e) {
+            e.setMethod(ZipEntry.STORED);
+            e.setSize(n);
+            e.setCrc(crc.getValue());
+        }
+    }
+
+    /**
+     * Attempt to create temporary file in the system-provided temporary folder, if failed attempts
+     * to create it in the same folder as the file in parameter (if any)
+     */
+    private File createTemporaryFile(String tmpbase, String suffix) {
+        File tmpfile = null;
+
+        try {
+            tmpfile = File.createTempFile(tmpbase, suffix);
+        } catch (IOException | SecurityException e) {
+            // Unable to create file due to permission violation or security exception
+        }
+        if (tmpfile == null) {
+            // Were unable to create temporary file, fall back to temporary file in the same folder
+            if (fname != null) {
+                try {
+                    File tmpfolder = new File(fname).getAbsoluteFile().getParentFile();
+                    tmpfile = File.createTempFile(fname, ".tmp" + suffix, tmpfolder);
+                } catch (IOException ioe) {
+                    // Last option failed - fall gracefully
+                    fatalError(ioe);
+                }
+            } else {
+                // No options left - we can not compress to stdout without access to the temporary folder
+                fatalError(new IOException(getMsg("error.create.tempfile")));
+            }
+        }
+        return tmpfile;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Manifest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 1996, 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.tools.jar;
+
+import java.io.*;
+import java.util.*;
+import java.security.*;
+
+import sun.net.www.MessageHeader;
+import java.util.Base64;
+
+/**
+ * This is OBSOLETE. DO NOT USE THIS. Use java.util.jar.Manifest
+ * instead. It has to stay here because some apps (namely HJ and HJV)
+ * call directly into it.
+ *
+ * @author David Brown
+ * @author Benjamin Renaud
+ */
+
+public class Manifest {
+
+    /* list of headers that all pertain to a particular
+     * file in the archive
+     */
+    private Vector<MessageHeader> entries = new Vector<>();
+    private byte[] tmpbuf = new byte[512];
+    /* a hashtable of entries, for fast lookup */
+    private Hashtable<String, MessageHeader> tableEntries = new Hashtable<>();
+
+    static final String[] hashes = {"SHA"};
+    static final byte[] EOL = {(byte)'\r', (byte)'\n'};
+
+    static final boolean debug = false;
+    static final String VERSION = "1.0";
+    static final void debug(String s) {
+        if (debug)
+            System.out.println("man> " + s);
+    }
+
+    public Manifest() {}
+
+    public Manifest(byte[] bytes) throws IOException {
+        this(new ByteArrayInputStream(bytes), false);
+    }
+
+    public Manifest(InputStream is) throws IOException {
+        this(is, true);
+    }
+
+    /**
+     * Parse a manifest from a stream, optionally computing hashes
+     * for the files.
+     */
+    public Manifest(InputStream is, boolean compute) throws IOException {
+        if (!is.markSupported()) {
+            is = new BufferedInputStream(is);
+        }
+        /* do not rely on available() here! */
+        while (true) {
+            is.mark(1);
+            if (is.read() == -1) { // EOF
+                break;
+            }
+            is.reset();
+            MessageHeader m = new MessageHeader(is);
+            if (compute) {
+                doHashes(m);
+            }
+            addEntry(m);
+        }
+    }
+
+    /* recursively generate manifests from directory tree */
+    public Manifest(String[] files) throws IOException {
+        MessageHeader globals = new MessageHeader();
+        globals.add("Manifest-Version", VERSION);
+        String jdkVersion = System.getProperty("java.version");
+        globals.add("Created-By", "Manifest JDK "+jdkVersion);
+        addEntry(globals);
+        addFiles(null, files);
+    }
+
+    public void addEntry(MessageHeader entry) {
+        entries.addElement(entry);
+        String name = entry.findValue("Name");
+        debug("addEntry for name: "+name);
+        if (name != null) {
+            tableEntries.put(name, entry);
+        }
+    }
+
+    public MessageHeader getEntry(String name) {
+        return tableEntries.get(name);
+    }
+
+    public MessageHeader entryAt(int i) {
+        return entries.elementAt(i);
+    }
+
+    public Enumeration<MessageHeader> entries() {
+        return entries.elements();
+    }
+
+    public void addFiles(File dir, String[] files) throws IOException {
+        if (files == null)
+            return;
+        for (int i = 0; i < files.length; i++) {
+            File file;
+            if (dir == null) {
+                file = new File(files[i]);
+            } else {
+                file = new File(dir, files[i]);
+            }
+            if (file.isDirectory()) {
+                addFiles(file, file.list());
+            } else {
+                addFile(file);
+            }
+        }
+    }
+
+    /**
+     * File names are represented internally using "/";
+     * they are converted to the local format for anything else
+     */
+
+    private final String stdToLocal(String name) {
+        return name.replace('/', java.io.File.separatorChar);
+    }
+
+    private final String localToStd(String name) {
+        name = name.replace(java.io.File.separatorChar, '/');
+        if (name.startsWith("./"))
+            name = name.substring(2);
+        else if (name.startsWith("/"))
+            name = name.substring(1);
+        return name;
+    }
+
+    public void addFile(File f) throws IOException {
+        String stdName = localToStd(f.getPath());
+        if (tableEntries.get(stdName) == null) {
+            MessageHeader mh = new MessageHeader();
+            mh.add("Name", stdName);
+            addEntry(mh);
+        }
+    }
+
+    public void doHashes(MessageHeader mh) throws IOException {
+        // If unnamed or is a directory return immediately
+        String name = mh.findValue("Name");
+        if (name == null || name.endsWith("/")) {
+            return;
+        }
+
+
+        /* compute hashes, write over any other "Hash-Algorithms" (?) */
+        for (int j = 0; j < hashes.length; ++j) {
+            InputStream is = new FileInputStream(stdToLocal(name));
+            try {
+                MessageDigest dig = MessageDigest.getInstance(hashes[j]);
+
+                int len;
+                while ((len = is.read(tmpbuf, 0, tmpbuf.length)) != -1) {
+                    dig.update(tmpbuf, 0, len);
+                }
+                mh.set(hashes[j] + "-Digest", Base64.getMimeEncoder().encodeToString(dig.digest()));
+            } catch (NoSuchAlgorithmException e) {
+                throw new JarException("Digest algorithm " + hashes[j] +
+                                       " not available.");
+            } finally {
+                is.close();
+            }
+        }
+    }
+
+    /* Add a manifest file at current position in a stream
+     */
+    public void stream(OutputStream os) throws IOException {
+
+        PrintStream ps;
+        if (os instanceof PrintStream) {
+            ps = (PrintStream) os;
+        } else {
+            ps = new PrintStream(os);
+        }
+
+        /* the first header in the file should be the global one.
+         * It should say "Manifest-Version: x.x"; if not add it
+         */
+        MessageHeader globals = entries.elementAt(0);
+
+        if (globals.findValue("Manifest-Version") == null) {
+            /* Assume this is a user-defined manifest.  If it has a Name: <..>
+             * field, then it is not global, in which case we just add our own
+             * global Manifest-version: <version>
+             * If the first MessageHeader has no Name: <..>, we assume it
+             * is a global header and so prepend Manifest to it.
+             */
+            String jdkVersion = System.getProperty("java.version");
+
+            if (globals.findValue("Name") == null) {
+                globals.prepend("Manifest-Version", VERSION);
+                globals.add("Created-By", "Manifest JDK "+jdkVersion);
+            } else {
+                ps.print("Manifest-Version: "+VERSION+"\r\n"+
+                         "Created-By: "+jdkVersion+"\r\n\r\n");
+            }
+            ps.flush();
+        }
+
+        globals.print(ps);
+
+        for (int i = 1; i < entries.size(); ++i) {
+            MessageHeader mh = entries.elementAt(i);
+            mh.print(ps);
+        }
+    }
+
+    public static boolean isManifestName(String name) {
+
+        // remove leading /
+        if (name.charAt(0) == '/') {
+            name = name.substring(1, name.length());
+        }
+        // case insensitive
+        name = name.toUpperCase();
+
+        if (name.equals("META-INF/MANIFEST.MF")) {
+            return true;
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/SignatureFile.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 1996, 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.tools.jar;
+
+import java.io.*;
+import java.util.*;
+import java.security.*;
+
+import sun.net.www.MessageHeader;
+import java.util.Base64;
+
+
+import sun.security.pkcs.*;
+import sun.security.x509.AlgorithmId;
+
+/**
+ * <p>A signature file as defined in the <a
+ * href="manifest.html">Manifest and Signature Format</a>. It has
+ * essentially the same structure as a Manifest file in that it is a
+ * set of RFC 822 headers (sections). The first section contains meta
+ * data relevant to the entire file (i.e "Signature-Version:1.0") and
+ * each subsequent section contains data relevant to specific entries:
+ * entry sections.
+ *
+ * <p>Each entry section contains the name of an entry (which must
+ * have a counterpart in the manifest). Like the manifest it contains
+ * a hash, the hash of the manifest section corresponding to the
+ * name. Since the manifest entry contains the hash of the data, this
+ * is equivalent to a signature of the data, plus the attributes of
+ * the manifest entry.
+ *
+ * <p>This signature file format deal with PKCS7 encoded DSA signature
+ * block. It should be straightforward to extent to support other
+ * algorithms.
+ *
+ * @author      David Brown
+ * @author      Benjamin Renaud */
+
+public class SignatureFile {
+
+    /* Are we debugging? */
+    static final boolean debug = false;
+
+    /* list of headers that all pertain to a particular file in the
+     * archive */
+    private Vector<MessageHeader> entries = new Vector<>();
+
+    /* Right now we only support SHA hashes */
+    static final String[] hashes = {"SHA"};
+
+    static final void debug(String s) {
+        if (debug)
+            System.out.println("sig> " + s);
+    }
+
+    /*
+     * The manifest we're working with.  */
+    private Manifest manifest;
+
+    /*
+     * The file name for the file. This is the raw name, i.e. the
+     * extention-less 8 character name (such as MYSIGN) which wil be
+     * used to build the signature filename (MYSIGN.SF) and the block
+     * filename (MYSIGN.DSA) */
+    private String rawName;
+
+    /* The digital signature block corresponding to this signature
+     * file.  */
+    private PKCS7 signatureBlock;
+
+
+    /**
+     * Private constructor which takes a name a given signature
+     * file. The name must be extension-less and less or equal to 8
+     * character in length.  */
+    private SignatureFile(String name) throws JarException {
+
+        entries = new Vector<>();
+
+        if (name != null) {
+            if (name.length() > 8 || name.indexOf('.') != -1) {
+                throw new JarException("invalid file name");
+            }
+            rawName = name.toUpperCase(Locale.ENGLISH);
+        }
+    }
+
+    /**
+     * Private constructor which takes a name a given signature file
+     * and a new file predicate. If it is a new file, a main header
+     * will be added. */
+    private SignatureFile(String name, boolean newFile)
+    throws JarException {
+
+        this(name);
+
+        if (newFile) {
+            MessageHeader globals = new MessageHeader();
+            globals.set("Signature-Version", "1.0");
+            entries.addElement(globals);
+        }
+    }
+
+    /**
+     * Constructs a new Signature file corresponding to a given
+     * Manifest. All entries in the manifest are signed.
+     *
+     * @param manifest the manifest to use.
+     *
+     * @param name for this signature file. This should
+     * be less than 8 characters, and without a suffix (i.e.
+     * without a period in it.
+     *
+     * @exception JarException if an invalid name is passed in.
+     */
+    public SignatureFile(Manifest manifest, String name)
+    throws JarException {
+
+        this(name, true);
+
+        this.manifest = manifest;
+        Enumeration<MessageHeader> enum_ = manifest.entries();
+        while (enum_.hasMoreElements()) {
+            MessageHeader mh = enum_.nextElement();
+            String entryName = mh.findValue("Name");
+            if (entryName != null) {
+                add(entryName);
+            }
+        }
+    }
+
+    /**
+     * Constructs a new Signature file corresponding to a given
+     * Manifest. Specific entries in the manifest are signed.
+     *
+     * @param manifest the manifest to use.
+     *
+     * @param entries the entries to sign.
+     *
+     * @param filename for this signature file. This should
+     * be less than 8 characters, and without a suffix (i.e.
+     * without a period in it.
+     *
+     * @exception JarException if an invalid name is passed in.
+     */
+    public SignatureFile(Manifest manifest, String[] entries,
+                         String filename)
+    throws JarException {
+        this(filename, true);
+        this.manifest = manifest;
+        add(entries);
+    }
+
+    /**
+     * Construct a Signature file from an input stream.
+     *
+     * @exception IOException if an invalid name is passed in or if a
+     * stream exception occurs.
+     */
+    public SignatureFile(InputStream is, String filename)
+    throws IOException {
+        this(filename);
+        while (is.available() > 0) {
+            MessageHeader m = new MessageHeader(is);
+            entries.addElement(m);
+        }
+    }
+
+   /**
+     * Construct a Signature file from an input stream.
+     *
+     * @exception IOException if an invalid name is passed in or if a
+     * stream exception occurs.
+     */
+    public SignatureFile(InputStream is) throws IOException {
+        this(is, null);
+    }
+
+    public SignatureFile(byte[] bytes) throws IOException {
+        this(new ByteArrayInputStream(bytes));
+    }
+
+    /**
+     * Returns the name of the signature file, ending with a ".SF"
+     * suffix */
+    public String getName() {
+        return "META-INF/" + rawName + ".SF";
+    }
+
+    /**
+     * Returns the name of the block file, ending with a block suffix
+     * such as ".DSA". */
+    public String getBlockName() {
+        String suffix = "DSA";
+        if (signatureBlock != null) {
+            SignerInfo info = signatureBlock.getSignerInfos()[0];
+            suffix = info.getDigestEncryptionAlgorithmId().getName();
+            String temp = AlgorithmId.getEncAlgFromSigAlg(suffix);
+            if (temp != null) suffix = temp;
+        }
+        return "META-INF/" + rawName + "." + suffix;
+    }
+
+    /**
+     * Returns the signature block associated with this file.
+     */
+    public PKCS7 getBlock() {
+        return signatureBlock;
+    }
+
+    /**
+     * Sets the signature block associated with this file.
+     */
+    public void setBlock(PKCS7 block) {
+        this.signatureBlock = block;
+    }
+
+    /**
+     * Add a set of entries from the current manifest.
+     */
+    public void add(String[] entries) throws JarException {
+        for (int i = 0; i < entries.length; i++) {
+            add (entries[i]);
+        }
+    }
+
+    /**
+     * Add a specific entry from the current manifest.
+     */
+    public void add(String entry) throws JarException {
+        MessageHeader mh = manifest.getEntry(entry);
+        if (mh == null) {
+            throw new JarException("entry " + entry + " not in manifest");
+        }
+        MessageHeader smh;
+        try {
+            smh = computeEntry(mh);
+        } catch (IOException e) {
+            throw new JarException(e.getMessage());
+        }
+        entries.addElement(smh);
+    }
+
+    /**
+     * Get the entry corresponding to a given name. Returns null if
+     *the entry does not exist.
+     */
+    public MessageHeader getEntry(String name) {
+        Enumeration<MessageHeader> enum_ = entries();
+        while(enum_.hasMoreElements()) {
+            MessageHeader mh = enum_.nextElement();
+            if (name.equals(mh.findValue("Name"))) {
+                return mh;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the n-th entry. The global header is a entry 0.  */
+    public MessageHeader entryAt(int n) {
+        return entries.elementAt(n);
+    }
+
+    /**
+     * Returns an enumeration of the entries.
+     */
+    public Enumeration<MessageHeader> entries() {
+        return entries.elements();
+    }
+
+    /**
+     * Given a manifest entry, computes the signature entry for this
+     * manifest entry.
+     */
+    private MessageHeader computeEntry(MessageHeader mh) throws IOException {
+        MessageHeader smh = new MessageHeader();
+
+        String name = mh.findValue("Name");
+        if (name == null) {
+            return null;
+        }
+        smh.set("Name", name);
+
+        try {
+            for (int i = 0; i < hashes.length; ++i) {
+                MessageDigest dig = getDigest(hashes[i]);
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                PrintStream ps = new PrintStream(baos);
+                mh.print(ps);
+                byte[] headerBytes = baos.toByteArray();
+                byte[] digest = dig.digest(headerBytes);
+                smh.set(hashes[i] + "-Digest", Base64.getMimeEncoder().encodeToString(digest));
+            }
+            return smh;
+        } catch (NoSuchAlgorithmException e) {
+            throw new JarException(e.getMessage());
+        }
+    }
+
+    private Hashtable<String, MessageDigest> digests = new Hashtable<>();
+
+    private MessageDigest getDigest(String algorithm)
+    throws NoSuchAlgorithmException {
+        MessageDigest dig = digests.get(algorithm);
+        if (dig == null) {
+            dig = MessageDigest.getInstance(algorithm);
+            digests.put(algorithm, dig);
+        }
+        dig.reset();
+        return dig;
+    }
+
+
+    /**
+     * Add a signature file at current position in a stream
+     */
+    public void stream(OutputStream os) throws IOException {
+
+        /* the first header in the file should be the global one.
+         * It should say "SignatureFile-Version: x.x"; barf if not
+         */
+        MessageHeader globals = entries.elementAt(0);
+        if (globals.findValue("Signature-Version") == null) {
+            throw new JarException("Signature file requires " +
+                            "Signature-Version: 1.0 in 1st header");
+        }
+
+        PrintStream ps = new PrintStream(os);
+        globals.print(ps);
+
+        for (int i = 1; i < entries.size(); ++i) {
+            MessageHeader mh = entries.elementAt(i);
+            mh.print(ps);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,94 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=\
+     can''t open: {0} 
+error.illegal.option=\
+        Illegal option: {0}
+error.bad.option=\
+        One of options -{ctxu} must be specified.
+error.bad.cflag=\
+        'c' flag requires manifest or input files to be specified!
+error.bad.uflag=\
+        'u' flag requires manifest, 'e' flag or input files to be specified!
+error.bad.eflag=\
+	'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
+	 together!
+error.nosuch.fileordir=\
+        {0} : no such file or directory
+error.write.file=\
+        Error in writing existing jar file
+error.create.dir=\
+        {0} : could not create directory
+error.incorrect.length=\
+        incorrect length while processing: {0}
+error.create.tempfile=\
+        Could not create a temporary file
+out.added.manifest=\
+        added manifest
+out.update.manifest=\
+        updated manifest
+out.ignore.entry=\
+        ignoring entry {0}
+out.adding=\
+        adding: {0}
+out.deflated=\
+        (deflated {0}%)
+out.stored=\
+        (stored 0%)
+out.create=\
+        \ \ created: {0}
+out.extracted=\
+        extracted: {0}
+out.inflated=\
+        \ inflated: {0}
+out.size=\
+        (in = {0}) (out= {1})
+
+usage=\
+Usage: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
+Options:\n\
+\ \   -c  create new archive\n\
+\ \   -t  list table of contents for archive\n\
+\ \   -x  extract named (or all) files from archive\n\
+\ \   -u  update existing archive\n\
+\ \   -v  generate verbose output on standard output\n\
+\ \   -f  specify archive file name\n\
+\ \   -m  include manifest information from specified manifest file\n\
+\ \   -n  perform Pack200 normalization after creating a new archive\n\
+\ \   -e  specify application entry point for stand-alone application \n\
+\ \       bundled into an executable jar file\n\
+\ \   -0  store only; use no ZIP compression\n\
+\ \   -M  do not create a manifest file for the entries\n\
+\ \   -i  generate index information for the specified jar files\n\
+\ \   -C  change to the specified directory and include the following file\n\
+If any file is a directory then it is processed recursively.\n\
+The manifest file name, the archive file name and the entry point name are\n\
+specified in the same order as the 'm', 'f' and 'e' flags.\n\n\
+Example 1: to archive two class files into an archive called classes.jar: \n\
+\ \      jar cvf classes.jar Foo.class Bar.class \n\
+Example 2: use an existing manifest file 'mymanifest' and archive all the\n\
+\ \          files in the foo/ directory into 'classes.jar': \n\
+\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=\u00D6ffnen nicht m\u00F6glich: {0} 
+error.illegal.option=Ung\u00FCltige Option: {0}
+error.bad.option=Eine der Optionen -{ctxu} muss angegeben werden.
+error.bad.cflag=Kennzeichen "c" erfordert Angabe von Manifest oder Eingabedateien.
+error.bad.uflag=Kennzeichen "u" erfordert Angabe von Manifest, Kennzeichen "e" oder Eingabedateien.
+error.bad.eflag=Kennzeichen "e" und Manifest mit dem Attribut "Main-Class" k\u00F6nnen nicht zusammen angegeben\nwerden.
+error.nosuch.fileordir={0}: Datei oder Verzeichnis nicht vorhanden
+error.write.file=Fehler beim Schreiben in vorhandener JAR-Datei
+error.create.dir={0}: Verzeichnis konnte nicht erstellt werden
+error.incorrect.length=Falsche L\u00E4nge bei der Verarbeitung: {0}
+error.create.tempfile=Es konnte keine tempor\u00E4re Datei erstellt werden
+out.added.manifest=Manifest wurde hinzugef\u00FCgt
+out.update.manifest=Manifest wurde aktualisiert
+out.ignore.entry=Eintrag {0} wird ignoriert
+out.adding={0} wird hinzugef\u00FCgt
+out.deflated=({0} % verkleinert)
+out.stored=(0 % gespeichert)
+out.create=\  erstellt: {0}
+out.extracted=extrahiert: {0}
+out.inflated=\ vergr\u00F6\u00DFert: {0}
+out.size=(ein = {0}) (aus = {1})
+
+usage=Verwendung: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien ...\nOptionen:\n    -c  Neues Archiv erstellen\n    -t  Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n    -x  Benannte (oder alle) Dateien aus dem Archiv extrahieren\n    -u  Vorhandenes Archiv aktualisieren\n    -v  Ausgabe im Verbose-Modus aus Standard-Ausgabe generieren\n    -f  Dateinamen f\u00FCr Archiv angeben\n    -m  Manifest-Informationen aus angegebener Manifest-Datei einschlie\u00DFen\n    -n  Pack200-Normalisierung nach Erstellung eines neuen Archivs ausf\u00FChren\n    -e  Anwendungs-Einstiegspunkt f\u00FCr alleinstehende Anwendung angeben\n        in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt\n    -0  nur speichern; keine ZIP-Komprimierung verwenden\n    -M  keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n    -i  Index-Informationen f\u00FCr die angegebenen JAR-Dateien generieren\n    -C  zu angegebenem Verzeichnis wechseln und die folgende Datei einschlie\u00DFen\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nDie Namen der Manifest-Datei, der Archiv-Datei und des Einstiegspunkts sind\nin derselben Reihenfolge wie die Kennzeichen f\u00FCr "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren von zwei Klassendateien in einem Archiv mit dem Namen "classes.jar": \n       jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden einer vorhandenen Manifest-Datei mit dem Namen "mymanifest" und Archivieren aller\n           Dateien im Verzeichnis mit dem Namen "foo/" in die Archiv-Datei "classes.jar": \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=no se puede abrir: {0} 
+error.illegal.option=Opci\u00F3n no permitida: {0}
+error.bad.option=Se debe especificar una de las opciones -{ctxu}.
+error.bad.cflag=El indicador 'c' necesita la especificaci\u00F3n de archivos de manifiesto o de entrada.
+error.bad.uflag=El indicador 'u' necesita la especificaci\u00F3n de archivos de manifiesto, de entrada o indicador 'e'.
+error.bad.eflag=El indicador 'e' y el manifiesto con el atributo 'Main-Class' no pueden especificarse \na la vez.
+error.nosuch.fileordir={0} : no existe tal archivo o directorio
+error.write.file=Error al escribir un archivo jar existente
+error.create.dir={0} : no se ha podido crear el directorio
+error.incorrect.length=longitud incorrecta al procesar: {0}
+error.create.tempfile=No se ha podido crear el archivo temporal
+out.added.manifest=manifiesto agregado
+out.update.manifest=manifiesto actualizado
+out.ignore.entry=ignorando entrada {0}
+out.adding=agregando: {0}
+out.deflated=(desinflado {0}%)
+out.stored=(almacenado 0%)
+out.create=\  creado: {0}
+out.extracted=extra\u00EDdo: {0}
+out.inflated=\ inflado: {0}
+out.size=(entrada = {0}) (salida = {1})
+
+usage=Sintaxis: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] archivos...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x  extraer el archive mencionado (o todos) del archivo\n    -u  actualizar archive existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archive de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n    -n  realizar normalizaci\u00F3n de Pack200 despu\u00E9s de crear un nuevo archivo\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archive jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -M  no crear un archive de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=impossible d''ouvrir : {0} 
+error.illegal.option=Option non admise : {0}
+error.bad.option=Une des options -{ctxu} doit \u00EAtre sp\u00E9cifi\u00E9e.
+error.bad.cflag=L'indicateur c requiert la sp\u00E9cification d'un fichier manifeste ou d'un fichier d'entr\u00E9e.
+error.bad.uflag=L'indicateur u requiert la sp\u00E9cification d'un fichier manifeste, d'un fichier d'entr\u00E9e ou d'un indicateur e.
+error.bad.eflag=L'indicateur e et le fichier manifeste portant l'attribut Main-Class ne peuvent pas \u00EAtre sp\u00E9cifi\u00E9s \nensemble.
+error.nosuch.fileordir={0} : fichier ou r\u00E9pertoire introuvable
+error.write.file=Erreur lors de l'\u00E9criture d'un fichier JAR existant
+error.create.dir={0} : impossible de cr\u00E9er le r\u00E9pertoire
+error.incorrect.length=longueur incorrecte lors du traitement de : {0}
+error.create.tempfile=Impossible de cr\u00E9er un fichier temporaire
+out.added.manifest=manifeste ajout\u00E9
+out.update.manifest=manifeste mis \u00E0 jour
+out.ignore.entry=entr\u00E9e {0} ignor\u00E9e
+out.adding=ajout : {0}
+out.deflated=(compression : {0} %)
+out.stored=(stockage : 0 %)
+out.create=\  cr\u00E9\u00E9 : {0}
+out.extracted=extrait : {0}
+out.inflated=\ d\u00E9compress\u00E9 : {0}
+out.size=(entr\u00E9e = {0}) (sortie = {1})
+
+usage=Syntaxe : jar {ctxui}[vfmn0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n    -c  cr\u00E9e une archive\n    -t  affiche la table des mati\u00E8res de l'archive\n    -x  extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n    -u  met \u00E0 jour l'archive existante\n    -v  g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n    -f  sp\u00E9cifie le nom du fichier archive\n    -m  inclut les informations de manifeste \u00E0 partir du fichier manifeste sp\u00E9cifi\u00E9\n    -n  effectue une normalisation Pack200 apr\u00E8s la cr\u00E9ation d'une archive\n    -e  sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n        int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n    -0  stockage uniquement, pas de compression ZIP\n    -M  ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n    -i  g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n    -C  passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier d'archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n       jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n           fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n       jar cvfm classes.jar monmanifeste -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=impossibile aprire: {0} 
+error.illegal.option=Opzione non valida: {0}
+error.bad.option=\u00C8 necessario specificare una delle opzioni -{ctxu}.
+error.bad.cflag=Per il flag 'c' \u00E8 necessario specificare file manifest o di input.
+error.bad.uflag=Per il flag 'u' \u00E8 necessario specificare il flag 'e' oppure file manifest o di input.
+error.bad.eflag=Il flag 'e' e il manifest con l'attributo 'Main-Class' non possono essere specificati\ninsieme.
+error.nosuch.fileordir={0} : file o directory inesistente
+error.write.file=Errore durante la scrittura del file jar esistente
+error.create.dir={0} : impossibile creare la directory
+error.incorrect.length=lunghezza non valida durante l''elaborazione: {0}
+error.create.tempfile=Impossibile creare il file temporaneo.
+out.added.manifest=aggiunto manifest
+out.update.manifest=aggiornato manifest
+out.ignore.entry=la voce {0} sar\u00E0 ignorata
+out.adding=aggiunta in corso di: {0}
+out.deflated=(compresso {0}%)
+out.stored=(memorizzato 0%)
+out.create=\     creato: {0}
+out.extracted=estratto: {0}
+out.inflated=\ decompresso: {0}
+out.size=(in = {0}) (out = {1})
+
+usage=Uso: jar {ctxui}[vfmn0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -n  esegue la normalizzazione Pack200 dopo la creazione di un nuovo archivio\n    -e  specifica il punto di ingresso per l'applicazione standalone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open={0}\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093 
+error.illegal.option=\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
+error.bad.option=\u30AA\u30D7\u30B7\u30E7\u30F3-{ctxu}\u306E\u3046\u3061\u306E1\u3064\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+error.bad.cflag=\u30D5\u30E9\u30B0'c'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002
+error.bad.uflag=\u30D5\u30E9\u30B0'u'\u3067\u306F\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304B'e'\u30D5\u30E9\u30B0\u3001\u307E\u305F\u306F\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u6307\u5B9A\u304C\u5FC5\u8981\u3067\u3059\u3002
+error.bad.eflag='e'\u30D5\u30E9\u30B0\u3068'Main-Class'\u5C5E\u6027\u3092\u6301\u3064\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u540C\u6642\u306B\n\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002
+error.nosuch.fileordir={0}\u3068\u3044\u3046\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u3042\u308A\u307E\u305B\u3093
+error.write.file=\u65E2\u5B58jar\u30D5\u30A1\u30A4\u30EB\u306E\u66F8\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
+error.create.dir=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+error.incorrect.length={0}\u306E\u51E6\u7406\u4E2D\u306B\u4E0D\u6B63\u306A\u9577\u3055\u304C\u3042\u308A\u307E\u3057\u305F
+error.create.tempfile=\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+out.added.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F
+out.update.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F
+out.ignore.entry=\u30A8\u30F3\u30C8\u30EA{0}\u3092\u7121\u8996\u3057\u307E\u3059
+out.adding={0}\u3092\u8FFD\u52A0\u4E2D\u3067\u3059
+out.deflated=({0}%\u53CE\u7E2E\u3055\u308C\u307E\u3057\u305F)
+out.stored=(0%\u683C\u7D0D\u3055\u308C\u307E\u3057\u305F)
+out.create=\  {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
+out.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F
+out.inflated=\ {0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
+out.size=(\u5165={0})(\u51FA={1})
+
+usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n    -c  \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n    -t  \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n    -x  \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n    -u  \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n    -v  \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n    -f  \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n    -m  \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n    -n  \u65B0\u898F\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u4F5C\u6210\u5F8C\u306BPack200\u6B63\u898F\u5316\u3092\u5B9F\u884C\u3059\u308B\n    -e  \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\n        \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n    -0  \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n    -M  \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n    -i  \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n    -C  \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B: \n       jar cvf classes.jar Foo.class Bar.class \n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n           \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=\uC5F4 \uC218 \uC5C6\uC74C: {0} 
+error.illegal.option=\uC798\uBABB\uB41C \uC635\uC158: {0}
+error.bad.option=\uC635\uC158 -{ctxu} \uC911 \uD558\uB098\uB97C \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
+error.bad.cflag='c' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4!
+error.bad.uflag='u' \uD50C\uB798\uADF8\uB97C \uC0AC\uC6A9\uD558\uB824\uBA74 Manifest, 'e' \uD50C\uB798\uADF8 \uB610\uB294 \uC785\uB825 \uD30C\uC77C\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4!
+error.bad.eflag='e' \uD50C\uB798\uADF8 \uBC0F Manifest\uB97C 'Main-Class' \uC18D\uC131\uACFC \uD568\uAED8 \uC9C0\uC815\uD560 \uC218\n\uC5C6\uC2B5\uB2C8\uB2E4!
+error.nosuch.fileordir={0}: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
+error.write.file=\uAE30\uC874 jar \uD30C\uC77C\uC5D0 \uC4F0\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+error.create.dir={0}: \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+error.incorrect.length=\uCC98\uB9AC \uC911 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uAE38\uC774\uAC00 \uBC1C\uACAC\uB428: {0}
+error.create.tempfile=\uC784\uC2DC \uD30C\uC77C\uC744 \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+out.added.manifest=Manifest\uB97C \uCD94\uAC00\uD568
+out.update.manifest=Manifest\uB97C \uC5C5\uB370\uC774\uD2B8\uD568
+out.ignore.entry={0} \uD56D\uBAA9\uC744 \uBB34\uC2DC\uD558\uB294 \uC911
+out.adding=\uCD94\uAC00\uD558\uB294 \uC911: {0}
+out.deflated=({0}%\uB97C \uAC10\uC18C\uD568)
+out.stored=(0%\uB97C \uC800\uC7A5\uD568)
+out.create=\  \uC0DD\uC131\uB428: {0}
+out.extracted=\uCD94\uCD9C\uB428: {0}
+out.inflated=\ \uC99D\uAC00\uB428: {0}
+out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
+
+usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n    -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n    -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n    -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n    -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n    -n  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD55C \uD6C4 Pack200 \uC815\uADDC\uD654\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n    -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n        \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -0  \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n           foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvfm classes.jar mymanifest -C foo/ .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=n\u00E3o \u00E9 poss\u00EDvel abrir: {0} 
+error.illegal.option=Op\u00E7\u00E3o inv\u00E1lida: {0}
+error.bad.option=Uma das op\u00E7\u00F5es -{ctxu} deve ser especificada.
+error.bad.cflag=flag 'c' requer que os arquivos de manifesto ou entrada sejam especificados!
+error.bad.uflag=o flag 'u' requer que arquivos de manifesto, o flag 'e' ou arquivos de entrada sejam especificados!
+error.bad.eflag=o flag 'e' e manifesto com o atributo 'Main-Class' n\u00E3o podem ser especificados \njuntos!
+error.nosuch.fileordir={0} : n\u00E3o h\u00E1 tal arquivo ou diret\u00F3rio
+error.write.file=Erro ao gravar o arquivo jar existente
+error.create.dir={0} : n\u00E3o foi poss\u00EDvel criar o diret\u00F3rio
+error.incorrect.length=largura incorreta durante o processamento: {0}
+error.create.tempfile=N\u00E3o foi poss\u00EDvel criar um arquivo tempor\u00E1rio
+out.added.manifest=manifesto adicionado
+out.update.manifest=manifesto atualizado
+out.ignore.entry=ignorando entrada {0}
+out.adding=adicionando: {0}
+out.deflated=(compactado {0}%)
+out.stored=(armazenado 0%)
+out.create=\  criado: {0}
+out.extracted=extra\u00EDdo: {0}
+out.inflated=\ inflado: {0}
+out.size=(entrada = {0}) (sa\u00EDda= {1})
+
+usage=Uso: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n    -c  cria novo arquivo compactado\n    -t  lista o sum\u00E1rio do arquivo compactado\n    -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n    -u  atualiza o arquivo compactado existente\n    -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n    -f  especifica o nome do arquivo do arquivo compactado\n    -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n    -n   executa a normaliza\u00E7\u00E3o Pack200 ap\u00F3s a cria\u00E7\u00E3o de um novo arquivo compactado\n    -e  especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o stand-alone \n        empacotada em um arquivo jar execut\u00E1vel\n    -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n    -M  n\u00E3o cria um arquivo de manifesto para as entradas\n    -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n    -C  passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n           arquivos no diret\u00F3rio foo/ na 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=kan inte \u00F6ppna: {0} 
+error.illegal.option=Otill\u00E5tet alternativ: {0}
+error.bad.option=Ett av alternativen -{ctxu} m\u00E5ste anges.
+error.bad.cflag=f\u00F6r c-flaggan m\u00E5ste manifest- eller indatafiler anges.
+error.bad.uflag=f\u00F6r u-flaggan m\u00E5ste manifest-, e-flagg- eller indatafiler anges.
+error.bad.eflag=e-flaggan och manifest med attributet Main-Class kan inte anges \ntillsammans.
+error.nosuch.fileordir={0} : det finns ingen s\u00E5dan fil eller katalog
+error.write.file=Det uppstod ett fel vid skrivning till befintlig jar-fil.
+error.create.dir={0} : kunde inte skapa n\u00E5gon katalog
+error.incorrect.length=ogiltig l\u00E4ngd vid bearbetning: {0}
+error.create.tempfile=Kunde inte skapa en tillf\u00E4llig fil
+out.added.manifest=tillagt manifestfil
+out.update.manifest=uppdaterat manifest
+out.ignore.entry=ignorerar posten {0}
+out.adding=l\u00E4gger till: {0}
+out.deflated=({0}% packat)
+out.stored=(0% lagrat)
+out.create=\  skapad: {0}
+out.extracted=extraherat: {0}
+out.inflated=\ uppackat: {0}
+out.size=(in = {0}) (ut = {1})
+
+usage=Syntax: jar {ctxui}[vfmn0Me] [jar-fil] [manifestfil] [startpunkt] [-C katalog] filer ...\nAlternativ:\n    -c  skapa nytt arkiv\n    -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n    -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n    -u  uppdatera befintligt arkiv\n    -v  generera utf\u00F6rliga utdata vid standardutmatning\n    -f  ange arkivfilens namn\n    -m  inkludera manifestinformation fr\u00E5n angivet manifest\n    -n  utf\u00F6r Pack200-normalisering efter att ha skapat ett nytt arkiv\n    -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n        som medf\u00F6ljer i en jar-programfil\n    -0  endast lagra  (ingen zip-komprimering)\n    -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n    -i  generera indexinformation f\u00F6r de angivna jar-filerna\n    -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges\ni samma ordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n           filer fr\u00E5n katalogen foo/ i classes.jar: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=\u65E0\u6CD5\u6253\u5F00: {0} 
+error.illegal.option=\u975E\u6CD5\u9009\u9879: {0}
+error.bad.option=\u5FC5\u987B\u6307\u5B9A {ctxu} \u4E2D\u7684\u4EFB\u4E00\u9009\u9879\u3002
+error.bad.cflag='c' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355\u6216\u8F93\u5165\u6587\u4EF6!
+error.bad.uflag='u' \u6807\u8BB0\u8981\u6C42\u6307\u5B9A\u6E05\u5355, 'e' \u6807\u8BB0\u6216\u8F93\u5165\u6587\u4EF6!
+error.bad.eflag=\u4E0D\u80FD\u540C\u65F6\u6307\u5B9A 'e' \u6807\u8BB0\u548C\u5177\u6709 'Main-Class' \u5C5E\u6027\u7684\n\u6E05\u5355!
+error.nosuch.fileordir={0}: \u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6\u6216\u76EE\u5F55
+error.write.file=\u5199\u5165\u73B0\u6709\u7684 jar \u6587\u4EF6\u65F6\u51FA\u9519
+error.create.dir={0}: \u65E0\u6CD5\u521B\u5EFA\u76EE\u5F55
+error.incorrect.length=\u5904\u7406\u65F6\u9047\u5230\u4E0D\u6B63\u786E\u7684\u957F\u5EA6: {0}
+error.create.tempfile=\u65E0\u6CD5\u521B\u5EFA\u4E34\u65F6\u6587\u4EF6
+out.added.manifest=\u5DF2\u6DFB\u52A0\u6E05\u5355
+out.update.manifest=\u5DF2\u66F4\u65B0\u6E05\u5355
+out.ignore.entry=\u6B63\u5728\u5FFD\u7565\u6761\u76EE{0}
+out.adding=\u6B63\u5728\u6DFB\u52A0: {0}
+out.deflated=(\u538B\u7F29\u4E86 {0}%)
+out.stored=(\u5B58\u50A8\u4E86 0%)
+out.create=\  \u5DF2\u521B\u5EFA: {0}
+out.extracted=\u5DF2\u63D0\u53D6: {0}
+out.inflated=\  \u5DF2\u89E3\u538B: {0}
+out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
+
+usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879:\n    -c  \u521B\u5EFA\u65B0\u6863\u6848\n    -t  \u5217\u51FA\u6863\u6848\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u6863\u6848\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u6863\u6848\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -n  \u521B\u5EFA\u65B0\u6863\u6848\u540E\u6267\u884C Pack200 \u89C4\u8303\u5316\n    -e  \u4E3A\u7ED1\u5B9A\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u4EFB\u4F55 ZIP \u538B\u7F29\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u4EE5\u4E0B\u6587\u4EF6\n\u5982\u679C\u4EFB\u4F55\u6587\u4EF6\u4E3A\u76EE\u5F55, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u6863\u6848\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u6863\u6848\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 1999, 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.
+#
+
+error.cant.open=\u7121\u6CD5\u958B\u555F: {0} 
+error.illegal.option=\u7121\u6548\u7684\u9078\u9805: {0}
+error.bad.option=\u5176\u4E2D\u4E00\u500B\u9078\u9805 -{ctxu} \u5FC5\u9808\u52A0\u4EE5\u6307\u5B9A\u3002
+error.bad.cflag='c' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u6216\u8F38\u5165\u6A94\u6848\uFF01
+error.bad.uflag='u' \u65D7\u6A19\u8981\u6C42\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u3001'e' \u65D7\u6A19\u6216\u8F38\u5165\u6A94\u6848\uFF01
+error.bad.eflag=\u7121\u6CD5\u540C\u6642\u6307\u5B9A 'e' \u65D7\u6A19\u548C\u5177\u6709 'Main-Class' \u5C6C\u6027\u7684\n\u8CC7\u8A0A\u6E05\u55AE\uFF01
+error.nosuch.fileordir={0} : \u6C92\u6709\u9019\u985E\u6A94\u6848\u6216\u76EE\u9304
+error.write.file=\u5BEB\u5165\u73FE\u6709\u7684 jar \u6A94\u6848\u6642\u767C\u751F\u932F\u8AA4
+error.create.dir={0} : \u7121\u6CD5\u5EFA\u7ACB\u76EE\u9304
+error.incorrect.length=\u8655\u7406 {0} \u6642\u9577\u5EA6\u4E0D\u6B63\u78BA
+error.create.tempfile=\u7121\u6CD5\u5EFA\u7ACB\u66AB\u5B58\u6A94\u6848
+out.added.manifest=\u5DF2\u65B0\u589E\u8CC7\u8A0A\u6E05\u55AE
+out.update.manifest=\u5DF2\u66F4\u65B0\u8CC7\u8A0A\u6E05\u55AE
+out.ignore.entry=\u5FFD\u7565\u9805\u76EE {0}
+out.adding=\u65B0\u589E: {0}
+out.deflated=(\u58D3\u7E2E {0}%)
+out.stored=(\u5132\u5B58 0%)
+out.create=\  \u5EFA\u7ACB: {0}
+out.extracted=\u64F7\u53D6: {0}
+out.inflated=\ \u64F4\u5C55: {0}
+out.size=\ (\u8B80={0})(\u5BEB={1})
+
+usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n    -c  \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n    -t  \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n    -x  \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n    -u  \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n    -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n    -f  \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n    -m  \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n    -n  \u5728\u5EFA\u7ACB\u65B0\u6B78\u6A94\u4E4B\u5F8C\u57F7\u884C Pack200 \u6B63\u898F\u5316\n    -e  \u70BA\u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\u7684\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\n        \u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n    -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n    -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n    -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n    -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n           foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -295,8 +295,8 @@
             },
             { "DatePatterns",
                 new String[] {
-                    "d. MMMM'ta 'yyyy", // full date pattern
-                    "d. MMMM'ta 'yyyy", // long date pattern
+                    "d. MMMM yyyy", // full date pattern
+                    "d. MMMM yyyy", // long date pattern
                     "d.M.yyyy", // medium date pattern
                     "d.M.yyyy", // short date pattern
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,486 @@
+/*
+ * 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.
+ */
+
+// -*- C++ -*-
+// Small program for unpacking specially compressed Java packages.
+// John R. Rose
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+#include "coding.h"
+#include "bands.h"
+
+#include "constants.h"
+#include "unpack.h"
+
+inline void band::abort(const char* msg) { u->abort(msg); }
+inline bool band::aborting() { return u->aborting(); }
+
+void band::readData(int expectedLength) {
+  CHECK;
+  assert(expectedLength >= 0);
+  assert(vs[0].cmk == cmk_ERROR);
+  if (expectedLength != 0) {
+    assert(length == 0);
+    length = expectedLength;
+  }
+  if (length == 0) {
+    assert((rplimit = cm.vs0.rp = u->rp) != null);
+    return;
+  }
+  assert(length > 0);
+
+  bool is_BYTE1 = (defc->spec == BYTE1_spec);
+
+  if (is_BYTE1) {
+    // No possibility of coding change.  Sizing is exact.
+    u->ensure_input(length);
+  } else {
+    // Make a conservatively generous estimate of band size in bytes.
+    // Assume B == 5 everywhere.
+    // Assume awkward pop with all {U} values (2*5 per value)
+    jlong generous = (jlong) length * (B_MAX*3+1) + C_SLOP;
+    u->ensure_input(generous);
+  }
+
+  // Read one value to see what it might be.
+  int XB = _meta_default;
+  int cp1 = 0, cp2 = 0;
+  if (!is_BYTE1) {
+    // must be a variable-length coding
+    assert(defc->B() > 1 && defc->L() > 0);
+    // must have already read from previous band:
+    assert(bn >= BAND_LIMIT || bn <= 0
+           || bn == e_cp_Utf8_big_chars
+           || endsWith(name, "_lo")  // preceded by _hi conditional band
+           || bn == e_file_options  // preceded by conditional band
+           || u->rp == u->all_bands[bn-1].maxRP()
+           || u->all_bands[bn-1].defc == null);
+
+    value_stream xvs;
+    coding* valc = defc;
+    if (valc->D() != 0) {
+      valc = coding::findBySpec(defc->B(), defc->H(), defc->S());
+      assert(!valc->isMalloc);
+    }
+    xvs.init(u->rp, u->rplimit, valc);
+    CHECK;
+    int X = xvs.getInt();
+    if (valc->S() != 0) {
+      assert(valc->min <= -256);
+      XB = -1-X;
+    } else {
+      int L = valc->L();
+      assert(valc->max >= L+255);
+      XB = X-L;
+    }
+    if (0 <= XB && XB < 256) {
+      // Skip over the escape value.
+      u->rp = xvs.rp;
+      cp1 = 1;
+    } else {
+      // No, it's still default.
+      XB = _meta_default;
+    }
+  }
+
+  if (XB <= _meta_canon_max) {
+    byte XB_byte = (byte) XB;
+    byte* XB_ptr = &XB_byte;
+    cm.init(u->rp, u->rplimit, XB_ptr, 0, defc, length, null);
+    CHECK;
+  } else {
+    NOT_PRODUCT(byte* meta_rp0 = u->meta_rp);
+    assert(u->meta_rp != null);
+    // Scribble the initial byte onto the band.
+    byte* save_meta_rp = --u->meta_rp;
+    byte  save_meta_xb = (*save_meta_rp);
+    (*save_meta_rp) = (byte) XB;
+    cm.init(u->rp, u->rplimit, u->meta_rp, 0, defc, length, null);
+    (*save_meta_rp) = save_meta_xb;  // put it back, just to be tidy
+    NOT_PRODUCT(cp2 = (int)(u->meta_rp - meta_rp0));
+  }
+  rplimit = u->rp;
+
+  rewind();
+
+#ifndef PRODUCT
+  PRINTCR((3,"readFrom %s at %p [%d values, %d bytes, cp=%d/%d]",
+           (name?name:"(band)"), minRP(), length, size(), cp1, cp2));
+  if (u->verbose_bands || u->verbose >= 4) dump();
+
+  if (ix != null && u->verbose != 0 && length > 0) {
+    // Check referential integrity early, for easier debugging.
+    band saved = (*this);  // save state
+    for (int i = 0; i < length; i++) {
+      int n = vs[0].getInt() - nullOK;
+      entry *ref = ix->get(n);
+      assert(ref != null || n == -1);
+    }
+    (*this) = saved;
+  }
+#endif
+}
+
+#ifndef PRODUCT
+void band::dump() {
+  band saved = (*this);  // save state
+  const char* b_name = name;
+  char b_name_buf[100];
+  if (b_name == null) {
+    char* bp = &b_name_buf[0];
+    b_name = bp;
+    sprintf(bp, "#%d/%d", bn, le_kind); bp += strlen(bp);
+    if (le_bci != 0)  { sprintf(bp, "/bci%d",  le_bci);  bp += strlen(bp); }
+    if (le_back != 0) { sprintf(bp, "/back%d", le_back); bp += strlen(bp); }
+    if (le_len != 0)  { sprintf(bp, "/len%d",  le_len);  bp += strlen(bp); }
+  }
+  fprintf(u->errstrm, "band %s[%d]%s", b_name, length, (length==0?"\n":" {"));
+  if (length > 0) {
+    for (int i = 0; i < length; i++) {
+      const char* eol = (length > 10 && i % 10 == 0) ? "\n" : " ";
+      fprintf(u->errstrm, "%s%d", eol, vs[0].getInt());
+    }
+    fprintf(u->errstrm, " }\n");
+  }
+  (*this) = saved;
+}
+#endif
+
+void band::setIndex(cpindex* ix_) {
+  assert(ix_ == null || ixTag == ix_->ixTag);
+  ix = ix_;
+}
+void band::setIndexByTag(byte tag) {
+  setIndex(u->cp.getIndex(tag));
+}
+
+entry* band::getRefCommon(cpindex* ix_, bool nullOKwithCaller) {
+  CHECK_0;
+  if (ix_ == NULL) {
+      abort("no index");
+      return NULL;
+  }
+  assert(ix_->ixTag == ixTag
+         || ((ixTag == CONSTANT_All ||
+              ixTag == CONSTANT_LoadableValue ||
+              ixTag == CONSTANT_AnyMember)
+         || (ixTag == CONSTANT_FieldSpecific &&
+              ix_->ixTag >= CONSTANT_Integer  &&
+              ix_->ixTag <= CONSTANT_String))
+         );
+  int n = vs[0].getInt() - nullOK;
+  // Note: band-local nullOK means null encodes as 0.
+  // But nullOKwithCaller means caller is willing to tolerate a null.
+  entry *ref = ix_->get(n);
+  if (ref == null && !(nullOKwithCaller && n == -1))
+    abort(n == -1 ? "null ref" : "bad ref");
+  return ref;
+}
+
+jlong band::getLong(band& lo_band, bool have_hi) {
+  band& hi_band = (*this);
+  assert(lo_band.bn == hi_band.bn + 1);
+  uint lo = lo_band.getInt();
+  if (!have_hi) {
+    assert(hi_band.length == 0);
+    return makeLong(0, lo);
+  }
+  uint hi = hi_band.getInt();
+  return makeLong(hi, lo);
+}
+
+int band::getIntTotal() {
+  CHECK_0;
+  if (length == 0)  return 0;
+  if (total_memo > 0)  return total_memo-1;
+  int total = getInt();
+  // overflow checks require that none of the addends are <0,
+  // and that the partial sums never overflow (wrap negative)
+  if (total < 0) {
+    abort("overflow detected");
+    return 0;
+  }
+  for (int k = length-1; k > 0; k--) {
+    int prev_total = total;
+    total += vs[0].getInt();
+    if (total < prev_total) {
+      abort("overflow detected");
+      return 0;
+    }
+  }
+  rewind();
+  total_memo = total+1;
+  return total;
+}
+
+int band::getIntCount(int tag) {
+  CHECK_0;
+  if (length == 0)  return 0;
+  if (tag >= HIST0_MIN && tag <= HIST0_MAX) {
+    if (hist0 == null) {
+      // Lazily calculate an approximate histogram.
+      hist0 = U_NEW(int, (HIST0_MAX - HIST0_MIN)+1);
+      CHECK_0;
+      for (int k = length; k > 0; k--) {
+        int x = vs[0].getInt();
+        if (x >= HIST0_MIN && x <= HIST0_MAX)
+          hist0[x - HIST0_MIN] += 1;
+      }
+      rewind();
+    }
+    return hist0[tag - HIST0_MIN];
+  }
+  int total = 0;
+  for (int k = length; k > 0; k--) {
+    total += (vs[0].getInt() == tag) ? 1 : 0;
+  }
+  rewind();
+  return total;
+}
+
+#define INDEX_INIT(tag, nullOK, subindex) \
+        ((tag) + (subindex)*SUBINDEX_BIT + (nullOK)*256)
+
+#define INDEX(tag)          INDEX_INIT(tag, 0, 0)
+#define NULL_OR_INDEX(tag)  INDEX_INIT(tag, 1, 0)
+#define SUB_INDEX(tag)      INDEX_INIT(tag, 0, 1)
+#define NO_INDEX            0
+
+struct band_init {
+  int         bn;
+  const char* name;
+  int   defc;
+  int   index;
+};
+
+#define BAND_INIT(name, cspec, ix) \
+  { e_##name,  #name, /*debug only*/ \
+    cspec, ix }
+
+const band_init all_band_inits[BAND_LIMIT+1] = {
+//BAND_INIT(archive_magic, BYTE1_spec, 0),
+//BAND_INIT(archive_header, UNSIGNED5_spec, 0),
+//BAND_INIT(band_headers, BYTE1_spec, 0),
+  BAND_INIT(cp_Utf8_prefix, DELTA5_spec, 0),
+  BAND_INIT(cp_Utf8_suffix, UNSIGNED5_spec, 0),
+  BAND_INIT(cp_Utf8_chars, CHAR3_spec, 0),
+  BAND_INIT(cp_Utf8_big_suffix, DELTA5_spec, 0),
+  BAND_INIT(cp_Utf8_big_chars, DELTA5_spec, 0),
+  BAND_INIT(cp_Int, UDELTA5_spec, 0),
+  BAND_INIT(cp_Float, UDELTA5_spec, 0),
+  BAND_INIT(cp_Long_hi, UDELTA5_spec, 0),
+  BAND_INIT(cp_Long_lo, DELTA5_spec, 0),
+  BAND_INIT(cp_Double_hi, UDELTA5_spec, 0),
+  BAND_INIT(cp_Double_lo, DELTA5_spec, 0),
+  BAND_INIT(cp_String, UDELTA5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(cp_Class, UDELTA5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(cp_Signature_form, DELTA5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(cp_Signature_classes, UDELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(cp_Descr_name, DELTA5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(cp_Descr_type, UDELTA5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(cp_Field_class, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(cp_Field_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(cp_Method_class, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(cp_Method_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(cp_Imethod_class, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(cp_Imethod_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(cp_MethodHandle_refkind, DELTA5_spec, 0),
+  BAND_INIT(cp_MethodHandle_member, UDELTA5_spec, INDEX(CONSTANT_AnyMember)),
+  BAND_INIT(cp_MethodType, UDELTA5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(cp_BootstrapMethod_ref, DELTA5_spec, INDEX(CONSTANT_MethodHandle)),
+  BAND_INIT(cp_BootstrapMethod_arg_count, UDELTA5_spec, 0),
+  BAND_INIT(cp_BootstrapMethod_arg, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
+  BAND_INIT(cp_InvokeDynamic_spec, DELTA5_spec, INDEX(CONSTANT_BootstrapMethod)),
+  BAND_INIT(cp_InvokeDynamic_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(attr_definition_headers, BYTE1_spec, 0),
+  BAND_INIT(attr_definition_name, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(attr_definition_layout, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(ic_this_class, UDELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(ic_flags, UNSIGNED5_spec, 0),
+  BAND_INIT(ic_outer_class, DELTA5_spec, NULL_OR_INDEX(CONSTANT_Class)),
+  BAND_INIT(ic_name, DELTA5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
+  BAND_INIT(class_this, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(class_super, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(class_interface_count, DELTA5_spec, 0),
+  BAND_INIT(class_interface, DELTA5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(class_field_count, DELTA5_spec, 0),
+  BAND_INIT(class_method_count, DELTA5_spec, 0),
+  BAND_INIT(field_descr, DELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(field_flags_hi, UNSIGNED5_spec, 0),
+  BAND_INIT(field_flags_lo, UNSIGNED5_spec, 0),
+  BAND_INIT(field_attr_count, UNSIGNED5_spec, 0),
+  BAND_INIT(field_attr_indexes, UNSIGNED5_spec, 0),
+  BAND_INIT(field_attr_calls, UNSIGNED5_spec, 0),
+  BAND_INIT(field_ConstantValue_KQ, UNSIGNED5_spec, INDEX(CONSTANT_FieldSpecific)),
+  BAND_INIT(field_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(field_metadata_bands, -1, -1),
+  BAND_INIT(field_attr_bands, -1, -1),
+  BAND_INIT(method_descr, MDELTA5_spec, INDEX(CONSTANT_NameandType)),
+  BAND_INIT(method_flags_hi, UNSIGNED5_spec, 0),
+  BAND_INIT(method_flags_lo, UNSIGNED5_spec, 0),
+  BAND_INIT(method_attr_count, UNSIGNED5_spec, 0),
+  BAND_INIT(method_attr_indexes, UNSIGNED5_spec, 0),
+  BAND_INIT(method_attr_calls, UNSIGNED5_spec, 0),
+  BAND_INIT(method_Exceptions_N, UNSIGNED5_spec, 0),
+  BAND_INIT(method_Exceptions_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(method_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(method_metadata_bands, -1, -1),
+  BAND_INIT(method_MethodParameters_NB, BYTE1_spec, 0),
+  BAND_INIT(method_MethodParameters_name_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
+  BAND_INIT(method_MethodParameters_flag_FH, UNSIGNED5_spec, 0),
+  BAND_INIT(method_attr_bands, -1, -1),
+  BAND_INIT(class_flags_hi, UNSIGNED5_spec, 0),
+  BAND_INIT(class_flags_lo, UNSIGNED5_spec, 0),
+  BAND_INIT(class_attr_count, UNSIGNED5_spec, 0),
+  BAND_INIT(class_attr_indexes, UNSIGNED5_spec, 0),
+  BAND_INIT(class_attr_calls, UNSIGNED5_spec, 0),
+  BAND_INIT(class_SourceFile_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
+  BAND_INIT(class_EnclosingMethod_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(class_EnclosingMethod_RDN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_NameandType)),
+  BAND_INIT(class_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(class_metadata_bands, -1, -1),
+  BAND_INIT(class_InnerClasses_N, UNSIGNED5_spec, 0),
+  BAND_INIT(class_InnerClasses_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(class_InnerClasses_F, UNSIGNED5_spec, 0),
+  BAND_INIT(class_InnerClasses_outer_RCN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
+  BAND_INIT(class_InnerClasses_name_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
+  BAND_INIT(class_ClassFile_version_minor_H, UNSIGNED5_spec, 0),
+  BAND_INIT(class_ClassFile_version_major_H, UNSIGNED5_spec, 0),
+  BAND_INIT(class_attr_bands, -1, -1),
+  BAND_INIT(code_headers, BYTE1_spec, 0),
+  BAND_INIT(code_max_stack, UNSIGNED5_spec, 0),
+  BAND_INIT(code_max_na_locals, UNSIGNED5_spec, 0),
+  BAND_INIT(code_handler_count, UNSIGNED5_spec, 0),
+  BAND_INIT(code_handler_start_P, BCI5_spec, 0),
+  BAND_INIT(code_handler_end_PO, BRANCH5_spec, 0),
+  BAND_INIT(code_handler_catch_PO, BRANCH5_spec, 0),
+  BAND_INIT(code_handler_class_RCN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
+  BAND_INIT(code_flags_hi, UNSIGNED5_spec, 0),
+  BAND_INIT(code_flags_lo, UNSIGNED5_spec, 0),
+  BAND_INIT(code_attr_count, UNSIGNED5_spec, 0),
+  BAND_INIT(code_attr_indexes, UNSIGNED5_spec, 0),
+  BAND_INIT(code_attr_calls, UNSIGNED5_spec, 0),
+  BAND_INIT(code_StackMapTable_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_StackMapTable_frame_T, BYTE1_spec, 0),
+  BAND_INIT(code_StackMapTable_local_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_StackMapTable_stack_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_StackMapTable_offset, UNSIGNED5_spec, 0),
+  BAND_INIT(code_StackMapTable_T, BYTE1_spec, 0),
+  BAND_INIT(code_StackMapTable_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
+  BAND_INIT(code_StackMapTable_P, BCI5_spec, 0),
+  BAND_INIT(code_LineNumberTable_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_LineNumberTable_bci_P, BCI5_spec, 0),
+  BAND_INIT(code_LineNumberTable_line, UNSIGNED5_spec, 0),
+  BAND_INIT(code_LocalVariableTable_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_LocalVariableTable_bci_P, BCI5_spec, 0),
+  BAND_INIT(code_LocalVariableTable_span_O, BRANCH5_spec, 0),
+  BAND_INIT(code_LocalVariableTable_name_RU, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(code_LocalVariableTable_type_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(code_LocalVariableTable_slot, UNSIGNED5_spec, 0),
+  BAND_INIT(code_LocalVariableTypeTable_N, UNSIGNED5_spec, 0),
+  BAND_INIT(code_LocalVariableTypeTable_bci_P, BCI5_spec, 0),
+  BAND_INIT(code_LocalVariableTypeTable_span_O, BRANCH5_spec, 0),
+  BAND_INIT(code_LocalVariableTypeTable_name_RU, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(code_LocalVariableTypeTable_type_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
+  BAND_INIT(code_LocalVariableTypeTable_slot, UNSIGNED5_spec, 0),
+  BAND_INIT(code_attr_bands, -1, -1),
+  BAND_INIT(bc_codes, BYTE1_spec, 0),
+  BAND_INIT(bc_case_count, UNSIGNED5_spec, 0),
+  BAND_INIT(bc_case_value, DELTA5_spec, 0),
+  BAND_INIT(bc_byte, BYTE1_spec, 0),
+  BAND_INIT(bc_short, DELTA5_spec, 0),
+  BAND_INIT(bc_local, UNSIGNED5_spec, 0),
+  BAND_INIT(bc_label, BRANCH5_spec, 0),
+  BAND_INIT(bc_intref, DELTA5_spec, INDEX(CONSTANT_Integer)),
+  BAND_INIT(bc_floatref, DELTA5_spec, INDEX(CONSTANT_Float)),
+  BAND_INIT(bc_longref, DELTA5_spec, INDEX(CONSTANT_Long)),
+  BAND_INIT(bc_doubleref, DELTA5_spec, INDEX(CONSTANT_Double)),
+  BAND_INIT(bc_stringref, DELTA5_spec, INDEX(CONSTANT_String)),
+  BAND_INIT(bc_loadablevalueref, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
+  BAND_INIT(bc_classref, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
+  BAND_INIT(bc_fieldref, DELTA5_spec, INDEX(CONSTANT_Fieldref)),
+  BAND_INIT(bc_methodref, UNSIGNED5_spec, INDEX(CONSTANT_Methodref)),
+  BAND_INIT(bc_imethodref, DELTA5_spec, INDEX(CONSTANT_InterfaceMethodref)),
+  BAND_INIT(bc_indyref, DELTA5_spec, INDEX(CONSTANT_InvokeDynamic)),
+  BAND_INIT(bc_thisfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
+  BAND_INIT(bc_superfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
+  BAND_INIT(bc_thismethod, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
+  BAND_INIT(bc_supermethod, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
+  BAND_INIT(bc_initref, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
+  BAND_INIT(bc_escref, UNSIGNED5_spec, INDEX(CONSTANT_All)),
+  BAND_INIT(bc_escrefsize, UNSIGNED5_spec, 0),
+  BAND_INIT(bc_escsize, UNSIGNED5_spec, 0),
+  BAND_INIT(bc_escbyte, BYTE1_spec, 0),
+  BAND_INIT(file_name, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
+  BAND_INIT(file_size_hi, UNSIGNED5_spec, 0),
+  BAND_INIT(file_size_lo, UNSIGNED5_spec, 0),
+  BAND_INIT(file_modtime, DELTA5_spec, 0),
+  BAND_INIT(file_options, UNSIGNED5_spec, 0),
+//BAND_INIT(file_bits, BYTE1_spec, 0),
+  { 0, NULL, 0, 0 }
+};
+
+band* band::makeBands(unpacker* u) {
+  band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
+  for (int i = 0; i < BAND_LIMIT; i++) {
+    assert((byte*)&all_band_inits[i+1]
+           < (byte*)all_band_inits+sizeof(all_band_inits));
+    const band_init& bi = all_band_inits[i];
+    band&            b  = tmp_all_bands[i];
+    coding*          defc = coding::findBySpec(bi.defc);
+    assert((defc == null) == (bi.defc == -1));  // no garbage, please
+    assert(defc == null || !defc->isMalloc);
+    assert(bi.bn == i);  // band array consistent w/ band enum
+    b.init(u, i, defc);
+    if (bi.index > 0) {
+      b.nullOK = ((bi.index >> 8) & 1);
+      b.ixTag = (bi.index & 0xFF);
+    }
+#ifndef PRODUCT
+    b.name = bi.name;
+#endif
+  }
+  return tmp_all_bands;
+}
+
+void band::initIndexes(unpacker* u) {
+  band* tmp_all_bands = u->all_bands;
+  for (int i = 0; i < BAND_LIMIT; i++) {
+    band* scan = &tmp_all_bands[i];
+    uint tag = scan->ixTag;  // Cf. #define INDEX(tag) above
+    if (tag != 0 && tag != CONSTANT_FieldSpecific && (tag & SUBINDEX_BIT) == 0) {
+      scan->setIndex(u->cp.getIndex(tag));
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/bands.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,481 @@
+/*
+ * 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.
+ */
+
+// -*- C++ -*-
+struct entry;
+struct cpindex;
+struct unpacker;
+
+struct band {
+  const char*   name;
+  int           bn;             // band_number of this band
+  coding*       defc;           // default coding method
+  cpindex*      ix;             // CP entry mapping, if CPRefBand
+  byte          ixTag;          // 0 or 1; null is coded as (nullOK?0:-1)
+  byte          nullOK;         // 0 or 1; null is coded as (nullOK?0:-1)
+  int           length;         // expected # values
+  unpacker*     u;              // back pointer
+
+  value_stream  vs[2];         // source of values
+  coding_method cm;            // method used for initial state of vs[0]
+  byte*         rplimit;       // end of band (encoded, transmitted)
+
+  int           total_memo;    // cached value of getIntTotal, or -1
+  int*          hist0;         // approximate. histogram
+  enum { HIST0_MIN = 0, HIST0_MAX = 255 }; // catches the usual cases
+
+  // properties for attribute layout elements:
+  byte          le_kind;       // EK_XXX
+  byte          le_bci;        // 0,EK_BCI,EK_BCD,EK_BCO
+  byte          le_back;       // ==EF_BACK
+  byte          le_len;        // 0,1,2,4 (size in classfile), or call addr
+  band**        le_body;       // body of repl, union, call (null-terminated)
+  // Note:  EK_CASE elements use hist0 to record union tags.
+  #define       le_casetags    hist0
+
+  band& nextBand() { return this[1]; }
+  band& prevBand() { return this[-1]; }
+
+  void init(unpacker* u_, int bn_, coding* defc_) {
+    u    = u_;
+    cm.u = u_;
+    bn   = bn_;
+    defc = defc_;
+  }
+  void init(unpacker* u_, int bn_, int defcSpec) {
+    init(u_, bn_, coding::findBySpec(defcSpec));
+  }
+  void initRef(int ixTag_ = 0, bool nullOK_ = false) {
+    ixTag  = ixTag_;
+    nullOK = nullOK_;
+    setIndexByTag(ixTag);
+  }
+
+  void expectMoreLength(int l) {
+    assert(length >= 0);      // able to accept a length
+    assert((int)l >= 0);      // no overflow
+    assert(rplimit == null);  // readData not yet called
+    length += l;
+    assert(length >= l);      // no overflow
+  }
+
+  void setIndex(cpindex* ix_);
+  void setIndexByTag(byte tag);
+
+  // Parse the band and its meta-coding header.
+  void readData(int expectedLength = 0);
+
+  // Reset the band for another pass (Cf. Java Band.resetForSecondPass.)
+  void rewind() {
+    cm.reset(&vs[0]);
+  }
+
+  byte* &curRP()    { return vs[0].rp; }
+  byte*  minRP()    { return cm.vs0.rp; }
+  byte*  maxRP()    { return rplimit; }
+  size_t size()     { return maxRP() - minRP(); }
+
+  int    getByte()  { assert(ix == null); return vs[0].getByte(); }
+  int    getInt()   { assert(ix == null); return vs[0].getInt(); }
+  entry* getRefN()  { return getRefCommon(ix, true); }
+  entry* getRef()   { return getRefCommon(ix, false); }
+  entry* getRefUsing(cpindex* ix2)
+                    { assert(ix == null); return getRefCommon(ix2, true); }
+  entry* getRefCommon(cpindex* ix, bool nullOK);
+  jlong  getLong(band& lo_band, bool have_hi);
+
+  static jlong makeLong(uint hi, uint lo) {
+    return ((julong)hi << 32) + (((julong)lo << 32) >> 32);
+  }
+
+  int    getIntTotal();
+  int    getIntCount(int tag);
+
+  static band* makeBands(unpacker* u);
+  static void initIndexes(unpacker* u);
+
+#ifndef PRODUCT
+  void dump();
+#endif
+
+  void abort(const char* msg = null); //{ u->abort(msg); }
+  bool aborting(); //{ return u->aborting(); }
+};
+
+extern band all_bands[];
+
+#define BAND_LOCAL /* \
+  band* band_temp = all_bands; \
+  band* all_bands = band_temp */
+
+// Band schema:
+enum band_number {
+  //e_archive_magic,
+  //e_archive_header,
+  //e_band_headers,
+
+    // constant pool contents
+    e_cp_Utf8_prefix,
+    e_cp_Utf8_suffix,
+    e_cp_Utf8_chars,
+    e_cp_Utf8_big_suffix,
+    e_cp_Utf8_big_chars,
+    e_cp_Int,
+    e_cp_Float,
+    e_cp_Long_hi,
+    e_cp_Long_lo,
+    e_cp_Double_hi,
+    e_cp_Double_lo,
+    e_cp_String,
+    e_cp_Class,
+    e_cp_Signature_form,
+    e_cp_Signature_classes,
+    e_cp_Descr_name,
+    e_cp_Descr_type,
+    e_cp_Field_class,
+    e_cp_Field_desc,
+    e_cp_Method_class,
+    e_cp_Method_desc,
+    e_cp_Imethod_class,
+    e_cp_Imethod_desc,
+    e_cp_MethodHandle_refkind,
+    e_cp_MethodHandle_member,
+    e_cp_MethodType,
+    e_cp_BootstrapMethod_ref,
+    e_cp_BootstrapMethod_arg_count,
+    e_cp_BootstrapMethod_arg,
+    e_cp_InvokeDynamic_spec,
+    e_cp_InvokeDynamic_desc,
+
+    // bands which define transmission of attributes
+    e_attr_definition_headers,
+    e_attr_definition_name,
+    e_attr_definition_layout,
+
+    // band for hardwired InnerClasses attribute (shared across the package)
+    e_ic_this_class,
+    e_ic_flags,
+    // These bands contain data only where flags sets ACC_IC_LONG_FORM:
+    e_ic_outer_class,
+    e_ic_name,
+
+    // bands for carrying class schema information:
+    e_class_this,
+    e_class_super,
+    e_class_interface_count,
+    e_class_interface,
+
+    // bands for class members
+    e_class_field_count,
+    e_class_method_count,
+
+    e_field_descr,
+    e_field_flags_hi,
+    e_field_flags_lo,
+    e_field_attr_count,
+    e_field_attr_indexes,
+    e_field_attr_calls,
+    e_field_ConstantValue_KQ,
+    e_field_Signature_RS,
+    e_field_metadata_bands,
+    e_field_attr_bands,
+
+    e_method_descr,
+    e_method_flags_hi,
+    e_method_flags_lo,
+    e_method_attr_count,
+    e_method_attr_indexes,
+    e_method_attr_calls,
+    e_method_Exceptions_N,
+    e_method_Exceptions_RC,
+    e_method_Signature_RS,
+    e_method_metadata_bands,
+    e_method_MethodParameters_NB,
+    e_method_MethodParameters_name_RUN,
+    e_method_MethodParameters_flag_FH,
+    e_method_attr_bands,
+
+    e_class_flags_hi,
+    e_class_flags_lo,
+    e_class_attr_count,
+    e_class_attr_indexes,
+    e_class_attr_calls,
+    e_class_SourceFile_RUN,
+    e_class_EnclosingMethod_RC,
+    e_class_EnclosingMethod_RDN,
+    e_class_Signature_RS,
+    e_class_metadata_bands,
+    e_class_InnerClasses_N,
+    e_class_InnerClasses_RC,
+    e_class_InnerClasses_F,
+    e_class_InnerClasses_outer_RCN,
+    e_class_InnerClasses_name_RUN,
+    e_class_ClassFile_version_minor_H,
+    e_class_ClassFile_version_major_H,
+    e_class_attr_bands,
+
+    e_code_headers,
+    e_code_max_stack,
+    e_code_max_na_locals,
+    e_code_handler_count,
+    e_code_handler_start_P,
+    e_code_handler_end_PO,
+    e_code_handler_catch_PO,
+    e_code_handler_class_RCN,
+
+    // code attributes
+    e_code_flags_hi,
+    e_code_flags_lo,
+    e_code_attr_count,
+    e_code_attr_indexes,
+    e_code_attr_calls,
+    e_code_StackMapTable_N,
+    e_code_StackMapTable_frame_T,
+    e_code_StackMapTable_local_N,
+    e_code_StackMapTable_stack_N,
+    e_code_StackMapTable_offset,
+    e_code_StackMapTable_T,
+    e_code_StackMapTable_RC,
+    e_code_StackMapTable_P,
+    e_code_LineNumberTable_N,
+    e_code_LineNumberTable_bci_P,
+    e_code_LineNumberTable_line,
+    e_code_LocalVariableTable_N,
+    e_code_LocalVariableTable_bci_P,
+    e_code_LocalVariableTable_span_O,
+    e_code_LocalVariableTable_name_RU,
+    e_code_LocalVariableTable_type_RS,
+    e_code_LocalVariableTable_slot,
+    e_code_LocalVariableTypeTable_N,
+    e_code_LocalVariableTypeTable_bci_P,
+    e_code_LocalVariableTypeTable_span_O,
+    e_code_LocalVariableTypeTable_name_RU,
+    e_code_LocalVariableTypeTable_type_RS,
+    e_code_LocalVariableTypeTable_slot,
+    e_code_attr_bands,
+
+    // bands for bytecodes
+    e_bc_codes,
+    // remaining bands provide typed opcode fields required by the bc_codes
+
+    e_bc_case_count,
+    e_bc_case_value,
+    e_bc_byte,
+    e_bc_short,
+    e_bc_local,
+    e_bc_label,
+
+    // ldc* operands:
+    e_bc_intref,
+    e_bc_floatref,
+    e_bc_longref,
+    e_bc_doubleref,
+    e_bc_stringref,
+    e_bc_loadablevalueref,
+    e_bc_classref,
+
+    e_bc_fieldref,
+    e_bc_methodref,
+    e_bc_imethodref,
+    e_bc_indyref,
+
+    // _self_linker_op family
+    e_bc_thisfield,
+    e_bc_superfield,
+    e_bc_thismethod,
+    e_bc_supermethod,
+
+    // bc_invokeinit family:
+    e_bc_initref,
+
+    // bytecode escape sequences
+    e_bc_escref,
+    e_bc_escrefsize,
+    e_bc_escsize,
+    e_bc_escbyte,
+
+    // file attributes and contents
+    e_file_name,
+    e_file_size_hi,
+    e_file_size_lo,
+    e_file_modtime,
+    e_file_options,
+    //e_file_bits,  // handled specially as an appendix
+
+    BAND_LIMIT
+};
+
+// Symbolic names for bands, as if in a giant global struct:
+//#define archive_magic all_bands[e_archive_magic]
+//#define archive_header all_bands[e_archive_header]
+//#define band_headers all_bands[e_band_headers]
+#define cp_Utf8_prefix all_bands[e_cp_Utf8_prefix]
+#define cp_Utf8_suffix all_bands[e_cp_Utf8_suffix]
+#define cp_Utf8_chars all_bands[e_cp_Utf8_chars]
+#define cp_Utf8_big_suffix all_bands[e_cp_Utf8_big_suffix]
+#define cp_Utf8_big_chars all_bands[e_cp_Utf8_big_chars]
+#define cp_Int all_bands[e_cp_Int]
+#define cp_Float all_bands[e_cp_Float]
+#define cp_Long_hi all_bands[e_cp_Long_hi]
+#define cp_Long_lo all_bands[e_cp_Long_lo]
+#define cp_Double_hi all_bands[e_cp_Double_hi]
+#define cp_Double_lo all_bands[e_cp_Double_lo]
+#define cp_String all_bands[e_cp_String]
+#define cp_Class all_bands[e_cp_Class]
+#define cp_Signature_form all_bands[e_cp_Signature_form]
+#define cp_Signature_classes all_bands[e_cp_Signature_classes]
+#define cp_Descr_name all_bands[e_cp_Descr_name]
+#define cp_Descr_type all_bands[e_cp_Descr_type]
+#define cp_Field_class all_bands[e_cp_Field_class]
+#define cp_Field_desc all_bands[e_cp_Field_desc]
+#define cp_Method_class all_bands[e_cp_Method_class]
+#define cp_Method_desc all_bands[e_cp_Method_desc]
+#define cp_Imethod_class all_bands[e_cp_Imethod_class]
+#define cp_Imethod_desc all_bands[e_cp_Imethod_desc]
+#define cp_MethodHandle_refkind all_bands[e_cp_MethodHandle_refkind]
+#define cp_MethodHandle_member all_bands[e_cp_MethodHandle_member]
+#define cp_MethodType all_bands[e_cp_MethodType]
+#define cp_BootstrapMethod_ref all_bands[e_cp_BootstrapMethod_ref]
+#define cp_BootstrapMethod_arg_count all_bands[e_cp_BootstrapMethod_arg_count]
+#define cp_BootstrapMethod_arg all_bands[e_cp_BootstrapMethod_arg]
+#define cp_InvokeDynamic_spec  all_bands[e_cp_InvokeDynamic_spec]
+#define cp_InvokeDynamic_desc all_bands[e_cp_InvokeDynamic_desc]
+#define attr_definition_headers all_bands[e_attr_definition_headers]
+#define attr_definition_name all_bands[e_attr_definition_name]
+#define attr_definition_layout all_bands[e_attr_definition_layout]
+#define ic_this_class all_bands[e_ic_this_class]
+#define ic_flags all_bands[e_ic_flags]
+#define ic_outer_class all_bands[e_ic_outer_class]
+#define ic_name all_bands[e_ic_name]
+#define class_this all_bands[e_class_this]
+#define class_super all_bands[e_class_super]
+#define class_interface_count all_bands[e_class_interface_count]
+#define class_interface all_bands[e_class_interface]
+#define class_field_count all_bands[e_class_field_count]
+#define class_method_count all_bands[e_class_method_count]
+#define field_descr all_bands[e_field_descr]
+#define field_flags_hi all_bands[e_field_flags_hi]
+#define field_flags_lo all_bands[e_field_flags_lo]
+#define field_attr_count all_bands[e_field_attr_count]
+#define field_attr_indexes all_bands[e_field_attr_indexes]
+#define field_ConstantValue_KQ all_bands[e_field_ConstantValue_KQ]
+#define field_Signature_RS all_bands[e_field_Signature_RS]
+#define field_attr_bands all_bands[e_field_attr_bands]
+#define method_descr all_bands[e_method_descr]
+#define method_flags_hi all_bands[e_method_flags_hi]
+#define method_flags_lo all_bands[e_method_flags_lo]
+#define method_attr_count all_bands[e_method_attr_count]
+#define method_attr_indexes all_bands[e_method_attr_indexes]
+#define method_Exceptions_N all_bands[e_method_Exceptions_N]
+#define method_Exceptions_RC all_bands[e_method_Exceptions_RC]
+#define method_Signature_RS all_bands[e_method_Signature_RS]
+#define method_MethodParameters_NB all_bands[e_method_MethodParameters_NB]
+#define method_MethodParameters_name_RUN all_bands[e_method_MethodParameters_name_RUN]
+#define method_MethodParameters_flag_FH all_bands[e_method_MethodParameters_flag_FH]
+#define method_attr_bands all_bands[e_method_attr_bands]
+#define class_flags_hi all_bands[e_class_flags_hi]
+#define class_flags_lo all_bands[e_class_flags_lo]
+#define class_attr_count all_bands[e_class_attr_count]
+#define class_attr_indexes all_bands[e_class_attr_indexes]
+#define class_SourceFile_RUN all_bands[e_class_SourceFile_RUN]
+#define class_EnclosingMethod_RC all_bands[e_class_EnclosingMethod_RC]
+#define class_EnclosingMethod_RDN all_bands[e_class_EnclosingMethod_RDN]
+#define class_Signature_RS all_bands[e_class_Signature_RS]
+#define class_InnerClasses_N all_bands[e_class_InnerClasses_N]
+#define class_InnerClasses_RC all_bands[e_class_InnerClasses_RC]
+#define class_InnerClasses_F all_bands[e_class_InnerClasses_F]
+#define class_InnerClasses_outer_RCN all_bands[e_class_InnerClasses_outer_RCN]
+#define class_InnerClasses_name_RUN all_bands[e_class_InnerClasses_name_RUN]
+#define class_ClassFile_version_minor_H all_bands[e_class_ClassFile_version_minor_H]
+#define class_ClassFile_version_major_H all_bands[e_class_ClassFile_version_major_H]
+#define class_attr_bands all_bands[e_class_attr_bands]
+#define code_headers all_bands[e_code_headers]
+#define code_max_stack all_bands[e_code_max_stack]
+#define code_max_na_locals all_bands[e_code_max_na_locals]
+#define code_handler_count all_bands[e_code_handler_count]
+#define code_handler_start_P all_bands[e_code_handler_start_P]
+#define code_handler_end_PO all_bands[e_code_handler_end_PO]
+#define code_handler_catch_PO all_bands[e_code_handler_catch_PO]
+#define code_handler_class_RCN all_bands[e_code_handler_class_RCN]
+#define code_flags_hi all_bands[e_code_flags_hi]
+#define code_flags_lo all_bands[e_code_flags_lo]
+#define code_attr_count all_bands[e_code_attr_count]
+#define code_attr_indexes all_bands[e_code_attr_indexes]
+#define code_StackMapTable_N all_bands[e_code_StackMapTable_N]
+#define code_StackMapTable_frame_T all_bands[e_code_StackMapTable_frame_T]
+#define code_StackMapTable_local_N all_bands[e_code_StackMapTable_local_N]
+#define code_StackMapTable_stack_N all_bands[e_code_StackMapTable_stack_N]
+#define code_StackMapTable_offset all_bands[e_code_StackMapTable_offset]
+#define code_StackMapTable_T all_bands[e_code_StackMapTable_T]
+#define code_StackMapTable_RC all_bands[e_code_StackMapTable_RC]
+#define code_StackMapTable_P all_bands[e_code_StackMapTable_P]
+#define code_LineNumberTable_N all_bands[e_code_LineNumberTable_N]
+#define code_LineNumberTable_bci_P all_bands[e_code_LineNumberTable_bci_P]
+#define code_LineNumberTable_line all_bands[e_code_LineNumberTable_line]
+#define code_LocalVariableTable_N all_bands[e_code_LocalVariableTable_N]
+#define code_LocalVariableTable_bci_P all_bands[e_code_LocalVariableTable_bci_P]
+#define code_LocalVariableTable_span_O all_bands[e_code_LocalVariableTable_span_O]
+#define code_LocalVariableTable_name_RU all_bands[e_code_LocalVariableTable_name_RU]
+#define code_LocalVariableTable_type_RS all_bands[e_code_LocalVariableTable_type_RS]
+#define code_LocalVariableTable_slot all_bands[e_code_LocalVariableTable_slot]
+#define code_LocalVariableTypeTable_N all_bands[e_code_LocalVariableTypeTable_N]
+#define code_LocalVariableTypeTable_bci_P all_bands[e_code_LocalVariableTypeTable_bci_P]
+#define code_LocalVariableTypeTable_span_O all_bands[e_code_LocalVariableTypeTable_span_O]
+#define code_LocalVariableTypeTable_name_RU all_bands[e_code_LocalVariableTypeTable_name_RU]
+#define code_LocalVariableTypeTable_type_RS all_bands[e_code_LocalVariableTypeTable_type_RS]
+#define code_LocalVariableTypeTable_slot all_bands[e_code_LocalVariableTypeTable_slot]
+#define code_attr_bands all_bands[e_code_attr_bands]
+#define bc_codes all_bands[e_bc_codes]
+#define bc_case_count all_bands[e_bc_case_count]
+#define bc_case_value all_bands[e_bc_case_value]
+#define bc_byte all_bands[e_bc_byte]
+#define bc_short all_bands[e_bc_short]
+#define bc_local all_bands[e_bc_local]
+#define bc_label all_bands[e_bc_label]
+#define bc_intref all_bands[e_bc_intref]
+#define bc_floatref all_bands[e_bc_floatref]
+#define bc_longref all_bands[e_bc_longref]
+#define bc_doubleref all_bands[e_bc_doubleref]
+#define bc_stringref all_bands[e_bc_stringref]
+#define bc_loadablevalueref all_bands[e_bc_loadablevalueref]
+#define bc_classref all_bands[e_bc_classref]
+#define bc_fieldref all_bands[e_bc_fieldref]
+#define bc_methodref all_bands[e_bc_methodref]
+#define bc_imethodref all_bands[e_bc_imethodref]
+#define bc_indyref all_bands[e_bc_indyref]
+#define bc_thisfield all_bands[e_bc_thisfield]
+#define bc_superfield all_bands[e_bc_superfield]
+#define bc_thismethod all_bands[e_bc_thismethod]
+#define bc_supermethod all_bands[e_bc_supermethod]
+#define bc_initref all_bands[e_bc_initref]
+#define bc_escref all_bands[e_bc_escref]
+#define bc_escrefsize all_bands[e_bc_escrefsize]
+#define bc_escsize all_bands[e_bc_escsize]
+#define bc_escbyte all_bands[e_bc_escbyte]
+#define file_name all_bands[e_file_name]
+#define file_size_hi all_bands[e_file_size_hi]
+#define file_size_lo all_bands[e_file_size_lo]
+#define file_modtime all_bands[e_file_modtime]
+#define file_options all_bands[e_file_options]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+
+
+static byte dummy[1 << 10];
+
+bool bytes::inBounds(const void* p) {
+  return p >= ptr && p < limit();
+}
+
+void bytes::malloc(size_t len_) {
+  len = len_;
+  ptr = NEW(byte, add_size(len_, 1));  // add trailing zero byte always
+  if (ptr == null) {
+    // set ptr to some victim memory, to ease escape
+    set(dummy, sizeof(dummy)-1);
+    unpack_abort(ERROR_ENOMEM);
+  }
+}
+
+void bytes::realloc(size_t len_) {
+  if (len == len_)   return;  // nothing to do
+  if (ptr == dummy)  return;  // escaping from an error
+  if (ptr == null) {
+    malloc(len_);
+    return;
+  }
+  byte* oldptr = ptr;
+  ptr = (len_ >= PSIZE_MAX) ? null : (byte*)::realloc(ptr, add_size(len_, 1));
+  if (ptr != null)  {
+    mtrace('r', oldptr, 0);
+    mtrace('m', ptr, len_+1);
+    if (len < len_)  memset(ptr+len, 0, len_-len);
+    ptr[len_] = 0;
+    len = len_;
+  } else {
+    ptr = oldptr;  // ease our escape
+    unpack_abort(ERROR_ENOMEM);
+  }
+}
+
+void bytes::free() {
+  if (ptr == dummy)  return;  // escaping from an error
+  if (ptr != null) {
+    mtrace('f', ptr, 0);
+    ::free(ptr);
+  }
+  len = 0;
+  ptr = 0;
+}
+
+int bytes::indexOf(byte c) {
+  byte* p = (byte*) memchr(ptr, c, len);
+  return (p == 0) ? -1 : (int)(p - ptr);
+}
+
+byte* bytes::writeTo(byte* bp) {
+  memcpy(bp, ptr, len);
+  return bp+len;
+}
+
+int bytes::compareTo(bytes& other) {
+  size_t l1 = len;
+  size_t l2 = other.len;
+  int cmp = memcmp(ptr, other.ptr, (l1 < l2) ? l1 : l2);
+  if (cmp != 0)  return cmp;
+  return (l1 < l2) ? -1 : (l1 > l2) ? 1 : 0;
+}
+
+void bytes::saveFrom(const void* ptr_, size_t len_) {
+  malloc(len_);
+  // Save as much as possible.  (Helps unpacker::abort.)
+  if (len_ > len) {
+    assert(ptr == dummy);  // error recovery
+    len_ = len;
+  }
+  copyFrom(ptr_, len_);
+}
+
+//#TODO: Need to fix for exception handling
+void bytes::copyFrom(const void* ptr_, size_t len_, size_t offset) {
+  assert(len_ == 0 || inBounds(ptr + offset));
+  assert(len_ == 0 || inBounds(ptr + offset+len_-1));
+  memcpy(ptr+offset, ptr_, len_);
+}
+
+
+#ifndef PRODUCT
+const char* bytes::string() {
+  if (len == 0)  return "";
+  if (ptr[len] == 0 && strlen((char*)ptr) == len)  return (const char*) ptr;
+  bytes junk;
+  junk.saveFrom(*this);
+  return (char*) junk.ptr;
+}
+#endif
+
+// Make sure there are 'o' bytes beyond the fill pointer,
+// advance the fill pointer, and return the old fill pointer.
+byte* fillbytes::grow(size_t s) {
+  size_t nlen = add_size(b.len, s);
+  if (nlen <= allocated) {
+    b.len = nlen;
+    return limit()-s;
+  }
+  size_t maxlen = nlen;
+  if (maxlen < 128)          maxlen = 128;
+  if (maxlen < allocated*2)  maxlen = allocated*2;
+  if (allocated == 0) {
+    // Initial buffer was not malloced.  Do not reallocate it.
+    bytes old = b;
+    b.malloc(maxlen);
+    if (b.len == maxlen)
+      old.writeTo(b.ptr);
+  } else {
+    b.realloc(maxlen);
+  }
+  allocated = b.len;
+  if (allocated != maxlen) {
+    assert(unpack_aborting());
+    b.len = nlen-s;  // back up
+    return dummy;    // scribble during error recov.
+  }
+  // after realloc, recompute pointers
+  b.len = nlen;
+  assert(b.len <= allocated);
+  return limit()-s;
+}
+
+void fillbytes::ensureSize(size_t s) {
+  if (allocated >= s)  return;
+  size_t len0 = b.len;
+  grow(s - size());
+  b.len = len0;  // put it back
+}
+
+int ptrlist::indexOf(const void* x) {
+  int len = length();
+  for (int i = 0; i < len; i++) {
+    if (get(i) == x)  return i;
+  }
+  return -1;
+}
+
+void ptrlist::freeAll() {
+  int len = length();
+  for (int i = 0; i < len; i++) {
+    void* p = (void*) get(i);
+    if (p != null)  {
+      mtrace('f', p, 0);
+      ::free(p);
+    }
+  }
+  free();
+}
+
+int intlist::indexOf(int x) {
+  int len = length();
+  for (int i = 0; i < len; i++) {
+    if (get(i) == x)  return i;
+  }
+  return -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+#ifdef WIN32_LEAN_AND_MEAN
+typedef signed char byte ;
+#endif
+
+struct bytes {
+  byte*  ptr;
+  size_t len;
+  byte*  limit() { return ptr+len; }
+
+  void set(byte* ptr_, size_t len_) { ptr = ptr_; len = len_; }
+  void set(const char* str)         { ptr = (byte*)str; len = strlen(str); }
+  bool inBounds(const void* p);     // p in [ptr, limit)
+  void malloc(size_t len_);
+  void realloc(size_t len_);
+  void free();
+  void copyFrom(const void* ptr_, size_t len_, size_t offset = 0);
+  void saveFrom(const void* ptr_, size_t len_);
+  void saveFrom(const char* str) { saveFrom(str, strlen(str)); }
+  void copyFrom(bytes& other, size_t offset = 0) {
+    copyFrom(other.ptr, other.len, offset);
+  }
+  void saveFrom(bytes& other) {
+    saveFrom(other.ptr, other.len);
+  }
+  void clear(int fill_byte = 0) { memset(ptr, fill_byte, len); }
+  byte* writeTo(byte* bp);
+  bool equals(bytes& other) { return 0 == compareTo(other); }
+  int compareTo(bytes& other);
+  bool contains(byte c) { return indexOf(c) >= 0; }
+  int indexOf(byte c);
+  // substrings:
+  static bytes of(byte* ptr, size_t len) {
+    bytes res;
+    res.set(ptr, len);
+    return res;
+  }
+  bytes slice(size_t beg, size_t end) {
+    bytes res;
+    res.ptr = ptr + beg;
+    res.len = end - beg;
+    assert(res.len == 0 || inBounds(res.ptr) && inBounds(res.limit()-1));
+    return res;
+  }
+  // building C strings inside byte buffers:
+  bytes& strcat(const char* str) { ::strcat((char*)ptr, str); return *this; }
+  bytes& strcat(bytes& other) { ::strncat((char*)ptr, (char*)other.ptr, other.len); return *this; }
+  char* strval() { assert(strlen((char*)ptr) == len); return (char*) ptr; }
+#ifdef PRODUCT
+  const char* string() { return 0; }
+#else
+  const char* string();
+#endif
+};
+#define BYTES_OF(var) (bytes::of((byte*)&(var), sizeof(var)))
+
+struct fillbytes {
+  bytes b;
+  size_t allocated;
+
+  byte*  base()               { return b.ptr; }
+  size_t size()               { return b.len; }
+  byte*  limit()              { return b.limit(); }          // logical limit
+  void   setLimit(byte* lp)   { assert(isAllocated(lp)); b.len = lp - b.ptr; }
+  byte*  end()                { return b.ptr + allocated; }  // physical limit
+  byte*  loc(size_t o)        { assert(o < b.len); return b.ptr + o; }
+  void   init()               { allocated = 0; b.set(null, 0); }
+  void   init(size_t s)       { init(); ensureSize(s); }
+  void   free()               { if (allocated != 0) b.free(); allocated = 0; }
+  void   empty()              { b.len = 0; }
+  byte*  grow(size_t s);      // grow so that limit() += s
+  int    getByte(uint i)      { return *loc(i) & 0xFF; }
+  void   addByte(byte x)      { *grow(1) = x; }
+  void   ensureSize(size_t s); // make sure allocated >= s
+  void   trimToSize()         { if (allocated > size())  b.realloc(allocated = size()); }
+  bool   canAppend(size_t s)  { return allocated > b.len+s; }
+  bool   isAllocated(byte* p) { return p >= base() && p <= end(); } //asserts
+  void   set(bytes& src)      { set(src.ptr, src.len); }
+
+  void set(byte* ptr, size_t len) {
+    b.set(ptr, len);
+    allocated = 0;   // mark as not reallocatable
+  }
+
+  // block operations on resizing byte buffer:
+  fillbytes& append(const void* ptr_, size_t len_)
+    { memcpy(grow(len_), ptr_, len_); return (*this); }
+  fillbytes& append(bytes& other)
+    { return append(other.ptr, other.len); }
+  fillbytes& append(const char* str)
+    { return append(str, strlen(str)); }
+};
+
+struct ptrlist : fillbytes {
+  typedef const void* cvptr;
+  int    length()     { return (int)(size() / sizeof(cvptr)); }
+  cvptr* base()       { return (cvptr*) fillbytes::base(); }
+  cvptr& get(int i)   { return *(cvptr*)loc(i * sizeof(cvptr)); }
+  cvptr* limit()      { return (cvptr*) fillbytes::limit(); }
+  void   add(cvptr x) { *(cvptr*)grow(sizeof(x)) = x; }
+  void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(cvptr); }
+  int    indexOf(cvptr x);
+  bool   contains(cvptr x) { return indexOf(x) >= 0; }
+  void   freeAll();   // frees every ptr on the list, plus the list itself
+};
+// Use a macro rather than mess with subtle mismatches
+// between member and non-member function pointers.
+#define PTRLIST_QSORT(ptrls, fn) \
+  ::qsort((ptrls).base(), (ptrls).length(), sizeof(void*), fn)
+
+struct intlist : fillbytes {
+  int    length()     { return (int)(size() / sizeof(int)); }
+  int*   base()       { return (int*) fillbytes::base(); }
+  int&   get(int i)   { return *(int*)loc(i * sizeof(int)); }
+  int*   limit()      { return (int*) fillbytes::limit(); }
+  void   add(int x)   { *(int*)grow(sizeof(x)) = x; }
+  void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(int); }
+  int    indexOf(int x);
+  bool   contains(int x) { return indexOf(x) >= 0; }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,989 @@
+/*
+ * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+// -*- C++ -*-
+// Small program for unpacking specially compressed Java packages.
+// John R. Rose
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "jni_util.h"
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+#include "coding.h"
+
+#include "constants.h"
+#include "unpack.h"
+
+extern coding basic_codings[];
+
+#define CODING_PRIVATE(spec) \
+  int spec_ = spec; \
+  int B = CODING_B(spec_); \
+  int H = CODING_H(spec_); \
+  int L = 256 - H; \
+  int S = CODING_S(spec_); \
+  int D = CODING_D(spec_)
+
+#define IS_NEG_CODE(S, codeVal) \
+  ( (((int)(codeVal)+1) & ((1<<S)-1)) == 0 )
+
+#define DECODE_SIGN_S1(ux) \
+  ( ((uint)(ux) >> 1) ^ -((int)(ux) & 1) )
+
+static maybe_inline
+int decode_sign(int S, uint ux) {  // == Coding.decodeSign32
+  assert(S > 0);
+  uint sigbits = (ux >> S);
+  if (IS_NEG_CODE(S, ux))
+    return (int)(    ~sigbits);
+  else
+    return (int)(ux - sigbits);
+  // Note that (int)(ux-sigbits) can be negative, if ux is large enough.
+}
+
+coding* coding::init() {
+  if (umax > 0)  return this;  // already done
+  assert(spec != 0);  // sanity
+
+  // fill in derived fields
+  CODING_PRIVATE(spec);
+
+  // Return null if 'arb(BHSD)' parameter constraints are not met:
+  if (B < 1 || B > B_MAX)  return null;
+  if (H < 1 || H > 256)    return null;
+  if (S < 0 || S > 2)      return null;
+  if (D < 0 || D > 1)      return null;
+  if (B == 1 && H != 256)  return null;  // 1-byte coding must be fixed-size
+  if (B >= 5 && H == 256)  return null;  // no 5-byte fixed-size coding
+
+  // first compute the range of the coding, in 64 bits
+  jlong range = 0;
+  {
+    jlong H_i = 1;
+    for (int i = 0; i < B; i++) {
+      range += H_i;
+      H_i *= H;
+    }
+    range *= L;
+    range += H_i;
+  }
+  assert(range > 0);  // no useless codings, please
+
+  int this_umax;
+
+  // now, compute min and max
+  if (range >= ((jlong)1 << 32)) {
+    this_umax  = INT_MAX_VALUE;
+    this->umin = INT_MIN_VALUE;
+    this->max  = INT_MAX_VALUE;
+    this->min  = INT_MIN_VALUE;
+  } else {
+    this_umax = (range > INT_MAX_VALUE) ? INT_MAX_VALUE : (int)range-1;
+    this->max = this_umax;
+    this->min = this->umin = 0;
+    if (S != 0 && range != 0) {
+      int Smask = (1<<S)-1;
+      jlong maxPosCode = range-1;
+      jlong maxNegCode = range-1;
+      while (IS_NEG_CODE(S,  maxPosCode))  --maxPosCode;
+      while (!IS_NEG_CODE(S, maxNegCode))  --maxNegCode;
+      int maxPos = decode_sign(S, (uint)maxPosCode);
+      if (maxPos < 0)
+        this->max = INT_MAX_VALUE;  // 32-bit wraparound
+      else
+        this->max = maxPos;
+      if (maxNegCode < 0)
+        this->min = 0;  // No negative codings at all.
+      else
+        this->min = decode_sign(S, (uint)maxNegCode);
+    }
+  }
+
+  assert(!(isFullRange | isSigned | isSubrange)); // init
+  if (min < 0)
+    this->isSigned = true;
+  if (max < INT_MAX_VALUE && range <= INT_MAX_VALUE)
+    this->isSubrange = true;
+  if (max == INT_MAX_VALUE && min == INT_MIN_VALUE)
+    this->isFullRange = true;
+
+  // do this last, to reduce MT exposure (should have a membar too)
+  this->umax = this_umax;
+
+  return this;
+}
+
+coding* coding::findBySpec(int spec) {
+  for (coding* scan = &basic_codings[0]; ; scan++) {
+    if (scan->spec == spec)
+      return scan->init();
+    if (scan->spec == 0)
+      break;
+  }
+  coding* ptr = NEW(coding, 1);
+  CHECK_NULL_RETURN(ptr, 0);
+  coding* c = ptr->initFrom(spec);
+  if (c == null) {
+    mtrace('f', ptr, 0);
+    ::free(ptr);
+  } else
+    // else caller should free it...
+    c->isMalloc = true;
+  return c;
+}
+
+coding* coding::findBySpec(int B, int H, int S, int D) {
+  if (B < 1 || B > B_MAX)  return null;
+  if (H < 1 || H > 256)    return null;
+  if (S < 0 || S > 2)      return null;
+  if (D < 0 || D > 1)      return null;
+  return findBySpec(CODING_SPEC(B, H, S, D));
+}
+
+void coding::free() {
+  if (isMalloc) {
+    mtrace('f', this, 0);
+    ::free(this);
+  }
+}
+
+void coding_method::reset(value_stream* state) {
+  assert(state->rp == state->rplimit);  // not in mid-stream, please
+  //assert(this == vs0.cm);
+  state[0] = vs0;
+  if (uValues != null) {
+    uValues->reset(state->helper());
+  }
+}
+
+maybe_inline
+uint coding::parse(byte* &rp, int B, int H) {
+  int L = 256-H;
+  byte* ptr = rp;
+  // hand peel the i==0 part of the loop:
+  uint b_i = *ptr++ & 0xFF;
+  if (B == 1 || b_i < (uint)L)
+    { rp = ptr; return b_i; }
+  uint sum = b_i;
+  uint H_i = H;
+  assert(B <= B_MAX);
+  for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
+    b_i = *ptr++ & 0xFF;
+    sum += b_i * H_i;
+    if (i == B || b_i < (uint)L)
+      { rp = ptr; return sum; }
+    H_i *= H;
+  }
+  assert(false);
+  return 0;
+}
+
+maybe_inline
+uint coding::parse_lgH(byte* &rp, int B, int H, int lgH) {
+  assert(H == (1<<lgH));
+  int L = 256-(1<<lgH);
+  byte* ptr = rp;
+  // hand peel the i==0 part of the loop:
+  uint b_i = *ptr++ & 0xFF;
+  if (B == 1 || b_i < (uint)L)
+    { rp = ptr; return b_i; }
+  uint sum = b_i;
+  uint lg_H_i = lgH;
+  assert(B <= B_MAX);
+  for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
+    b_i = *ptr++ & 0xFF;
+    sum += b_i << lg_H_i;
+    if (i == B || b_i < (uint)L)
+      { rp = ptr; return sum; }
+    lg_H_i += lgH;
+  }
+  assert(false);
+  return 0;
+}
+
+static const char ERB[] = "EOF reading band";
+
+maybe_inline
+void coding::parseMultiple(byte* &rp, int N, byte* limit, int B, int H) {
+  if (N < 0) {
+    abort("bad value count");
+    return;
+  }
+  byte* ptr = rp;
+  if (B == 1 || H == 256) {
+    size_t len = (size_t)N*B;
+    if (len / B != (size_t)N || ptr+len > limit) {
+      abort(ERB);
+      return;
+    }
+    rp = ptr+len;
+    return;
+  }
+  // Note:  We assume rp has enough zero-padding.
+  int L = 256-H;
+  int n = B;
+  while (N > 0) {
+    ptr += 1;
+    if (--n == 0) {
+      // end of encoding at B bytes, regardless of byte value
+    } else {
+      int b = (ptr[-1] & 0xFF);
+      if (b >= L) {
+        // keep going, unless we find a byte < L
+        continue;
+      }
+    }
+    // found the last byte
+    N -= 1;
+    n = B;   // reset length counter
+    // do an error check here
+    if (ptr > limit) {
+      abort(ERB);
+      return;
+    }
+  }
+  rp = ptr;
+  return;
+}
+
+bool value_stream::hasHelper() {
+  // If my coding method is a pop-style method,
+  // then I need a second value stream to transmit
+  // unfavored values.
+  // This can be determined by examining fValues.
+  return cm->fValues != null;
+}
+
+void value_stream::init(byte* rp_, byte* rplimit_, coding* defc) {
+  rp = rp_;
+  rplimit = rplimit_;
+  sum = 0;
+  cm = null;  // no need in the simple case
+  setCoding(defc);
+}
+
+void value_stream::setCoding(coding* defc) {
+  if (defc == null) {
+    unpack_abort("bad coding");
+    defc = coding::findByIndex(_meta_canon_min);  // random pick for recovery
+  }
+
+  c = (*defc);
+
+  // choose cmk
+  cmk = cmk_ERROR;
+  switch (c.spec) {
+  case BYTE1_spec:      cmk = cmk_BYTE1;        break;
+  case CHAR3_spec:      cmk = cmk_CHAR3;        break;
+  case UNSIGNED5_spec:  cmk = cmk_UNSIGNED5;    break;
+  case DELTA5_spec:     cmk = cmk_DELTA5;       break;
+  case BCI5_spec:       cmk = cmk_BCI5;         break;
+  case BRANCH5_spec:    cmk = cmk_BRANCH5;      break;
+  default:
+    if (c.D() == 0) {
+      switch (c.S()) {
+      case 0:  cmk = cmk_BHS0;  break;
+      case 1:  cmk = cmk_BHS1;  break;
+      default: cmk = cmk_BHS;   break;
+      }
+    } else {
+      if (c.S() == 1) {
+        if (c.isFullRange)   cmk = cmk_BHS1D1full;
+        if (c.isSubrange)    cmk = cmk_BHS1D1sub;
+      }
+      if (cmk == cmk_ERROR)  cmk = cmk_BHSD1;
+    }
+  }
+}
+
+static maybe_inline
+int getPopValue(value_stream* self, uint uval) {
+  if (uval > 0) {
+    // note that the initial parse performed a range check
+    assert(uval <= (uint)self->cm->fVlength);
+    return self->cm->fValues[uval-1];
+  } else {
+    // take an unfavored value
+    return self->helper()->getInt();
+  }
+}
+
+maybe_inline
+int coding::sumInUnsignedRange(int x, int y) {
+  assert(isSubrange);
+  int range = (int)(umax+1);
+  assert(range > 0);
+  x += y;
+  if (x != (int)((jlong)(x-y) + (jlong)y)) {
+    // 32-bit overflow interferes with range reduction.
+    // Back off from the overflow by adding a multiple of range:
+    if (x < 0) {
+      x -= range;
+      assert(x >= 0);
+    } else {
+      x += range;
+      assert(x < 0);
+    }
+  }
+  if (x < 0) {
+    x += range;
+    if (x >= 0)  return x;
+  } else if (x >= range) {
+    x -= range;
+    if (x < range)  return x;
+  } else {
+    // in range
+    return x;
+  }
+  // do it the hard way
+  x %= range;
+  if (x < 0)  x += range;
+  return x;
+}
+
+static maybe_inline
+int getDeltaValue(value_stream* self, uint uval, bool isSubrange) {
+  assert((uint)(self->c.isSubrange) == (uint)isSubrange);
+  assert(self->c.isSubrange | self->c.isFullRange);
+  if (isSubrange)
+    return self->sum = self->c.sumInUnsignedRange(self->sum, (int)uval);
+  else
+    return self->sum += (int) uval;
+}
+
+bool value_stream::hasValue() {
+  if (rp < rplimit)      return true;
+  if (cm == null)        return false;
+  if (cm->next == null)  return false;
+  cm->next->reset(this);
+  return hasValue();
+}
+
+int value_stream::getInt() {
+  if (rp >= rplimit) {
+    // Advance to next coding segment.
+    if (rp > rplimit || cm == null || cm->next == null) {
+      // Must perform this check and throw an exception on bad input.
+      unpack_abort(ERB);
+      return 0;
+    }
+    cm->next->reset(this);
+    return getInt();
+  }
+
+  CODING_PRIVATE(c.spec);
+  uint uval;
+  enum {
+    B5 = 5,
+    B3 = 3,
+    H128 = 128,
+    H64 = 64,
+    H4 = 4
+  };
+  switch (cmk) {
+  case cmk_BHS:
+    assert(D == 0);
+    uval = coding::parse(rp, B, H);
+    if (S == 0)
+      return (int) uval;
+    return decode_sign(S, uval);
+
+  case cmk_BHS0:
+    assert(S == 0 && D == 0);
+    uval = coding::parse(rp, B, H);
+    return (int) uval;
+
+  case cmk_BHS1:
+    assert(S == 1 && D == 0);
+    uval = coding::parse(rp, B, H);
+    return DECODE_SIGN_S1(uval);
+
+  case cmk_BYTE1:
+    assert(c.spec == BYTE1_spec);
+    assert(B == 1 && H == 256 && S == 0 && D == 0);
+    return *rp++ & 0xFF;
+
+  case cmk_CHAR3:
+    assert(c.spec == CHAR3_spec);
+    assert(B == B3 && H == H128 && S == 0 && D == 0);
+    return coding::parse_lgH(rp, B3, H128, 7);
+
+  case cmk_UNSIGNED5:
+    assert(c.spec == UNSIGNED5_spec);
+    assert(B == B5 && H == H64 && S == 0 && D == 0);
+    return coding::parse_lgH(rp, B5, H64, 6);
+
+  case cmk_BHSD1:
+    assert(D == 1);
+    uval = coding::parse(rp, B, H);
+    if (S != 0)
+      uval = (uint) decode_sign(S, uval);
+    return getDeltaValue(this, uval, (bool)c.isSubrange);
+
+  case cmk_BHS1D1full:
+    assert(S == 1 && D == 1 && c.isFullRange);
+    uval = coding::parse(rp, B, H);
+    uval = (uint) DECODE_SIGN_S1(uval);
+    return getDeltaValue(this, uval, false);
+
+  case cmk_BHS1D1sub:
+    assert(S == 1 && D == 1 && c.isSubrange);
+    uval = coding::parse(rp, B, H);
+    uval = (uint) DECODE_SIGN_S1(uval);
+    return getDeltaValue(this, uval, true);
+
+  case cmk_DELTA5:
+    assert(c.spec == DELTA5_spec);
+    assert(B == B5 && H == H64 && S == 1 && D == 1 && c.isFullRange);
+    uval = coding::parse_lgH(rp, B5, H64, 6);
+    sum += DECODE_SIGN_S1(uval);
+    return sum;
+
+  case cmk_BCI5:
+    assert(c.spec == BCI5_spec);
+    assert(B == B5 && H == H4 && S == 0 && D == 0);
+    return coding::parse_lgH(rp, B5, H4, 2);
+
+  case cmk_BRANCH5:
+    assert(c.spec == BRANCH5_spec);
+    assert(B == B5 && H == H4 && S == 2 && D == 0);
+    uval = coding::parse_lgH(rp, B5, H4, 2);
+    return decode_sign(S, uval);
+
+  case cmk_pop:
+    uval = coding::parse(rp, B, H);
+    if (S != 0) {
+      uval = (uint) decode_sign(S, uval);
+    }
+    if (D != 0) {
+      assert(c.isSubrange | c.isFullRange);
+      if (c.isSubrange)
+        sum = c.sumInUnsignedRange(sum, (int) uval);
+      else
+        sum += (int) uval;
+      uval = (uint) sum;
+    }
+    return getPopValue(this, uval);
+
+  case cmk_pop_BHS0:
+    assert(S == 0 && D == 0);
+    uval = coding::parse(rp, B, H);
+    return getPopValue(this, uval);
+
+  case cmk_pop_BYTE1:
+    assert(c.spec == BYTE1_spec);
+    assert(B == 1 && H == 256 && S == 0 && D == 0);
+    return getPopValue(this, *rp++ & 0xFF);
+
+  default:
+    break;
+  }
+  assert(false);
+  return 0;
+}
+
+static maybe_inline
+int moreCentral(int x, int y) {  // used to find end of Pop.{F}
+  // Suggested implementation from the Pack200 specification:
+  uint kx = (x >> 31) ^ (x << 1);
+  uint ky = (y >> 31) ^ (y << 1);
+  return (kx < ky? x: y);
+}
+//static maybe_inline
+//int moreCentral2(int x, int y, int min) {
+//  // Strict implementation of buggy 150.7 specification.
+//  // The bug is that the spec. says absolute-value ties are broken
+//  // in favor of positive numbers, but the suggested implementation
+//  // (also mentioned in the spec.) breaks ties in favor of negative numbers.
+//  if ((x + y) != 0)
+//    return min;
+//  else
+//    // return the other value, which breaks a tie in the positive direction
+//    return (x > y)? x: y;
+//}
+
+static const byte* no_meta[] = {null};
+#define NO_META (*(byte**)no_meta)
+enum { POP_FAVORED_N = -2 };
+
+// mode bits
+#define DISABLE_RUN  1  // used immediately inside ACodee
+#define DISABLE_POP  2  // used recursively in all pop sub-bands
+
+// This function knows all about meta-coding.
+void coding_method::init(byte* &band_rp, byte* band_limit,
+                         byte* &meta_rp, int mode,
+                         coding* defc, int N,
+                         intlist* valueSink) {
+  assert(N != 0);
+
+  assert(u != null);  // must be pre-initialized
+  //if (u == null)  u = unpacker::current();  // expensive
+
+  int op = (meta_rp == null) ? _meta_default :  (*meta_rp++ & 0xFF);
+  coding* foundc = null;
+  coding* to_free = null;
+
+  if (op == _meta_default) {
+    foundc = defc;
+    // and fall through
+
+  } else if (op >= _meta_canon_min && op <= _meta_canon_max) {
+    foundc = coding::findByIndex(op);
+    // and fall through
+
+  } else if (op == _meta_arb) {
+    int args = (*meta_rp++ & 0xFF);
+    // args = (D:[0..1] + 2*S[0..2] + 8*(B:[1..5]-1))
+    int D = ((args >> 0) & 1);
+    int S = ((args >> 1) & 3);
+    int B = ((args >> 3) & -1) + 1;
+    // & (H[1..256]-1)
+    int H = (*meta_rp++ & 0xFF) + 1;
+    foundc = coding::findBySpec(B, H, S, D);
+    to_free = foundc;  // findBySpec may dynamically allocate
+    if (foundc == null) {
+      abort("illegal arb. coding");
+      return;
+    }
+    // and fall through
+
+  } else if (op >= _meta_run && op < _meta_pop) {
+    int args = (op - _meta_run);
+    // args: KX:[0..3] + 4*(KBFlag:[0..1]) + 8*(ABDef:[0..2])
+    int KX     = ((args >> 0) & 3);
+    int KBFlag = ((args >> 2) & 1);
+    int ABDef  = ((args >> 3) & -1);
+    assert(ABDef <= 2);
+    // & KB: one of [0..255] if KBFlag=1
+    int KB     = (!KBFlag? 3: (*meta_rp++ & 0xFF));
+    int K      = (KB+1) << (KX * 4);
+    int N2 = (N >= 0) ? N-K : N;
+    if (N == 0 || (N2 <= 0 && N2 != N)) {
+      abort("illegal run encoding");
+      return;
+    }
+    if ((mode & DISABLE_RUN) != 0) {
+      abort("illegal nested run encoding");
+      return;
+    }
+
+    // & Enc{ ACode } if ADef=0  (ABDef != 1)
+    // No direct nesting of 'run' in ACode, but in BCode it's OK.
+    int disRun = mode | DISABLE_RUN;
+    if (ABDef == 1) {
+      this->init(band_rp, band_limit, NO_META, disRun, defc, K, valueSink);
+    } else {
+      this->init(band_rp, band_limit, meta_rp, disRun, defc, K, valueSink);
+    }
+    CHECK;
+
+    // & Enc{ BCode } if BDef=0  (ABDef != 2)
+    coding_method* tail = U_NEW(coding_method, 1);
+    CHECK_NULL(tail);
+    tail->u = u;
+
+    // The 'run' codings may be nested indirectly via 'pop' codings.
+    // This means that this->next may already be filled in, if
+    // ACode was of type 'pop' with a 'run' token coding.
+    // No problem:  Just chain the upcoming BCode onto the end.
+    for (coding_method* self = this; ; self = self->next) {
+      if (self->next == null) {
+        self->next = tail;
+        break;
+      }
+    }
+
+    if (ABDef == 2) {
+      tail->init(band_rp, band_limit, NO_META, mode, defc, N2, valueSink);
+    } else {
+      tail->init(band_rp, band_limit, meta_rp, mode, defc, N2, valueSink);
+    }
+    // Note:  The preceding calls to init should be tail-recursive.
+
+    return;  // done; no falling through
+
+  } else if (op >= _meta_pop && op < _meta_limit) {
+    int args = (op - _meta_pop);
+    // args: (FDef:[0..1]) + 2*UDef:[0..1] + 4*(TDefL:[0..11])
+    int FDef  = ((args >> 0) & 1);
+    int UDef  = ((args >> 1) & 1);
+    int TDefL = ((args >> 2) & -1);
+    assert(TDefL <= 11);
+    int TDef  = (TDefL > 0);
+    int TL    = (TDefL <= 6) ? (2 << TDefL) : (256 - (4 << (11-TDefL)));
+    int TH    = (256-TL);
+    if (N <= 0) {
+      abort("illegal pop encoding");
+      return;
+    }
+    if ((mode & DISABLE_POP) != 0) {
+      abort("illegal nested pop encoding");
+      return;
+    }
+
+    // No indirect nesting of 'pop', but 'run' is OK.
+    int disPop = DISABLE_POP;
+
+    // & Enc{ FCode } if FDef=0
+    int FN = POP_FAVORED_N;
+    assert(valueSink == null);
+    intlist fValueSink; fValueSink.init();
+    coding_method fval;
+    BYTES_OF(fval).clear(); fval.u = u;
+    if (FDef != 0) {
+      fval.init(band_rp, band_limit, NO_META, disPop, defc, FN, &fValueSink);
+    } else {
+      fval.init(band_rp, band_limit, meta_rp, disPop, defc, FN, &fValueSink);
+    }
+    bytes fvbuf;
+    fValues  = (u->saveTo(fvbuf, fValueSink.b), (int*) fvbuf.ptr);
+    fVlength = fValueSink.length();  // i.e., the parameter K
+    fValueSink.free();
+    CHECK;
+
+    // Skip the first {F} run in all subsequent passes.
+    // The next call to this->init(...) will set vs0.rp to point after the {F}.
+
+    // & Enc{ TCode } if TDef=0  (TDefL==0)
+    if (TDef != 0) {
+      coding* tcode = coding::findBySpec(1, 256);  // BYTE1
+      // find the most narrowly sufficient code:
+      for (int B = 2; B <= B_MAX; B++) {
+        if (fVlength <= tcode->umax)  break;  // found it
+        tcode->free();
+        tcode = coding::findBySpec(B, TH);
+        CHECK_NULL(tcode);
+      }
+      if (!(fVlength <= tcode->umax)) {
+        abort("pop.L value too small");
+        return;
+      }
+      this->init(band_rp, band_limit, NO_META, disPop, tcode, N, null);
+      tcode->free();
+    } else {
+      this->init(band_rp, band_limit, meta_rp, disPop,  defc, N, null);
+    }
+    CHECK;
+
+    // Count the number of zero tokens right now.
+    // Also verify that they are in bounds.
+    int UN = 0;   // one {U} for each zero in {T}
+    value_stream vs = vs0;
+    for (int i = 0; i < N; i++) {
+      uint val = vs.getInt();
+      if (val == 0)  UN += 1;
+      if (!(val <= (uint)fVlength)) {
+        abort("pop token out of range");
+        return;
+      }
+    }
+    vs.done();
+
+    // & Enc{ UCode } if UDef=0
+    if (UN != 0) {
+      uValues = U_NEW(coding_method, 1);
+      CHECK_NULL(uValues);
+      uValues->u = u;
+      if (UDef != 0) {
+        uValues->init(band_rp, band_limit, NO_META, disPop, defc, UN, null);
+      } else {
+        uValues->init(band_rp, band_limit, meta_rp, disPop, defc, UN, null);
+      }
+    } else {
+      if (UDef == 0) {
+        int uop = (*meta_rp++ & 0xFF);
+        if (uop > _meta_canon_max)
+          // %%% Spec. requires the more strict (uop != _meta_default).
+          abort("bad meta-coding for empty pop/U");
+      }
+    }
+
+    // Bug fix for 6259542
+    // Last of all, adjust vs0.cmk to the 'pop' flavor
+    for (coding_method* self = this; self != null; self = self->next) {
+        coding_method_kind cmk2 = cmk_pop;
+        switch (self->vs0.cmk) {
+        case cmk_BHS0:   cmk2 = cmk_pop_BHS0;   break;
+        case cmk_BYTE1:  cmk2 = cmk_pop_BYTE1;  break;
+        default: break;
+        }
+        self->vs0.cmk = cmk2;
+        if (self != this) {
+          assert(self->fValues == null); // no double init
+          self->fValues  = this->fValues;
+          self->fVlength = this->fVlength;
+          assert(self->uValues == null); // must stay null
+        }
+    }
+
+    return;  // done; no falling through
+
+  } else {
+    abort("bad meta-coding");
+    return;
+  }
+
+  // Common code here skips a series of values with one coding.
+  assert(foundc != null);
+
+  assert(vs0.cmk == cmk_ERROR);  // no garbage, please
+  assert(vs0.rp == null);  // no garbage, please
+  assert(vs0.rplimit == null);  // no garbage, please
+  assert(vs0.sum == 0);  // no garbage, please
+
+  vs0.init(band_rp, band_limit, foundc);
+
+  // Done with foundc.  Free if necessary.
+  if (to_free != null) {
+    to_free->free();
+    to_free = null;
+  }
+  foundc = null;
+
+  coding& c = vs0.c;
+  CODING_PRIVATE(c.spec);
+  // assert sane N
+  assert((uint)N < INT_MAX_VALUE || N == POP_FAVORED_N);
+
+  // Look at the values, or at least skip over them quickly.
+  if (valueSink == null) {
+    // Skip and ignore values in the first pass.
+    c.parseMultiple(band_rp, N, band_limit, B, H);
+  } else if (N >= 0) {
+    // Pop coding, {F} sequence, initial run of values...
+    assert((mode & DISABLE_POP) != 0);
+    value_stream vs = vs0;
+    for (int n = 0; n < N; n++) {
+      int val = vs.getInt();
+      valueSink->add(val);
+    }
+    band_rp = vs.rp;
+  } else {
+    // Pop coding, {F} sequence, final run of values...
+    assert((mode & DISABLE_POP) != 0);
+    assert(N == POP_FAVORED_N);
+    int min = INT_MIN_VALUE;  // farthest from the center
+    // min2 is based on the buggy specification of centrality in version 150.7
+    // no known implementations transmit this value, but just in case...
+    //int min2 = INT_MIN_VALUE;
+    int last = 0;
+    // if there were initial runs, find the potential sentinels in them:
+    for (int i = 0; i < valueSink->length(); i++) {
+      last = valueSink->get(i);
+      min = moreCentral(min, last);
+      //min2 = moreCentral2(min2, last, min);
+    }
+    value_stream vs = vs0;
+    for (;;) {
+      int val = vs.getInt();
+      if (valueSink->length() > 0 &&
+          (val == last || val == min)) //|| val == min2
+        break;
+      valueSink->add(val);
+      CHECK;
+      last = val;
+      min = moreCentral(min, last);
+      //min2 = moreCentral2(min2, last, min);
+    }
+    band_rp = vs.rp;
+  }
+  CHECK;
+
+  // Get an accurate upper limit now.
+  vs0.rplimit = band_rp;
+  vs0.cm = this;
+
+  return; // success
+}
+
+coding basic_codings[] = {
+  // This one is not a usable irregular coding, but is used by cp_Utf8_chars.
+  CODING_INIT(3,128,0,0),
+
+  // Fixed-length codings:
+  CODING_INIT(1,256,0,0),
+  CODING_INIT(1,256,1,0),
+  CODING_INIT(1,256,0,1),
+  CODING_INIT(1,256,1,1),
+  CODING_INIT(2,256,0,0),
+  CODING_INIT(2,256,1,0),
+  CODING_INIT(2,256,0,1),
+  CODING_INIT(2,256,1,1),
+  CODING_INIT(3,256,0,0),
+  CODING_INIT(3,256,1,0),
+  CODING_INIT(3,256,0,1),
+  CODING_INIT(3,256,1,1),
+  CODING_INIT(4,256,0,0),
+  CODING_INIT(4,256,1,0),
+  CODING_INIT(4,256,0,1),
+  CODING_INIT(4,256,1,1),
+
+  // Full-range variable-length codings:
+  CODING_INIT(5,  4,0,0),
+  CODING_INIT(5,  4,1,0),
+  CODING_INIT(5,  4,2,0),
+  CODING_INIT(5, 16,0,0),
+  CODING_INIT(5, 16,1,0),
+  CODING_INIT(5, 16,2,0),
+  CODING_INIT(5, 32,0,0),
+  CODING_INIT(5, 32,1,0),
+  CODING_INIT(5, 32,2,0),
+  CODING_INIT(5, 64,0,0),
+  CODING_INIT(5, 64,1,0),
+  CODING_INIT(5, 64,2,0),
+  CODING_INIT(5,128,0,0),
+  CODING_INIT(5,128,1,0),
+  CODING_INIT(5,128,2,0),
+
+  CODING_INIT(5,  4,0,1),
+  CODING_INIT(5,  4,1,1),
+  CODING_INIT(5,  4,2,1),
+  CODING_INIT(5, 16,0,1),
+  CODING_INIT(5, 16,1,1),
+  CODING_INIT(5, 16,2,1),
+  CODING_INIT(5, 32,0,1),
+  CODING_INIT(5, 32,1,1),
+  CODING_INIT(5, 32,2,1),
+  CODING_INIT(5, 64,0,1),
+  CODING_INIT(5, 64,1,1),
+  CODING_INIT(5, 64,2,1),
+  CODING_INIT(5,128,0,1),
+  CODING_INIT(5,128,1,1),
+  CODING_INIT(5,128,2,1),
+
+  // Variable length subrange codings:
+  CODING_INIT(2,192,0,0),
+  CODING_INIT(2,224,0,0),
+  CODING_INIT(2,240,0,0),
+  CODING_INIT(2,248,0,0),
+  CODING_INIT(2,252,0,0),
+
+  CODING_INIT(2,  8,0,1),
+  CODING_INIT(2,  8,1,1),
+  CODING_INIT(2, 16,0,1),
+  CODING_INIT(2, 16,1,1),
+  CODING_INIT(2, 32,0,1),
+  CODING_INIT(2, 32,1,1),
+  CODING_INIT(2, 64,0,1),
+  CODING_INIT(2, 64,1,1),
+  CODING_INIT(2,128,0,1),
+  CODING_INIT(2,128,1,1),
+  CODING_INIT(2,192,0,1),
+  CODING_INIT(2,192,1,1),
+  CODING_INIT(2,224,0,1),
+  CODING_INIT(2,224,1,1),
+  CODING_INIT(2,240,0,1),
+  CODING_INIT(2,240,1,1),
+  CODING_INIT(2,248,0,1),
+  CODING_INIT(2,248,1,1),
+
+  CODING_INIT(3,192,0,0),
+  CODING_INIT(3,224,0,0),
+  CODING_INIT(3,240,0,0),
+  CODING_INIT(3,248,0,0),
+  CODING_INIT(3,252,0,0),
+
+  CODING_INIT(3,  8,0,1),
+  CODING_INIT(3,  8,1,1),
+  CODING_INIT(3, 16,0,1),
+  CODING_INIT(3, 16,1,1),
+  CODING_INIT(3, 32,0,1),
+  CODING_INIT(3, 32,1,1),
+  CODING_INIT(3, 64,0,1),
+  CODING_INIT(3, 64,1,1),
+  CODING_INIT(3,128,0,1),
+  CODING_INIT(3,128,1,1),
+  CODING_INIT(3,192,0,1),
+  CODING_INIT(3,192,1,1),
+  CODING_INIT(3,224,0,1),
+  CODING_INIT(3,224,1,1),
+  CODING_INIT(3,240,0,1),
+  CODING_INIT(3,240,1,1),
+  CODING_INIT(3,248,0,1),
+  CODING_INIT(3,248,1,1),
+
+  CODING_INIT(4,192,0,0),
+  CODING_INIT(4,224,0,0),
+  CODING_INIT(4,240,0,0),
+  CODING_INIT(4,248,0,0),
+  CODING_INIT(4,252,0,0),
+
+  CODING_INIT(4,  8,0,1),
+  CODING_INIT(4,  8,1,1),
+  CODING_INIT(4, 16,0,1),
+  CODING_INIT(4, 16,1,1),
+  CODING_INIT(4, 32,0,1),
+  CODING_INIT(4, 32,1,1),
+  CODING_INIT(4, 64,0,1),
+  CODING_INIT(4, 64,1,1),
+  CODING_INIT(4,128,0,1),
+  CODING_INIT(4,128,1,1),
+  CODING_INIT(4,192,0,1),
+  CODING_INIT(4,192,1,1),
+  CODING_INIT(4,224,0,1),
+  CODING_INIT(4,224,1,1),
+  CODING_INIT(4,240,0,1),
+  CODING_INIT(4,240,1,1),
+  CODING_INIT(4,248,0,1),
+  CODING_INIT(4,248,1,1),
+  CODING_INIT(0,0,0,0)
+};
+#define BASIC_INDEX_LIMIT \
+        (int)(sizeof(basic_codings)/sizeof(basic_codings[0])-1)
+
+coding* coding::findByIndex(int idx) {
+#ifndef PRODUCT
+  /* Tricky assert here, constants and gcc complains about it without local. */
+  int index_limit = BASIC_INDEX_LIMIT;
+  assert(_meta_canon_min == 1 && _meta_canon_max+1 == index_limit);
+#endif
+  if (idx >= _meta_canon_min && idx <= _meta_canon_max)
+    return basic_codings[idx].init();
+  else
+    return null;
+}
+
+#ifndef PRODUCT
+const char* coding::string() {
+  CODING_PRIVATE(spec);
+  bytes buf;
+  buf.malloc(100);
+  char maxS[20], minS[20];
+  sprintf(maxS, "%d", max);
+  sprintf(minS, "%d", min);
+  if (max == INT_MAX_VALUE)  strcpy(maxS, "max");
+  if (min == INT_MIN_VALUE)  strcpy(minS, "min");
+  sprintf((char*)buf.ptr, "(%d,%d,%d,%d) L=%d r=[%s,%s]",
+          B,H,S,D,L,minS,maxS);
+  return (const char*) buf.ptr;
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/coding.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2002, 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.
+ */
+
+struct unpacker;
+
+#define INT_MAX_VALUE ((int)0x7FFFFFFF)
+#define INT_MIN_VALUE ((int)0x80000000)
+
+#define CODING_SPEC(B, H, S, D) ((B)<<20|(H)<<8|(S)<<4|(D)<<0)
+#define CODING_B(x) ((x)>>20 & 0xF)
+#define CODING_H(x) ((x)>>8  & 0xFFF)
+#define CODING_S(x) ((x)>>4  & 0xF)
+#define CODING_D(x) ((x)>>0  & 0xF)
+
+#define CODING_INIT(B, H, S, D) \
+  { CODING_SPEC(B, H, S, D) , 0, 0, 0, 0, 0, 0, 0, 0}
+
+// For debugging purposes, some compilers do not like this and will complain.
+//    #define long do_not_use_C_long_types_use_jlong_or_int
+// Use of the type "long" is problematic, do not use it.
+
+struct coding {
+  int  spec;  // B,H,S,D
+
+  // Handy values derived from the spec:
+  int B() { return CODING_B(spec); }
+  int H() { return CODING_H(spec); }
+  int S() { return CODING_S(spec); }
+  int D() { return CODING_D(spec); }
+  int L() { return 256-CODING_H(spec); }
+  int  min, max;
+  int  umin, umax;
+  char isSigned, isSubrange, isFullRange, isMalloc;
+
+  coding* init();  // returns self or null if error
+  coding* initFrom(int spec_) {
+    assert(this->spec == 0);
+    this->spec = spec_;
+    return init();
+  }
+
+  static coding* findBySpec(int spec);
+  static coding* findBySpec(int B, int H, int S=0, int D=0);
+  static coding* findByIndex(int irregularCodingIndex);
+
+  static uint parse(byte* &rp, int B, int H);
+  static uint parse_lgH(byte* &rp, int B, int H, int lgH);
+  static void parseMultiple(byte* &rp, int N, byte* limit, int B, int H);
+
+  uint parse(byte* &rp) {
+    return parse(rp, CODING_B(spec), CODING_H(spec));
+  }
+  void parseMultiple(byte* &rp, int N, byte* limit) {
+    parseMultiple(rp, N, limit, CODING_B(spec), CODING_H(spec));
+  }
+
+  bool canRepresent(int x)         { return (x >= min  && x <= max);  }
+  bool canRepresentUnsigned(int x) { return (x >= umin && x <= umax); }
+
+  int sumInUnsignedRange(int x, int y);
+
+  int readFrom(byte* &rpVar, int* dbase);
+  void readArrayFrom(byte* &rpVar, int* dbase, int length, int* values);
+  void skipArrayFrom(byte* &rpVar, int length) {
+    readArrayFrom(rpVar, (int*)NULL, length, (int*)NULL);
+  }
+
+#ifndef PRODUCT
+  const char* string();
+#endif
+
+  void free();  // free self if isMalloc
+
+  // error handling
+  static void abort(const char* msg = null) { unpack_abort(msg); }
+};
+
+enum coding_method_kind {
+  cmk_ERROR,
+  cmk_BHS,
+  cmk_BHS0,
+  cmk_BHS1,
+  cmk_BHSD1,
+  cmk_BHS1D1full,  // isFullRange
+  cmk_BHS1D1sub,   // isSubRange
+
+  // special cases hand-optimized (~50% of all decoded values)
+  cmk_BYTE1,         //(1,256)      6%
+  cmk_CHAR3,         //(3,128)      7%
+  cmk_UNSIGNED5,     //(5,64)      13%
+  cmk_DELTA5,        //(5,64,1,1)   5%
+  cmk_BCI5,          //(5,4)       18%
+  cmk_BRANCH5,       //(5,4,2)      4%
+//cmk_UNSIGNED5H16,  //(5,16)       5%
+//cmk_UNSIGNED2H4,   //(2,4)        6%
+//cmk_DELTA4H8,      //(4,8,1,1)   10%
+//cmk_DELTA3H16,     //(3,16,1,1)   9%
+  cmk_BHS_LIMIT,
+
+  cmk_pop,
+  cmk_pop_BHS0,
+  cmk_pop_BYTE1,
+  cmk_pop_LIMIT,
+
+  cmk_LIMIT
+};
+
+enum {
+  BYTE1_spec       = CODING_SPEC(1, 256, 0, 0),
+  CHAR3_spec       = CODING_SPEC(3, 128, 0, 0),
+  UNSIGNED4_spec   = CODING_SPEC(4, 256, 0, 0),
+  UNSIGNED5_spec   = CODING_SPEC(5, 64, 0, 0),
+  SIGNED5_spec     = CODING_SPEC(5, 64, 1, 0),
+  DELTA5_spec      = CODING_SPEC(5, 64, 1, 1),
+  UDELTA5_spec     = CODING_SPEC(5, 64, 0, 1),
+  MDELTA5_spec     = CODING_SPEC(5, 64, 2, 1),
+  BCI5_spec        = CODING_SPEC(5, 4, 0, 0),
+  BRANCH5_spec     = CODING_SPEC(5, 4, 2, 0)
+};
+
+enum {
+  B_MAX = 5,
+  C_SLOP = B_MAX*10
+};
+
+struct coding_method;
+
+// iterator under the control of a meta-coding
+struct value_stream {
+  // current coding of values or values
+  coding c;               // B,H,S,D,etc.
+  coding_method_kind cmk; // type of decoding needed
+  byte* rp;               // read pointer
+  byte* rplimit;          // final value of read pointer
+  int sum;                // partial sum of all values so far (D=1 only)
+  coding_method* cm;      // coding method that defines this stream
+
+  void init(byte* band_rp, byte* band_limit, coding* defc);
+  void init(byte* band_rp, byte* band_limit, int spec)
+    { init(band_rp, band_limit, coding::findBySpec(spec)); }
+
+  void setCoding(coding* c);
+  void setCoding(int spec) { setCoding(coding::findBySpec(spec)); }
+
+  // Parse and decode a single value.
+  int getInt();
+
+  // Parse and decode a single byte, with no error checks.
+  int getByte() {
+    assert(cmk == cmk_BYTE1);
+    assert(rp < rplimit);
+    return *rp++ & 0xFF;
+  }
+
+  // Used only for asserts.
+  bool hasValue();
+
+  void done() { assert(!hasValue()); }
+
+  // Sometimes a value stream has an auxiliary (but there are never two).
+  value_stream* helper() {
+    assert(hasHelper());
+    return this+1;
+  }
+  bool hasHelper();
+
+  // error handling
+  //  inline void abort(const char* msg);
+  //  inline void aborting();
+};
+
+struct coding_method {
+  value_stream vs0;       // initial state snapshot (vs.meta==this)
+
+  coding_method* next;    // what to do when we run out of bytes
+
+  // these fields are used for pop codes only:
+  int* fValues;           // favored value array
+  int  fVlength;          // maximum favored value token
+  coding_method* uValues; // unfavored value stream
+
+  // pointer to outer unpacker, for error checks etc.
+  unpacker* u;
+
+  // Initialize a value stream.
+  void reset(value_stream* state);
+
+  // Parse a band header, size a band, and initialize for further action.
+  // band_rp advances (but not past band_limit), and meta_rp advances.
+  // The mode gives context, such as "inside a pop".
+  // The defc and N are the incoming parameters to a meta-coding.
+  // The value sink is used to collect output values, when desired.
+  void init(byte* &band_rp, byte* band_limit,
+            byte* &meta_rp, int mode,
+            coding* defc, int N,
+            intlist* valueSink);
+
+  // error handling
+  void abort(const char* msg) { unpack_abort(msg, u); }
+  bool aborting()             { return unpack_aborting(u); }
+};
+
+//inline void value_stream::abort(const char* msg) { cm->abort(msg); }
+//inline void value_stream::aborting()             { cm->aborting(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/constants.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,517 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+/*
+  Java Class Version numbers history
+  1.0 to 1.3.X 45,3
+  1.4 to 1.4.X 46,0
+  1.5 to 1.5.X 49,0
+  1.6 to 1.5.x 50,0 NOTE Assumed for now
+*/
+
+// classfile constants
+#define JAVA_MAGIC 0xCAFEBABE
+#define JAVA_MIN_MAJOR_VERSION 45
+#define JAVA_MIN_MINOR_VERSION 3
+
+#define JAVA5_MAX_MAJOR_VERSION 49
+#define JAVA5_MAX_MINOR_VERSION 0
+
+#define JAVA6_MAX_MAJOR_VERSION 50
+#define JAVA6_MAX_MINOR_VERSION 0
+
+#define JAVA7_MAX_MAJOR_VERSION 51
+#define JAVA7_MAX_MINOR_VERSION 0
+
+#define JAVA8_MAX_MAJOR_VERSION 52
+#define JAVA8_MAX_MINOR_VERSION 0
+
+// package file constants
+#define JAVA_PACKAGE_MAGIC 0xCAFED00D
+#define JAVA5_PACKAGE_MAJOR_VERSION 150
+#define JAVA5_PACKAGE_MINOR_VERSION 7
+
+#define JAVA6_PACKAGE_MAJOR_VERSION 160
+#define JAVA6_PACKAGE_MINOR_VERSION 1
+
+#define JAVA7_PACKAGE_MAJOR_VERSION 170
+#define JAVA7_PACKAGE_MINOR_VERSION 1
+
+#define JAVA8_PACKAGE_MAJOR_VERSION 171
+#define JAVA8_PACKAGE_MINOR_VERSION 0
+
+// magic number for gzip streams (for processing pack200-gzip data)
+#define GZIP_MAGIC      0x1F8B0800
+#define GZIP_MAGIC_MASK 0xFFFFFF00  // last byte is variable "flg" field
+
+enum {
+    CONSTANT_None               = 0,
+    CONSTANT_Utf8               = 1,
+    CONSTANT_unused             = 2,     /* unused, was Unicode */
+    CONSTANT_Integer            = 3,
+    CONSTANT_Float              = 4,
+    CONSTANT_Long               = 5,
+    CONSTANT_Double             = 6,
+    CONSTANT_Class              = 7,
+    CONSTANT_String             = 8,
+    CONSTANT_Fieldref           = 9,
+    CONSTANT_Methodref          = 10,
+    CONSTANT_InterfaceMethodref = 11,
+    CONSTANT_NameandType        = 12,
+    CONSTANT_unused13           = 13,
+    CONSTANT_unused14           = 14,
+    CONSTANT_MethodHandle       = 15,
+    CONSTANT_MethodType         = 16,
+    CONSTANT_unused17           = 17,
+    CONSTANT_InvokeDynamic      = 18,
+    CONSTANT_Limit              = 19,
+    CONSTANT_Signature          = CONSTANT_unused13,
+    CONSTANT_BootstrapMethod    = CONSTANT_unused17, // used only for InvokeDynamic
+    CONSTANT_All                = 50,                // combined global map
+    CONSTANT_LoadableValue      = 51,                // used for 'KL' and qldc operands
+    CONSTANT_AnyMember          = 52,                // union of refs to field or (interface) method
+    CONSTANT_FieldSpecific      = 53,                // used only for 'KQ' ConstantValue attrs
+    CONSTANT_GroupFirst         = CONSTANT_All,      // start group marker
+    CONSTANT_GroupLimit         = 54,                // end group marker
+
+    // CONSTANT_MethodHandle reference kinds
+    REF_getField         = 1,
+    REF_getStatic        = 2,
+    REF_putField         = 3,
+    REF_putStatic        = 4,
+    REF_invokeVirtual    = 5,
+    REF_invokeStatic     = 6,
+    REF_invokeSpecial    = 7,
+    REF_newInvokeSpecial = 8,
+    REF_invokeInterface  = 9,
+
+    SUBINDEX_BIT = 64,  // combined with CONSTANT_xxx for ixTag
+
+    ACC_STATIC       = 0x0008,
+    ACC_IC_LONG_FORM = (1<<16), //for ic_flags
+
+    CLASS_ATTR_SourceFile                            = 17,
+    CLASS_ATTR_EnclosingMethod                       = 18,
+    CLASS_ATTR_InnerClasses                          = 23,
+    CLASS_ATTR_ClassFile_version                     = 24,
+    CLASS_ATTR_BootstrapMethods                      = 25,
+    FIELD_ATTR_ConstantValue                         = 17,
+    METHOD_ATTR_Code                                 = 17,
+    METHOD_ATTR_Exceptions                           = 18,
+    METHOD_ATTR_RuntimeVisibleParameterAnnotations   = 23,
+    METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24,
+    METHOD_ATTR_AnnotationDefault                    = 25,
+    METHOD_ATTR_MethodParameters                     = 26,
+    CODE_ATTR_StackMapTable          = 0,
+    CODE_ATTR_LineNumberTable        = 1,
+    CODE_ATTR_LocalVariableTable     = 2,
+    CODE_ATTR_LocalVariableTypeTable = 3,
+    //X_ATTR_Synthetic = 12,  // ACC_SYNTHETIC; not predefined
+    X_ATTR_Signature                   = 19,
+    X_ATTR_Deprecated                  = 20,
+    X_ATTR_RuntimeVisibleAnnotations   = 21,
+    X_ATTR_RuntimeInvisibleAnnotations = 22,
+    X_ATTR_RuntimeVisibleTypeAnnotations   = 27,
+    X_ATTR_RuntimeInvisibleTypeAnnotations = 28,
+    X_ATTR_OVERFLOW                    = 16,
+    X_ATTR_LIMIT_NO_FLAGS_HI           = 32,
+    X_ATTR_LIMIT_FLAGS_HI              = 63,
+
+#define O_ATTR_DO(F) \
+        F(X_ATTR_OVERFLOW,01) \
+          /*(end)*/
+#define X_ATTR_DO(F) \
+        O_ATTR_DO(F) \
+        F(X_ATTR_Signature,Signature) \
+        F(X_ATTR_Deprecated,Deprecated) \
+        F(X_ATTR_RuntimeVisibleAnnotations,RuntimeVisibleAnnotations) \
+        F(X_ATTR_RuntimeInvisibleAnnotations,RuntimeInvisibleAnnotations) \
+        F(X_ATTR_RuntimeVisibleTypeAnnotations,RuntimeVisibleTypeAnnotations) \
+        F(X_ATTR_RuntimeInvisibleTypeAnnotations,RuntimeInvisibleTypeAnnotations) \
+        /*F(X_ATTR_Synthetic,Synthetic)*/ \
+          /*(end)*/
+#define CLASS_ATTR_DO(F) \
+        F(CLASS_ATTR_SourceFile,SourceFile) \
+        F(CLASS_ATTR_InnerClasses,InnerClasses) \
+        F(CLASS_ATTR_EnclosingMethod,EnclosingMethod) \
+        F(CLASS_ATTR_ClassFile_version,02) \
+        F(CLASS_ATTR_BootstrapMethods,BootstrapMethods) \
+          /*(end)*/
+#define FIELD_ATTR_DO(F) \
+        F(FIELD_ATTR_ConstantValue,ConstantValue) \
+          /*(end)*/
+#define METHOD_ATTR_DO(F) \
+        F(METHOD_ATTR_Code,Code) \
+        F(METHOD_ATTR_Exceptions,Exceptions) \
+        F(METHOD_ATTR_RuntimeVisibleParameterAnnotations,RuntimeVisibleParameterAnnotations) \
+        F(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations) \
+        F(METHOD_ATTR_AnnotationDefault,AnnotationDefault) \
+        F(METHOD_ATTR_MethodParameters,MethodParameters) \
+          /*(end)*/
+#define CODE_ATTR_DO(F) \
+        F(CODE_ATTR_StackMapTable,StackMapTable) \
+        F(CODE_ATTR_LineNumberTable,LineNumberTable) \
+        F(CODE_ATTR_LocalVariableTable,LocalVariableTable) \
+        F(CODE_ATTR_LocalVariableTypeTable,LocalVariableTypeTable) \
+          /*(end)*/
+#define ALL_ATTR_DO(F) \
+        X_ATTR_DO(F) \
+        CLASS_ATTR_DO(F) \
+        FIELD_ATTR_DO(F) \
+        METHOD_ATTR_DO(F) \
+        CODE_ATTR_DO(F) \
+          /*(end)*/
+
+    // attribute "context types"
+    ATTR_CONTEXT_CLASS  = 0,
+    ATTR_CONTEXT_FIELD  = 1,
+    ATTR_CONTEXT_METHOD = 2,
+    ATTR_CONTEXT_CODE   = 3,
+    ATTR_CONTEXT_LIMIT  = 4,
+
+    // constants for parsed layouts (stored in band::le_kind)
+    EK_NONE = 0,     // not a layout element
+    EK_INT  = 'I',   // B H I SH etc., also FH etc.
+    EK_BCI  = 'P',   // PH etc.
+    EK_BCID = 'Q',   // POH etc.
+    EK_BCO  = 'O',   // OH etc.
+    EK_REPL = 'N',   // NH[...] etc.
+    EK_REF  = 'R',   // RUH, RUNH, KQH, etc.
+    EK_UN   = 'T',   // TB(...)[...] etc.
+    EK_CASE = 'K',   // (...)[...] etc.
+    EK_CALL = '(',   // (0), (1), etc.
+    EK_CBLE = '[',   // [...][...] etc.
+    NO_BAND_INDEX = -1,
+
+    // File option bits, from LSB in ascending bit position.
+    FO_DEFLATE_HINT           = 1<<0,
+    FO_IS_CLASS_STUB          = 1<<1,
+
+    // Archive option bits, from LSB in ascending bit position:
+    AO_HAVE_SPECIAL_FORMATS   = 1<<0,
+    AO_HAVE_CP_NUMBERS        = 1<<1,
+    AO_HAVE_ALL_CODE_FLAGS    = 1<<2,
+    AO_HAVE_CP_EXTRAS         = 1<<3,
+    AO_HAVE_FILE_HEADERS      = 1<<4,
+    AO_DEFLATE_HINT           = 1<<5,
+    AO_HAVE_FILE_MODTIME      = 1<<6,
+    AO_HAVE_FILE_OPTIONS      = 1<<7,
+    AO_HAVE_FILE_SIZE_HI      = 1<<8,
+    AO_HAVE_CLASS_FLAGS_HI    = 1<<9,
+    AO_HAVE_FIELD_FLAGS_HI    = 1<<10,
+    AO_HAVE_METHOD_FLAGS_HI   = 1<<11,
+    AO_HAVE_CODE_FLAGS_HI     = 1<<12,
+    AO_UNUSED_MBZ             = (-1)<<13, // options bits reserved for future use.
+
+#define ARCHIVE_BIT_DO(F) \
+         F(AO_HAVE_SPECIAL_FORMATS) \
+         F(AO_HAVE_CP_NUMBERS) \
+         F(AO_HAVE_ALL_CODE_FLAGS) \
+         F(AO_HAVE_CP_EXTRAS) \
+         F(AO_HAVE_FILE_HEADERS) \
+         F(AO_DEFLATE_HINT) \
+         F(AO_HAVE_FILE_MODTIME) \
+         F(AO_HAVE_FILE_OPTIONS) \
+         F(AO_HAVE_FILE_SIZE_HI) \
+         F(AO_HAVE_CLASS_FLAGS_HI) \
+         F(AO_HAVE_FIELD_FLAGS_HI) \
+         F(AO_HAVE_METHOD_FLAGS_HI) \
+         F(AO_HAVE_CODE_FLAGS_HI) \
+          /*(end)*/
+
+    // Constants for decoding attribute definition header bytes.
+    ADH_CONTEXT_MASK   = 0x3,  // (hdr & ADH_CONTEXT_MASK)
+    ADH_BIT_SHIFT      = 0x2,  // (hdr >> ADH_BIT_SHIFT)
+    ADH_BIT_IS_LSB     = 1,    // (hdr >> ADH_BIT_SHIFT) - ADH_BIT_IS_LSB
+#define ADH_BYTE(context, index) \
+        ((((index) + ADH_BIT_IS_LSB)<<ADH_BIT_SHIFT) + (context))
+#define ADH_BYTE_CONTEXT(adhb) \
+        ((adhb) & ADH_CONTEXT_MASK)
+#define ADH_BYTE_INDEX(adhb) \
+        (((adhb) >> ADH_BIT_SHIFT) - ADH_BIT_IS_LSB)
+
+    NO_MODTIME = 0,  // null modtime value
+
+    // meta-coding
+    _meta_default   = 0,
+    _meta_canon_min = 1,
+    _meta_canon_max = 115,
+    _meta_arb       = 116,
+    _meta_run       = 117,
+    _meta_pop       = 141,
+    _meta_limit     = 189,
+    _meta_error     = 255,
+
+    _xxx_1_end
+};
+
+// Bytecodes.
+
+enum {
+  bc_nop                  =   0, // 0x00
+  bc_aconst_null          =   1, // 0x01
+  bc_iconst_m1            =   2, // 0x02
+  bc_iconst_0             =   3, // 0x03
+  bc_iconst_1             =   4, // 0x04
+  bc_iconst_2             =   5, // 0x05
+  bc_iconst_3             =   6, // 0x06
+  bc_iconst_4             =   7, // 0x07
+  bc_iconst_5             =   8, // 0x08
+  bc_lconst_0             =   9, // 0x09
+  bc_lconst_1             =  10, // 0x0a
+  bc_fconst_0             =  11, // 0x0b
+  bc_fconst_1             =  12, // 0x0c
+  bc_fconst_2             =  13, // 0x0d
+  bc_dconst_0             =  14, // 0x0e
+  bc_dconst_1             =  15, // 0x0f
+  bc_bipush               =  16, // 0x10
+  bc_sipush               =  17, // 0x11
+  bc_ldc                  =  18, // 0x12
+  bc_ldc_w                =  19, // 0x13
+  bc_ldc2_w               =  20, // 0x14
+  bc_iload                =  21, // 0x15
+  bc_lload                =  22, // 0x16
+  bc_fload                =  23, // 0x17
+  bc_dload                =  24, // 0x18
+  bc_aload                =  25, // 0x19
+  bc_iload_0              =  26, // 0x1a
+  bc_iload_1              =  27, // 0x1b
+  bc_iload_2              =  28, // 0x1c
+  bc_iload_3              =  29, // 0x1d
+  bc_lload_0              =  30, // 0x1e
+  bc_lload_1              =  31, // 0x1f
+  bc_lload_2              =  32, // 0x20
+  bc_lload_3              =  33, // 0x21
+  bc_fload_0              =  34, // 0x22
+  bc_fload_1              =  35, // 0x23
+  bc_fload_2              =  36, // 0x24
+  bc_fload_3              =  37, // 0x25
+  bc_dload_0              =  38, // 0x26
+  bc_dload_1              =  39, // 0x27
+  bc_dload_2              =  40, // 0x28
+  bc_dload_3              =  41, // 0x29
+  bc_aload_0              =  42, // 0x2a
+  bc_aload_1              =  43, // 0x2b
+  bc_aload_2              =  44, // 0x2c
+  bc_aload_3              =  45, // 0x2d
+  bc_iaload               =  46, // 0x2e
+  bc_laload               =  47, // 0x2f
+  bc_faload               =  48, // 0x30
+  bc_daload               =  49, // 0x31
+  bc_aaload               =  50, // 0x32
+  bc_baload               =  51, // 0x33
+  bc_caload               =  52, // 0x34
+  bc_saload               =  53, // 0x35
+  bc_istore               =  54, // 0x36
+  bc_lstore               =  55, // 0x37
+  bc_fstore               =  56, // 0x38
+  bc_dstore               =  57, // 0x39
+  bc_astore               =  58, // 0x3a
+  bc_istore_0             =  59, // 0x3b
+  bc_istore_1             =  60, // 0x3c
+  bc_istore_2             =  61, // 0x3d
+  bc_istore_3             =  62, // 0x3e
+  bc_lstore_0             =  63, // 0x3f
+  bc_lstore_1             =  64, // 0x40
+  bc_lstore_2             =  65, // 0x41
+  bc_lstore_3             =  66, // 0x42
+  bc_fstore_0             =  67, // 0x43
+  bc_fstore_1             =  68, // 0x44
+  bc_fstore_2             =  69, // 0x45
+  bc_fstore_3             =  70, // 0x46
+  bc_dstore_0             =  71, // 0x47
+  bc_dstore_1             =  72, // 0x48
+  bc_dstore_2             =  73, // 0x49
+  bc_dstore_3             =  74, // 0x4a
+  bc_astore_0             =  75, // 0x4b
+  bc_astore_1             =  76, // 0x4c
+  bc_astore_2             =  77, // 0x4d
+  bc_astore_3             =  78, // 0x4e
+  bc_iastore              =  79, // 0x4f
+  bc_lastore              =  80, // 0x50
+  bc_fastore              =  81, // 0x51
+  bc_dastore              =  82, // 0x52
+  bc_aastore              =  83, // 0x53
+  bc_bastore              =  84, // 0x54
+  bc_castore              =  85, // 0x55
+  bc_sastore              =  86, // 0x56
+  bc_pop                  =  87, // 0x57
+  bc_pop2                 =  88, // 0x58
+  bc_dup                  =  89, // 0x59
+  bc_dup_x1               =  90, // 0x5a
+  bc_dup_x2               =  91, // 0x5b
+  bc_dup2                 =  92, // 0x5c
+  bc_dup2_x1              =  93, // 0x5d
+  bc_dup2_x2              =  94, // 0x5e
+  bc_swap                 =  95, // 0x5f
+  bc_iadd                 =  96, // 0x60
+  bc_ladd                 =  97, // 0x61
+  bc_fadd                 =  98, // 0x62
+  bc_dadd                 =  99, // 0x63
+  bc_isub                 = 100, // 0x64
+  bc_lsub                 = 101, // 0x65
+  bc_fsub                 = 102, // 0x66
+  bc_dsub                 = 103, // 0x67
+  bc_imul                 = 104, // 0x68
+  bc_lmul                 = 105, // 0x69
+  bc_fmul                 = 106, // 0x6a
+  bc_dmul                 = 107, // 0x6b
+  bc_idiv                 = 108, // 0x6c
+  bc_ldiv                 = 109, // 0x6d
+  bc_fdiv                 = 110, // 0x6e
+  bc_ddiv                 = 111, // 0x6f
+  bc_irem                 = 112, // 0x70
+  bc_lrem                 = 113, // 0x71
+  bc_frem                 = 114, // 0x72
+  bc_drem                 = 115, // 0x73
+  bc_ineg                 = 116, // 0x74
+  bc_lneg                 = 117, // 0x75
+  bc_fneg                 = 118, // 0x76
+  bc_dneg                 = 119, // 0x77
+  bc_ishl                 = 120, // 0x78
+  bc_lshl                 = 121, // 0x79
+  bc_ishr                 = 122, // 0x7a
+  bc_lshr                 = 123, // 0x7b
+  bc_iushr                = 124, // 0x7c
+  bc_lushr                = 125, // 0x7d
+  bc_iand                 = 126, // 0x7e
+  bc_land                 = 127, // 0x7f
+  bc_ior                  = 128, // 0x80
+  bc_lor                  = 129, // 0x81
+  bc_ixor                 = 130, // 0x82
+  bc_lxor                 = 131, // 0x83
+  bc_iinc                 = 132, // 0x84
+  bc_i2l                  = 133, // 0x85
+  bc_i2f                  = 134, // 0x86
+  bc_i2d                  = 135, // 0x87
+  bc_l2i                  = 136, // 0x88
+  bc_l2f                  = 137, // 0x89
+  bc_l2d                  = 138, // 0x8a
+  bc_f2i                  = 139, // 0x8b
+  bc_f2l                  = 140, // 0x8c
+  bc_f2d                  = 141, // 0x8d
+  bc_d2i                  = 142, // 0x8e
+  bc_d2l                  = 143, // 0x8f
+  bc_d2f                  = 144, // 0x90
+  bc_i2b                  = 145, // 0x91
+  bc_i2c                  = 146, // 0x92
+  bc_i2s                  = 147, // 0x93
+  bc_lcmp                 = 148, // 0x94
+  bc_fcmpl                = 149, // 0x95
+  bc_fcmpg                = 150, // 0x96
+  bc_dcmpl                = 151, // 0x97
+  bc_dcmpg                = 152, // 0x98
+  bc_ifeq                 = 153, // 0x99
+  bc_ifne                 = 154, // 0x9a
+  bc_iflt                 = 155, // 0x9b
+  bc_ifge                 = 156, // 0x9c
+  bc_ifgt                 = 157, // 0x9d
+  bc_ifle                 = 158, // 0x9e
+  bc_if_icmpeq            = 159, // 0x9f
+  bc_if_icmpne            = 160, // 0xa0
+  bc_if_icmplt            = 161, // 0xa1
+  bc_if_icmpge            = 162, // 0xa2
+  bc_if_icmpgt            = 163, // 0xa3
+  bc_if_icmple            = 164, // 0xa4
+  bc_if_acmpeq            = 165, // 0xa5
+  bc_if_acmpne            = 166, // 0xa6
+  bc_goto                 = 167, // 0xa7
+  bc_jsr                  = 168, // 0xa8
+  bc_ret                  = 169, // 0xa9
+  bc_tableswitch          = 170, // 0xaa
+  bc_lookupswitch         = 171, // 0xab
+  bc_ireturn              = 172, // 0xac
+  bc_lreturn              = 173, // 0xad
+  bc_freturn              = 174, // 0xae
+  bc_dreturn              = 175, // 0xaf
+  bc_areturn              = 176, // 0xb0
+  bc_return               = 177, // 0xb1
+  bc_getstatic            = 178, // 0xb2
+  bc_putstatic            = 179, // 0xb3
+  bc_getfield             = 180, // 0xb4
+  bc_putfield             = 181, // 0xb5
+  bc_invokevirtual        = 182, // 0xb6
+  bc_invokespecial        = 183, // 0xb7
+  bc_invokestatic         = 184, // 0xb8
+  bc_invokeinterface      = 185, // 0xb9
+  bc_invokedynamic        = 186, // 0xba
+  bc_new                  = 187, // 0xbb
+  bc_newarray             = 188, // 0xbc
+  bc_anewarray            = 189, // 0xbd
+  bc_arraylength          = 190, // 0xbe
+  bc_athrow               = 191, // 0xbf
+  bc_checkcast            = 192, // 0xc0
+  bc_instanceof           = 193, // 0xc1
+  bc_monitorenter         = 194, // 0xc2
+  bc_monitorexit          = 195, // 0xc3
+  bc_wide                 = 196, // 0xc4
+  bc_multianewarray       = 197, // 0xc5
+  bc_ifnull               = 198, // 0xc6
+  bc_ifnonnull            = 199, // 0xc7
+  bc_goto_w               = 200, // 0xc8
+  bc_jsr_w                = 201, // 0xc9
+  bc_bytecode_limit       = 202  // 0xca
+};
+
+enum {
+  bc_end_marker = 255,
+  bc_byte_escape = 254,
+  bc_ref_escape = 253,
+
+  _first_linker_op = bc_getstatic,
+  _last_linker_op  = bc_invokestatic,
+  _num_linker_ops  = (_last_linker_op - _first_linker_op) + 1,
+  _self_linker_op  = bc_bytecode_limit,
+  _self_linker_aload_flag = 1*_num_linker_ops,
+  _self_linker_super_flag = 2*_num_linker_ops,
+  _self_linker_limit = _self_linker_op + 4*_num_linker_ops,
+
+  _invokeinit_op = _self_linker_limit,
+  _invokeinit_self_option = 0,
+  _invokeinit_super_option = 1,
+  _invokeinit_new_option = 2,
+  _invokeinit_limit = _invokeinit_op+3,
+
+  _xldc_op = _invokeinit_limit,
+  bc_sldc = bc_ldc,      // previously named bc_aldc
+  bc_cldc = _xldc_op+0,
+  bc_ildc = _xldc_op+1,
+  bc_fldc = _xldc_op+2,
+  bc_sldc_w = bc_ldc_w,  // previously named bc_aldc_w
+  bc_cldc_w = _xldc_op+3,
+  bc_ildc_w = _xldc_op+4,
+  bc_fldc_w = _xldc_op+5,
+  bc_lldc2_w = bc_ldc2_w,
+  bc_dldc2_w = _xldc_op+6,
+  // anything other primitive, string, or class must be handled with qldc:
+  bc_qldc    = _xldc_op+7,
+  bc_qldc_w  = _xldc_op+8,
+  _xldc_limit = _xldc_op+9,
+  _invoke_int_op = _xldc_limit,
+  _invokespecial_int = _invoke_int_op+0,
+  _invokestatic_int = _invoke_int_op+1,
+  _invoke_int_limit =  _invoke_int_op+2,
+  _xxx_3_end
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/defines.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+// random definitions
+
+#ifdef _MSC_VER
+#include <windows.h>
+#include <winuser.h>
+#else
+#include <unistd.h>
+#endif
+
+#ifndef NO_ZLIB
+#include <zconf.h>
+#endif
+
+#ifndef FULL
+#define FULL 1 /* Adds <500 bytes to the zipped final product. */
+#endif
+
+#if FULL  // define this if you want debugging and/or compile-time attributes
+#define IF_FULL(x) x
+#else
+#define IF_FULL(x) /*x*/
+#endif
+
+#ifdef PRODUCT
+#define IF_PRODUCT(xxx) xxx
+#define NOT_PRODUCT(xxx)
+#define assert(p)
+#define PRINTCR(args)
+#define VERSION_STRING "%s version %s\n"
+#else
+#define IF_PRODUCT(xxx)
+#define NOT_PRODUCT(xxx) xxx
+#define assert(p) ((p) || assert_failed(#p))
+#define PRINTCR(args)  u->verbose && u->printcr_if_verbose args
+#define VERSION_STRING "%s version non-product %s\n"
+extern "C" void breakpoint();
+extern int assert_failed(const char*);
+#define BREAK (breakpoint())
+#endif
+
+// Build-time control of some C++ inlining.
+// To make a slightly faster smaller binary, say "CC -Dmaybe_inline=inline"
+#ifndef maybe_inline
+#define maybe_inline /*inline*/
+#endif
+// By marking larger member functions inline, we remove external linkage.
+#ifndef local_inline
+#define local_inline inline
+#endif
+
+// Error messages that we have
+#define ERROR_ENOMEM    "Native allocation failed"
+#define ERROR_FORMAT    "Corrupted pack file"
+#define ERROR_RESOURCE  "Cannot extract resource file"
+#define ERROR_OVERFLOW  "Internal buffer overflow"
+#define ERROR_INTERNAL  "Internal error"
+#define ERROR_INIT      "cannot init class members"
+
+#define LOGFILE_STDOUT "-"
+#define LOGFILE_STDERR ""
+
+#define lengthof(array) (sizeof(array)/sizeof(array[0]))
+
+#define NEW(T, n)    (T*) must_malloc((int)(scale_size(n, sizeof(T))))
+#define U_NEW(T, n)  (T*) u->alloc(scale_size(n, sizeof(T)))
+#define T_NEW(T, n)  (T*) u->temp_alloc(scale_size(n, sizeof(T)))
+
+
+// bytes and byte arrays
+
+typedef unsigned int uint;
+#if defined(NO_ZLIB)
+#ifdef _LP64
+typedef unsigned int uLong; // Historical zlib, should be 32-bit.
+#else
+typedef unsigned long uLong;
+#endif
+#endif
+#ifdef _MSC_VER
+typedef LONGLONG        jlong;
+typedef DWORDLONG       julong;
+#define MKDIR(dir)      mkdir(dir)
+#define getpid()        _getpid()
+#define PATH_MAX        MAX_PATH
+#define dup2(a,b)       _dup2(a,b)
+#define strcasecmp(s1, s2) _stricmp(s1,s2)
+#define tempname        _tempname
+#define sleep           Sleep
+#define snprintf        _snprintf
+#else
+typedef signed char byte;
+#ifdef _LP64
+typedef long jlong;
+typedef long unsigned julong;
+#else
+typedef long long jlong;
+typedef long long unsigned julong;
+#endif
+#define MKDIR(dir) mkdir(dir, 0777);
+#endif
+
+#ifdef OLDCC
+typedef int bool;
+enum { false, true };
+#endif
+
+#define null (0)
+
+/* Must cast to void *, then size_t, then int. */
+#define ptrlowbits(x)  ((int)(size_t)(void*)(x))
+
+/* Back and forth from jlong to pointer */
+#define ptr2jlong(x)  ((jlong)(size_t)(void*)(x))
+#define jlong2ptr(x)  ((void*)(size_t)(x))
+
+// Keys used by Java:
+#define UNPACK_DEFLATE_HINT             "unpack.deflate.hint"
+
+#define COM_PREFIX                      "com.sun.java.util.jar.pack."
+#define UNPACK_MODIFICATION_TIME        COM_PREFIX"unpack.modification.time"
+#define DEBUG_VERBOSE                   COM_PREFIX"verbose"
+
+#define ZIP_ARCHIVE_MARKER_COMMENT      "PACK200"
+
+// The following are not known to the Java classes:
+#define UNPACK_LOG_FILE                 COM_PREFIX"unpack.log.file"
+#define UNPACK_REMOVE_PACKFILE          COM_PREFIX"unpack.remove.packfile"
+
+
+// Called from unpacker layers
+#define _CHECK_DO(t,x)          { if (t) {x;} }
+
+#define CHECK                   _CHECK_DO(aborting(), return)
+#define CHECK_(y)               _CHECK_DO(aborting(), return y)
+#define CHECK_0                 _CHECK_DO(aborting(), return 0)
+
+#define CHECK_COUNT(t)          if (t < 0){abort("bad value count");} CHECK
+
+#define STR_TRUE   "true"
+#define STR_FALSE  "false"
+
+#define STR_TF(x)  ((x) ?  STR_TRUE : STR_FALSE)
+#define BOOL_TF(x) (((x) != null && strcmp((x),STR_TRUE) == 0) ? true : false)
+
+#define DEFAULT_ARCHIVE_MODTIME 1060000000 // Aug 04, 2003 5:26 PM PDT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,5215 @@
+/*
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+// -*- C++ -*-
+// Program for unpacking specially compressed Java packages.
+// John R. Rose
+
+/*
+ * When compiling for a 64bit LP64 system (longs and pointers being 64bits),
+ *    the printf format %ld is correct and use of %lld will cause warning
+ *    errors from some compilers (gcc/g++).
+ * _LP64 can be explicitly set (used on Linux).
+ * Should be checking for the Visual C++ since the _LP64 is set on the 64-bit
+ * systems but the correct format prefix for 64-bit integers is ll.
+ * Solaris compilers will define __sparcv9 or __x86_64 on 64bit compilations.
+ */
+#if !defined (_MSC_VER) && \
+    (defined(_LP64) || defined(__sparcv9) || defined(__x86_64))
+  #define LONG_LONG_FORMAT "%ld"
+  #define LONG_LONG_HEX_FORMAT "%lx"
+#else
+  #define LONG_LONG_FORMAT "%lld"
+  #define LONG_LONG_HEX_FORMAT "%016llx"
+#endif
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include <limits.h>
+#include <time.h>
+
+
+
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+#include "coding.h"
+#include "bands.h"
+
+#include "constants.h"
+
+#include "zip.h"
+
+#include "unpack.h"
+
+
+// tags, in canonical order:
+static const byte TAGS_IN_ORDER[] = {
+  CONSTANT_Utf8,
+  CONSTANT_Integer,
+  CONSTANT_Float,
+  CONSTANT_Long,
+  CONSTANT_Double,
+  CONSTANT_String,
+  CONSTANT_Class,
+  CONSTANT_Signature,
+  CONSTANT_NameandType,
+  CONSTANT_Fieldref,
+  CONSTANT_Methodref,
+  CONSTANT_InterfaceMethodref,
+  // constants defined as of JDK 7
+  CONSTANT_MethodHandle,
+  CONSTANT_MethodType,
+  CONSTANT_BootstrapMethod,
+  CONSTANT_InvokeDynamic
+};
+#define N_TAGS_IN_ORDER (sizeof TAGS_IN_ORDER)
+
+#ifndef PRODUCT
+static const char* TAG_NAME[] = {
+  "*None",
+  "Utf8",
+  "*Unicode",
+  "Integer",
+  "Float",
+  "Long",
+  "Double",
+  "Class",
+  "String",
+  "Fieldref",
+  "Methodref",
+  "InterfaceMethodref",
+  "NameandType",
+  "*Signature",
+  "unused14",
+  "MethodHandle",
+  "MethodType",
+  "*BootstrapMethod",
+  "InvokeDynamic",
+  0
+};
+
+static const char* ATTR_CONTEXT_NAME[] = {  // match ATTR_CONTEXT_NAME, etc.
+  "class", "field", "method", "code"
+};
+
+#else
+
+#define ATTR_CONTEXT_NAME ((const char**)null)
+
+#endif
+
+// Note that REQUESTED_LDC comes first, then the normal REQUESTED,
+// in the regular constant pool.
+enum { REQUESTED_NONE = -1,
+       // The codes below REQUESTED_NONE are in constant pool output order,
+       // for the sake of outputEntry_cmp:
+       REQUESTED_LDC = -99, REQUESTED
+};
+
+#define NO_INORD ((uint)-1)
+
+struct entry {
+  byte tag;
+
+  #if 0
+  byte bits;
+  enum {
+    //EB_EXTRA = 1,
+    EB_SUPER = 2
+  };
+  #endif
+  unsigned short nrefs;  // pack w/ tag
+
+  int  outputIndex;
+  uint inord;   // &cp.entries[cp.tag_base[this->tag]+this->inord] == this
+
+  entry* *refs;
+
+  // put last to pack best
+  union {
+    bytes b;
+    int i;
+    jlong l;
+  } value;
+
+  void requestOutputIndex(cpool& cp, int req = REQUESTED);
+  int getOutputIndex() {
+    assert(outputIndex > REQUESTED_NONE);
+    return outputIndex;
+  }
+
+  entry* ref(int refnum) {
+    assert((uint)refnum < nrefs);
+    return refs[refnum];
+  }
+
+  const char* utf8String() {
+    assert(tagMatches(CONSTANT_Utf8));
+    assert(value.b.len == strlen((const char*)value.b.ptr));
+    return (const char*)value.b.ptr;
+  }
+
+  entry* className() {
+    assert(tagMatches(CONSTANT_Class));
+    return ref(0);
+  }
+
+  entry* memberClass() {
+    assert(tagMatches(CONSTANT_AnyMember));
+    return ref(0);
+  }
+
+  entry* memberDescr() {
+    assert(tagMatches(CONSTANT_AnyMember));
+    return ref(1);
+  }
+
+  entry* descrName() {
+    assert(tagMatches(CONSTANT_NameandType));
+    return ref(0);
+  }
+
+  entry* descrType() {
+    assert(tagMatches(CONSTANT_NameandType));
+    return ref(1);
+  }
+
+  int typeSize();
+
+  bytes& asUtf8();
+  int    asInteger() { assert(tag == CONSTANT_Integer); return value.i; }
+
+  bool isUtf8(bytes& b) { return tagMatches(CONSTANT_Utf8) && value.b.equals(b); }
+
+  bool isDoubleWord() { return tag == CONSTANT_Double || tag == CONSTANT_Long; }
+
+  bool tagMatches(byte tag2) {
+    return (tag2 == tag)
+      || (tag2 == CONSTANT_Utf8 && tag == CONSTANT_Signature)
+      #ifndef PRODUCT
+      || (tag2 == CONSTANT_FieldSpecific
+          && tag >= CONSTANT_Integer && tag <= CONSTANT_String && tag != CONSTANT_Class)
+      || (tag2 == CONSTANT_AnyMember
+          && tag >= CONSTANT_Fieldref && tag <= CONSTANT_InterfaceMethodref)
+      #endif
+      ;
+  }
+
+#ifdef PRODUCT
+  char* string() { return 0; }
+#else
+  char* string();  // see far below
+#endif
+};
+
+entry* cpindex::get(uint i) {
+  if (i >= len)
+    return null;
+  else if (base1 != null)
+    // primary index
+    return &base1[i];
+  else
+    // secondary index
+    return base2[i];
+}
+
+inline bytes& entry::asUtf8() {
+  assert(tagMatches(CONSTANT_Utf8));
+  return value.b;
+}
+
+int entry::typeSize() {
+  assert(tagMatches(CONSTANT_Utf8));
+  const char* sigp = (char*) value.b.ptr;
+  switch (*sigp) {
+  case '(': sigp++; break;  // skip opening '('
+  case 'D':
+  case 'J': return 2; // double field
+  default:  return 1; // field
+  }
+  int siglen = 0;
+  for (;;) {
+    int ch = *sigp++;
+    switch (ch) {
+    case 'D': case 'J':
+      siglen += 1;
+      break;
+    case '[':
+      // Skip rest of array info.
+      while (ch == '[') { ch = *sigp++; }
+      if (ch != 'L')  break;
+      // else fall through
+    case 'L':
+      sigp = strchr(sigp, ';');
+      if (sigp == null) {
+          unpack_abort("bad data");
+          return 0;
+      }
+      sigp += 1;
+      break;
+    case ')':  // closing ')'
+      return siglen;
+    }
+    siglen += 1;
+  }
+}
+
+inline cpindex* cpool::getFieldIndex(entry* classRef) {
+  if (classRef == NULL) { abort("missing class reference"); return NULL; }
+  assert(classRef->tagMatches(CONSTANT_Class));
+  assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
+  return &member_indexes[classRef->inord*2+0];
+}
+inline cpindex* cpool::getMethodIndex(entry* classRef) {
+  if (classRef == NULL) { abort("missing class reference"); return NULL; }
+  assert(classRef->tagMatches(CONSTANT_Class));
+  assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
+  return &member_indexes[classRef->inord*2+1];
+}
+
+struct inner_class {
+  entry* inner;
+  entry* outer;
+  entry* name;
+  int    flags;
+  inner_class* next_sibling;
+  bool   requested;
+};
+
+// Here is where everything gets deallocated:
+void unpacker::free() {
+  int i;
+  assert(jniobj == null); // caller resp.
+  assert(infileptr == null);  // caller resp.
+  if (jarout != null)  jarout->reset();
+  if (gzin != null)    { gzin->free(); gzin = null; }
+  if (free_input)  input.free();
+  // free everybody ever allocated with U_NEW or (recently) with T_NEW
+  assert(smallbuf.base()  == null || mallocs.contains(smallbuf.base()));
+  assert(tsmallbuf.base() == null || tmallocs.contains(tsmallbuf.base()));
+  mallocs.freeAll();
+  tmallocs.freeAll();
+  smallbuf.init();
+  tsmallbuf.init();
+  bcimap.free();
+  class_fixup_type.free();
+  class_fixup_offset.free();
+  class_fixup_ref.free();
+  code_fixup_type.free();
+  code_fixup_offset.free();
+  code_fixup_source.free();
+  requested_ics.free();
+  cp.requested_bsms.free();
+  cur_classfile_head.free();
+  cur_classfile_tail.free();
+  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
+    attr_defs[i].free();
+
+  // free CP state
+  cp.outputEntries.free();
+  for (i = 0; i < CONSTANT_Limit; i++)
+    cp.tag_extras[i].free();
+}
+
+// input handling
+// Attempts to advance rplimit so that (rplimit-rp) is at least 'more'.
+// Will eagerly read ahead by larger chunks, if possible.
+// Returns false if (rplimit-rp) is not at least 'more',
+// unless rplimit hits input.limit().
+bool unpacker::ensure_input(jlong more) {
+  julong want = more - input_remaining();
+  if ((jlong)want <= 0)          return true;  // it's already in the buffer
+  if (rplimit == input.limit())  return true;  // not expecting any more
+
+  if (read_input_fn == null) {
+    // assume it is already all there
+    bytes_read += input.limit() - rplimit;
+    rplimit = input.limit();
+    return true;
+  }
+  CHECK_0;
+
+  julong remaining = (input.limit() - rplimit);  // how much left to read?
+  byte* rpgoal = (want >= remaining)? input.limit(): rplimit + (size_t)want;
+  enum { CHUNK_SIZE = (1<<14) };
+  julong fetch = want;
+  if (fetch < CHUNK_SIZE)
+    fetch = CHUNK_SIZE;
+  if (fetch > remaining*3/4)
+    fetch = remaining;
+  // Try to fetch at least "more" bytes.
+  while ((jlong)fetch > 0) {
+    jlong nr = (*read_input_fn)(this, rplimit, fetch, remaining);
+    if (nr <= 0) {
+      return (rplimit >= rpgoal);
+    }
+    remaining -= nr;
+    rplimit += nr;
+    fetch -= nr;
+    bytes_read += nr;
+    assert(remaining == (julong)(input.limit() - rplimit));
+  }
+  return true;
+}
+
+// output handling
+
+fillbytes* unpacker::close_output(fillbytes* which) {
+  assert(wp != null);
+  if (which == null) {
+    if (wpbase == cur_classfile_head.base()) {
+      which = &cur_classfile_head;
+    } else {
+      which = &cur_classfile_tail;
+    }
+  }
+  assert(wpbase  == which->base());
+  assert(wplimit == which->end());
+  which->setLimit(wp);
+  wp      = null;
+  wplimit = null;
+  //wpbase = null;
+  return which;
+}
+
+//maybe_inline
+void unpacker::ensure_put_space(size_t size) {
+  if (wp + size <= wplimit)  return;
+  // Determine which segment needs expanding.
+  fillbytes* which = close_output();
+  byte* wp0 = which->grow(size);
+  wpbase  = which->base();
+  wplimit = which->end();
+  wp = wp0;
+}
+
+maybe_inline
+byte* unpacker::put_space(size_t size) {
+  byte* wp0 = wp;
+  byte* wp1 = wp0 + size;
+  if (wp1 > wplimit) {
+    ensure_put_space(size);
+    wp0 = wp;
+    wp1 = wp0 + size;
+  }
+  wp = wp1;
+  return wp0;
+}
+
+maybe_inline
+void unpacker::putu2_at(byte* wp, int n) {
+  if (n != (unsigned short)n) {
+    unpack_abort(ERROR_OVERFLOW);
+    return;
+  }
+  wp[0] = (n) >> 8;
+  wp[1] = (n) >> 0;
+}
+
+maybe_inline
+void unpacker::putu4_at(byte* wp, int n) {
+  wp[0] = (n) >> 24;
+  wp[1] = (n) >> 16;
+  wp[2] = (n) >> 8;
+  wp[3] = (n) >> 0;
+}
+
+maybe_inline
+void unpacker::putu8_at(byte* wp, jlong n) {
+  putu4_at(wp+0, (int)((julong)n >> 32));
+  putu4_at(wp+4, (int)((julong)n >> 0));
+}
+
+maybe_inline
+void unpacker::putu2(int n) {
+  putu2_at(put_space(2), n);
+}
+
+maybe_inline
+void unpacker::putu4(int n) {
+  putu4_at(put_space(4), n);
+}
+
+maybe_inline
+void unpacker::putu8(jlong n) {
+  putu8_at(put_space(8), n);
+}
+
+maybe_inline
+int unpacker::putref_index(entry* e, int size) {
+  if (e == null)
+    return 0;
+  else if (e->outputIndex > REQUESTED_NONE)
+    return e->outputIndex;
+  else if (e->tag == CONSTANT_Signature)
+    return putref_index(e->ref(0), size);
+  else {
+    e->requestOutputIndex(cp, (size == 1 ? REQUESTED_LDC : REQUESTED));
+    // Later on we'll fix the bits.
+    class_fixup_type.addByte(size);
+    class_fixup_offset.add((int)wpoffset());
+    class_fixup_ref.add(e);
+#ifdef PRODUCT
+    return 0;
+#else
+    return 0x20+size;  // 0x22 is easy to eyeball
+#endif
+  }
+}
+
+maybe_inline
+void unpacker::putref(entry* e) {
+  int oidx = putref_index(e, 2);
+  putu2_at(put_space(2), oidx);
+}
+
+maybe_inline
+void unpacker::putu1ref(entry* e) {
+  int oidx = putref_index(e, 1);
+  putu1_at(put_space(1), oidx);
+}
+
+
+static int total_cp_size[] = {0, 0};
+static int largest_cp_ref[] = {0, 0};
+static int hash_probes[] = {0, 0};
+
+// Allocation of small and large blocks.
+
+enum { CHUNK = (1 << 14), SMALL = (1 << 9) };
+
+// Call malloc.  Try to combine small blocks and free much later.
+void* unpacker::alloc_heap(size_t size, bool smallOK, bool temp) {
+  if (!smallOK || size > SMALL) {
+    void* res = must_malloc((int)size);
+    (temp ? &tmallocs : &mallocs)->add(res);
+    return res;
+  }
+  fillbytes& xsmallbuf = *(temp ? &tsmallbuf : &smallbuf);
+  if (!xsmallbuf.canAppend(size+1)) {
+    xsmallbuf.init(CHUNK);
+    (temp ? &tmallocs : &mallocs)->add(xsmallbuf.base());
+  }
+  int growBy = (int)size;
+  growBy += -growBy & 7;  // round up mod 8
+  return xsmallbuf.grow(growBy);
+}
+
+maybe_inline
+void unpacker::saveTo(bytes& b, byte* ptr, size_t len) {
+  b.ptr = U_NEW(byte, add_size(len,1));
+  if (aborting()) {
+    b.len = 0;
+    return;
+  }
+  b.len = len;
+  b.copyFrom(ptr, len);
+}
+
+bool testBit(int archive_options, int bitMask) {
+    return (archive_options & bitMask) != 0;
+}
+
+// Read up through band_headers.
+// Do the archive_size dance to set the size of the input mega-buffer.
+void unpacker::read_file_header() {
+  // Read file header to determine file type and total size.
+  enum {
+    MAGIC_BYTES = 4,
+    AH_LENGTH_0 = 3,  // archive_header_0 = {minver, majver, options}
+    AH_LENGTH_MIN = 15, // observed in spec {header_0[3], cp_counts[8], class_counts[4]}
+    AH_LENGTH_0_MAX = AH_LENGTH_0 + 1,  // options might have 2 bytes
+    AH_LENGTH   = 30, //maximum archive header length (w/ all fields)
+    // Length contributions from optional header fields:
+    AH_LENGTH_S = 2, // archive_header_S = optional {size_hi, size_lo}
+    AH_ARCHIVE_SIZE_HI = 0, // offset in archive_header_S
+    AH_ARCHIVE_SIZE_LO = 1, // offset in archive_header_S
+    AH_FILE_HEADER_LEN = 5, // file_counts = {{size_hi, size_lo), next, modtile, files}
+    AH_SPECIAL_FORMAT_LEN = 2, // special_count = {layouts, band_headers}
+    AH_CP_NUMBER_LEN = 4,      // cp_number_counts = {int, float, long, double}
+    AH_CP_EXTRA_LEN = 4,        // cp_attr_counts = {MH, MT, InDy, BSM}
+    ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S,
+    FIRST_READ  = MAGIC_BYTES + AH_LENGTH_MIN
+  };
+
+  assert(AH_LENGTH_MIN    == 15); // # of UNSIGNED5 fields required after archive_magic
+  // An absolute minimum null archive is magic[4], {minver,majver,options}[3],
+  // archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes.
+  // (Note that archive_size is optional; it may be 0..10 bytes in length.)
+  // The first read must capture everything up through the options field.
+  // This happens to work even if {minver,majver,options} is a pathological
+  // 15 bytes long.  Legal pack files limit those three fields to 1+1+2 bytes.
+  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0 * B_MAX);
+
+  // Up through archive_size, the largest possible archive header is
+  // magic[4], {minver,majver,options}[4], archive_size[10].
+  // (Note only the low 12 bits of options are allowed to be non-zero.)
+  // In order to parse archive_size, we need at least this many bytes
+  // in the first read.  Of course, if archive_size_hi is more than
+  // a byte, we probably will fail to allocate the buffer, since it
+  // will be many gigabytes long.  This is a practical, not an
+  // architectural limit to Pack200 archive sizes.
+  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0_MAX + 2*B_MAX);
+
+  bool foreign_buf = (read_input_fn == null);
+  byte initbuf[(int)FIRST_READ + (int)C_SLOP + 200];  // 200 is for JAR I/O
+  if (foreign_buf) {
+    // inbytes is all there is
+    input.set(inbytes);
+    rp      = input.base();
+    rplimit = input.limit();
+  } else {
+    // inbytes, if not empty, contains some read-ahead we must use first
+    // ensure_input will take care of copying it into initbuf,
+    // then querying read_input_fn for any additional data needed.
+    // However, the caller must assume that we use up all of inbytes.
+    // There is no way to tell the caller that we used only part of them.
+    // Therefore, the caller must use only a bare minimum of read-ahead.
+    if (inbytes.len > FIRST_READ) {
+      abort("too much read-ahead");
+      return;
+    }
+    input.set(initbuf, sizeof(initbuf));
+    input.b.clear();
+    input.b.copyFrom(inbytes);
+    rplimit = rp = input.base();
+    rplimit += inbytes.len;
+    bytes_read += inbytes.len;
+  }
+  // Read only 19 bytes, which is certain to contain #archive_options fields,
+  // but is certain not to overflow past the archive_header.
+  input.b.len = FIRST_READ;
+  if (!ensure_input(FIRST_READ))
+    abort("EOF reading archive magic number");
+
+  if (rp[0] == 'P' && rp[1] == 'K') {
+#ifdef UNPACK_JNI
+    // Java driver must handle this case before we get this far.
+    abort("encountered a JAR header in unpacker");
+#else
+    // In the Unix-style program, we simply simulate a copy command.
+    // Copy until EOF; assume the JAR file is the last segment.
+    fprintf(errstrm, "Copy-mode.\n");
+    for (;;) {
+      jarout->write_data(rp, (int)input_remaining());
+      if (foreign_buf)
+        break;  // one-time use of a passed in buffer
+      if (input.size() < CHUNK) {
+        // Get some breathing room.
+        input.set(U_NEW(byte, (size_t) CHUNK + C_SLOP), (size_t) CHUNK);
+        CHECK;
+      }
+      rp = rplimit = input.base();
+      if (!ensure_input(1))
+        break;
+    }
+    jarout->closeJarFile(false);
+#endif
+    return;
+  }
+
+  // Read the magic number.
+  magic = 0;
+  for (int i1 = 0; i1 < (int)sizeof(magic); i1++) {
+    magic <<= 8;
+    magic += (*rp++ & 0xFF);
+  }
+
+  // Read the first 3 values from the header.
+  value_stream hdr;
+  int          hdrVals = 0;
+  int          hdrValsSkipped = 0;  // for assert
+  hdr.init(rp, rplimit, UNSIGNED5_spec);
+  minver = hdr.getInt();
+  majver = hdr.getInt();
+  hdrVals += 2;
+
+  int majmin[4][2] = {
+      {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION},
+      {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION},
+      {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION},
+      {JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION}
+  };
+  int majminfound = false;
+  for (int i = 0 ; i < 4 ; i++) {
+      if (majver == majmin[i][0] && minver == majmin[i][1]) {
+          majminfound = true;
+          break;
+      }
+  }
+  if (majminfound == null) {
+    char message[200];
+    sprintf(message, "@" ERROR_FORMAT ": magic/ver = "
+            "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n",
+            magic, majver, minver,
+            JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION,
+            JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION,
+            JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION,
+            JAVA_PACKAGE_MAGIC, JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION);
+    abort(message);
+  }
+  CHECK;
+
+  archive_options = hdr.getInt();
+  hdrVals += 1;
+  assert(hdrVals == AH_LENGTH_0);  // first three fields only
+  bool haveSizeHi = testBit(archive_options, AO_HAVE_FILE_SIZE_HI);
+  bool haveModTime = testBit(archive_options, AO_HAVE_FILE_MODTIME);
+  bool haveFileOpt = testBit(archive_options, AO_HAVE_FILE_OPTIONS);
+
+  bool haveSpecial = testBit(archive_options, AO_HAVE_SPECIAL_FORMATS);
+  bool haveFiles = testBit(archive_options, AO_HAVE_FILE_HEADERS);
+  bool haveNumbers = testBit(archive_options, AO_HAVE_CP_NUMBERS);
+  bool haveCPExtra = testBit(archive_options, AO_HAVE_CP_EXTRAS);
+
+  if (majver < JAVA7_PACKAGE_MAJOR_VERSION) {
+    if (haveCPExtra) {
+        abort("Format bits for Java 7 must be zero in previous releases");
+        return;
+    }
+  }
+  if (testBit(archive_options, AO_UNUSED_MBZ)) {
+    abort("High archive option bits are reserved and must be zero");
+    return;
+  }
+  if (haveFiles) {
+    uint hi = hdr.getInt();
+    uint lo = hdr.getInt();
+    julong x = band::makeLong(hi, lo);
+    archive_size = (size_t) x;
+    if (archive_size != x) {
+      // Silly size specified; force overflow.
+      archive_size = PSIZE_MAX+1;
+    }
+    hdrVals += 2;
+  } else {
+    hdrValsSkipped += 2;
+  }
+
+  // Now we can size the whole archive.
+  // Read everything else into a mega-buffer.
+  rp = hdr.rp;
+  int header_size_0 = (int)(rp - input.base()); // used-up header (4byte + 3int)
+  int header_size_1 = (int)(rplimit - rp);      // buffered unused initial fragment
+  int header_size   = header_size_0+header_size_1;
+  unsized_bytes_read = header_size_0;
+  CHECK;
+  if (foreign_buf) {
+    if (archive_size > (size_t)header_size_1) {
+      abort("EOF reading fixed input buffer");
+      return;
+    }
+  } else if (archive_size != 0) {
+    if (archive_size < ARCHIVE_SIZE_MIN) {
+      abort("impossible archive size");  // bad input data
+      return;
+    }
+    if (archive_size < header_size_1) {
+      abort("too much read-ahead");  // somehow we pre-fetched too much?
+      return;
+    }
+    input.set(U_NEW(byte, add_size(header_size_0, archive_size, C_SLOP)),
+              (size_t) header_size_0 + archive_size);
+    CHECK;
+    assert(input.limit()[0] == 0);
+    // Move all the bytes we read initially into the real buffer.
+    input.b.copyFrom(initbuf, header_size);
+    rp      = input.b.ptr + header_size_0;
+    rplimit = input.b.ptr + header_size;
+  } else {
+    // It's more complicated and painful.
+    // A zero archive_size means that we must read until EOF.
+    input.init(CHUNK*2);
+    CHECK;
+    input.b.len = input.allocated;
+    rp = rplimit = input.base();
+    // Set up input buffer as if we already read the header:
+    input.b.copyFrom(initbuf, header_size);
+    CHECK;
+    rplimit += header_size;
+    while (ensure_input(input.limit() - rp)) {
+      size_t dataSoFar = input_remaining();
+      size_t nextSize = add_size(dataSoFar, CHUNK);
+      input.ensureSize(nextSize);
+      CHECK;
+      input.b.len = input.allocated;
+      rp = rplimit = input.base();
+      rplimit += dataSoFar;
+    }
+    size_t dataSize = (rplimit - input.base());
+    input.b.len = dataSize;
+    input.grow(C_SLOP);
+    CHECK;
+    free_input = true;  // free it later
+    input.b.len = dataSize;
+    assert(input.limit()[0] == 0);
+    rp = rplimit = input.base();
+    rplimit += dataSize;
+    rp += header_size_0;  // already scanned these bytes...
+  }
+  live_input = true;    // mark as "do not reuse"
+  if (aborting()) {
+    abort("cannot allocate large input buffer for package file");
+    return;
+  }
+
+  // read the rest of the header fields  int assertSkipped = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
+  int remainingHeaders = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
+  if (haveSpecial)
+    remainingHeaders += AH_SPECIAL_FORMAT_LEN;
+  if (haveFiles)
+     remainingHeaders += AH_FILE_HEADER_LEN;
+  if (haveNumbers)
+    remainingHeaders += AH_CP_NUMBER_LEN;
+  if (haveCPExtra)
+    remainingHeaders += AH_CP_EXTRA_LEN;
+
+  ensure_input(remainingHeaders * B_MAX);
+  CHECK;
+  hdr.rp      = rp;
+  hdr.rplimit = rplimit;
+
+  if (haveFiles) {
+    archive_next_count = hdr.getInt();
+    CHECK_COUNT(archive_next_count);
+    archive_modtime = hdr.getInt();
+    file_count = hdr.getInt();
+    CHECK_COUNT(file_count);
+    hdrVals += 3;
+  } else {
+    hdrValsSkipped += 3;
+  }
+
+  if (haveSpecial) {
+    band_headers_size = hdr.getInt();
+    CHECK_COUNT(band_headers_size);
+    attr_definition_count = hdr.getInt();
+    CHECK_COUNT(attr_definition_count);
+    hdrVals += 2;
+  } else {
+    hdrValsSkipped += 2;
+  }
+
+  int cp_counts[N_TAGS_IN_ORDER];
+  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
+    if (!haveNumbers) {
+      switch (TAGS_IN_ORDER[k]) {
+      case CONSTANT_Integer:
+      case CONSTANT_Float:
+      case CONSTANT_Long:
+      case CONSTANT_Double:
+        cp_counts[k] = 0;
+        hdrValsSkipped += 1;
+        continue;
+      }
+    }
+    if (!haveCPExtra) {
+        switch(TAGS_IN_ORDER[k]) {
+        case CONSTANT_MethodHandle:
+        case CONSTANT_MethodType:
+        case CONSTANT_InvokeDynamic:
+        case CONSTANT_BootstrapMethod:
+          cp_counts[k] = 0;
+          hdrValsSkipped += 1;
+          continue;
+        }
+    }
+    cp_counts[k] = hdr.getInt();
+    CHECK_COUNT(cp_counts[k]);
+    hdrVals += 1;
+  }
+
+  ic_count = hdr.getInt();
+  CHECK_COUNT(ic_count);
+  default_class_minver = hdr.getInt();
+  default_class_majver = hdr.getInt();
+  class_count = hdr.getInt();
+  CHECK_COUNT(class_count);
+  hdrVals += 4;
+
+  // done with archive_header, time to reconcile to ensure
+  // we have read everything correctly
+  hdrVals += hdrValsSkipped;
+  assert(hdrVals == AH_LENGTH);
+  rp = hdr.rp;
+  if (rp > rplimit)
+    abort("EOF reading archive header");
+
+  // Now size the CP.
+#ifndef PRODUCT
+  // bool x = (N_TAGS_IN_ORDER == CONSTANT_Limit);
+  // assert(x);
+#endif //PRODUCT
+  cp.init(this, cp_counts);
+  CHECK;
+
+  default_file_modtime = archive_modtime;
+  if (default_file_modtime == 0 && haveModTime)
+    default_file_modtime = DEFAULT_ARCHIVE_MODTIME;  // taken from driver
+  if (testBit(archive_options, AO_DEFLATE_HINT))
+    default_file_options |= FO_DEFLATE_HINT;
+
+  // meta-bytes, if any, immediately follow archive header
+  //band_headers.readData(band_headers_size);
+  ensure_input(band_headers_size);
+  if (input_remaining() < (size_t)band_headers_size) {
+    abort("EOF reading band headers");
+    return;
+  }
+  bytes band_headers;
+  // The "1+" allows an initial byte to be pushed on the front.
+  band_headers.set(1+U_NEW(byte, 1+band_headers_size+C_SLOP),
+                   band_headers_size);
+  CHECK;
+  // Start scanning band headers here:
+  band_headers.copyFrom(rp, band_headers.len);
+  rp += band_headers.len;
+  assert(rp <= rplimit);
+  meta_rp = band_headers.ptr;
+  // Put evil meta-codes at the end of the band headers,
+  // so we are sure to throw an error if we run off the end.
+  bytes::of(band_headers.limit(), C_SLOP).clear(_meta_error);
+}
+
+void unpacker::finish() {
+  if (verbose >= 1) {
+    fprintf(errstrm,
+            "A total of "
+            LONG_LONG_FORMAT " bytes were read in %d segment(s).\n",
+            (bytes_read_before_reset+bytes_read),
+            segments_read_before_reset+1);
+    fprintf(errstrm,
+            "A total of "
+            LONG_LONG_FORMAT " file content bytes were written.\n",
+            (bytes_written_before_reset+bytes_written));
+    fprintf(errstrm,
+            "A total of %d files (of which %d are classes) were written to output.\n",
+            files_written_before_reset+files_written,
+            classes_written_before_reset+classes_written);
+  }
+  if (jarout != null)
+    jarout->closeJarFile(true);
+  if (errstrm != null) {
+    if (errstrm == stdout || errstrm == stderr) {
+      fflush(errstrm);
+    } else {
+      fclose(errstrm);
+    }
+    errstrm = null;
+    errstrm_name = null;
+  }
+}
+
+
+// Cf. PackageReader.readConstantPoolCounts
+void cpool::init(unpacker* u_, int counts[CONSTANT_Limit]) {
+  this->u = u_;
+
+  // Fill-pointer for CP.
+  int next_entry = 0;
+
+  // Size the constant pool:
+  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
+    byte tag = TAGS_IN_ORDER[k];
+    int  len = counts[k];
+    tag_count[tag] = len;
+    tag_base[tag] = next_entry;
+    next_entry += len;
+    // Detect and defend against constant pool size overflow.
+    // (Pack200 forbids the sum of CP counts to exceed 2^29-1.)
+    enum {
+      CP_SIZE_LIMIT = (1<<29),
+      IMPLICIT_ENTRY_COUNT = 1  // empty Utf8 string
+    };
+    if (len >= (1<<29) || len < 0
+        || next_entry >= CP_SIZE_LIMIT+IMPLICIT_ENTRY_COUNT) {
+      abort("archive too large:  constant pool limit exceeded");
+      return;
+    }
+  }
+
+  // Close off the end of the CP:
+  nentries = next_entry;
+
+  // place a limit on future CP growth:
+  int generous = 0;
+  generous = add_size(generous, u->ic_count); // implicit name
+  generous = add_size(generous, u->ic_count); // outer
+  generous = add_size(generous, u->ic_count); // outer.utf8
+  generous = add_size(generous, 40); // WKUs, misc
+  generous = add_size(generous, u->class_count); // implicit SourceFile strings
+  maxentries = add_size(nentries, generous);
+
+  // Note that this CP does not include "empty" entries
+  // for longs and doubles.  Those are introduced when
+  // the entries are renumbered for classfile output.
+
+  entries = U_NEW(entry, maxentries);
+  CHECK;
+
+  first_extra_entry = &entries[nentries];
+
+  // Initialize the standard indexes.
+  for (int tag = 0; tag < CONSTANT_Limit; tag++) {
+    entry* cpMap = &entries[tag_base[tag]];
+    tag_index[tag].init(tag_count[tag], cpMap, tag);
+  }
+
+  // Initialize *all* our entries once
+  for (int i = 0 ; i < maxentries ; i++)
+    entries[i].outputIndex = REQUESTED_NONE;
+
+  initGroupIndexes();
+  // Initialize hashTab to a generous power-of-two size.
+  uint pow2 = 1;
+  uint target = maxentries + maxentries/2;  // 60% full
+  while (pow2 < target)  pow2 <<= 1;
+  hashTab = U_NEW(entry*, hashTabLength = pow2);
+}
+
+static byte* store_Utf8_char(byte* cp, unsigned short ch) {
+  if (ch >= 0x001 && ch <= 0x007F) {
+    *cp++ = (byte) ch;
+  } else if (ch <= 0x07FF) {
+    *cp++ = (byte) (0xC0 | ((ch >>  6) & 0x1F));
+    *cp++ = (byte) (0x80 | ((ch >>  0) & 0x3F));
+  } else {
+    *cp++ = (byte) (0xE0 | ((ch >> 12) & 0x0F));
+    *cp++ = (byte) (0x80 | ((ch >>  6) & 0x3F));
+    *cp++ = (byte) (0x80 | ((ch >>  0) & 0x3F));
+  }
+  return cp;
+}
+
+static byte* skip_Utf8_chars(byte* cp, int len) {
+  for (;; cp++) {
+    int ch = *cp & 0xFF;
+    if ((ch & 0xC0) != 0x80) {
+      if (len-- == 0)
+        return cp;
+      if (ch < 0x80 && len == 0)
+        return cp+1;
+    }
+  }
+}
+
+static int compare_Utf8_chars(bytes& b1, bytes& b2) {
+  int l1 = (int)b1.len;
+  int l2 = (int)b2.len;
+  int l0 = (l1 < l2) ? l1 : l2;
+  byte* p1 = b1.ptr;
+  byte* p2 = b2.ptr;
+  int c0 = 0;
+  for (int i = 0; i < l0; i++) {
+    int c1 = p1[i] & 0xFF;
+    int c2 = p2[i] & 0xFF;
+    if (c1 != c2) {
+      // Before returning the obvious answer,
+      // check to see if c1 or c2 is part of a 0x0000,
+      // which encodes as {0xC0,0x80}.  The 0x0000 is the
+      // lowest-sorting Java char value, and yet it encodes
+      // as if it were the first char after 0x7F, which causes
+      // strings containing nulls to sort too high.  All other
+      // comparisons are consistent between Utf8 and Java chars.
+      if (c1 == 0xC0 && (p1[i+1] & 0xFF) == 0x80)  c1 = 0;
+      if (c2 == 0xC0 && (p2[i+1] & 0xFF) == 0x80)  c2 = 0;
+      if (c0 == 0xC0) {
+        assert(((c1|c2) & 0xC0) == 0x80);  // c1 & c2 are extension chars
+        if (c1 == 0x80)  c1 = 0;  // will sort below c2
+        if (c2 == 0x80)  c2 = 0;  // will sort below c1
+      }
+      return c1 - c2;
+    }
+    c0 = c1;  // save away previous char
+  }
+  // common prefix is identical; return length difference if any
+  return l1 - l2;
+}
+
+// Cf. PackageReader.readUtf8Bands
+local_inline
+void unpacker::read_Utf8_values(entry* cpMap, int len) {
+  // Implicit first Utf8 string is the empty string.
+  enum {
+    // certain bands begin with implicit zeroes
+    PREFIX_SKIP_2 = 2,
+    SUFFIX_SKIP_1 = 1
+  };
+
+  int i;
+
+  // First band:  Read lengths of shared prefixes.
+  if (len > PREFIX_SKIP_2)
+    cp_Utf8_prefix.readData(len - PREFIX_SKIP_2);
+    NOT_PRODUCT(else cp_Utf8_prefix.readData(0));  // for asserts
+
+  // Second band:  Read lengths of unshared suffixes:
+  if (len > SUFFIX_SKIP_1)
+    cp_Utf8_suffix.readData(len - SUFFIX_SKIP_1);
+    NOT_PRODUCT(else cp_Utf8_suffix.readData(0));  // for asserts
+
+  bytes* allsuffixes = T_NEW(bytes, len);
+  CHECK;
+
+  int nbigsuf = 0;
+  fillbytes charbuf;    // buffer to allocate small strings
+  charbuf.init();
+
+  // Third band:  Read the char values in the unshared suffixes:
+  cp_Utf8_chars.readData(cp_Utf8_suffix.getIntTotal());
+  for (i = 0; i < len; i++) {
+    int suffix = (i < SUFFIX_SKIP_1)? 0: cp_Utf8_suffix.getInt();
+    if (suffix < 0) {
+      abort("bad utf8 suffix");
+      return;
+    }
+    if (suffix == 0 && i >= SUFFIX_SKIP_1) {
+      // chars are packed in cp_Utf8_big_chars
+      nbigsuf += 1;
+      continue;
+    }
+    bytes& chars  = allsuffixes[i];
+    uint size3    = suffix * 3;     // max Utf8 length
+    bool isMalloc = (suffix > SMALL);
+    if (isMalloc) {
+      chars.malloc(size3);
+    } else {
+      if (!charbuf.canAppend(size3+1)) {
+        assert(charbuf.allocated == 0 || tmallocs.contains(charbuf.base()));
+        charbuf.init(CHUNK);  // Reset to new buffer.
+        tmallocs.add(charbuf.base());
+      }
+      chars.set(charbuf.grow(size3+1), size3);
+    }
+    CHECK;
+    byte* chp = chars.ptr;
+    for (int j = 0; j < suffix; j++) {
+      unsigned short ch = cp_Utf8_chars.getInt();
+      chp = store_Utf8_char(chp, ch);
+    }
+    // shrink to fit:
+    if (isMalloc) {
+      chars.realloc(chp - chars.ptr);
+      CHECK;
+      tmallocs.add(chars.ptr); // free it later
+    } else {
+      int shrink = (int)(chars.limit() - chp);
+      chars.len -= shrink;
+      charbuf.b.len -= shrink;  // ungrow to reclaim buffer space
+      // Note that we did not reclaim the final '\0'.
+      assert(chars.limit() == charbuf.limit()-1);
+      assert(strlen((char*)chars.ptr) == chars.len);
+    }
+  }
+  //cp_Utf8_chars.done();
+#ifndef PRODUCT
+  charbuf.b.set(null, 0); // tidy
+#endif
+
+  // Fourth band:  Go back and size the specially packed strings.
+  int maxlen = 0;
+  cp_Utf8_big_suffix.readData(nbigsuf);
+  cp_Utf8_suffix.rewind();
+  for (i = 0; i < len; i++) {
+    int suffix = (i < SUFFIX_SKIP_1)? 0: cp_Utf8_suffix.getInt();
+    int prefix = (i < PREFIX_SKIP_2)? 0: cp_Utf8_prefix.getInt();
+    if (prefix < 0 || prefix+suffix < 0) {
+       abort("bad utf8 prefix");
+       return;
+    }
+    bytes& chars = allsuffixes[i];
+    if (suffix == 0 && i >= SUFFIX_SKIP_1) {
+      suffix = cp_Utf8_big_suffix.getInt();
+      assert(chars.ptr == null);
+      chars.len = suffix;  // just a momentary hack
+    } else {
+      assert(chars.ptr != null);
+    }
+    if (maxlen < prefix + suffix) {
+      maxlen = prefix + suffix;
+    }
+  }
+  //cp_Utf8_suffix.done();      // will use allsuffixes[i].len (ptr!=null)
+  //cp_Utf8_big_suffix.done();  // will use allsuffixes[i].len
+
+  // Fifth band(s):  Get the specially packed characters.
+  cp_Utf8_big_suffix.rewind();
+  for (i = 0; i < len; i++) {
+    bytes& chars = allsuffixes[i];
+    if (chars.ptr != null)  continue;  // already input
+    int suffix = (int)chars.len;  // pick up the hack
+    uint size3 = suffix * 3;
+    if (suffix == 0)  continue;  // done with empty string
+    chars.malloc(size3);
+    CHECK;
+    byte* chp = chars.ptr;
+    band saved_band = cp_Utf8_big_chars;
+    cp_Utf8_big_chars.readData(suffix);
+    CHECK;
+    for (int j = 0; j < suffix; j++) {
+      unsigned short ch = cp_Utf8_big_chars.getInt();
+      CHECK;
+      chp = store_Utf8_char(chp, ch);
+    }
+    chars.realloc(chp - chars.ptr);
+    CHECK;
+    tmallocs.add(chars.ptr);  // free it later
+    //cp_Utf8_big_chars.done();
+    cp_Utf8_big_chars = saved_band;  // reset the band for the next string
+  }
+  cp_Utf8_big_chars.readData(0);  // zero chars
+  //cp_Utf8_big_chars.done();
+
+  // Finally, sew together all the prefixes and suffixes.
+  bytes bigbuf;
+  bigbuf.malloc(maxlen * 3 + 1);  // max Utf8 length, plus slop for null
+  CHECK;
+  int prevlen = 0;  // previous string length (in chars)
+  tmallocs.add(bigbuf.ptr);  // free after this block
+  CHECK;
+  cp_Utf8_prefix.rewind();
+  for (i = 0; i < len; i++) {
+    bytes& chars = allsuffixes[i];
+    int prefix = (i < PREFIX_SKIP_2)? 0: cp_Utf8_prefix.getInt();
+    CHECK;
+    int suffix = (int)chars.len;
+    byte* fillp;
+    // by induction, the buffer is already filled with the prefix
+    // make sure the prefix value is not corrupted, though:
+    if (prefix > prevlen) {
+       abort("utf8 prefix overflow");
+       return;
+    }
+    fillp = skip_Utf8_chars(bigbuf.ptr, prefix);
+    // copy the suffix into the same buffer:
+    fillp = chars.writeTo(fillp);
+    assert(bigbuf.inBounds(fillp));
+    *fillp = 0;  // bigbuf must contain a well-formed Utf8 string
+    int length = (int)(fillp - bigbuf.ptr);
+    bytes& value = cpMap[i].value.b;
+    value.set(U_NEW(byte, add_size(length,1)), length);
+    value.copyFrom(bigbuf.ptr, length);
+    CHECK;
+    // Index all Utf8 strings
+    entry* &htref = cp.hashTabRef(CONSTANT_Utf8, value);
+    if (htref == null) {
+      // Note that if two identical strings are transmitted,
+      // the first is taken to be the canonical one.
+      htref = &cpMap[i];
+    }
+    prevlen = prefix + suffix;
+  }
+  //cp_Utf8_prefix.done();
+
+  // Free intermediate buffers.
+  free_temps();
+}
+
+local_inline
+void unpacker::read_single_words(band& cp_band, entry* cpMap, int len) {
+  cp_band.readData(len);
+  for (int i = 0; i < len; i++) {
+    cpMap[i].value.i = cp_band.getInt();  // coding handles signs OK
+  }
+}
+
+maybe_inline
+void unpacker::read_double_words(band& cp_bands, entry* cpMap, int len) {
+  band& cp_band_hi = cp_bands;
+  band& cp_band_lo = cp_bands.nextBand();
+  cp_band_hi.readData(len);
+  cp_band_lo.readData(len);
+  for (int i = 0; i < len; i++) {
+    cpMap[i].value.l = cp_band_hi.getLong(cp_band_lo, true);
+  }
+  //cp_band_hi.done();
+  //cp_band_lo.done();
+}
+
+maybe_inline
+void unpacker::read_single_refs(band& cp_band, byte refTag, entry* cpMap, int len) {
+  assert(refTag == CONSTANT_Utf8);
+  cp_band.setIndexByTag(refTag);
+  cp_band.readData(len);
+  CHECK;
+  int indexTag = (cp_band.bn == e_cp_Class) ? CONSTANT_Class : 0;
+  for (int i = 0; i < len; i++) {
+    entry& e = cpMap[i];
+    e.refs = U_NEW(entry*, e.nrefs = 1);
+    entry* utf = cp_band.getRef();
+    CHECK;
+    e.refs[0] = utf;
+    e.value.b = utf->value.b;  // copy value of Utf8 string to self
+    if (indexTag != 0) {
+      // Maintain cross-reference:
+      entry* &htref = cp.hashTabRef(indexTag, e.value.b);
+      if (htref == null) {
+        // Note that if two identical classes are transmitted,
+        // the first is taken to be the canonical one.
+        htref = &e;
+      }
+    }
+  }
+  //cp_band.done();
+}
+
+maybe_inline
+void unpacker::read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag,
+                                entry* cpMap, int len) {
+  band& cp_band1 = cp_band;
+  band& cp_band2 = cp_band.nextBand();
+  cp_band1.setIndexByTag(ref1Tag);
+  cp_band2.setIndexByTag(ref2Tag);
+  cp_band1.readData(len);
+  cp_band2.readData(len);
+  CHECK;
+  for (int i = 0; i < len; i++) {
+    entry& e = cpMap[i];
+    e.refs = U_NEW(entry*, e.nrefs = 2);
+    e.refs[0] = cp_band1.getRef();
+    CHECK;
+    e.refs[1] = cp_band2.getRef();
+    CHECK;
+  }
+  //cp_band1.done();
+  //cp_band2.done();
+}
+
+// Cf. PackageReader.readSignatureBands
+maybe_inline
+void unpacker::read_signature_values(entry* cpMap, int len) {
+  cp_Signature_form.setIndexByTag(CONSTANT_Utf8);
+  cp_Signature_form.readData(len);
+  CHECK;
+  int ncTotal = 0;
+  int i;
+  for (i = 0; i < len; i++) {
+    entry& e = cpMap[i];
+    entry& form = *cp_Signature_form.getRef();
+    CHECK;
+    int nc = 0;
+
+    for ( const char* ncp = form.utf8String() ; *ncp; ncp++) {
+      if (*ncp == 'L')  nc++;
+    }
+
+    ncTotal += nc;
+    e.refs = U_NEW(entry*, cpMap[i].nrefs = 1 + nc);
+    CHECK;
+    e.refs[0] = &form;
+  }
+  //cp_Signature_form.done();
+  cp_Signature_classes.setIndexByTag(CONSTANT_Class);
+  cp_Signature_classes.readData(ncTotal);
+  for (i = 0; i < len; i++) {
+    entry& e = cpMap[i];
+    for (int j = 1; j < e.nrefs; j++) {
+      e.refs[j] = cp_Signature_classes.getRef();
+      CHECK;
+    }
+  }
+  //cp_Signature_classes.done();
+}
+
+maybe_inline
+void unpacker::checkLegacy(const char* name) {
+  if (u->majver < JAVA7_PACKAGE_MAJOR_VERSION) {
+      char message[100];
+      snprintf(message, 99, "unexpected band %s\n", name);
+      abort(message);
+  }
+}
+
+maybe_inline
+void unpacker::read_method_handle(entry* cpMap, int len) {
+  if (len > 0) {
+    checkLegacy(cp_MethodHandle_refkind.name);
+  }
+  cp_MethodHandle_refkind.readData(len);
+  cp_MethodHandle_member.setIndexByTag(CONSTANT_AnyMember);
+  cp_MethodHandle_member.readData(len);
+  for (int i = 0 ; i < len ; i++) {
+    entry& e = cpMap[i];
+    e.value.i = cp_MethodHandle_refkind.getInt();
+    e.refs = U_NEW(entry*, e.nrefs = 1);
+    e.refs[0] = cp_MethodHandle_member.getRef();
+    CHECK;
+  }
+}
+
+maybe_inline
+void unpacker::read_method_type(entry* cpMap, int len) {
+  if (len > 0) {
+    checkLegacy(cp_MethodType.name);
+  }
+  cp_MethodType.setIndexByTag(CONSTANT_Signature);
+  cp_MethodType.readData(len);
+  for (int i = 0 ; i < len ; i++) {
+      entry& e = cpMap[i];
+      e.refs = U_NEW(entry*, e.nrefs = 1);
+      e.refs[0] = cp_MethodType.getRef();
+      CHECK;
+  }
+}
+
+maybe_inline
+void unpacker::read_bootstrap_methods(entry* cpMap, int len) {
+  if (len > 0) {
+    checkLegacy(cp_BootstrapMethod_ref.name);
+  }
+  cp_BootstrapMethod_ref.setIndexByTag(CONSTANT_MethodHandle);
+  cp_BootstrapMethod_ref.readData(len);
+
+  cp_BootstrapMethod_arg_count.readData(len);
+  int totalArgCount = cp_BootstrapMethod_arg_count.getIntTotal();
+  cp_BootstrapMethod_arg.setIndexByTag(CONSTANT_LoadableValue);
+  cp_BootstrapMethod_arg.readData(totalArgCount);
+  for (int i = 0; i < len; i++) {
+    entry& e = cpMap[i];
+    int argc = cp_BootstrapMethod_arg_count.getInt();
+    e.value.i = argc;
+    e.refs = U_NEW(entry*, e.nrefs = argc + 1);
+    e.refs[0] = cp_BootstrapMethod_ref.getRef();
+    for (int j = 1 ; j < e.nrefs ; j++) {
+      e.refs[j] = cp_BootstrapMethod_arg.getRef();
+      CHECK;
+    }
+  }
+}
+// Cf. PackageReader.readConstantPool
+void unpacker::read_cp() {
+  byte* rp0 = rp;
+
+  int i;
+
+  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
+    byte tag = TAGS_IN_ORDER[k];
+    int  len = cp.tag_count[tag];
+    int base = cp.tag_base[tag];
+
+    PRINTCR((1,"Reading %d %s entries...", len, NOT_PRODUCT(TAG_NAME[tag])+0));
+    entry* cpMap = &cp.entries[base];
+    for (i = 0; i < len; i++) {
+      cpMap[i].tag = tag;
+      cpMap[i].inord = i;
+    }
+    // Initialize the tag's CP index right away, since it might be needed
+    // in the next pass to initialize the CP for another tag.
+#ifndef PRODUCT
+    cpindex* ix = &cp.tag_index[tag];
+    assert(ix->ixTag == tag);
+    assert((int)ix->len   == len);
+    assert(ix->base1 == cpMap);
+#endif
+
+    switch (tag) {
+    case CONSTANT_Utf8:
+      read_Utf8_values(cpMap, len);
+      break;
+    case CONSTANT_Integer:
+      read_single_words(cp_Int, cpMap, len);
+      break;
+    case CONSTANT_Float:
+      read_single_words(cp_Float, cpMap, len);
+      break;
+    case CONSTANT_Long:
+      read_double_words(cp_Long_hi /*& cp_Long_lo*/, cpMap, len);
+      break;
+    case CONSTANT_Double:
+      read_double_words(cp_Double_hi /*& cp_Double_lo*/, cpMap, len);
+      break;
+    case CONSTANT_String:
+      read_single_refs(cp_String, CONSTANT_Utf8, cpMap, len);
+      break;
+    case CONSTANT_Class:
+      read_single_refs(cp_Class, CONSTANT_Utf8, cpMap, len);
+      break;
+    case CONSTANT_Signature:
+      read_signature_values(cpMap, len);
+      break;
+    case CONSTANT_NameandType:
+      read_double_refs(cp_Descr_name /*& cp_Descr_type*/,
+                       CONSTANT_Utf8, CONSTANT_Signature,
+                       cpMap, len);
+      break;
+    case CONSTANT_Fieldref:
+      read_double_refs(cp_Field_class /*& cp_Field_desc*/,
+                       CONSTANT_Class, CONSTANT_NameandType,
+                       cpMap, len);
+      break;
+    case CONSTANT_Methodref:
+      read_double_refs(cp_Method_class /*& cp_Method_desc*/,
+                       CONSTANT_Class, CONSTANT_NameandType,
+                       cpMap, len);
+      break;
+    case CONSTANT_InterfaceMethodref:
+      read_double_refs(cp_Imethod_class /*& cp_Imethod_desc*/,
+                       CONSTANT_Class, CONSTANT_NameandType,
+                       cpMap, len);
+      break;
+    case CONSTANT_MethodHandle:
+      // consumes cp_MethodHandle_refkind and cp_MethodHandle_member
+      read_method_handle(cpMap, len);
+      break;
+    case CONSTANT_MethodType:
+      // consumes cp_MethodType
+      read_method_type(cpMap, len);
+      break;
+    case CONSTANT_InvokeDynamic:
+      read_double_refs(cp_InvokeDynamic_spec, CONSTANT_BootstrapMethod,
+                       CONSTANT_NameandType,
+                       cpMap, len);
+      break;
+    case CONSTANT_BootstrapMethod:
+      // consumes cp_BootstrapMethod_ref, cp_BootstrapMethod_arg_count and cp_BootstrapMethod_arg
+      read_bootstrap_methods(cpMap, len);
+      break;
+    default:
+      assert(false);
+      break;
+    }
+    CHECK;
+  }
+
+  cp.expandSignatures();
+  CHECK;
+  cp.initMemberIndexes();
+  CHECK;
+
+  PRINTCR((1,"parsed %d constant pool entries in %d bytes", cp.nentries, (rp - rp0)));
+
+  #define SNAME(n,s) #s "\0"
+  const char* symNames = (
+    ALL_ATTR_DO(SNAME)
+    "<init>"
+  );
+  #undef SNAME
+
+  for (int sn = 0; sn < cpool::s_LIMIT; sn++) {
+    assert(symNames[0] >= '0' && symNames[0] <= 'Z');  // sanity
+    bytes name; name.set(symNames);
+    if (name.len > 0 && name.ptr[0] != '0') {
+      cp.sym[sn] = cp.ensureUtf8(name);
+      PRINTCR((4, "well-known sym %d=%s", sn, cp.sym[sn]->string()));
+    }
+    symNames += name.len + 1;  // skip trailing null to next name
+  }
+
+  band::initIndexes(this);
+}
+
+static band* no_bands[] = { null };  // shared empty body
+
+inline
+band& unpacker::attr_definitions::fixed_band(int e_class_xxx) {
+  return u->all_bands[xxx_flags_hi_bn + (e_class_xxx-e_class_flags_hi)];
+}
+inline band& unpacker::attr_definitions::xxx_flags_hi()
+  { return fixed_band(e_class_flags_hi); }
+inline band& unpacker::attr_definitions::xxx_flags_lo()
+  { return fixed_band(e_class_flags_lo); }
+inline band& unpacker::attr_definitions::xxx_attr_count()
+  { return fixed_band(e_class_attr_count); }
+inline band& unpacker::attr_definitions::xxx_attr_indexes()
+  { return fixed_band(e_class_attr_indexes); }
+inline band& unpacker::attr_definitions::xxx_attr_calls()
+  { return fixed_band(e_class_attr_calls); }
+
+
+inline
+unpacker::layout_definition*
+unpacker::attr_definitions::defineLayout(int idx,
+                                         entry* nameEntry,
+                                         const char* layout) {
+  const char* name = nameEntry->value.b.strval();
+  layout_definition* lo = defineLayout(idx, name, layout);
+  CHECK_0;
+  lo->nameEntry = nameEntry;
+  return lo;
+}
+
+unpacker::layout_definition*
+unpacker::attr_definitions::defineLayout(int idx,
+                                         const char* name,
+                                         const char* layout) {
+  assert(flag_limit != 0);  // must be set up already
+  if (idx >= 0) {
+    // Fixed attr.
+    if (idx >= (int)flag_limit)
+      abort("attribute index too large");
+    if (isRedefined(idx))
+      abort("redefined attribute index");
+    redef |= ((julong)1<<idx);
+  } else {
+    idx = flag_limit + overflow_count.length();
+    overflow_count.add(0);  // make a new counter
+  }
+  layout_definition* lo = U_NEW(layout_definition, 1);
+  CHECK_0;
+  lo->idx = idx;
+  lo->name = name;
+  lo->layout = layout;
+  for (int adds = (idx+1) - layouts.length(); adds > 0; adds--) {
+    layouts.add(null);
+  }
+  CHECK_0;
+  layouts.get(idx) = lo;
+  return lo;
+}
+
+band**
+unpacker::attr_definitions::buildBands(unpacker::layout_definition* lo) {
+  int i;
+  if (lo->elems != null)
+    return lo->bands();
+  if (lo->layout[0] == '\0') {
+    lo->elems = no_bands;
+  } else {
+    // Create bands for this attribute by parsing the layout.
+    bool hasCallables = lo->hasCallables();
+    bands_made = 0x10000;  // base number for bands made
+    const char* lp = lo->layout;
+    lp = parseLayout(lp, lo->elems, -1);
+    CHECK_0;
+    if (lp[0] != '\0' || band_stack.length() > 0) {
+      abort("garbage at end of layout");
+    }
+    band_stack.popTo(0);
+    CHECK_0;
+
+    // Fix up callables to point at their callees.
+    band** bands = lo->elems;
+    assert(bands == lo->bands());
+    int num_callables = 0;
+    if (hasCallables) {
+      while (bands[num_callables] != null) {
+        if (bands[num_callables]->le_kind != EK_CBLE) {
+          abort("garbage mixed with callables");
+          break;
+        }
+        num_callables += 1;
+      }
+    }
+    for (i = 0; i < calls_to_link.length(); i++) {
+      band& call = *(band*) calls_to_link.get(i);
+      assert(call.le_kind == EK_CALL);
+      // Determine the callee.
+      int call_num = call.le_len;
+      if (call_num < 0 || call_num >= num_callables) {
+        abort("bad call in layout");
+        break;
+      }
+      band& cble = *bands[call_num];
+      // Link the call to it.
+      call.le_body[0] = &cble;
+      // Distinguish backward calls and callables:
+      assert(cble.le_kind == EK_CBLE);
+      assert(cble.le_len == call_num);
+      cble.le_back |= call.le_back;
+    }
+    calls_to_link.popTo(0);
+  }
+  return lo->elems;
+}
+
+/* attribute layout language parser
+
+  attribute_layout:
+        ( layout_element )* | ( callable )+
+  layout_element:
+        ( integral | replication | union | call | reference )
+
+  callable:
+        '[' body ']'
+  body:
+        ( layout_element )+
+
+  integral:
+        ( unsigned_int | signed_int | bc_index | bc_offset | flag )
+  unsigned_int:
+        uint_type
+  signed_int:
+        'S' uint_type
+  any_int:
+        ( unsigned_int | signed_int )
+  bc_index:
+        ( 'P' uint_type | 'PO' uint_type )
+  bc_offset:
+        'O' any_int
+  flag:
+        'F' uint_type
+  uint_type:
+        ( 'B' | 'H' | 'I' | 'V' )
+
+  replication:
+        'N' uint_type '[' body ']'
+
+  union:
+        'T' any_int (union_case)* '(' ')' '[' (body)? ']'
+  union_case:
+        '(' union_case_tag (',' union_case_tag)* ')' '[' (body)? ']'
+  union_case_tag:
+        ( numeral | numeral '-' numeral )
+  call:
+        '(' numeral ')'
+
+  reference:
+        reference_type ( 'N' )? uint_type
+  reference_type:
+        ( constant_ref | schema_ref | utf8_ref | untyped_ref )
+  constant_ref:
+        ( 'KI' | 'KJ' | 'KF' | 'KD' | 'KS' | 'KQ' )
+  schema_ref:
+        ( 'RC' | 'RS' | 'RD' | 'RF' | 'RM' | 'RI' )
+  utf8_ref:
+        'RU'
+  untyped_ref:
+        'RQ'
+
+  numeral:
+        '(' ('-')? (digit)+ ')'
+  digit:
+        ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
+
+*/
+
+const char*
+unpacker::attr_definitions::parseIntLayout(const char* lp, band* &res,
+                                           byte le_kind, bool can_be_signed) {
+  const char* lp0 = lp;
+  band* b = U_NEW(band, 1);
+  CHECK_(lp);
+  char le = *lp++;
+  int spec = UNSIGNED5_spec;
+  if (le == 'S' && can_be_signed) {
+    // Note:  This is the last use of sign.  There is no 'EF_SIGN'.
+    spec = SIGNED5_spec;
+    le = *lp++;
+  } else if (le == 'B') {
+    spec = BYTE1_spec;  // unsigned byte
+  }
+  b->init(u, bands_made++, spec);
+  b->le_kind = le_kind;
+  int le_len = 0;
+  switch (le) {
+  case 'B': le_len = 1; break;
+  case 'H': le_len = 2; break;
+  case 'I': le_len = 4; break;
+  case 'V': le_len = 0; break;
+  default:  abort("bad layout element");
+  }
+  b->le_len = le_len;
+  band_stack.add(b);
+  res = b;
+  return lp;
+}
+
+const char*
+unpacker::attr_definitions::parseNumeral(const char* lp, int &res) {
+  const char* lp0 = lp;
+  bool sgn = false;
+  if (*lp == '0') { res = 0; return lp+1; }  // special case '0'
+  if (*lp == '-') { sgn = true; lp++; }
+  const char* dp = lp;
+  int con = 0;
+  while (*dp >= '0' && *dp <= '9') {
+    int con0 = con;
+    con *= 10;
+    con += (*dp++) - '0';
+    if (con <= con0) { con = -1; break; }  //  numeral overflow
+  }
+  if (lp == dp) {
+    abort("missing numeral in layout");
+    return "";
+  }
+  lp = dp;
+  if (con < 0 && !(sgn && con == -con)) {
+    // (Portability note:  Misses the error if int is not 32 bits.)
+    abort("numeral overflow");
+    return "" ;
+  }
+  if (sgn)  con = -con;
+  res = con;
+  return lp;
+}
+
+band**
+unpacker::attr_definitions::popBody(int bs_base) {
+  // Return everything that was pushed, as a null-terminated pointer array.
+  int bs_limit = band_stack.length();
+  if (bs_base == bs_limit) {
+    return no_bands;
+  } else {
+    int nb = bs_limit - bs_base;
+    band** res = U_NEW(band*, add_size(nb, 1));
+    CHECK_(no_bands);
+    for (int i = 0; i < nb; i++) {
+      band* b = (band*) band_stack.get(bs_base + i);
+      res[i] = b;
+    }
+    band_stack.popTo(bs_base);
+    return res;
+  }
+}
+
+const char*
+unpacker::attr_definitions::parseLayout(const char* lp, band** &res,
+                                        int curCble) {
+  const char* lp0 = lp;
+  int bs_base = band_stack.length();
+  bool top_level = (bs_base == 0);
+  band* b;
+  enum { can_be_signed = true };  // optional arg to parseIntLayout
+
+  for (bool done = false; !done; ) {
+    switch (*lp++) {
+    case 'B': case 'H': case 'I': case 'V': // unsigned_int
+    case 'S': // signed_int
+      --lp; // reparse
+    case 'F':
+      lp = parseIntLayout(lp, b, EK_INT);
+      break;
+    case 'P':
+      {
+        int le_bci = EK_BCI;
+        if (*lp == 'O') {
+          ++lp;
+          le_bci = EK_BCID;
+        }
+        assert(*lp != 'S');  // no PSH, etc.
+        lp = parseIntLayout(lp, b, EK_INT);
+        b->le_bci = le_bci;
+        if (le_bci == EK_BCI)
+          b->defc = coding::findBySpec(BCI5_spec);
+        else
+          b->defc = coding::findBySpec(BRANCH5_spec);
+      }
+      break;
+    case 'O':
+      lp = parseIntLayout(lp, b, EK_INT, can_be_signed);
+      b->le_bci = EK_BCO;
+      b->defc = coding::findBySpec(BRANCH5_spec);
+      break;
+    case 'N': // replication: 'N' uint '[' elem ... ']'
+      lp = parseIntLayout(lp, b, EK_REPL);
+      assert(*lp == '[');
+      ++lp;
+      lp = parseLayout(lp, b->le_body, curCble);
+      CHECK_(lp);
+      break;
+    case 'T': // union: 'T' any_int union_case* '(' ')' '[' body ']'
+      lp = parseIntLayout(lp, b, EK_UN, can_be_signed);
+      {
+        int union_base = band_stack.length();
+        for (;;) {   // for each case
+          band& k_case = *U_NEW(band, 1);
+          CHECK_(lp);
+          band_stack.add(&k_case);
+          k_case.le_kind = EK_CASE;
+          k_case.bn = bands_made++;
+          if (*lp++ != '(') {
+            abort("bad union case");
+            return "";
+          }
+          if (*lp++ != ')') {
+            --lp;  // reparse
+            // Read some case values.  (Use band_stack for temp. storage.)
+            int case_base = band_stack.length();
+            for (;;) {
+              int caseval = 0;
+              lp = parseNumeral(lp, caseval);
+              band_stack.add((void*)(size_t)caseval);
+              if (*lp == '-') {
+                // new in version 160, allow (1-5) for (1,2,3,4,5)
+                if (u->majver < JAVA6_PACKAGE_MAJOR_VERSION) {
+                  abort("bad range in union case label (old archive format)");
+                  return "";
+                }
+                int caselimit = caseval;
+                lp++;
+                lp = parseNumeral(lp, caselimit);
+                if (caseval >= caselimit
+                    || (uint)(caselimit - caseval) > 0x10000) {
+                  // Note:  0x10000 is arbitrary implementation restriction.
+                  // We can remove it later if it's important to.
+                  abort("bad range in union case label");
+                  return "";
+                }
+                for (;;) {
+                  ++caseval;
+                  band_stack.add((void*)(size_t)caseval);
+                  if (caseval == caselimit)  break;
+                }
+              }
+              if (*lp != ',')  break;
+              lp++;
+            }
+            if (*lp++ != ')') {
+              abort("bad case label");
+              return "";
+            }
+            // save away the case labels
+            int ntags = band_stack.length() - case_base;
+            int* tags = U_NEW(int, add_size(ntags, 1));
+            CHECK_(lp);
+            k_case.le_casetags = tags;
+            *tags++ = ntags;
+            for (int i = 0; i < ntags; i++) {
+              *tags++ = ptrlowbits(band_stack.get(case_base+i));
+            }
+            band_stack.popTo(case_base);
+            CHECK_(lp);
+          }
+          // Got le_casetags.  Now grab the body.
+          assert(*lp == '[');
+          ++lp;
+          lp = parseLayout(lp, k_case.le_body, curCble);
+          CHECK_(lp);
+          if (k_case.le_casetags == null)  break;  // done
+        }
+        b->le_body = popBody(union_base);
+      }
+      break;
+    case '(': // call: '(' -?NN* ')'
+      {
+        band& call = *U_NEW(band, 1);
+        CHECK_(lp);
+        band_stack.add(&call);
+        call.le_kind = EK_CALL;
+        call.bn = bands_made++;
+        call.le_body = U_NEW(band*, 2); // fill in later
+        int call_num = 0;
+        lp = parseNumeral(lp, call_num);
+        call.le_back = (call_num <= 0);
+        call_num += curCble;  // numeral is self-relative offset
+        call.le_len = call_num;  //use le_len as scratch
+        calls_to_link.add(&call);
+        CHECK_(lp);
+        if (*lp++ != ')') {
+          abort("bad call label");
+          return "";
+        }
+      }
+      break;
+    case 'K': // reference_type: constant_ref
+    case 'R': // reference_type: schema_ref
+      {
+        int ixTag = CONSTANT_None;
+        if (lp[-1] == 'K') {
+          switch (*lp++) {
+          case 'I': ixTag = CONSTANT_Integer; break;
+          case 'J': ixTag = CONSTANT_Long; break;
+          case 'F': ixTag = CONSTANT_Float; break;
+          case 'D': ixTag = CONSTANT_Double; break;
+          case 'S': ixTag = CONSTANT_String; break;
+          case 'Q': ixTag = CONSTANT_FieldSpecific; break;
+
+          // new in 1.7
+          case 'M': ixTag = CONSTANT_MethodHandle; break;
+          case 'T': ixTag = CONSTANT_MethodType; break;
+          case 'L': ixTag = CONSTANT_LoadableValue; break;
+          }
+        } else {
+          switch (*lp++) {
+          case 'C': ixTag = CONSTANT_Class; break;
+          case 'S': ixTag = CONSTANT_Signature; break;
+          case 'D': ixTag = CONSTANT_NameandType; break;
+          case 'F': ixTag = CONSTANT_Fieldref; break;
+          case 'M': ixTag = CONSTANT_Methodref; break;
+          case 'I': ixTag = CONSTANT_InterfaceMethodref; break;
+          case 'U': ixTag = CONSTANT_Utf8; break; //utf8_ref
+          case 'Q': ixTag = CONSTANT_All; break; //untyped_ref
+
+          // new in 1.7
+          case 'Y': ixTag = CONSTANT_InvokeDynamic; break;
+          case 'B': ixTag = CONSTANT_BootstrapMethod; break;
+          case 'N': ixTag = CONSTANT_AnyMember; break;
+          }
+        }
+        if (ixTag == CONSTANT_None) {
+          abort("bad reference layout");
+          break;
+        }
+        bool nullOK = false;
+        if (*lp == 'N') {
+          nullOK = true;
+          lp++;
+        }
+        lp = parseIntLayout(lp, b, EK_REF);
+        b->defc = coding::findBySpec(UNSIGNED5_spec);
+        b->initRef(ixTag, nullOK);
+      }
+      break;
+    case '[':
+      {
+        // [callable1][callable2]...
+        if (!top_level) {
+          abort("bad nested callable");
+          break;
+        }
+        curCble += 1;
+        NOT_PRODUCT(int call_num = band_stack.length() - bs_base);
+        band& cble = *U_NEW(band, 1);
+        CHECK_(lp);
+        band_stack.add(&cble);
+        cble.le_kind = EK_CBLE;
+        NOT_PRODUCT(cble.le_len = call_num);
+        cble.bn = bands_made++;
+        lp = parseLayout(lp, cble.le_body, curCble);
+      }
+      break;
+    case ']':
+      // Hit a closing brace.  This ends whatever body we were in.
+      done = true;
+      break;
+    case '\0':
+      // Hit a null.  Also ends the (top-level) body.
+      --lp;  // back up, so caller can see the null also
+      done = true;
+      break;
+    default:
+      abort("bad layout");
+      break;
+    }
+    CHECK_(lp);
+  }
+
+  // Return the accumulated bands:
+  res = popBody(bs_base);
+  return lp;
+}
+
+void unpacker::read_attr_defs() {
+  int i;
+
+  // Tell each AD which attrc it is and where its fixed flags are:
+  attr_defs[ATTR_CONTEXT_CLASS].attrc            = ATTR_CONTEXT_CLASS;
+  attr_defs[ATTR_CONTEXT_CLASS].xxx_flags_hi_bn  = e_class_flags_hi;
+  attr_defs[ATTR_CONTEXT_FIELD].attrc            = ATTR_CONTEXT_FIELD;
+  attr_defs[ATTR_CONTEXT_FIELD].xxx_flags_hi_bn  = e_field_flags_hi;
+  attr_defs[ATTR_CONTEXT_METHOD].attrc           = ATTR_CONTEXT_METHOD;
+  attr_defs[ATTR_CONTEXT_METHOD].xxx_flags_hi_bn = e_method_flags_hi;
+  attr_defs[ATTR_CONTEXT_CODE].attrc             = ATTR_CONTEXT_CODE;
+  attr_defs[ATTR_CONTEXT_CODE].xxx_flags_hi_bn   = e_code_flags_hi;
+
+  // Decide whether bands for the optional high flag words are present.
+  attr_defs[ATTR_CONTEXT_CLASS]
+    .setHaveLongFlags(testBit(archive_options, AO_HAVE_CLASS_FLAGS_HI));
+  attr_defs[ATTR_CONTEXT_FIELD]
+    .setHaveLongFlags(testBit(archive_options, AO_HAVE_FIELD_FLAGS_HI));
+  attr_defs[ATTR_CONTEXT_METHOD]
+    .setHaveLongFlags(testBit(archive_options, AO_HAVE_METHOD_FLAGS_HI));
+  attr_defs[ATTR_CONTEXT_CODE]
+    .setHaveLongFlags(testBit(archive_options, AO_HAVE_CODE_FLAGS_HI));
+
+  // Set up built-in attrs.
+  // (The simple ones are hard-coded.  The metadata layouts are not.)
+  const char* md_layout = (
+    // parameter annotations:
+#define MDL0 \
+    "[NB[(1)]]"
+    MDL0
+    // annotations:
+#define MDL1 \
+    "[NH[(1)]]"
+    MDL1
+#define MDL2 \
+    "[RSHNH[RUH(1)]]"
+    MDL2
+    // element_value:
+#define MDL3 \
+    "[TB"                        \
+      "(66,67,73,83,90)[KIH]"    \
+      "(68)[KDH]"                \
+      "(70)[KFH]"                \
+      "(74)[KJH]"                \
+      "(99)[RSH]"                \
+      "(101)[RSHRUH]"            \
+      "(115)[RUH]"               \
+      "(91)[NH[(0)]]"            \
+      "(64)["                    \
+        /* nested annotation: */ \
+        "RSH"                    \
+        "NH[RUH(0)]"             \
+        "]"                      \
+      "()[]"                     \
+    "]"
+    MDL3
+    );
+
+  const char* md_layout_P = md_layout;
+  const char* md_layout_A = md_layout+strlen(MDL0);
+  const char* md_layout_V = md_layout+strlen(MDL0 MDL1 MDL2);
+  assert(0 == strncmp(&md_layout_A[-3], ")]][", 4));
+  assert(0 == strncmp(&md_layout_V[-3], ")]][", 4));
+
+const char* type_md_layout(
+    "[NH[(1)(2)(3)]]"
+    // target-type + target_info
+    "[TB"
+       "(0,1)[B]"
+       "(16)[FH]"
+       "(17,18)[BB]"
+       "(19,20,21)[]"
+       "(22)[B]"
+       "(23)[H]"
+       "(64,65)[NH[PHOHH]]"
+       "(66)[H]"
+       "(67,68,69,70)[PH]"
+       "(71,72,73,74,75)[PHB]"
+       "()[]]"
+    // target-path
+    "[NB[BB]]"
+    // annotation + element_value
+    MDL2
+    MDL3
+);
+
+  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+    attr_definitions& ad = attr_defs[i];
+    if (i != ATTR_CONTEXT_CODE) {
+      ad.defineLayout(X_ATTR_RuntimeVisibleAnnotations,
+                      "RuntimeVisibleAnnotations", md_layout_A);
+      ad.defineLayout(X_ATTR_RuntimeInvisibleAnnotations,
+                      "RuntimeInvisibleAnnotations", md_layout_A);
+      if (i == ATTR_CONTEXT_METHOD) {
+        ad.defineLayout(METHOD_ATTR_RuntimeVisibleParameterAnnotations,
+                        "RuntimeVisibleParameterAnnotations", md_layout_P);
+        ad.defineLayout(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,
+                        "RuntimeInvisibleParameterAnnotations", md_layout_P);
+        ad.defineLayout(METHOD_ATTR_AnnotationDefault,
+                        "AnnotationDefault", md_layout_V);
+      }
+    }
+    ad.defineLayout(X_ATTR_RuntimeVisibleTypeAnnotations,
+                    "RuntimeVisibleTypeAnnotations", type_md_layout);
+    ad.defineLayout(X_ATTR_RuntimeInvisibleTypeAnnotations,
+                    "RuntimeInvisibleTypeAnnotations", type_md_layout);
+  }
+
+  attr_definition_headers.readData(attr_definition_count);
+  attr_definition_name.readData(attr_definition_count);
+  attr_definition_layout.readData(attr_definition_count);
+
+  CHECK;
+
+  // Initialize correct predef bits, to distinguish predefs from new defs.
+#define ORBIT(n,s) |((julong)1<<n)
+  attr_defs[ATTR_CONTEXT_CLASS].predef
+    = (0 X_ATTR_DO(ORBIT) CLASS_ATTR_DO(ORBIT));
+  attr_defs[ATTR_CONTEXT_FIELD].predef
+    = (0 X_ATTR_DO(ORBIT) FIELD_ATTR_DO(ORBIT));
+  attr_defs[ATTR_CONTEXT_METHOD].predef
+    = (0 X_ATTR_DO(ORBIT) METHOD_ATTR_DO(ORBIT));
+  attr_defs[ATTR_CONTEXT_CODE].predef
+    = (0 O_ATTR_DO(ORBIT) CODE_ATTR_DO(ORBIT));
+#undef ORBIT
+  // Clear out the redef bits, folding them back into predef.
+  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
+    attr_defs[i].predef |= attr_defs[i].redef;
+    attr_defs[i].redef = 0;
+  }
+
+  // Now read the transmitted locally defined attrs.
+  // This will set redef bits again.
+  for (i = 0; i < attr_definition_count; i++) {
+    int    header  = attr_definition_headers.getByte();
+    int    attrc   = ADH_BYTE_CONTEXT(header);
+    int    idx     = ADH_BYTE_INDEX(header);
+    entry* name    = attr_definition_name.getRef();
+    CHECK;
+    entry* layout  = attr_definition_layout.getRef();
+    CHECK;
+    attr_defs[attrc].defineLayout(idx, name, layout->value.b.strval());
+  }
+}
+
+#define NO_ENTRY_YET ((entry*)-1)
+
+static bool isDigitString(bytes& x, int beg, int end) {
+  if (beg == end)  return false;  // null string
+  byte* xptr = x.ptr;
+  for (int i = beg; i < end; i++) {
+    char ch = xptr[i];
+    if (!(ch >= '0' && ch <= '9'))  return false;
+  }
+  return true;
+}
+
+enum {  // constants for parsing class names
+  SLASH_MIN = '.',
+  SLASH_MAX = '/',
+  DOLLAR_MIN = 0,
+  DOLLAR_MAX = '-'
+};
+
+static int lastIndexOf(int chmin, int chmax, bytes& x, int pos) {
+  byte* ptr = x.ptr;
+  for (byte* cp = ptr + pos; --cp >= ptr; ) {
+    assert(x.inBounds(cp));
+    if (*cp >= chmin && *cp <= chmax)
+      return (int)(cp - ptr);
+  }
+  return -1;
+}
+
+maybe_inline
+inner_class* cpool::getIC(entry* inner) {
+  if (inner == null)  return null;
+  assert(inner->tag == CONSTANT_Class);
+  if (inner->inord == NO_INORD)  return null;
+  inner_class* ic = ic_index[inner->inord];
+  assert(ic == null || ic->inner == inner);
+  return ic;
+}
+
+maybe_inline
+inner_class* cpool::getFirstChildIC(entry* outer) {
+  if (outer == null)  return null;
+  assert(outer->tag == CONSTANT_Class);
+  if (outer->inord == NO_INORD)  return null;
+  inner_class* ic = ic_child_index[outer->inord];
+  assert(ic == null || ic->outer == outer);
+  return ic;
+}
+
+maybe_inline
+inner_class* cpool::getNextChildIC(inner_class* child) {
+  inner_class* ic = child->next_sibling;
+  assert(ic == null || ic->outer == child->outer);
+  return ic;
+}
+
+void unpacker::read_ics() {
+  int i;
+  int index_size = cp.tag_count[CONSTANT_Class];
+  inner_class** ic_index       = U_NEW(inner_class*, index_size);
+  inner_class** ic_child_index = U_NEW(inner_class*, index_size);
+  cp.ic_index = ic_index;
+  cp.ic_child_index = ic_child_index;
+  ics = U_NEW(inner_class, ic_count);
+  ic_this_class.readData(ic_count);
+  ic_flags.readData(ic_count);
+  CHECK;
+  // Scan flags to get count of long-form bands.
+  int long_forms = 0;
+  for (i = 0; i < ic_count; i++) {
+    int flags = ic_flags.getInt();  // may be long form!
+    if ((flags & ACC_IC_LONG_FORM) != 0) {
+      long_forms += 1;
+      ics[i].name = NO_ENTRY_YET;
+    }
+    flags &= ~ACC_IC_LONG_FORM;
+    entry* inner = ic_this_class.getRef();
+    CHECK;
+    uint inord = inner->inord;
+    assert(inord < (uint)cp.tag_count[CONSTANT_Class]);
+    if (ic_index[inord] != null) {
+      abort("identical inner class");
+      break;
+    }
+    ic_index[inord] = &ics[i];
+    ics[i].inner = inner;
+    ics[i].flags = flags;
+    assert(cp.getIC(inner) == &ics[i]);
+  }
+  CHECK;
+  //ic_this_class.done();
+  //ic_flags.done();
+  ic_outer_class.readData(long_forms);
+  ic_name.readData(long_forms);
+  for (i = 0; i < ic_count; i++) {
+    if (ics[i].name == NO_ENTRY_YET) {
+      // Long form.
+      ics[i].outer = ic_outer_class.getRefN();
+      CHECK;
+      ics[i].name  = ic_name.getRefN();
+      CHECK;
+    } else {
+      // Fill in outer and name based on inner.
+      bytes& n = ics[i].inner->value.b;
+      bytes pkgOuter;
+      bytes number;
+      bytes name;
+      // Parse n into pkgOuter and name (and number).
+      PRINTCR((5, "parse short IC name %s", n.ptr));
+      int dollar1, dollar2;  // pointers to $ in the pattern
+      // parse n = (<pkg>/)*<outer>($<number>)?($<name>)?
+      int nlen = (int)n.len;
+      int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, nlen) + 1;
+      dollar2    = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, nlen);
+      if (dollar2 < 0) {
+         abort();
+         return;
+      }
+      assert(dollar2 >= pkglen);
+      if (isDigitString(n, dollar2+1, nlen)) {
+        // n = (<pkg>/)*<outer>$<number>
+        number = n.slice(dollar2+1, nlen);
+        name.set(null,0);
+        dollar1 = dollar2;
+      } else if (pkglen < (dollar1
+                           = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, dollar2-1))
+                 && isDigitString(n, dollar1+1, dollar2)) {
+        // n = (<pkg>/)*<outer>$<number>$<name>
+        number = n.slice(dollar1+1, dollar2);
+        name = n.slice(dollar2+1, nlen);
+      } else {
+        // n = (<pkg>/)*<outer>$<name>
+        dollar1 = dollar2;
+        number.set(null,0);
+        name = n.slice(dollar2+1, nlen);
+      }
+      if (number.ptr == null)
+        pkgOuter = n.slice(0, dollar1);
+      else
+        pkgOuter.set(null,0);
+      PRINTCR((5,"=> %s$ 0%s $%s",
+              pkgOuter.string(), number.string(), name.string()));
+
+      if (pkgOuter.ptr != null)
+        ics[i].outer = cp.ensureClass(pkgOuter);
+
+      if (name.ptr != null)
+        ics[i].name = cp.ensureUtf8(name);
+    }
+
+    // update child/sibling list
+    if (ics[i].outer != null) {
+      uint outord = ics[i].outer->inord;
+      if (outord != NO_INORD) {
+        assert(outord < (uint)cp.tag_count[CONSTANT_Class]);
+        ics[i].next_sibling = ic_child_index[outord];
+        ic_child_index[outord] = &ics[i];
+      }
+    }
+  }
+  //ic_outer_class.done();
+  //ic_name.done();
+}
+
+void unpacker::read_classes() {
+  PRINTCR((1,"  ...scanning %d classes...", class_count));
+  class_this.readData(class_count);
+  class_super.readData(class_count);
+  class_interface_count.readData(class_count);
+  class_interface.readData(class_interface_count.getIntTotal());
+
+  CHECK;
+
+  #if 0
+  int i;
+  // Make a little mark on super-classes.
+  for (i = 0; i < class_count; i++) {
+    entry* e = class_super.getRefN();
+    if (e != null)  e->bits |= entry::EB_SUPER;
+  }
+  class_super.rewind();
+  #endif
+
+  // Members.
+  class_field_count.readData(class_count);
+  class_method_count.readData(class_count);
+
+  CHECK;
+
+  int field_count = class_field_count.getIntTotal();
+  int method_count = class_method_count.getIntTotal();
+
+  field_descr.readData(field_count);
+  read_attrs(ATTR_CONTEXT_FIELD, field_count);
+  CHECK;
+
+  method_descr.readData(method_count);
+  read_attrs(ATTR_CONTEXT_METHOD, method_count);
+
+  CHECK;
+
+  read_attrs(ATTR_CONTEXT_CLASS, class_count);
+  CHECK;
+
+  read_code_headers();
+
+  PRINTCR((1,"scanned %d classes, %d fields, %d methods, %d code headers",
+          class_count, field_count, method_count, code_count));
+}
+
+maybe_inline
+int unpacker::attr_definitions::predefCount(uint idx) {
+  return isPredefined(idx) ? flag_count[idx] : 0;
+}
+
+void unpacker::read_attrs(int attrc, int obj_count) {
+  attr_definitions& ad = attr_defs[attrc];
+  assert(ad.attrc == attrc);
+
+  int i, idx, count;
+
+  CHECK;
+
+  bool haveLongFlags = ad.haveLongFlags();
+
+  band& xxx_flags_hi = ad.xxx_flags_hi();
+  assert(endsWith(xxx_flags_hi.name, "_flags_hi"));
+  if (haveLongFlags)
+    xxx_flags_hi.readData(obj_count);
+  CHECK;
+
+  band& xxx_flags_lo = ad.xxx_flags_lo();
+  assert(endsWith(xxx_flags_lo.name, "_flags_lo"));
+  xxx_flags_lo.readData(obj_count);
+  CHECK;
+
+  // pre-scan flags, counting occurrences of each index bit
+  julong indexMask = ad.flagIndexMask();  // which flag bits are index bits?
+  for (i = 0; i < obj_count; i++) {
+    julong indexBits = xxx_flags_hi.getLong(xxx_flags_lo, haveLongFlags);
+    if ((indexBits & ~indexMask) > (ushort)-1) {
+      abort("undefined attribute flag bit");
+      return;
+    }
+    indexBits &= indexMask;  // ignore classfile flag bits
+    for (idx = 0; indexBits != 0; idx++, indexBits >>= 1) {
+      ad.flag_count[idx] += (int)(indexBits & 1);
+    }
+  }
+  // we'll scan these again later for output:
+  xxx_flags_lo.rewind();
+  xxx_flags_hi.rewind();
+
+  band& xxx_attr_count = ad.xxx_attr_count();
+  assert(endsWith(xxx_attr_count.name, "_attr_count"));
+  // There is one count element for each 1<<16 bit set in flags:
+  xxx_attr_count.readData(ad.predefCount(X_ATTR_OVERFLOW));
+  CHECK;
+
+  band& xxx_attr_indexes = ad.xxx_attr_indexes();
+  assert(endsWith(xxx_attr_indexes.name, "_attr_indexes"));
+  int overflowIndexCount = xxx_attr_count.getIntTotal();
+  xxx_attr_indexes.readData(overflowIndexCount);
+  CHECK;
+  // pre-scan attr indexes, counting occurrences of each value
+  for (i = 0; i < overflowIndexCount; i++) {
+    idx = xxx_attr_indexes.getInt();
+    if (!ad.isIndex(idx)) {
+      abort("attribute index out of bounds");
+      return;
+    }
+    ad.getCount(idx) += 1;
+  }
+  xxx_attr_indexes.rewind();  // we'll scan it again later for output
+
+  // We will need a backward call count for each used backward callable.
+  int backwardCounts = 0;
+  for (idx = 0; idx < ad.layouts.length(); idx++) {
+    layout_definition* lo = ad.getLayout(idx);
+    if (lo != null && ad.getCount(idx) != 0) {
+      // Build the bands lazily, only when they are used.
+      band** bands = ad.buildBands(lo);
+      CHECK;
+      if (lo->hasCallables()) {
+        for (i = 0; bands[i] != null; i++) {
+          if (bands[i]->le_back) {
+            assert(bands[i]->le_kind == EK_CBLE);
+            backwardCounts += 1;
+          }
+        }
+      }
+    }
+  }
+  ad.xxx_attr_calls().readData(backwardCounts);
+  CHECK;
+
+  // Read built-in bands.
+  // Mostly, these are hand-coded equivalents to readBandData().
+  switch (attrc) {
+  case ATTR_CONTEXT_CLASS:
+
+    count = ad.predefCount(CLASS_ATTR_SourceFile);
+    class_SourceFile_RUN.readData(count);
+    CHECK;
+
+    count = ad.predefCount(CLASS_ATTR_EnclosingMethod);
+    class_EnclosingMethod_RC.readData(count);
+    class_EnclosingMethod_RDN.readData(count);
+    CHECK;
+
+    count = ad.predefCount(X_ATTR_Signature);
+    class_Signature_RS.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
+    CHECK;
+
+    count = ad.predefCount(CLASS_ATTR_InnerClasses);
+    class_InnerClasses_N.readData(count);
+    CHECK;
+
+    count = class_InnerClasses_N.getIntTotal();
+    class_InnerClasses_RC.readData(count);
+    class_InnerClasses_F.readData(count);
+    CHECK;
+    // Drop remaining columns wherever flags are zero:
+    count -= class_InnerClasses_F.getIntCount(0);
+    class_InnerClasses_outer_RCN.readData(count);
+    class_InnerClasses_name_RUN.readData(count);
+    CHECK;
+
+    count = ad.predefCount(CLASS_ATTR_ClassFile_version);
+    class_ClassFile_version_minor_H.readData(count);
+    class_ClassFile_version_major_H.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
+    CHECK;
+    break;
+
+  case ATTR_CONTEXT_FIELD:
+
+    count = ad.predefCount(FIELD_ATTR_ConstantValue);
+    field_ConstantValue_KQ.readData(count);
+    CHECK;
+
+    count = ad.predefCount(X_ATTR_Signature);
+    field_Signature_RS.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
+    CHECK;
+    break;
+
+  case ATTR_CONTEXT_METHOD:
+
+    code_count = ad.predefCount(METHOD_ATTR_Code);
+    // Code attrs are handled very specially below...
+
+    count = ad.predefCount(METHOD_ATTR_Exceptions);
+    method_Exceptions_N.readData(count);
+    count = method_Exceptions_N.getIntTotal();
+    method_Exceptions_RC.readData(count);
+    CHECK;
+
+    count = ad.predefCount(X_ATTR_Signature);
+    method_Signature_RS.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
+    ad.readBandData(METHOD_ATTR_RuntimeVisibleParameterAnnotations);
+    ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations);
+    ad.readBandData(METHOD_ATTR_AnnotationDefault);
+    CHECK;
+
+    count = ad.predefCount(METHOD_ATTR_MethodParameters);
+    method_MethodParameters_NB.readData(count);
+    count = method_MethodParameters_NB.getIntTotal();
+    method_MethodParameters_name_RUN.readData(count);
+    method_MethodParameters_flag_FH.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
+    CHECK;
+
+    break;
+
+  case ATTR_CONTEXT_CODE:
+    // (keep this code aligned with its brother in unpacker::write_attrs)
+    count = ad.predefCount(CODE_ATTR_StackMapTable);
+    // disable this feature in old archives!
+    if (count != 0 && majver < JAVA6_PACKAGE_MAJOR_VERSION) {
+      abort("undefined StackMapTable attribute (old archive format)");
+      return;
+    }
+    code_StackMapTable_N.readData(count);
+    CHECK;
+    count = code_StackMapTable_N.getIntTotal();
+    code_StackMapTable_frame_T.readData(count);
+    CHECK;
+    // the rest of it depends in a complicated way on frame tags
+    {
+      int fat_frame_count = 0;
+      int offset_count = 0;
+      int type_count = 0;
+      for (int k = 0; k < count; k++) {
+        int tag = code_StackMapTable_frame_T.getByte();
+        if (tag <= 127) {
+          // (64-127)  [(2)]
+          if (tag >= 64)  type_count++;
+        } else if (tag <= 251) {
+          // (247)     [(1)(2)]
+          // (248-251) [(1)]
+          if (tag >= 247)  offset_count++;
+          if (tag == 247)  type_count++;
+        } else if (tag <= 254) {
+          // (252)     [(1)(2)]
+          // (253)     [(1)(2)(2)]
+          // (254)     [(1)(2)(2)(2)]
+          offset_count++;
+          type_count += (tag - 251);
+        } else {
+          // (255)     [(1)NH[(2)]NH[(2)]]
+          fat_frame_count++;
+        }
+      }
+
+      // done pre-scanning frame tags:
+      code_StackMapTable_frame_T.rewind();
+
+      // deal completely with fat frames:
+      offset_count += fat_frame_count;
+      code_StackMapTable_local_N.readData(fat_frame_count);
+      CHECK;
+      type_count += code_StackMapTable_local_N.getIntTotal();
+      code_StackMapTable_stack_N.readData(fat_frame_count);
+      type_count += code_StackMapTable_stack_N.getIntTotal();
+      CHECK;
+      // read the rest:
+      code_StackMapTable_offset.readData(offset_count);
+      code_StackMapTable_T.readData(type_count);
+      CHECK;
+      // (7) [RCH]
+      count = code_StackMapTable_T.getIntCount(7);
+      code_StackMapTable_RC.readData(count);
+      CHECK;
+      // (8) [PH]
+      count = code_StackMapTable_T.getIntCount(8);
+      code_StackMapTable_P.readData(count);
+      CHECK;
+    }
+
+    count = ad.predefCount(CODE_ATTR_LineNumberTable);
+    code_LineNumberTable_N.readData(count);
+    CHECK;
+    count = code_LineNumberTable_N.getIntTotal();
+    code_LineNumberTable_bci_P.readData(count);
+    code_LineNumberTable_line.readData(count);
+    CHECK;
+
+    count = ad.predefCount(CODE_ATTR_LocalVariableTable);
+    code_LocalVariableTable_N.readData(count);
+    CHECK;
+    count = code_LocalVariableTable_N.getIntTotal();
+    code_LocalVariableTable_bci_P.readData(count);
+    code_LocalVariableTable_span_O.readData(count);
+    code_LocalVariableTable_name_RU.readData(count);
+    code_LocalVariableTable_type_RS.readData(count);
+    code_LocalVariableTable_slot.readData(count);
+    CHECK;
+
+    count = ad.predefCount(CODE_ATTR_LocalVariableTypeTable);
+    code_LocalVariableTypeTable_N.readData(count);
+    count = code_LocalVariableTypeTable_N.getIntTotal();
+    code_LocalVariableTypeTable_bci_P.readData(count);
+    code_LocalVariableTypeTable_span_O.readData(count);
+    code_LocalVariableTypeTable_name_RU.readData(count);
+    code_LocalVariableTypeTable_type_RS.readData(count);
+    code_LocalVariableTypeTable_slot.readData(count);
+    CHECK;
+
+    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
+    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
+    CHECK;
+
+    break;
+  }
+
+  // Read compressor-defined bands.
+  for (idx = 0; idx < ad.layouts.length(); idx++) {
+    if (ad.getLayout(idx) == null)
+      continue;  // none at this fixed index <32
+    if (idx < (int)ad.flag_limit && ad.isPredefined(idx))
+      continue;  // already handled
+    if (ad.getCount(idx) == 0)
+      continue;  // no attributes of this type (then why transmit layouts?)
+    ad.readBandData(idx);
+  }
+}
+
+void unpacker::attr_definitions::readBandData(int idx) {
+  int j;
+  uint count = getCount(idx);
+  if (count == 0)  return;
+  layout_definition* lo = getLayout(idx);
+  if (lo != null) {
+    PRINTCR((1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
+            count, isRedefined(idx), isPredefined(idx),
+            ATTR_CONTEXT_NAME[attrc], lo->name));
+  }
+  bool hasCallables = lo->hasCallables();
+  band** bands = lo->bands();
+  if (!hasCallables) {
+    // Read through the rest of the bands in a regular way.
+    readBandData(bands, count);
+  } else {
+    // Deal with the callables.
+    // First set up the forward entry count for each callable.
+    // This is stored on band::length of the callable.
+    bands[0]->expectMoreLength(count);
+    for (j = 0; bands[j] != null; j++) {
+      band& j_cble = *bands[j];
+      assert(j_cble.le_kind == EK_CBLE);
+      if (j_cble.le_back) {
+        // Add in the predicted effects of backward calls, too.
+        int back_calls = xxx_attr_calls().getInt();
+        j_cble.expectMoreLength(back_calls);
+        // In a moment, more forward calls may increment j_cble.length.
+      }
+    }
+    // Now consult whichever callables have non-zero entry counts.
+    readBandData(bands, (uint)-1);
+  }
+}
+
+// Recursive helper to the previous function:
+void unpacker::attr_definitions::readBandData(band** body, uint count) {
+  int j, k;
+  for (j = 0; body[j] != null; j++) {
+    band& b = *body[j];
+    if (b.defc != null) {
+      // It has data, so read it.
+      b.readData(count);
+    }
+    switch (b.le_kind) {
+    case EK_REPL:
+      {
+        int reps = b.getIntTotal();
+        readBandData(b.le_body, reps);
+      }
+      break;
+    case EK_UN:
+      {
+        int remaining = count;
+        for (k = 0; b.le_body[k] != null; k++) {
+          band& k_case = *b.le_body[k];
+          int   k_count = 0;
+          if (k_case.le_casetags == null) {
+            k_count = remaining;  // last (empty) case
+          } else {
+            int* tags = k_case.le_casetags;
+            int ntags = *tags++;  // 1st element is length (why not?)
+            while (ntags-- > 0) {
+              int tag = *tags++;
+              k_count += b.getIntCount(tag);
+            }
+          }
+          readBandData(k_case.le_body, k_count);
+          remaining -= k_count;
+        }
+        assert(remaining == 0);
+      }
+      break;
+    case EK_CALL:
+      // Push the count forward, if it is not a backward call.
+      if (!b.le_back) {
+        band& cble = *b.le_body[0];
+        assert(cble.le_kind == EK_CBLE);
+        cble.expectMoreLength(count);
+      }
+      break;
+    case EK_CBLE:
+      assert((int)count == -1);  // incoming count is meaningless
+      k = b.length;
+      assert(k >= 0);
+      // This is intended and required for non production mode.
+      assert((b.length = -1)); // make it unable to accept more calls now.
+      readBandData(b.le_body, k);
+      break;
+    }
+  }
+}
+
+static inline
+band** findMatchingCase(int matchTag, band** cases) {
+  for (int k = 0; cases[k] != null; k++) {
+    band& k_case = *cases[k];
+    if (k_case.le_casetags != null) {
+      // If it has tags, it must match a tag.
+      int* tags = k_case.le_casetags;
+      int ntags = *tags++;  // 1st element is length
+      for (; ntags > 0; ntags--) {
+        int tag = *tags++;
+        if (tag == matchTag)
+          break;
+      }
+      if (ntags == 0)
+        continue;   // does not match
+    }
+    return k_case.le_body;
+  }
+  return null;
+}
+
+// write attribute band data:
+void unpacker::putlayout(band** body) {
+  int i;
+  int prevBII = -1;
+  int prevBCI = -1;
+  if (body == NULL) {
+    abort("putlayout: unexpected NULL for body");
+    return;
+  }
+  for (i = 0; body[i] != null; i++) {
+    band& b = *body[i];
+    byte le_kind = b.le_kind;
+
+    // Handle scalar part, if any.
+    int    x = 0;
+    entry* e = null;
+    if (b.defc != null) {
+      // It has data, so unparse an element.
+      if (b.ixTag != CONSTANT_None) {
+        assert(le_kind == EK_REF);
+        if (b.ixTag == CONSTANT_FieldSpecific)
+          e = b.getRefUsing(cp.getKQIndex());
+        else
+          e = b.getRefN();
+        CHECK;
+        switch (b.le_len) {
+        case 0: break;
+        case 1: putu1ref(e); break;
+        case 2: putref(e); break;
+        case 4: putu2(0); putref(e); break;
+        default: assert(false);
+        }
+      } else {
+        assert(le_kind == EK_INT || le_kind == EK_REPL || le_kind == EK_UN);
+        x = b.getInt();
+
+        assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
+        switch (b.le_bci) {
+        case EK_BCI:   // PH:  transmit R(bci), store bci
+          x = to_bci(prevBII = x);
+          prevBCI = x;
+          break;
+        case EK_BCID:  // POH: transmit D(R(bci)), store bci
+          x = to_bci(prevBII += x);
+          prevBCI = x;
+          break;
+        case EK_BCO:   // OH:  transmit D(R(bci)), store D(bci)
+          x = to_bci(prevBII += x) - prevBCI;
+          prevBCI += x;
+          break;
+        }
+        assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
+
+        switch (b.le_len) {
+        case 0: break;
+        case 1: putu1(x); break;
+        case 2: putu2(x); break;
+        case 4: putu4(x); break;
+        default: assert(false);
+        }
+      }
+    }
+
+    // Handle subparts, if any.
+    switch (le_kind) {
+    case EK_REPL:
+      // x is the repeat count
+      while (x-- > 0) {
+        putlayout(b.le_body);
+      }
+      break;
+    case EK_UN:
+      // x is the tag
+      putlayout(findMatchingCase(x, b.le_body));
+      break;
+    case EK_CALL:
+      {
+        band& cble = *b.le_body[0];
+        assert(cble.le_kind == EK_CBLE);
+        assert(cble.le_len == b.le_len);
+        putlayout(cble.le_body);
+      }
+      break;
+
+    #ifndef PRODUCT
+    case EK_CBLE:
+    case EK_CASE:
+      assert(false);  // should not reach here
+    #endif
+    }
+  }
+}
+
+void unpacker::read_files() {
+  file_name.readData(file_count);
+  if (testBit(archive_options, AO_HAVE_FILE_SIZE_HI))
+    file_size_hi.readData(file_count);
+  file_size_lo.readData(file_count);
+  if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
+    file_modtime.readData(file_count);
+  int allFiles = file_count + class_count;
+  if (testBit(archive_options, AO_HAVE_FILE_OPTIONS)) {
+    file_options.readData(file_count);
+    // FO_IS_CLASS_STUB might be set, causing overlap between classes and files
+    for (int i = 0; i < file_count; i++) {
+      if ((file_options.getInt() & FO_IS_CLASS_STUB) != 0) {
+        allFiles -= 1;  // this one counts as both class and file
+      }
+    }
+    file_options.rewind();
+  }
+  assert((default_file_options & FO_IS_CLASS_STUB) == 0);
+  files_remaining = allFiles;
+}
+
+maybe_inline
+void unpacker::get_code_header(int& max_stack,
+                               int& max_na_locals,
+                               int& handler_count,
+                               int& cflags) {
+  int sc = code_headers.getByte();
+  if (sc == 0) {
+    max_stack = max_na_locals = handler_count = cflags = -1;
+    return;
+  }
+  // Short code header is the usual case:
+  int nh;
+  int mod;
+  if (sc < 1 + 12*12) {
+    sc -= 1;
+    nh = 0;
+    mod = 12;
+  } else if (sc < 1 + 12*12 + 8*8) {
+    sc -= 1 + 12*12;
+    nh = 1;
+    mod = 8;
+  } else {
+    assert(sc < 1 + 12*12 + 8*8 + 7*7);
+    sc -= 1 + 12*12 + 8*8;
+    nh = 2;
+    mod = 7;
+  }
+  max_stack     = sc % mod;
+  max_na_locals = sc / mod;  // caller must add static, siglen
+  handler_count = nh;
+  if (testBit(archive_options, AO_HAVE_ALL_CODE_FLAGS))
+    cflags      = -1;
+  else
+    cflags      = 0;  // this one has no attributes
+}
+
+// Cf. PackageReader.readCodeHeaders
+void unpacker::read_code_headers() {
+  code_headers.readData(code_count);
+  CHECK;
+  int totalHandlerCount = 0;
+  int totalFlagsCount   = 0;
+  for (int i = 0; i < code_count; i++) {
+    int max_stack, max_locals, handler_count, cflags;
+    get_code_header(max_stack, max_locals, handler_count, cflags);
+    if (max_stack < 0)      code_max_stack.expectMoreLength(1);
+    if (max_locals < 0)     code_max_na_locals.expectMoreLength(1);
+    if (handler_count < 0)  code_handler_count.expectMoreLength(1);
+    else                    totalHandlerCount += handler_count;
+    if (cflags < 0)         totalFlagsCount += 1;
+  }
+  code_headers.rewind();  // replay later during writing
+
+  code_max_stack.readData();
+  code_max_na_locals.readData();
+  code_handler_count.readData();
+  totalHandlerCount += code_handler_count.getIntTotal();
+  CHECK;
+
+  // Read handler specifications.
+  // Cf. PackageReader.readCodeHandlers.
+  code_handler_start_P.readData(totalHandlerCount);
+  code_handler_end_PO.readData(totalHandlerCount);
+  code_handler_catch_PO.readData(totalHandlerCount);
+  code_handler_class_RCN.readData(totalHandlerCount);
+  CHECK;
+
+  read_attrs(ATTR_CONTEXT_CODE, totalFlagsCount);
+  CHECK;
+}
+
+static inline bool is_in_range(uint n, uint min, uint max) {
+  return n - min <= max - min;  // unsigned arithmetic!
+}
+static inline bool is_field_op(int bc) {
+  return is_in_range(bc, bc_getstatic, bc_putfield);
+}
+static inline bool is_invoke_init_op(int bc) {
+  return is_in_range(bc, _invokeinit_op, _invokeinit_limit-1);
+}
+static inline bool is_self_linker_op(int bc) {
+  return is_in_range(bc, _self_linker_op, _self_linker_limit-1);
+}
+static bool is_branch_op(int bc) {
+  return is_in_range(bc, bc_ifeq,   bc_jsr)
+      || is_in_range(bc, bc_ifnull, bc_jsr_w);
+}
+static bool is_local_slot_op(int bc) {
+  return is_in_range(bc, bc_iload,  bc_aload)
+      || is_in_range(bc, bc_istore, bc_astore)
+      || bc == bc_iinc || bc == bc_ret;
+}
+band* unpacker::ref_band_for_op(int bc) {
+  switch (bc) {
+  case bc_ildc:
+  case bc_ildc_w:
+    return &bc_intref;
+  case bc_fldc:
+  case bc_fldc_w:
+    return &bc_floatref;
+  case bc_lldc2_w:
+    return &bc_longref;
+  case bc_dldc2_w:
+    return &bc_doubleref;
+  case bc_sldc:
+  case bc_sldc_w:
+    return &bc_stringref;
+  case bc_cldc:
+  case bc_cldc_w:
+    return &bc_classref;
+  case bc_qldc: case bc_qldc_w:
+    return &bc_loadablevalueref;
+
+  case bc_getstatic:
+  case bc_putstatic:
+  case bc_getfield:
+  case bc_putfield:
+    return &bc_fieldref;
+
+  case _invokespecial_int:
+  case _invokestatic_int:
+    return &bc_imethodref;
+  case bc_invokevirtual:
+  case bc_invokespecial:
+  case bc_invokestatic:
+    return &bc_methodref;
+  case bc_invokeinterface:
+    return &bc_imethodref;
+  case bc_invokedynamic:
+    return &bc_indyref;
+
+  case bc_new:
+  case bc_anewarray:
+  case bc_checkcast:
+  case bc_instanceof:
+  case bc_multianewarray:
+    return &bc_classref;
+  }
+  return null;
+}
+
+maybe_inline
+band* unpacker::ref_band_for_self_op(int bc, bool& isAloadVar, int& origBCVar) {
+  if (!is_self_linker_op(bc))  return null;
+  int idx = (bc - _self_linker_op);
+  bool isSuper = (idx >= _self_linker_super_flag);
+  if (isSuper)  idx -= _self_linker_super_flag;
+  bool isAload = (idx >= _self_linker_aload_flag);
+  if (isAload)  idx -= _self_linker_aload_flag;
+  int origBC = _first_linker_op + idx;
+  bool isField = is_field_op(origBC);
+  isAloadVar = isAload;
+  origBCVar  = _first_linker_op + idx;
+  if (!isSuper)
+    return isField? &bc_thisfield: &bc_thismethod;
+  else
+    return isField? &bc_superfield: &bc_supermethod;
+}
+
+// Cf. PackageReader.readByteCodes
+inline  // called exactly once => inline
+void unpacker::read_bcs() {
+  PRINTCR((3, "reading compressed bytecodes and operands for %d codes...",
+          code_count));
+
+  // read from bc_codes and bc_case_count
+  fillbytes all_switch_ops;
+  all_switch_ops.init();
+  CHECK;
+
+  // Read directly from rp/rplimit.
+  //Do this later:  bc_codes.readData(...)
+  byte* rp0 = rp;
+
+  band* bc_which;
+  byte* opptr = rp;
+  byte* oplimit = rplimit;
+
+  bool  isAload;  // passed by ref and then ignored
+  int   junkBC;   // passed by ref and then ignored
+  for (int k = 0; k < code_count; k++) {
+    // Scan one method:
+    for (;;) {
+      if (opptr+2 > oplimit) {
+        rp = opptr;
+        ensure_input(2);
+        oplimit = rplimit;
+        rp = rp0;  // back up
+      }
+      if (opptr == oplimit) { abort(); break; }
+      int bc = *opptr++ & 0xFF;
+      bool isWide = false;
+      if (bc == bc_wide) {
+        if (opptr == oplimit) { abort(); break; }
+        bc = *opptr++ & 0xFF;
+        isWide = true;
+      }
+      // Adjust expectations of various band sizes.
+      switch (bc) {
+      case bc_tableswitch:
+      case bc_lookupswitch:
+        all_switch_ops.addByte(bc);
+        break;
+      case bc_iinc:
+        bc_local.expectMoreLength(1);
+        bc_which = isWide ? &bc_short : &bc_byte;
+        bc_which->expectMoreLength(1);
+        break;
+      case bc_sipush:
+        bc_short.expectMoreLength(1);
+        break;
+      case bc_bipush:
+        bc_byte.expectMoreLength(1);
+        break;
+      case bc_newarray:
+        bc_byte.expectMoreLength(1);
+        break;
+      case bc_multianewarray:
+        assert(ref_band_for_op(bc) == &bc_classref);
+        bc_classref.expectMoreLength(1);
+        bc_byte.expectMoreLength(1);
+        break;
+      case bc_ref_escape:
+        bc_escrefsize.expectMoreLength(1);
+        bc_escref.expectMoreLength(1);
+        break;
+      case bc_byte_escape:
+        bc_escsize.expectMoreLength(1);
+        // bc_escbyte will have to be counted too
+        break;
+      default:
+        if (is_invoke_init_op(bc)) {
+          bc_initref.expectMoreLength(1);
+          break;
+        }
+        bc_which = ref_band_for_self_op(bc, isAload, junkBC);
+        if (bc_which != null) {
+          bc_which->expectMoreLength(1);
+          break;
+        }
+        if (is_branch_op(bc)) {
+          bc_label.expectMoreLength(1);
+          break;
+        }
+        bc_which = ref_band_for_op(bc);
+        if (bc_which != null) {
+          bc_which->expectMoreLength(1);
+          assert(bc != bc_multianewarray);  // handled elsewhere
+          break;
+        }
+        if (is_local_slot_op(bc)) {
+          bc_local.expectMoreLength(1);
+          break;
+        }
+        break;
+      case bc_end_marker:
+        // Increment k and test against code_count.
+        goto doneScanningMethod;
+      }
+    }
+  doneScanningMethod:{}
+    if (aborting())  break;
+  }
+
+  // Go through the formality, so we can use it in a regular fashion later:
+  assert(rp == rp0);
+  bc_codes.readData((int)(opptr - rp));
+
+  int i = 0;
+
+  // To size instruction bands correctly, we need info on switches:
+  bc_case_count.readData((int)all_switch_ops.size());
+  for (i = 0; i < (int)all_switch_ops.size(); i++) {
+    int caseCount = bc_case_count.getInt();
+    int bc        = all_switch_ops.getByte(i);
+    bc_label.expectMoreLength(1+caseCount); // default label + cases
+    bc_case_value.expectMoreLength(bc == bc_tableswitch ? 1 : caseCount);
+    PRINTCR((2, "switch bc=%d caseCount=%d", bc, caseCount));
+  }
+  bc_case_count.rewind();  // uses again for output
+
+  all_switch_ops.free();
+
+  for (i = e_bc_case_value; i <= e_bc_escsize; i++) {
+    all_bands[i].readData();
+  }
+
+  // The bc_escbyte band is counted by the immediately previous band.
+  bc_escbyte.readData(bc_escsize.getIntTotal());
+
+  PRINTCR((3, "scanned %d opcode and %d operand bytes for %d codes...",
+          (int)(bc_codes.size()),
+          (int)(bc_escsize.maxRP() - bc_case_value.minRP()),
+          code_count));
+}
+
+void unpacker::read_bands() {
+  byte* rp0 = rp;
+  CHECK;
+  read_file_header();
+  CHECK;
+
+  if (cp.nentries == 0) {
+    // read_file_header failed to read a CP, because it copied a JAR.
+    return;
+  }
+
+  // Do this after the file header has been read:
+  check_options();
+
+  read_cp();
+  CHECK;
+  read_attr_defs();
+  CHECK;
+  read_ics();
+  CHECK;
+  read_classes();
+  CHECK;
+  read_bcs();
+  CHECK;
+  read_files();
+}
+
+/// CP routines
+
+entry*& cpool::hashTabRef(byte tag, bytes& b) {
+  PRINTCR((5, "hashTabRef tag=%d %s[%d]", tag, b.string(), b.len));
+  uint hash = tag + (int)b.len;
+  for (int i = 0; i < (int)b.len; i++) {
+    hash = hash * 31 + (0xFF & b.ptr[i]);
+  }
+  entry**  ht = hashTab;
+  int    hlen = hashTabLength;
+  assert((hlen & (hlen-1)) == 0);  // must be power of 2
+  uint hash1 = hash & (hlen-1);    // == hash % hlen
+  uint hash2 = 0;                  // lazily computed (requires mod op.)
+  int probes = 0;
+  while (ht[hash1] != null) {
+    entry& e = *ht[hash1];
+    if (e.value.b.equals(b) && e.tag == tag)
+      break;
+    if (hash2 == 0)
+      // Note:  hash2 must be relatively prime to hlen, hence the "|1".
+      hash2 = (((hash % 499) & (hlen-1)) | 1);
+    hash1 += hash2;
+    if (hash1 >= (uint)hlen)  hash1 -= hlen;
+    assert(hash1 < (uint)hlen);
+    assert(++probes < hlen);
+  }
+  #ifndef PRODUCT
+  hash_probes[0] += 1;
+  hash_probes[1] += probes;
+  #endif
+  PRINTCR((5, " => @%d %p", hash1, ht[hash1]));
+  return ht[hash1];
+}
+
+maybe_inline
+static void insert_extra(entry* e, ptrlist& extras) {
+  // This ordering helps implement the Pack200 requirement
+  // of a predictable CP order in the class files produced.
+  e->inord = NO_INORD;  // mark as an "extra"
+  extras.add(e);
+  // Note:  We will sort the list (by string-name) later.
+}
+
+entry* cpool::ensureUtf8(bytes& b) {
+  entry*& ix = hashTabRef(CONSTANT_Utf8, b);
+  if (ix != null)  return ix;
+  // Make one.
+  if (nentries == maxentries) {
+    abort("cp utf8 overflow");
+    return &entries[tag_base[CONSTANT_Utf8]];  // return something
+  }
+  entry& e = entries[nentries++];
+  e.tag = CONSTANT_Utf8;
+  u->saveTo(e.value.b, b);
+  assert(&e >= first_extra_entry);
+  insert_extra(&e, tag_extras[CONSTANT_Utf8]);
+  PRINTCR((4,"ensureUtf8 miss %s", e.string()));
+  return ix = &e;
+}
+
+entry* cpool::ensureClass(bytes& b) {
+  entry*& ix = hashTabRef(CONSTANT_Class, b);
+  if (ix != null)  return ix;
+  // Make one.
+  if (nentries == maxentries) {
+    abort("cp class overflow");
+    return &entries[tag_base[CONSTANT_Class]];  // return something
+  }
+  entry& e = entries[nentries++];
+  e.tag = CONSTANT_Class;
+  e.nrefs = 1;
+  e.refs = U_NEW(entry*, 1);
+  ix = &e;  // hold my spot in the index
+  entry* utf = ensureUtf8(b);
+  e.refs[0] = utf;
+  e.value.b = utf->value.b;
+  assert(&e >= first_extra_entry);
+  insert_extra(&e, tag_extras[CONSTANT_Class]);
+  PRINTCR((4,"ensureClass miss %s", e.string()));
+  return &e;
+}
+
+void cpool::expandSignatures() {
+  int i;
+  int nsigs = 0;
+  int nreused = 0;
+  int first_sig = tag_base[CONSTANT_Signature];
+  int sig_limit = tag_count[CONSTANT_Signature] + first_sig;
+  fillbytes buf;
+  buf.init(1<<10);
+  CHECK;
+  for (i = first_sig; i < sig_limit; i++) {
+    entry& e = entries[i];
+    assert(e.tag == CONSTANT_Signature);
+    int refnum = 0;
+    bytes form = e.refs[refnum++]->asUtf8();
+    buf.empty();
+    for (int j = 0; j < (int)form.len; j++) {
+      int c = form.ptr[j];
+      buf.addByte(c);
+      if (c == 'L') {
+        entry* cls = e.refs[refnum++];
+        buf.append(cls->className()->asUtf8());
+      }
+    }
+    assert(refnum == e.nrefs);
+    bytes& sig = buf.b;
+    PRINTCR((5,"signature %d %s -> %s", i, form.ptr, sig.ptr));
+
+    // try to find a pre-existing Utf8:
+    entry* &e2 = hashTabRef(CONSTANT_Utf8, sig);
+    if (e2 != null) {
+      assert(e2->isUtf8(sig));
+      e.value.b = e2->value.b;
+      e.refs[0] = e2;
+      e.nrefs = 1;
+      PRINTCR((5,"signature replaced %d => %s", i, e.string()));
+      nreused++;
+    } else {
+      // there is no other replacement; reuse this CP entry as a Utf8
+      u->saveTo(e.value.b, sig);
+      e.tag = CONSTANT_Utf8;
+      e.nrefs = 0;
+      e2 = &e;
+      PRINTCR((5,"signature changed %d => %s", e.inord, e.string()));
+    }
+    nsigs++;
+  }
+  PRINTCR((1,"expanded %d signatures (reused %d utfs)", nsigs, nreused));
+  buf.free();
+
+  // go expunge all references to remaining signatures:
+  for (i = 0; i < (int)nentries; i++) {
+    entry& e = entries[i];
+    for (int j = 0; j < e.nrefs; j++) {
+      entry*& e2 = e.refs[j];
+      if (e2 != null && e2->tag == CONSTANT_Signature)
+        e2 = e2->refs[0];
+    }
+  }
+}
+
+bool isLoadableValue(int tag) {
+  switch(tag) {
+    case CONSTANT_Integer:
+    case CONSTANT_Float:
+    case CONSTANT_Long:
+    case CONSTANT_Double:
+    case CONSTANT_String:
+    case CONSTANT_Class:
+    case CONSTANT_MethodHandle:
+    case CONSTANT_MethodType:
+      return true;
+    default:
+      return false;
+  }
+}
+/*
+ * this method can be used to size an array using null as the parameter,
+ * thereafter can be reused to initialize the array using a valid pointer
+ * as a parameter.
+ */
+int cpool::initLoadableValues(entry** loadable_entries) {
+  int loadable_count = 0;
+  for (int i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
+    int tag = TAGS_IN_ORDER[i];
+    if (!isLoadableValue(tag))
+      continue;
+    if (loadable_entries != NULL) {
+      for (int n = 0 ; n < tag_count[tag] ; n++) {
+        loadable_entries[loadable_count + n] = &entries[tag_base[tag] + n];
+      }
+    }
+    loadable_count += tag_count[tag];
+  }
+  return loadable_count;
+}
+
+// Initialize various views into the constant pool.
+void cpool::initGroupIndexes() {
+  // Initialize All
+  int all_count = 0;
+  for (int tag = CONSTANT_None ; tag < CONSTANT_Limit ; tag++) {
+    all_count += tag_count[tag];
+  }
+  entry* all_entries = &entries[tag_base[CONSTANT_None]];
+  tag_group_count[CONSTANT_All - CONSTANT_All] = all_count;
+  tag_group_index[CONSTANT_All - CONSTANT_All].init(all_count, all_entries, CONSTANT_All);
+
+  // Initialize LoadableValues
+  int loadable_count = initLoadableValues(NULL);
+  entry** loadable_entries = U_NEW(entry*, loadable_count);
+  initLoadableValues(loadable_entries);
+  tag_group_count[CONSTANT_LoadableValue - CONSTANT_All] = loadable_count;
+  tag_group_index[CONSTANT_LoadableValue - CONSTANT_All].init(loadable_count,
+                  loadable_entries, CONSTANT_LoadableValue);
+
+// Initialize AnyMembers
+  int any_count = tag_count[CONSTANT_Fieldref] +
+                  tag_count[CONSTANT_Methodref] +
+                  tag_count[CONSTANT_InterfaceMethodref];
+  entry *any_entries = &entries[tag_base[CONSTANT_Fieldref]];
+  tag_group_count[CONSTANT_AnyMember - CONSTANT_All] = any_count;
+  tag_group_index[CONSTANT_AnyMember - CONSTANT_All].init(any_count,
+                                               any_entries, CONSTANT_AnyMember);
+}
+
+void cpool::initMemberIndexes() {
+  // This function does NOT refer to any class schema.
+  // It is totally internal to the cpool.
+  int i, j;
+
+  // Get the pre-existing indexes:
+  int   nclasses = tag_count[CONSTANT_Class];
+  entry* classes = tag_base[CONSTANT_Class] + entries;
+  int   nfields  = tag_count[CONSTANT_Fieldref];
+  entry* fields  = tag_base[CONSTANT_Fieldref] + entries;
+  int   nmethods = tag_count[CONSTANT_Methodref];
+  entry* methods = tag_base[CONSTANT_Methodref] + entries;
+
+  int*     field_counts  = T_NEW(int, nclasses);
+  int*     method_counts = T_NEW(int, nclasses);
+  cpindex* all_indexes   = U_NEW(cpindex, nclasses*2);
+  entry**  field_ix      = U_NEW(entry*, add_size(nfields, nclasses));
+  entry**  method_ix     = U_NEW(entry*, add_size(nmethods, nclasses));
+
+  for (j = 0; j < nfields; j++) {
+    entry& f = fields[j];
+    i = f.memberClass()->inord;
+    assert(i < nclasses);
+    field_counts[i]++;
+  }
+  for (j = 0; j < nmethods; j++) {
+    entry& m = methods[j];
+    i = m.memberClass()->inord;
+    assert(i < nclasses);
+    method_counts[i]++;
+  }
+
+  int fbase = 0, mbase = 0;
+  for (i = 0; i < nclasses; i++) {
+    int fc = field_counts[i];
+    int mc = method_counts[i];
+    all_indexes[i*2+0].init(fc, field_ix+fbase,
+                            CONSTANT_Fieldref  + SUBINDEX_BIT);
+    all_indexes[i*2+1].init(mc, method_ix+mbase,
+                            CONSTANT_Methodref + SUBINDEX_BIT);
+    // reuse field_counts and member_counts as fill pointers:
+    field_counts[i] = fbase;
+    method_counts[i] = mbase;
+    PRINTCR((3, "class %d fields @%d[%d] methods @%d[%d]",
+            i, fbase, fc, mbase, mc));
+    fbase += fc+1;
+    mbase += mc+1;
+    // (the +1 leaves a space between every subarray)
+  }
+  assert(fbase == nfields+nclasses);
+  assert(mbase == nmethods+nclasses);
+
+  for (j = 0; j < nfields; j++) {
+    entry& f = fields[j];
+    i = f.memberClass()->inord;
+    field_ix[field_counts[i]++] = &f;
+  }
+  for (j = 0; j < nmethods; j++) {
+    entry& m = methods[j];
+    i = m.memberClass()->inord;
+    method_ix[method_counts[i]++] = &m;
+  }
+
+  member_indexes = all_indexes;
+
+#ifndef PRODUCT
+  // Test the result immediately on every class and field.
+  int fvisited = 0, mvisited = 0;
+  int prevord, len;
+  for (i = 0; i < nclasses; i++) {
+    entry*   cls = &classes[i];
+    cpindex* fix = getFieldIndex(cls);
+    cpindex* mix = getMethodIndex(cls);
+    PRINTCR((2, "field and method index for %s [%d] [%d]",
+            cls->string(), mix->len, fix->len));
+    prevord = -1;
+    for (j = 0, len = fix->len; j < len; j++) {
+      entry* f = fix->get(j);
+      assert(f != null);
+      PRINTCR((3, "- field %s", f->string()));
+      assert(f->memberClass() == cls);
+      assert(prevord < (int)f->inord);
+      prevord = f->inord;
+      fvisited++;
+    }
+    assert(fix->base2[j] == null);
+    prevord = -1;
+    for (j = 0, len = mix->len; j < len; j++) {
+      entry* m = mix->get(j);
+      assert(m != null);
+      PRINTCR((3, "- method %s", m->string()));
+      assert(m->memberClass() == cls);
+      assert(prevord < (int)m->inord);
+      prevord = m->inord;
+      mvisited++;
+    }
+    assert(mix->base2[j] == null);
+  }
+  assert(fvisited == nfields);
+  assert(mvisited == nmethods);
+#endif
+
+  // Free intermediate buffers.
+  u->free_temps();
+}
+
+void entry::requestOutputIndex(cpool& cp, int req) {
+  assert(outputIndex <= REQUESTED_NONE);  // must not have assigned indexes yet
+  if (tag == CONSTANT_Signature) {
+    ref(0)->requestOutputIndex(cp, req);
+    return;
+  }
+  assert(req == REQUESTED || req == REQUESTED_LDC);
+  if (outputIndex != REQUESTED_NONE) {
+    if (req == REQUESTED_LDC)
+      outputIndex = req;  // this kind has precedence
+    return;
+  }
+  outputIndex = req;
+  //assert(!cp.outputEntries.contains(this));
+  assert(tag != CONSTANT_Signature);
+  // The BSMs are jetisoned to a side table, however all references
+  // that the BSMs refer to,  need to be considered.
+  if (tag == CONSTANT_BootstrapMethod) {
+    // this is a a pseudo-op entry; an attribute will be generated later on
+    cp.requested_bsms.add(this);
+  } else {
+    // all other tag types go into real output file CP:
+    cp.outputEntries.add(this);
+  }
+  for (int j = 0; j < nrefs; j++) {
+    ref(j)->requestOutputIndex(cp);
+  }
+}
+
+void cpool::resetOutputIndexes() {
+    /*
+     * reset those few entries that are being used in the current class
+     * (Caution since this method is called after every class written, a loop
+     * over every global constant pool entry would be a quadratic cost.)
+     */
+
+  int noes    = outputEntries.length();
+  entry** oes = (entry**) outputEntries.base();
+  for (int i = 0 ; i < noes ; i++) {
+    entry& e = *oes[i];
+    e.outputIndex = REQUESTED_NONE;
+  }
+
+  // do the same for bsms and reset them if required
+  int nbsms = requested_bsms.length();
+  entry** boes = (entry**) requested_bsms.base();
+  for (int i = 0 ; i < nbsms ; i++) {
+    entry& e = *boes[i];
+    e.outputIndex = REQUESTED_NONE;
+  }
+  outputIndexLimit = 0;
+  outputEntries.empty();
+#ifndef PRODUCT
+  // ensure things are cleared out
+  for (int i = 0; i < (int)maxentries; i++)
+    assert(entries[i].outputIndex == REQUESTED_NONE);
+#endif
+}
+
+static const byte TAG_ORDER[CONSTANT_Limit] = {
+  0, 1, 0, 2, 3, 4, 5, 7, 6, 10, 11, 12, 9, 8, 0, 13, 14, 15, 16
+};
+
+extern "C"
+int outputEntry_cmp(const void* e1p, const void* e2p) {
+  // Sort entries according to the Pack200 rules for deterministic
+  // constant pool ordering.
+  //
+  // The four sort keys as follows, in order of decreasing importance:
+  //   1. ldc first, then non-ldc guys
+  //   2. normal cp_All entries by input order (i.e., address order)
+  //   3. after that, extra entries by lexical order (as in tag_extras[*])
+  entry& e1 = *(entry*) *(void**) e1p;
+  entry& e2 = *(entry*) *(void**) e2p;
+  int   oi1 = e1.outputIndex;
+  int   oi2 = e2.outputIndex;
+  assert(oi1 == REQUESTED || oi1 == REQUESTED_LDC);
+  assert(oi2 == REQUESTED || oi2 == REQUESTED_LDC);
+  if (oi1 != oi2) {
+    if (oi1 == REQUESTED_LDC)  return 0-1;
+    if (oi2 == REQUESTED_LDC)  return 1-0;
+    // Else fall through; neither is an ldc request.
+  }
+  if (e1.inord != NO_INORD || e2.inord != NO_INORD) {
+    // One or both is normal.  Use input order.
+    if (&e1 > &e2)  return 1-0;
+    if (&e1 < &e2)  return 0-1;
+    return 0;  // equal pointers
+  }
+  // Both are extras.  Sort by tag and then by value.
+  if (e1.tag != e2.tag) {
+    return TAG_ORDER[e1.tag] - TAG_ORDER[e2.tag];
+  }
+  // If the tags are the same, use string comparison.
+  return compare_Utf8_chars(e1.value.b, e2.value.b);
+}
+
+void cpool::computeOutputIndexes() {
+  int i;
+
+#ifndef PRODUCT
+  // outputEntries must be a complete list of those requested:
+  static uint checkStart = 0;
+  int checkStep = 1;
+  if (nentries > 100)  checkStep = nentries / 100;
+  for (i = (int)(checkStart++ % checkStep); i < (int)nentries; i += checkStep) {
+    entry& e = entries[i];
+    if (e.tag == CONSTANT_BootstrapMethod) {
+      if (e.outputIndex != REQUESTED_NONE) {
+        assert(requested_bsms.contains(&e));
+      } else {
+        assert(!requested_bsms.contains(&e));
+      }
+    } else {
+      if (e.outputIndex != REQUESTED_NONE) {
+        assert(outputEntries.contains(&e));
+      } else {
+        assert(!outputEntries.contains(&e));
+      }
+    }
+  }
+
+  // check hand-initialization of TAG_ORDER
+  for (i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
+    byte tag = TAGS_IN_ORDER[i];
+    assert(TAG_ORDER[tag] == i+1);
+  }
+#endif
+
+  int    noes =           outputEntries.length();
+  entry** oes = (entry**) outputEntries.base();
+
+  // Sort the output constant pool into the order required by Pack200.
+  PTRLIST_QSORT(outputEntries, outputEntry_cmp);
+
+  // Allocate a new index for each entry that needs one.
+  // We do this in two passes, one for LDC entries and one for the rest.
+  int nextIndex = 1;  // always skip index #0 in output cpool
+  for (i = 0; i < noes; i++) {
+    entry& e = *oes[i];
+    assert(e.outputIndex >= REQUESTED_LDC);
+    e.outputIndex = nextIndex++;
+    if (e.isDoubleWord())  nextIndex++;  // do not use the next index
+  }
+  outputIndexLimit = nextIndex;
+  PRINTCR((3,"renumbering CP to %d entries", outputIndexLimit));
+}
+
+#ifndef PRODUCT
+// debugging goo
+
+unpacker* debug_u;
+
+static bytes& getbuf(int len) {  // for debugging only!
+  static int bn = 0;
+  static bytes bufs[8];
+  bytes& buf = bufs[bn++ & 7];
+  while ((int)buf.len < len+10)
+    buf.realloc(buf.len ? buf.len * 2 : 1000);
+  buf.ptr[0] = 0;  // for the sake of strcat
+  return buf;
+}
+
+char* entry::string() {
+  bytes buf;
+  switch (tag) {
+  case CONSTANT_None:
+    return (char*)"<empty>";
+  case CONSTANT_Signature:
+    if (value.b.ptr == null)
+      return ref(0)->string();
+    // else fall through:
+  case CONSTANT_Utf8:
+    buf = value.b;
+    break;
+  case CONSTANT_Integer:
+  case CONSTANT_Float:
+    buf = getbuf(12);
+    sprintf((char*)buf.ptr, "0x%08x", value.i);
+    break;
+  case CONSTANT_Long:
+  case CONSTANT_Double:
+    buf = getbuf(24);
+    sprintf((char*)buf.ptr, "0x" LONG_LONG_HEX_FORMAT, value.l);
+    break;
+  default:
+    if (nrefs == 0) {
+      buf = getbuf(20);
+      sprintf((char*)buf.ptr, TAG_NAME[tag]);
+    } else if (nrefs == 1) {
+      return refs[0]->string();
+    } else {
+      char* s1 = refs[0]->string();
+      char* s2 = refs[1]->string();
+      buf = getbuf((int)strlen(s1) + 1 + (int)strlen(s2) + 4 + 1);
+      buf.strcat(s1).strcat(" ").strcat(s2);
+      if (nrefs > 2)  buf.strcat(" ...");
+    }
+  }
+  return (char*)buf.ptr;
+}
+
+void print_cp_entry(int i) {
+  entry& e = debug_u->cp.entries[i];
+  char buf[30];
+  sprintf(buf, ((uint)e.tag < CONSTANT_Limit)? TAG_NAME[e.tag]: "%d", e.tag);
+  printf(" %d\t%s %s\n", i, buf, e.string());
+}
+
+void print_cp_entries(int beg, int end) {
+  for (int i = beg; i < end; i++)
+    print_cp_entry(i);
+}
+
+void print_cp() {
+  print_cp_entries(0, debug_u->cp.nentries);
+}
+
+#endif
+
+// Unpacker Start
+
+const char str_tf[] = "true\0false";
+#undef STR_TRUE
+#undef STR_FALSE
+#define STR_TRUE   (&str_tf[0])
+#define STR_FALSE  (&str_tf[5])
+
+const char* unpacker::get_option(const char* prop) {
+  if (prop == null )  return null;
+  if (strcmp(prop, UNPACK_DEFLATE_HINT) == 0) {
+    return deflate_hint_or_zero == 0? null : STR_TF(deflate_hint_or_zero > 0);
+#ifdef HAVE_STRIP
+  } else if (strcmp(prop, UNPACK_STRIP_COMPILE) == 0) {
+    return STR_TF(strip_compile);
+  } else if (strcmp(prop, UNPACK_STRIP_DEBUG) == 0) {
+    return STR_TF(strip_debug);
+  } else if (strcmp(prop, UNPACK_STRIP_JCOV) == 0) {
+    return STR_TF(strip_jcov);
+#endif /*HAVE_STRIP*/
+  } else if (strcmp(prop, UNPACK_REMOVE_PACKFILE) == 0) {
+    return STR_TF(remove_packfile);
+  } else if (strcmp(prop, DEBUG_VERBOSE) == 0) {
+    return saveIntStr(verbose);
+  } else if (strcmp(prop, UNPACK_MODIFICATION_TIME) == 0) {
+    return (modification_time_or_zero == 0)? null:
+      saveIntStr(modification_time_or_zero);
+  } else if (strcmp(prop, UNPACK_LOG_FILE) == 0) {
+    return log_file;
+  } else {
+    return NULL; // unknown option ignore
+  }
+}
+
+bool unpacker::set_option(const char* prop, const char* value) {
+  if (prop == NULL)  return false;
+  if (strcmp(prop, UNPACK_DEFLATE_HINT) == 0) {
+    deflate_hint_or_zero = ( (value == null || strcmp(value, "keep") == 0)
+                                ? 0: BOOL_TF(value) ? +1: -1);
+#ifdef HAVE_STRIP
+  } else if (strcmp(prop, UNPACK_STRIP_COMPILE) == 0) {
+    strip_compile = STR_TF(value);
+  } else if (strcmp(prop, UNPACK_STRIP_DEBUG) == 0) {
+    strip_debug = STR_TF(value);
+  } else if (strcmp(prop, UNPACK_STRIP_JCOV) == 0) {
+    strip_jcov = STR_TF(value);
+#endif /*HAVE_STRIP*/
+  } else if (strcmp(prop, UNPACK_REMOVE_PACKFILE) == 0) {
+    remove_packfile = STR_TF(value);
+  } else if (strcmp(prop, DEBUG_VERBOSE) == 0) {
+    verbose = (value == null)? 0: atoi(value);
+  } else if (strcmp(prop, DEBUG_VERBOSE ".bands") == 0) {
+#ifndef PRODUCT
+    verbose_bands = (value == null)? 0: atoi(value);
+#endif
+  } else if (strcmp(prop, UNPACK_MODIFICATION_TIME) == 0) {
+    if (value == null || (strcmp(value, "keep") == 0)) {
+      modification_time_or_zero = 0;
+    } else if (strcmp(value, "now") == 0) {
+      time_t now;
+      time(&now);
+      modification_time_or_zero = (int) now;
+    } else {
+      modification_time_or_zero = atoi(value);
+      if (modification_time_or_zero == 0)
+        modification_time_or_zero = 1;  // make non-zero
+    }
+  } else if (strcmp(prop, UNPACK_LOG_FILE) == 0) {
+    log_file = (value == null)? value: saveStr(value);
+  } else {
+    return false; // unknown option ignore
+  }
+  return true;
+}
+
+// Deallocate all internal storage and reset to a clean state.
+// Do not disturb any input or output connections, including
+// infileptr, infileno, inbytes, read_input_fn, jarout, or errstrm.
+// Do not reset any unpack options.
+void unpacker::reset() {
+  bytes_read_before_reset      += bytes_read;
+  bytes_written_before_reset   += bytes_written;
+  files_written_before_reset   += files_written;
+  classes_written_before_reset += classes_written;
+  segments_read_before_reset   += 1;
+  if (verbose >= 2) {
+    fprintf(errstrm,
+            "After segment %d, "
+            LONG_LONG_FORMAT " bytes read and "
+            LONG_LONG_FORMAT " bytes written.\n",
+            segments_read_before_reset-1,
+            bytes_read_before_reset, bytes_written_before_reset);
+    fprintf(errstrm,
+            "After segment %d, %d files (of which %d are classes) written to output.\n",
+            segments_read_before_reset-1,
+            files_written_before_reset, classes_written_before_reset);
+    if (archive_next_count != 0) {
+      fprintf(errstrm,
+              "After segment %d, %d segment%s remaining (estimated).\n",
+              segments_read_before_reset-1,
+              archive_next_count, archive_next_count==1?"":"s");
+    }
+  }
+
+  unpacker save_u = (*this);  // save bytewise image
+  infileptr = null;  // make asserts happy
+  jniobj = null;  // make asserts happy
+  jarout = null;  // do not close the output jar
+  gzin = null;  // do not close the input gzip stream
+  bytes esn;
+  if (errstrm_name != null) {
+    esn.saveFrom(errstrm_name);
+  } else {
+    esn.set(null, 0);
+  }
+  this->free();
+  mtrace('s', 0, 0);  // note the boundary between segments
+  this->init(read_input_fn);
+
+  // restore selected interface state:
+#define SAVE(x) this->x = save_u.x
+  SAVE(jniobj);
+  SAVE(jnienv);
+  SAVE(infileptr);  // buffered
+  SAVE(infileno);   // unbuffered
+  SAVE(inbytes);    // direct
+  SAVE(jarout);
+  SAVE(gzin);
+  //SAVE(read_input_fn);
+  SAVE(errstrm);
+  SAVE(verbose);  // verbose level, 0 means no output
+  SAVE(strip_compile);
+  SAVE(strip_debug);
+  SAVE(strip_jcov);
+  SAVE(remove_packfile);
+  SAVE(deflate_hint_or_zero);  // ==0 means not set, otherwise -1 or 1
+  SAVE(modification_time_or_zero);
+  SAVE(bytes_read_before_reset);
+  SAVE(bytes_written_before_reset);
+  SAVE(files_written_before_reset);
+  SAVE(classes_written_before_reset);
+  SAVE(segments_read_before_reset);
+#undef SAVE
+  if (esn.len > 0) {
+    errstrm_name = saveStr(esn.strval());
+    esn.free();
+  }
+  log_file = errstrm_name;
+  // Note:  If we use strip_names, watch out:  They get nuked here.
+}
+
+void unpacker::init(read_input_fn_t input_fn) {
+  int i;
+  NOT_PRODUCT(debug_u = this);
+  BYTES_OF(*this).clear();
+#ifndef PRODUCT
+  free();  // just to make sure freeing is idempotent
+#endif
+  this->u = this;    // self-reference for U_NEW macro
+  errstrm = stdout;  // default error-output
+  log_file = LOGFILE_STDOUT;
+  read_input_fn = input_fn;
+  all_bands = band::makeBands(this);
+  // Make a default jar buffer; caller may safely overwrite it.
+  jarout = U_NEW(jar, 1);
+  jarout->init(this);
+  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
+    attr_defs[i].u = u;  // set up outer ptr
+}
+
+const char* unpacker::get_abort_message() {
+   return abort_message;
+}
+
+void unpacker::dump_options() {
+  static const char* opts[] = {
+    UNPACK_LOG_FILE,
+    UNPACK_DEFLATE_HINT,
+#ifdef HAVE_STRIP
+    UNPACK_STRIP_COMPILE,
+    UNPACK_STRIP_DEBUG,
+    UNPACK_STRIP_JCOV,
+#endif /*HAVE_STRIP*/
+    UNPACK_REMOVE_PACKFILE,
+    DEBUG_VERBOSE,
+    UNPACK_MODIFICATION_TIME,
+    null
+  };
+  for (int i = 0; opts[i] != null; i++) {
+    const char* str = get_option(opts[i]);
+    if (str == null) {
+      if (verbose == 0)  continue;
+      str = "(not set)";
+    }
+    fprintf(errstrm, "%s=%s\n", opts[i], str);
+  }
+}
+
+
+// Usage: unpack a byte buffer
+// packptr is a reference to byte buffer containing a
+// packed file and len is the length of the buffer.
+// If null, the callback is used to fill an internal buffer.
+void unpacker::start(void* packptr, size_t len) {
+  CHECK;
+  NOT_PRODUCT(debug_u = this);
+  if (packptr != null && len != 0) {
+    inbytes.set((byte*) packptr, len);
+  }
+  CHECK;
+  read_bands();
+}
+
+void unpacker::check_options() {
+  const char* strue  = "true";
+  const char* sfalse = "false";
+  if (deflate_hint_or_zero != 0) {
+    bool force_deflate_hint = (deflate_hint_or_zero > 0);
+    if (force_deflate_hint)
+      default_file_options |= FO_DEFLATE_HINT;
+    else
+      default_file_options &= ~FO_DEFLATE_HINT;
+    // Turn off per-file deflate hint by force.
+    suppress_file_options |= FO_DEFLATE_HINT;
+  }
+  if (modification_time_or_zero != 0) {
+    default_file_modtime = modification_time_or_zero;
+    // Turn off per-file modtime by force.
+    archive_options &= ~AO_HAVE_FILE_MODTIME;
+  }
+  // %%% strip_compile, etc...
+}
+
+// classfile writing
+
+void unpacker::reset_cur_classfile() {
+  // set defaults
+  cur_class_minver = default_class_minver;
+  cur_class_majver = default_class_majver;
+
+  // reset constant pool state
+  cp.resetOutputIndexes();
+
+  // reset fixups
+  class_fixup_type.empty();
+  class_fixup_offset.empty();
+  class_fixup_ref.empty();
+  requested_ics.empty();
+  cp.requested_bsms.empty();
+}
+
+cpindex* cpool::getKQIndex() {
+  char ch = '?';
+  if (u->cur_descr != null) {
+    entry* type = u->cur_descr->descrType();
+    ch = type->value.b.ptr[0];
+  }
+  byte tag = CONSTANT_Integer;
+  switch (ch) {
+  case 'L': tag = CONSTANT_String;   break;
+  case 'I': tag = CONSTANT_Integer;  break;
+  case 'J': tag = CONSTANT_Long;     break;
+  case 'F': tag = CONSTANT_Float;    break;
+  case 'D': tag = CONSTANT_Double;   break;
+  case 'B': case 'S': case 'C':
+  case 'Z': tag = CONSTANT_Integer;  break;
+  default:  abort("bad KQ reference"); break;
+  }
+  return getIndex(tag);
+}
+
+uint unpacker::to_bci(uint bii) {
+  uint  len =         bcimap.length();
+  uint* map = (uint*) bcimap.base();
+  assert(len > 0);  // must be initialized before using to_bci
+  if (bii < len)
+    return map[bii];
+  // Else it's a fractional or out-of-range BCI.
+  uint key = bii-len;
+  for (int i = len; ; i--) {
+    if (map[i-1]-(i-1) <= key)
+      break;
+    else
+      --bii;
+  }
+  return bii;
+}
+
+void unpacker::put_stackmap_type() {
+  int tag = code_StackMapTable_T.getByte();
+  putu1(tag);
+  switch (tag) {
+  case 7: // (7) [RCH]
+    putref(code_StackMapTable_RC.getRef());
+    break;
+  case 8: // (8) [PH]
+    putu2(to_bci(code_StackMapTable_P.getInt()));
+    break;
+  }
+}
+
+// Functions for writing code.
+
+maybe_inline
+void unpacker::put_label(int curIP, int size) {
+  code_fixup_type.addByte(size);
+  code_fixup_offset.add((int)put_empty(size));
+  code_fixup_source.add(curIP);
+}
+
+inline  // called exactly once => inline
+void unpacker::write_bc_ops() {
+  bcimap.empty();
+  code_fixup_type.empty();
+  code_fixup_offset.empty();
+  code_fixup_source.empty();
+
+  band* bc_which;
+
+  byte*  opptr = bc_codes.curRP();
+  // No need for oplimit, since the codes are pre-counted.
+
+  size_t codeBase = wpoffset();
+
+  bool   isAload;  // copy-out result
+  int    origBC;
+
+  entry* thisClass  = cur_class;
+  entry* superClass = cur_super;
+  entry* newClass   = null;  // class of last _new opcode
+
+  // overwrite any prior index on these bands; it changes w/ current class:
+  bc_thisfield.setIndex(    cp.getFieldIndex( thisClass));
+  bc_thismethod.setIndex(   cp.getMethodIndex(thisClass));
+  if (superClass != null) {
+    bc_superfield.setIndex( cp.getFieldIndex( superClass));
+    bc_supermethod.setIndex(cp.getMethodIndex(superClass));
+  } else {
+    NOT_PRODUCT(bc_superfield.setIndex(null));
+    NOT_PRODUCT(bc_supermethod.setIndex(null));
+  }
+  CHECK;
+
+  for (int curIP = 0; ; curIP++) {
+    int curPC = (int)(wpoffset() - codeBase);
+    bcimap.add(curPC);
+    ensure_put_space(10);  // covers most instrs w/o further bounds check
+    int bc = *opptr++ & 0xFF;
+
+    putu1_fast(bc);
+    // Note:  See '--wp' below for pseudo-bytecodes like bc_end_marker.
+
+    bool isWide = false;
+    if (bc == bc_wide) {
+      bc = *opptr++ & 0xFF;
+      putu1_fast(bc);
+      isWide = true;
+    }
+    switch (bc) {
+    case bc_end_marker:
+      --wp;  // not really part of the code
+      assert(opptr <= bc_codes.maxRP());
+      bc_codes.curRP() = opptr;  // advance over this in bc_codes
+      goto doneScanningMethod;
+    case bc_tableswitch: // apc:  (df, lo, hi, (hi-lo+1)*(label))
+    case bc_lookupswitch: // apc:  (df, nc, nc*(case, label))
+      {
+        int caseCount = bc_case_count.getInt();
+        while (((wpoffset() - codeBase) % 4) != 0)  putu1_fast(0);
+        ensure_put_space(30 + caseCount*8);
+        put_label(curIP, 4);  //int df = bc_label.getInt();
+        if (bc == bc_tableswitch) {
+          int lo = bc_case_value.getInt();
+          int hi = lo + caseCount-1;
+          putu4(lo);
+          putu4(hi);
+          for (int j = 0; j < caseCount; j++) {
+            put_label(curIP, 4); //int lVal = bc_label.getInt();
+            //int cVal = lo + j;
+          }
+        } else {
+          putu4(caseCount);
+          for (int j = 0; j < caseCount; j++) {
+            int cVal = bc_case_value.getInt();
+            putu4(cVal);
+            put_label(curIP, 4); //int lVal = bc_label.getInt();
+          }
+        }
+        assert((int)to_bci(curIP) == curPC);
+        continue;
+      }
+    case bc_iinc:
+      {
+        int local = bc_local.getInt();
+        int delta = (isWide ? bc_short : bc_byte).getInt();
+        if (isWide) {
+          putu2(local);
+          putu2(delta);
+        } else {
+          putu1_fast(local);
+          putu1_fast(delta);
+        }
+        continue;
+      }
+    case bc_sipush:
+      {
+        int val = bc_short.getInt();
+        putu2(val);
+        continue;
+      }
+    case bc_bipush:
+    case bc_newarray:
+      {
+        int val = bc_byte.getByte();
+        putu1_fast(val);
+        continue;
+      }
+    case bc_ref_escape:
+      {
+        // Note that insnMap has one entry for this.
+        --wp;  // not really part of the code
+        int size = bc_escrefsize.getInt();
+        entry* ref = bc_escref.getRefN();
+        CHECK;
+        switch (size) {
+        case 1: putu1ref(ref); break;
+        case 2: putref(ref);   break;
+        default: assert(false);
+        }
+        continue;
+      }
+    case bc_byte_escape:
+      {
+        // Note that insnMap has one entry for all these bytes.
+        --wp;  // not really part of the code
+        int size = bc_escsize.getInt();
+        ensure_put_space(size);
+        for (int j = 0; j < size; j++)
+          putu1_fast(bc_escbyte.getByte());
+        continue;
+      }
+    default:
+      if (is_invoke_init_op(bc)) {
+        origBC = bc_invokespecial;
+        entry* classRef;
+        switch (bc - _invokeinit_op) {
+        case _invokeinit_self_option:   classRef = thisClass;  break;
+        case _invokeinit_super_option:  classRef = superClass; break;
+        default: assert(bc == _invokeinit_op+_invokeinit_new_option);
+        case _invokeinit_new_option:    classRef = newClass;   break;
+        }
+        wp[-1] = origBC;  // overwrite with origBC
+        int coding = bc_initref.getInt();
+        // Find the nth overloading of <init> in classRef.
+        entry*   ref = null;
+        cpindex* ix = cp.getMethodIndex(classRef);
+        CHECK;
+        for (int j = 0, which_init = 0; ; j++) {
+          ref = (ix == null)? null: ix->get(j);
+          if (ref == null)  break;  // oops, bad input
+          assert(ref->tag == CONSTANT_Methodref);
+          if (ref->memberDescr()->descrName() == cp.sym[cpool::s_lt_init_gt]) {
+            if (which_init++ == coding)  break;
+          }
+        }
+        putref(ref);
+        continue;
+      }
+      bc_which = ref_band_for_self_op(bc, isAload, origBC);
+      if (bc_which != null) {
+        if (!isAload) {
+          wp[-1] = origBC;  // overwrite with origBC
+        } else {
+          wp[-1] = bc_aload_0;  // overwrite with _aload_0
+          // Note: insnMap keeps the _aload_0 separate.
+          bcimap.add(++curPC);
+          ++curIP;
+          putu1_fast(origBC);
+        }
+        entry* ref = bc_which->getRef();
+        CHECK;
+        putref(ref);
+        continue;
+      }
+      if (is_branch_op(bc)) {
+        //int lVal = bc_label.getInt();
+        if (bc < bc_goto_w) {
+          put_label(curIP, 2);  //putu2(lVal & 0xFFFF);
+        } else {
+          assert(bc <= bc_jsr_w);
+          put_label(curIP, 4);  //putu4(lVal);
+        }
+        assert((int)to_bci(curIP) == curPC);
+        continue;
+      }
+      bc_which = ref_band_for_op(bc);
+      if (bc_which != null) {
+        entry* ref = bc_which->getRefCommon(bc_which->ix, bc_which->nullOK);
+        CHECK;
+        if (ref == null && bc_which == &bc_classref) {
+          // Shorthand for class self-references.
+          ref = thisClass;
+        }
+        origBC = bc;
+        switch (bc) {
+        case _invokestatic_int:
+          origBC = bc_invokestatic;
+          break;
+        case _invokespecial_int:
+          origBC = bc_invokespecial;
+          break;
+        case bc_ildc:
+        case bc_cldc:
+        case bc_fldc:
+        case bc_sldc:
+        case bc_qldc:
+          origBC = bc_ldc;
+          break;
+        case bc_ildc_w:
+        case bc_cldc_w:
+        case bc_fldc_w:
+        case bc_sldc_w:
+        case bc_qldc_w:
+          origBC = bc_ldc_w;
+          break;
+        case bc_lldc2_w:
+        case bc_dldc2_w:
+          origBC = bc_ldc2_w;
+          break;
+        case bc_new:
+          newClass = ref;
+          break;
+        }
+        wp[-1] = origBC;  // overwrite with origBC
+        if (origBC == bc_ldc) {
+          putu1ref(ref);
+        } else {
+          putref(ref);
+        }
+        if (origBC == bc_multianewarray) {
+          // Copy the trailing byte also.
+          int val = bc_byte.getByte();
+          putu1_fast(val);
+        } else if (origBC == bc_invokeinterface) {
+          int argSize = ref->memberDescr()->descrType()->typeSize();
+          putu1_fast(1 + argSize);
+          putu1_fast(0);
+        } else if (origBC == bc_invokedynamic) {
+          // pad the next two byte
+          putu1_fast(0);
+          putu1_fast(0);
+        }
+        continue;
+      }
+      if (is_local_slot_op(bc)) {
+        int local = bc_local.getInt();
+        if (isWide) {
+          putu2(local);
+          if (bc == bc_iinc) {
+            int iVal = bc_short.getInt();
+            putu2(iVal);
+          }
+        } else {
+          putu1_fast(local);
+          if (bc == bc_iinc) {
+            int iVal = bc_byte.getByte();
+            putu1_fast(iVal);
+          }
+        }
+        continue;
+      }
+      // Random bytecode.  Just copy it.
+      assert(bc < bc_bytecode_limit);
+    }
+  }
+ doneScanningMethod:{}
+  //bcimap.add(curPC);  // PC limit is already also in map, from bc_end_marker
+
+  // Armed with a bcimap, we can now fix up all the labels.
+  for (int i = 0; i < (int)code_fixup_type.size(); i++) {
+    int   type   = code_fixup_type.getByte(i);
+    byte* bp     = wp_at(code_fixup_offset.get(i));
+    int   curIP  = code_fixup_source.get(i);
+    int   destIP = curIP + bc_label.getInt();
+    int   span   = to_bci(destIP) - to_bci(curIP);
+    switch (type) {
+    case 2: putu2_at(bp, (ushort)span); break;
+    case 4: putu4_at(bp,         span); break;
+    default: assert(false);
+    }
+  }
+}
+
+inline  // called exactly once => inline
+void unpacker::write_code() {
+  int j;
+
+  int max_stack, max_locals, handler_count, cflags;
+  get_code_header(max_stack, max_locals, handler_count, cflags);
+
+  if (max_stack < 0)      max_stack = code_max_stack.getInt();
+  if (max_locals < 0)     max_locals = code_max_na_locals.getInt();
+  if (handler_count < 0)  handler_count = code_handler_count.getInt();
+
+  int siglen = cur_descr->descrType()->typeSize();
+  CHECK;
+  if ((cur_descr_flags & ACC_STATIC) == 0)  siglen++;
+  max_locals += siglen;
+
+  putu2(max_stack);
+  putu2(max_locals);
+  size_t bcbase = put_empty(4);
+
+  // Write the bytecodes themselves.
+  write_bc_ops();
+  CHECK;
+
+  byte* bcbasewp = wp_at(bcbase);
+  putu4_at(bcbasewp, (int)(wp - (bcbasewp+4)));  // size of code attr
+
+  putu2(handler_count);
+  for (j = 0; j < handler_count; j++) {
+    int bii = code_handler_start_P.getInt();
+    putu2(to_bci(bii));
+    bii    += code_handler_end_PO.getInt();
+    putu2(to_bci(bii));
+    bii    += code_handler_catch_PO.getInt();
+    putu2(to_bci(bii));
+    putref(code_handler_class_RCN.getRefN());
+    CHECK;
+  }
+
+  julong indexBits = cflags;
+  if (cflags < 0) {
+    bool haveLongFlags = attr_defs[ATTR_CONTEXT_CODE].haveLongFlags();
+    indexBits = code_flags_hi.getLong(code_flags_lo, haveLongFlags);
+  }
+  write_attrs(ATTR_CONTEXT_CODE, indexBits);
+}
+
+int unpacker::write_attrs(int attrc, julong indexBits) {
+  CHECK_0;
+  if (indexBits == 0) {
+    // Quick short-circuit.
+    putu2(0);
+    return 0;
+  }
+
+  attr_definitions& ad = attr_defs[attrc];
+
+  int i, j, j2, idx, count;
+
+  int oiCount = 0;
+  if (ad.isPredefined(X_ATTR_OVERFLOW)
+      && (indexBits & ((julong)1<<X_ATTR_OVERFLOW)) != 0) {
+    indexBits -= ((julong)1<<X_ATTR_OVERFLOW);
+    oiCount = ad.xxx_attr_count().getInt();
+  }
+
+  int bitIndexes[X_ATTR_LIMIT_FLAGS_HI];
+  int biCount = 0;
+
+  // Fill bitIndexes with index bits, in order.
+  for (idx = 0; indexBits != 0; idx++, indexBits >>= 1) {
+    if ((indexBits & 1) != 0)
+      bitIndexes[biCount++] = idx;
+  }
+  assert(biCount <= (int)lengthof(bitIndexes));
+
+  // Write a provisional attribute count, perhaps to be corrected later.
+  int naOffset = (int)wpoffset();
+  int na0 = biCount + oiCount;
+  putu2(na0);
+
+  int na = 0;
+  for (i = 0; i < na0; i++) {
+    if (i < biCount)
+      idx = bitIndexes[i];
+    else
+      idx = ad.xxx_attr_indexes().getInt();
+    assert(ad.isIndex(idx));
+    entry* aname = null;
+    entry* ref;  // scratch
+    size_t abase = put_empty(2+4);
+    CHECK_0;
+    if (idx < (int)ad.flag_limit && ad.isPredefined(idx)) {
+      // Switch on the attrc and idx simultaneously.
+      switch (ADH_BYTE(attrc, idx)) {
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS,  X_ATTR_OVERFLOW):
+      case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_OVERFLOW):
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_OVERFLOW):
+      case ADH_BYTE(ATTR_CONTEXT_CODE,   X_ATTR_OVERFLOW):
+        // no attribute at all, so back up on this one
+        wp = wp_at(abase);
+        continue;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_ClassFile_version):
+        cur_class_minver = class_ClassFile_version_minor_H.getInt();
+        cur_class_majver = class_ClassFile_version_major_H.getInt();
+        // back up; not a real attribute
+        wp = wp_at(abase);
+        continue;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_InnerClasses):
+        // note the existence of this attr, but save for later
+        if (cur_class_has_local_ics)
+          abort("too many InnerClasses attrs");
+        cur_class_has_local_ics = true;
+        wp = wp_at(abase);
+        continue;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_SourceFile):
+        aname = cp.sym[cpool::s_SourceFile];
+        ref = class_SourceFile_RUN.getRefN();
+        CHECK_0;
+        if (ref == null) {
+          bytes& n = cur_class->ref(0)->value.b;
+          // parse n = (<pkg>/)*<outer>?($<id>)*
+          int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, (int)n.len)+1;
+          bytes prefix = n.slice(pkglen, n.len);
+          for (;;) {
+            // Work backwards, finding all '$', '#', etc.
+            int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, (int)prefix.len);
+            if (dollar < 0)  break;
+            prefix = prefix.slice(0, dollar);
+          }
+          const char* suffix = ".java";
+          int len = (int)(prefix.len + strlen(suffix));
+          bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
+          name.strcat(prefix).strcat(suffix);
+          ref = cp.ensureUtf8(name);
+        }
+        putref(ref);
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_EnclosingMethod):
+        aname = cp.sym[cpool::s_EnclosingMethod];
+        putref(class_EnclosingMethod_RC.getRefN());
+        CHECK_0;
+        putref(class_EnclosingMethod_RDN.getRefN());
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_FIELD, FIELD_ATTR_ConstantValue):
+        aname = cp.sym[cpool::s_ConstantValue];
+        putref(field_ConstantValue_KQ.getRefUsing(cp.getKQIndex()));
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Code):
+        aname = cp.sym[cpool::s_Code];
+        write_code();
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Exceptions):
+        aname = cp.sym[cpool::s_Exceptions];
+        putu2(count = method_Exceptions_N.getInt());
+        for (j = 0; j < count; j++) {
+          putref(method_Exceptions_RC.getRefN());
+          CHECK_0;
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_MethodParameters):
+        aname = cp.sym[cpool::s_MethodParameters];
+        putu1(count = method_MethodParameters_NB.getByte());
+        for (j = 0; j < count; j++) {
+          putref(method_MethodParameters_name_RUN.getRefN());
+          putu2(method_MethodParameters_flag_FH.getInt());
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable):
+        aname = cp.sym[cpool::s_StackMapTable];
+        // (keep this code aligned with its brother in unpacker::read_attrs)
+        putu2(count = code_StackMapTable_N.getInt());
+        for (j = 0; j < count; j++) {
+          int tag = code_StackMapTable_frame_T.getByte();
+          putu1(tag);
+          if (tag <= 127) {
+            // (64-127)  [(2)]
+            if (tag >= 64)  put_stackmap_type();
+          } else if (tag <= 251) {
+            // (247)     [(1)(2)]
+            // (248-251) [(1)]
+            if (tag >= 247)  putu2(code_StackMapTable_offset.getInt());
+            if (tag == 247)  put_stackmap_type();
+          } else if (tag <= 254) {
+            // (252)     [(1)(2)]
+            // (253)     [(1)(2)(2)]
+            // (254)     [(1)(2)(2)(2)]
+            putu2(code_StackMapTable_offset.getInt());
+            CHECK_0;
+            for (int k = (tag - 251); k > 0; k--) {
+              put_stackmap_type();
+              CHECK_0;
+            }
+          } else {
+            // (255)     [(1)NH[(2)]NH[(2)]]
+            putu2(code_StackMapTable_offset.getInt());
+            putu2(j2 = code_StackMapTable_local_N.getInt());
+            while (j2-- > 0) {put_stackmap_type(); CHECK_0;}
+            putu2(j2 = code_StackMapTable_stack_N.getInt());
+            while (j2-- > 0)  {put_stackmap_type(); CHECK_0;}
+          }
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LineNumberTable):
+        aname = cp.sym[cpool::s_LineNumberTable];
+        putu2(count = code_LineNumberTable_N.getInt());
+        for (j = 0; j < count; j++) {
+          putu2(to_bci(code_LineNumberTable_bci_P.getInt()));
+          putu2(code_LineNumberTable_line.getInt());
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTable):
+        aname = cp.sym[cpool::s_LocalVariableTable];
+        putu2(count = code_LocalVariableTable_N.getInt());
+        for (j = 0; j < count; j++) {
+          int bii = code_LocalVariableTable_bci_P.getInt();
+          int bci = to_bci(bii);
+          putu2(bci);
+          bii    += code_LocalVariableTable_span_O.getInt();
+          putu2(to_bci(bii) - bci);
+          putref(code_LocalVariableTable_name_RU.getRefN());
+          CHECK_0;
+          putref(code_LocalVariableTable_type_RS.getRefN());
+          CHECK_0;
+          putu2(code_LocalVariableTable_slot.getInt());
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTypeTable):
+        aname = cp.sym[cpool::s_LocalVariableTypeTable];
+        putu2(count = code_LocalVariableTypeTable_N.getInt());
+        for (j = 0; j < count; j++) {
+          int bii = code_LocalVariableTypeTable_bci_P.getInt();
+          int bci = to_bci(bii);
+          putu2(bci);
+          bii    += code_LocalVariableTypeTable_span_O.getInt();
+          putu2(to_bci(bii) - bci);
+          putref(code_LocalVariableTypeTable_name_RU.getRefN());
+          CHECK_0;
+          putref(code_LocalVariableTypeTable_type_RS.getRefN());
+          CHECK_0;
+          putu2(code_LocalVariableTypeTable_slot.getInt());
+        }
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS, X_ATTR_Signature):
+        aname = cp.sym[cpool::s_Signature];
+        putref(class_Signature_RS.getRefN());
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_FIELD, X_ATTR_Signature):
+        aname = cp.sym[cpool::s_Signature];
+        putref(field_Signature_RS.getRefN());
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Signature):
+        aname = cp.sym[cpool::s_Signature];
+        putref(method_Signature_RS.getRefN());
+        break;
+
+      case ADH_BYTE(ATTR_CONTEXT_CLASS,  X_ATTR_Deprecated):
+      case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_Deprecated):
+      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Deprecated):
+        aname = cp.sym[cpool::s_Deprecated];
+        // no data
+        break;
+      }
+    }
+    CHECK_0;
+    if (aname == null) {
+      // Unparse a compressor-defined attribute.
+      layout_definition* lo = ad.getLayout(idx);
+      if (lo == null) {
+        abort("bad layout index");
+        break;
+      }
+      assert((int)lo->idx == idx);
+      aname = lo->nameEntry;
+      if (aname == null) {
+        bytes nameb; nameb.set(lo->name);
+        aname = cp.ensureUtf8(nameb);
+        // Cache the name entry for next time.
+        lo->nameEntry = aname;
+      }
+      // Execute all the layout elements.
+      band** bands = lo->bands();
+      if (lo->hasCallables()) {
+        band& cble = *bands[0];
+        assert(cble.le_kind == EK_CBLE);
+        bands = cble.le_body;
+      }
+      putlayout(bands);
+    }
+
+    if (aname == null)
+      abort("bad attribute index");
+    CHECK_0;
+
+    byte* wp1 = wp;
+    wp = wp_at(abase);
+
+    // DTRT if this attr is on the strip-list.
+    // (Note that we emptied the data out of the band first.)
+    if (ad.strip_names.contains(aname)) {
+      continue;
+    }
+
+    // patch the name and length
+    putref(aname);
+    putu4((int)(wp1 - (wp+4)));  // put the attr size
+    wp = wp1;
+    na++;  // count the attrs actually written
+  }
+
+  if (na != na0)
+    // Refresh changed count.
+    putu2_at(wp_at(naOffset), na);
+  return na;
+}
+
+void unpacker::write_members(int num, int attrc) {
+  CHECK;
+  attr_definitions& ad = attr_defs[attrc];
+  band& member_flags_hi = ad.xxx_flags_hi();
+  band& member_flags_lo = ad.xxx_flags_lo();
+  band& member_descr = (&member_flags_hi)[e_field_descr-e_field_flags_hi];
+  assert(endsWith(member_descr.name, "_descr"));
+  assert(endsWith(member_flags_lo.name, "_flags_lo"));
+  assert(endsWith(member_flags_lo.name, "_flags_lo"));
+  bool haveLongFlags = ad.haveLongFlags();
+
+  putu2(num);
+  julong indexMask = attr_defs[attrc].flagIndexMask();
+  for (int i = 0; i < num; i++) {
+    julong mflags = member_flags_hi.getLong(member_flags_lo, haveLongFlags);
+    entry* mdescr = member_descr.getRef();
+    cur_descr = mdescr;
+    putu2(cur_descr_flags = (ushort)(mflags & ~indexMask));
+    CHECK;
+    putref(mdescr->descrName());
+    putref(mdescr->descrType());
+    write_attrs(attrc, (mflags & indexMask));
+    CHECK;
+  }
+  cur_descr = null;
+}
+
+extern "C"
+int raw_address_cmp(const void* p1p, const void* p2p) {
+  void* p1 = *(void**) p1p;
+  void* p2 = *(void**) p2p;
+  return (p1 > p2)? 1: (p1 < p2)? -1: 0;
+}
+
+/*
+ * writes the InnerClass attributes and returns the updated attribute
+ */
+int  unpacker::write_ics(int naOffset, int na) {
+#ifdef ASSERT
+  for (int i = 0; i < ic_count; i++) {
+    assert(!ics[i].requested);
+  }
+#endif
+  // First, consult the global table and the local constant pool,
+  // and decide on the globally implied inner classes.
+  // (Note that we read the cpool's outputIndex fields, but we
+  // do not yet write them, since the local IC attribute might
+  // reverse a global decision to declare an IC.)
+  assert(requested_ics.length() == 0);  // must start out empty
+  // Always include all members of the current class.
+  for (inner_class* child = cp.getFirstChildIC(cur_class);
+       child != null;
+       child = cp.getNextChildIC(child)) {
+    child->requested = true;
+    requested_ics.add(child);
+  }
+  // And, for each inner class mentioned in the constant pool,
+  // include it and all its outers.
+  int    noes =           cp.outputEntries.length();
+  entry** oes = (entry**) cp.outputEntries.base();
+  for (int i = 0; i < noes; i++) {
+    entry& e = *oes[i];
+    if (e.tag != CONSTANT_Class)  continue;  // wrong sort
+    for (inner_class* ic = cp.getIC(&e);
+         ic != null;
+         ic = cp.getIC(ic->outer)) {
+      if (ic->requested)  break;  // already processed
+      ic->requested = true;
+      requested_ics.add(ic);
+    }
+  }
+  int local_ics = requested_ics.length();
+  // Second, consult a local attribute (if any) and adjust the global set.
+  inner_class* extra_ics = null;
+  int      num_extra_ics = 0;
+  if (cur_class_has_local_ics) {
+    // adjust the set of ICs by symmetric set difference w/ the locals
+    num_extra_ics = class_InnerClasses_N.getInt();
+    if (num_extra_ics == 0) {
+      // Explicit zero count has an irregular meaning:  It deletes the attr.
+      local_ics = 0;  // (short-circuit all tests of requested bits)
+    } else {
+      extra_ics = T_NEW(inner_class, num_extra_ics);
+      // Note:  extra_ics will be freed up by next call to get_next_file().
+    }
+  }
+  for (int i = 0; i < num_extra_ics; i++) {
+    inner_class& extra_ic = extra_ics[i];
+    extra_ic.inner = class_InnerClasses_RC.getRef();
+    CHECK_0;
+    // Find the corresponding equivalent global IC:
+    inner_class* global_ic = cp.getIC(extra_ic.inner);
+    int flags = class_InnerClasses_F.getInt();
+    if (flags == 0) {
+      // The extra IC is simply a copy of a global IC.
+      if (global_ic == null) {
+        abort("bad reference to inner class");
+        break;
+      }
+      extra_ic = (*global_ic);  // fill in rest of fields
+    } else {
+      flags &= ~ACC_IC_LONG_FORM;  // clear high bit if set to get clean zero
+      extra_ic.flags = flags;
+      extra_ic.outer = class_InnerClasses_outer_RCN.getRefN();
+      CHECK_0;
+      extra_ic.name  = class_InnerClasses_name_RUN.getRefN();
+      CHECK_0;
+      // Detect if this is an exact copy of the global tuple.
+      if (global_ic != null) {
+        if (global_ic->flags != extra_ic.flags ||
+            global_ic->outer != extra_ic.outer ||
+            global_ic->name  != extra_ic.name) {
+          global_ic = null;  // not really the same, so break the link
+        }
+      }
+    }
+    if (global_ic != null && global_ic->requested) {
+      // This local repetition reverses the globally implied request.
+      global_ic->requested = false;
+      extra_ic.requested = false;
+      local_ics -= 1;
+    } else {
+      // The global either does not exist, or is not yet requested.
+      extra_ic.requested = true;
+      local_ics += 1;
+    }
+  }
+  // Finally, if there are any that survived, put them into an attribute.
+  // (Note that a zero-count attribute is always deleted.)
+  // The putref calls below will tell the constant pool to add any
+  // necessary local CP references to support the InnerClasses attribute.
+  // This step must be the last round of additions to the local CP.
+  if (local_ics > 0) {
+    // append the new attribute:
+    putref(cp.sym[cpool::s_InnerClasses]);
+    putu4(2 + 2*4*local_ics);
+    putu2(local_ics);
+    PTRLIST_QSORT(requested_ics, raw_address_cmp);
+    int num_global_ics = requested_ics.length();
+    for (int i = -num_global_ics; i < num_extra_ics; i++) {
+      inner_class* ic;
+      if (i < 0)
+        ic = (inner_class*) requested_ics.get(num_global_ics+i);
+      else
+        ic = &extra_ics[i];
+      if (ic->requested) {
+        putref(ic->inner);
+        putref(ic->outer);
+        putref(ic->name);
+        putu2(ic->flags);
+        NOT_PRODUCT(local_ics--);
+      }
+    }
+    assert(local_ics == 0);           // must balance
+    putu2_at(wp_at(naOffset), ++na);  // increment class attr count
+  }
+
+  // Tidy up global 'requested' bits:
+  for (int i = requested_ics.length(); --i >= 0; ) {
+    inner_class* ic = (inner_class*) requested_ics.get(i);
+    ic->requested = false;
+  }
+  requested_ics.empty();
+  return na;
+}
+
+/*
+ * Writes the BootstrapMethods attribute and returns the updated attribute count
+ */
+int unpacker::write_bsms(int naOffset, int na) {
+  cur_class_local_bsm_count = cp.requested_bsms.length();
+  if (cur_class_local_bsm_count > 0) {
+    int    noes =           cp.outputEntries.length();
+    entry** oes = (entry**) cp.outputEntries.base();
+    PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp);
+    // append the BootstrapMethods attribute (after the InnerClasses attr):
+    putref(cp.sym[cpool::s_BootstrapMethods]);
+    // make a note of the offset, for lazy patching
+    int sizeOffset = (int)wpoffset();
+    putu4(-99);  // attr size will be patched
+    putu2(cur_class_local_bsm_count);
+    int written_bsms = 0;
+    for (int i = 0 ; i < cur_class_local_bsm_count ; i++) {
+      entry* e = (entry*)cp.requested_bsms.get(i);
+      assert(e->outputIndex != REQUESTED_NONE);
+      // output index is the index within the array
+      e->outputIndex = i;
+      putref(e->refs[0]);  // bsm
+      putu2(e->nrefs-1);  // number of args after bsm
+      for (int j = 1; j < e->nrefs; j++) {
+        putref(e->refs[j]);
+      }
+      written_bsms += 1;
+    }
+    assert(written_bsms == cur_class_local_bsm_count);  // else insane
+    byte* sizewp = wp_at(sizeOffset);
+    putu4_at(sizewp, (int)(wp - (sizewp+4)));  // size of code attr
+    putu2_at(wp_at(naOffset), ++na);  // increment class attr count
+  }
+  return na;
+}
+
+void unpacker::write_classfile_tail() {
+
+  cur_classfile_tail.empty();
+  set_output(&cur_classfile_tail);
+
+  int i, num;
+
+  attr_definitions& ad = attr_defs[ATTR_CONTEXT_CLASS];
+
+  bool haveLongFlags = ad.haveLongFlags();
+  julong kflags = class_flags_hi.getLong(class_flags_lo, haveLongFlags);
+  julong indexMask = ad.flagIndexMask();
+
+  cur_class = class_this.getRef();
+  CHECK;
+  cur_super = class_super.getRef();
+  CHECK;
+
+  if (cur_super == cur_class)  cur_super = null;
+  // special representation for java/lang/Object
+
+  putu2((ushort)(kflags & ~indexMask));
+  putref(cur_class);
+  putref(cur_super);
+
+  putu2(num = class_interface_count.getInt());
+  for (i = 0; i < num; i++) {
+    putref(class_interface.getRef());
+    CHECK;
+  }
+
+  write_members(class_field_count.getInt(),  ATTR_CONTEXT_FIELD);
+  write_members(class_method_count.getInt(), ATTR_CONTEXT_METHOD);
+  CHECK;
+
+  cur_class_has_local_ics = false;  // may be set true by write_attrs
+
+  int naOffset = (int)wpoffset();   // note the attr count location
+  int na = write_attrs(ATTR_CONTEXT_CLASS, (kflags & indexMask));
+  CHECK;
+
+  na = write_bsms(naOffset, na);
+  CHECK;
+
+  // choose which inner classes (if any) pertain to k:
+  na = write_ics(naOffset, na);
+  CHECK;
+
+  close_output();
+  cp.computeOutputIndexes();
+
+  // rewrite CP references in the tail
+  int nextref = 0;
+  for (i = 0; i < (int)class_fixup_type.size(); i++) {
+    int    type = class_fixup_type.getByte(i);
+    byte*  fixp = wp_at(class_fixup_offset.get(i));
+    entry* e    = (entry*)class_fixup_ref.get(nextref++);
+    int    idx  = e->getOutputIndex();
+    switch (type) {
+    case 1:  putu1_at(fixp, idx);  break;
+    case 2:  putu2_at(fixp, idx);  break;
+    default: assert(false);  // should not reach here
+    }
+  }
+  CHECK;
+}
+
+void unpacker::write_classfile_head() {
+  cur_classfile_head.empty();
+  set_output(&cur_classfile_head);
+
+  putu4(JAVA_MAGIC);
+  putu2(cur_class_minver);
+  putu2(cur_class_majver);
+  putu2(cp.outputIndexLimit);
+
+  int checkIndex = 1;
+  int    noes =           cp.outputEntries.length();
+  entry** oes = (entry**) cp.outputEntries.base();
+  for (int i = 0; i < noes; i++) {
+    entry& e = *oes[i];
+    assert(e.getOutputIndex() == checkIndex++);
+    byte tag = e.tag;
+    assert(tag != CONSTANT_Signature);
+    putu1(tag);
+    switch (tag) {
+    case CONSTANT_Utf8:
+      putu2((int)e.value.b.len);
+      put_bytes(e.value.b);
+      break;
+    case CONSTANT_Integer:
+    case CONSTANT_Float:
+      putu4(e.value.i);
+      break;
+    case CONSTANT_Long:
+    case CONSTANT_Double:
+      putu8(e.value.l);
+      assert(checkIndex++);
+      break;
+    case CONSTANT_Class:
+    case CONSTANT_String:
+      // just write the ref
+      putu2(e.refs[0]->getOutputIndex());
+      break;
+    case CONSTANT_Fieldref:
+    case CONSTANT_Methodref:
+    case CONSTANT_InterfaceMethodref:
+    case CONSTANT_NameandType:
+    case CONSTANT_InvokeDynamic:
+      putu2(e.refs[0]->getOutputIndex());
+      putu2(e.refs[1]->getOutputIndex());
+      break;
+    case CONSTANT_MethodHandle:
+        putu1(e.value.i);
+        putu2(e.refs[0]->getOutputIndex());
+        break;
+    case CONSTANT_MethodType:
+      putu2(e.refs[0]->getOutputIndex());
+      break;
+    case CONSTANT_BootstrapMethod: // should not happen
+    default:
+      abort(ERROR_INTERNAL);
+    }
+  }
+
+#ifndef PRODUCT
+  total_cp_size[0] += cp.outputIndexLimit;
+  total_cp_size[1] += (int)cur_classfile_head.size();
+#endif
+  close_output();
+}
+
+unpacker::file* unpacker::get_next_file() {
+  CHECK_0;
+  free_temps();
+  if (files_remaining == 0) {
+    // Leave a clue that we're exhausted.
+    cur_file.name = null;
+    cur_file.size = null;
+    if (archive_size != 0) {
+      julong predicted_size = unsized_bytes_read + archive_size;
+      if (predicted_size != bytes_read)
+        abort("archive header had incorrect size");
+    }
+    return null;
+  }
+  files_remaining -= 1;
+  assert(files_written < file_count || classes_written < class_count);
+  cur_file.name = "";
+  cur_file.size = 0;
+  cur_file.modtime = default_file_modtime;
+  cur_file.options = default_file_options;
+  cur_file.data[0].set(null, 0);
+  cur_file.data[1].set(null, 0);
+  if (files_written < file_count) {
+    entry* e = file_name.getRef();
+    CHECK_0;
+    cur_file.name = e->utf8String();
+    bool haveLongSize = (testBit(archive_options, AO_HAVE_FILE_SIZE_HI));
+    cur_file.size = file_size_hi.getLong(file_size_lo, haveLongSize);
+    if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
+      cur_file.modtime += file_modtime.getInt();  //relative to archive modtime
+    if (testBit(archive_options, AO_HAVE_FILE_OPTIONS))
+      cur_file.options |= file_options.getInt() & ~suppress_file_options;
+  } else if (classes_written < class_count) {
+    // there is a class for a missing file record
+    cur_file.options |= FO_IS_CLASS_STUB;
+  }
+  if ((cur_file.options & FO_IS_CLASS_STUB) != 0) {
+    assert(classes_written < class_count);
+    classes_written += 1;
+    if (cur_file.size != 0) {
+      abort("class file size transmitted");
+      return null;
+    }
+    reset_cur_classfile();
+
+    // write the meat of the classfile:
+    write_classfile_tail();
+    cur_file.data[1] = cur_classfile_tail.b;
+    CHECK_0;
+
+    // write the CP of the classfile, second:
+    write_classfile_head();
+    cur_file.data[0] = cur_classfile_head.b;
+    CHECK_0;
+
+    cur_file.size += cur_file.data[0].len;
+    cur_file.size += cur_file.data[1].len;
+    if (cur_file.name[0] == '\0') {
+      bytes& prefix = cur_class->ref(0)->value.b;
+      const char* suffix = ".class";
+      int len = (int)(prefix.len + strlen(suffix));
+      bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
+      cur_file.name = name.strcat(prefix).strcat(suffix).strval();
+    }
+  } else {
+    // If there is buffered file data, produce a pointer to it.
+    if (cur_file.size != (size_t) cur_file.size) {
+      // Silly size specified.
+      abort("resource file too large");
+      return null;
+    }
+    size_t rpleft = input_remaining();
+    if (rpleft > 0) {
+      if (rpleft > cur_file.size)
+        rpleft = (size_t) cur_file.size;
+      cur_file.data[0].set(rp, rpleft);
+      rp += rpleft;
+    }
+    if (rpleft < cur_file.size) {
+      // Caller must read the rest.
+      size_t fleft = (size_t)cur_file.size - rpleft;
+      bytes_read += fleft;  // Credit it to the overall archive size.
+    }
+  }
+  CHECK_0;
+  bytes_written += cur_file.size;
+  files_written += 1;
+  return &cur_file;
+}
+
+// Write a file to jarout.
+void unpacker::write_file_to_jar(unpacker::file* f) {
+  size_t htsize = f->data[0].len + f->data[1].len;
+  julong fsize = f->size;
+#ifndef PRODUCT
+  if (nowrite NOT_PRODUCT(|| skipfiles-- > 0)) {
+    PRINTCR((2,"would write %d bytes to %s", (int) fsize, f->name));
+    return;
+  }
+#endif
+  if (htsize == fsize) {
+    jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
+                        f->data[0], f->data[1]);
+  } else {
+    assert(input_remaining() == 0);
+    bytes part1, part2;
+    part1.len = f->data[0].len;
+    part1.set(T_NEW(byte, part1.len), part1.len);
+    part1.copyFrom(f->data[0]);
+    assert(f->data[1].len == 0);
+    part2.set(null, 0);
+    size_t fleft = (size_t) fsize - part1.len;
+    assert(bytes_read > fleft);  // part2 already credited by get_next_file
+    bytes_read -= fleft;
+    if (fleft > 0) {
+      // Must read some more.
+      if (live_input) {
+        // Stop using the input buffer.  Make a new one:
+        if (free_input)  input.free();
+        input.init(fleft > (1<<12) ? fleft : (1<<12));
+        free_input = true;
+        live_input = false;
+      } else {
+        // Make it large enough.
+        assert(free_input);  // must be reallocable
+        input.ensureSize(fleft);
+      }
+      rplimit = rp = input.base();
+      CHECK;
+      input.setLimit(rp + fleft);
+      if (!ensure_input(fleft))
+        abort("EOF reading resource file");
+      part2.ptr = input_scan();
+      part2.len = input_remaining();
+      rplimit = rp = input.base();
+    }
+    jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
+                        part1, part2);
+  }
+  if (verbose >= 3) {
+    fprintf(errstrm, "Wrote "
+                     LONG_LONG_FORMAT " bytes to: %s\n", fsize, f->name);
+  }
+}
+
+// Redirect the stdio to the specified file in the unpack.log.file option
+void unpacker::redirect_stdio() {
+  if (log_file == null) {
+    log_file = LOGFILE_STDOUT;
+  }
+  if (log_file == errstrm_name)
+    // Nothing more to be done.
+    return;
+  errstrm_name = log_file;
+  if (strcmp(log_file, LOGFILE_STDERR) == 0) {
+    errstrm = stderr;
+    return;
+  } else if (strcmp(log_file, LOGFILE_STDOUT) == 0) {
+    errstrm = stdout;
+    return;
+  } else if (log_file[0] != '\0' && (errstrm = fopen(log_file,"a+")) != NULL) {
+    return;
+  } else {
+    fprintf(stderr, "Can not open log file %s\n", log_file);
+    // Last resort
+    // (Do not use stdout, since it might be jarout->jarfp.)
+    errstrm = stderr;
+    log_file = errstrm_name = LOGFILE_STDERR;
+  }
+}
+
+#ifndef PRODUCT
+int unpacker::printcr_if_verbose(int level, const char* fmt ...) {
+  if (verbose < level)  return 0;
+  va_list vl;
+  va_start(vl, fmt);
+  char fmtbuf[300];
+  strcpy(fmtbuf+100, fmt);
+  strcat(fmtbuf+100, "\n");
+  char* fmt2 = fmtbuf+100;
+  while (level-- > 0)  *--fmt2 = ' ';
+  vfprintf(errstrm, fmt2, vl);
+  return 1;  // for ?: usage
+}
+#endif
+
+void unpacker::abort(const char* message) {
+  if (message == null)  message = "error unpacking archive";
+#ifdef UNPACK_JNI
+  if (message[0] == '@') {  // secret convention for sprintf
+     bytes saved;
+     saved.saveFrom(message+1);
+     mallocs.add(message = saved.strval());
+   }
+  abort_message = message;
+  return;
+#else
+  if (message[0] == '@')  ++message;
+  fprintf(errstrm, "%s\n", message);
+#ifndef PRODUCT
+  fflush(errstrm);
+  ::abort();
+#else
+  exit(-1);
+#endif
+#endif // JNI
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,510 @@
+/*
+ * 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.
+ */
+// Global Structures
+struct jar;
+struct gunzip;
+struct band;
+struct cpool;
+struct entry;
+struct cpindex;
+struct inner_class;
+struct value_stream;
+
+struct cpindex {
+  uint    len;
+  entry*  base1;   // base of primary index
+  entry** base2;   // base of secondary index
+  byte    ixTag;   // type of entries (!= CONSTANT_None), plus 64 if sub-index
+  enum { SUB_TAG = 64 };
+
+  entry* get(uint i);
+
+  void init(int len_, entry* base1_, int ixTag_) {
+    len = len_;
+    base1 = base1_;
+    base2 = null;
+    ixTag = ixTag_;
+  }
+  void init(int len_, entry** base2_, int ixTag_) {
+    len = len_;
+    base1 = null;
+    base2 = base2_;
+    ixTag = ixTag_;
+  }
+};
+
+struct cpool {
+  uint  nentries;
+  entry* entries;
+  entry* first_extra_entry;
+  uint maxentries;      // total allocated size of entries
+
+  // Position and size of each homogeneous subrange:
+  int     tag_count[CONSTANT_Limit];
+  int     tag_base[CONSTANT_Limit];
+  cpindex tag_index[CONSTANT_Limit];
+  ptrlist tag_extras[CONSTANT_Limit];
+
+  int     tag_group_count[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
+  cpindex tag_group_index[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
+
+  cpindex* member_indexes;   // indexed by 2*CONSTANT_Class.inord
+  cpindex* getFieldIndex(entry* classRef);
+  cpindex* getMethodIndex(entry* classRef);
+
+  inner_class** ic_index;
+  inner_class** ic_child_index;
+  inner_class* getIC(entry* inner);
+  inner_class* getFirstChildIC(entry* outer);
+  inner_class* getNextChildIC(inner_class* child);
+
+  int outputIndexLimit;  // index limit after renumbering
+  ptrlist outputEntries; // list of entry* needing output idx assigned
+  ptrlist requested_bsms; // which bsms need output?
+
+  entry** hashTab;
+  uint    hashTabLength;
+  entry*& hashTabRef(byte tag, bytes& b);
+  entry*  ensureUtf8(bytes& b);
+  entry*  ensureClass(bytes& b);
+
+  // Well-known Utf8 symbols.
+  enum {
+    #define SNAME(n,s) s_##s,
+    ALL_ATTR_DO(SNAME)
+    #undef SNAME
+    s_lt_init_gt,  // <init>
+    s_LIMIT
+  };
+  entry* sym[s_LIMIT];
+
+  // read counts from hdr, allocate main arrays
+  void init(unpacker* u, int counts[CONSTANT_Limit]);
+
+  // pointer to outer unpacker, for error checks etc.
+  unpacker* u;
+
+  int getCount(byte tag) {
+    if ((uint)tag >= CONSTANT_GroupFirst) {
+      assert((uint)tag < CONSTANT_GroupLimit);
+      return tag_group_count[(uint)tag - CONSTANT_GroupFirst];
+    } else {
+      assert((uint)tag < CONSTANT_Limit);
+      return tag_count[(uint)tag];
+    }
+  }
+  cpindex* getIndex(byte tag) {
+    if ((uint)tag >= CONSTANT_GroupFirst) {
+      assert((uint)tag < CONSTANT_GroupLimit);
+      return &tag_group_index[(uint)tag - CONSTANT_GroupFirst];
+    } else {
+      assert((uint)tag < CONSTANT_Limit);
+      return &tag_index[(uint)tag];
+    }
+  }
+
+  cpindex* getKQIndex();  // uses cur_descr
+
+  void expandSignatures();
+  void initGroupIndexes();
+  void initMemberIndexes();
+  int  initLoadableValues(entry** loadable_entries);
+
+  void computeOutputOrder();
+  void computeOutputIndexes();
+  void resetOutputIndexes();
+
+  // error handling
+  inline void abort(const char* msg);
+  inline bool aborting();
+};
+
+/*
+ * The unpacker provides the entry points to the unpack engine,
+ * as well as maintains the state of the engine.
+ */
+struct unpacker {
+  // One element of the resulting JAR.
+  struct file {
+    const char* name;
+    julong      size;
+    int         modtime;
+    int         options;
+    bytes       data[2];
+    // Note:  If Sum(data[*].len) < size,
+    // remaining bytes must be read directly from the input stream.
+    bool deflate_hint() { return ((options & FO_DEFLATE_HINT) != 0); }
+  };
+
+  // back pointer to NativeUnpacker obj and Java environment
+  void* jniobj;
+  void* jnienv;
+
+  // global pointer to self, if not running under JNI (not multi-thread safe)
+  static unpacker* non_mt_current;
+
+  // if running Unix-style, here are the inputs and outputs
+  FILE* infileptr;  // buffered
+  int   infileno;   // unbuffered
+  bytes inbytes;    // direct
+  gunzip* gzin;     // gunzip filter, if any
+  jar*  jarout;     // output JAR file
+  uint  gzcrc;      // CRC gathered from gzip content
+
+#ifndef PRODUCT
+  int   nowrite;
+  int   skipfiles;
+  int   verbose_bands;
+#endif
+
+  // pointer to self, for U_NEW macro
+  unpacker* u;
+
+  // private abort message string, allocated to PATH_MAX*2
+  const char* abort_message;
+  ptrlist mallocs;      // list of guys to free when we are all done
+  ptrlist tmallocs;     // list of guys to free on next client request
+  fillbytes smallbuf;   // supplies small alloc requests
+  fillbytes tsmallbuf;  // supplies temporary small alloc requests
+
+  // option management members
+  int   verbose;  // verbose level, 0 means no output
+  bool  strip_compile;
+  bool  strip_debug;
+  bool  strip_jcov;
+  bool  remove_packfile;
+  int   deflate_hint_or_zero;  // ==0 means not set, otherwise -1 or 1
+  int   modification_time_or_zero;
+
+  FILE*       errstrm;
+  const char* errstrm_name;
+
+  const char* log_file;
+
+  // input stream
+  fillbytes input;       // the whole block (size is predicted, has slop too)
+  bool      live_input;  // is the data in this block live?
+  bool      free_input;  // must the input buffer be freed?
+  byte*     rp;          // read pointer (< rplimit <= input.limit())
+  byte*     rplimit;     // how much of the input block has been read?
+  julong    bytes_read;
+  int       unsized_bytes_read;
+
+  // callback to read at least one byte, up to available input
+  typedef jlong (*read_input_fn_t)(unpacker* self, void* buf, jlong minlen, jlong maxlen);
+  read_input_fn_t read_input_fn;
+
+  // archive header fields
+  int      magic, minver, majver;
+  size_t   archive_size;
+  int      archive_next_count, archive_options, archive_modtime;
+  int      band_headers_size;
+  int      file_count, attr_definition_count, ic_count, class_count;
+  int      default_class_minver, default_class_majver;
+  int      default_file_options, suppress_file_options;  // not header fields
+  int      default_archive_modtime, default_file_modtime;  // not header fields
+  int      code_count;  // not a header field
+  int      files_remaining;  // not a header field
+
+  // engine state
+  band*        all_bands;   // indexed by band_number
+  byte*        meta_rp;     // read-pointer into (copy of) band_headers
+  cpool        cp;          // all constant pool information
+  inner_class* ics;         // InnerClasses
+
+  // output stream
+  bytes    output;      // output block (either classfile head or tail)
+  byte*    wp;          // write pointer (< wplimit == output.limit())
+  byte*    wpbase;      // write pointer starting address (<= wp)
+  byte*    wplimit;     // how much of the output block has been written?
+
+  // output state
+  file      cur_file;
+  entry*    cur_class;  // CONSTANT_Class entry
+  entry*    cur_super;  // CONSTANT_Class entry or null
+  entry*    cur_descr;  // CONSTANT_NameandType entry
+  int       cur_descr_flags;  // flags corresponding to cur_descr
+  int       cur_class_minver, cur_class_majver;
+  bool      cur_class_has_local_ics;
+  int       cur_class_local_bsm_count;
+  fillbytes cur_classfile_head;
+  fillbytes cur_classfile_tail;
+  int       files_written;   // also tells which file we're working on
+  int       classes_written; // also tells which class we're working on
+  julong    bytes_written;
+  intlist   bcimap;
+  fillbytes class_fixup_type;
+  intlist   class_fixup_offset;
+  ptrlist   class_fixup_ref;
+  fillbytes code_fixup_type;    // which format of branch operand?
+  intlist   code_fixup_offset;  // location of operand needing fixup
+  intlist   code_fixup_source;  // encoded ID of branch insn
+  ptrlist   requested_ics;      // which ics need output?
+
+  // stats pertaining to multiple segments (updated on reset)
+  julong    bytes_read_before_reset;
+  julong    bytes_written_before_reset;
+  int       files_written_before_reset;
+  int       classes_written_before_reset;
+  int       segments_read_before_reset;
+
+  // attribute state
+  struct layout_definition {
+    uint          idx;        // index (0..31...) which identifies this layout
+    const char*   name;       // name of layout
+    entry*        nameEntry;
+    const char*   layout;     // string of layout (not yet parsed)
+    band**        elems;      // array of top-level layout elems (or callables)
+
+    bool hasCallables()   { return layout[0] == '['; }
+    band** bands()        { assert(elems != null); return elems; }
+  };
+  struct attr_definitions {
+    unpacker* u;  // pointer to self, for U_NEW macro
+    int     xxx_flags_hi_bn;// locator for flags, count, indexes, calls bands
+    int     attrc;          // ATTR_CONTEXT_CLASS, etc.
+    uint    flag_limit;     // 32 or 63, depending on archive_options bit
+    julong  predef;         // mask of built-in definitions
+    julong  redef;          // mask of local flag definitions or redefinitions
+    ptrlist layouts;        // local (compressor-defined) defs, in index order
+    int     flag_count[X_ATTR_LIMIT_FLAGS_HI];
+    intlist overflow_count;
+    ptrlist strip_names;    // what attribute names are being stripped?
+    ptrlist band_stack;     // Temp., used during layout parsing.
+    ptrlist calls_to_link;  //  (ditto)
+    int     bands_made;     //  (ditto)
+
+    void free() {
+      layouts.free();
+      overflow_count.free();
+      strip_names.free();
+      band_stack.free();
+      calls_to_link.free();
+    }
+
+    // Locate the five fixed bands.
+    band& xxx_flags_hi();
+    band& xxx_flags_lo();
+    band& xxx_attr_count();
+    band& xxx_attr_indexes();
+    band& xxx_attr_calls();
+    band& fixed_band(int e_class_xxx);
+
+    // Register a new layout, and make bands for it.
+    layout_definition* defineLayout(int idx, const char* name, const char* layout);
+    layout_definition* defineLayout(int idx, entry* nameEntry, const char* layout);
+    band** buildBands(layout_definition* lo);
+
+    // Parse a layout string or part of one, recursively if necessary.
+    const char* parseLayout(const char* lp,    band** &res, int curCble);
+    const char* parseNumeral(const char* lp,   int    &res);
+    const char* parseIntLayout(const char* lp, band*  &res, byte le_kind,
+                               bool can_be_signed = false);
+    band** popBody(int band_stack_base);  // pops a body off band_stack
+
+    // Read data into the bands of the idx-th layout.
+    void readBandData(int idx);  // parse layout, make bands, read data
+    void readBandData(band** body, uint count);  // recursive helper
+
+    layout_definition* getLayout(uint idx) {
+      if (idx >= (uint)layouts.length())  return null;
+      return (layout_definition*) layouts.get(idx);
+    }
+
+    void setHaveLongFlags(bool z) {
+      assert(flag_limit == 0);  // not set up yet
+      flag_limit = (z? X_ATTR_LIMIT_FLAGS_HI: X_ATTR_LIMIT_NO_FLAGS_HI);
+    }
+    bool haveLongFlags() {
+     assert(flag_limit == X_ATTR_LIMIT_NO_FLAGS_HI ||
+            flag_limit == X_ATTR_LIMIT_FLAGS_HI);
+      return flag_limit == X_ATTR_LIMIT_FLAGS_HI;
+    }
+
+    // Return flag_count if idx is predef and not redef, else zero.
+    int predefCount(uint idx);
+
+    bool isRedefined(uint idx) {
+      if (idx >= flag_limit) return false;
+      return (bool)((redef >> idx) & 1);
+    }
+    bool isPredefined(uint idx) {
+      if (idx >= flag_limit) return false;
+      return (bool)(((predef & ~redef) >> idx) & 1);
+    }
+    julong flagIndexMask() {
+      return (predef | redef);
+    }
+    bool isIndex(uint idx) {
+      assert(flag_limit != 0);  // must be set up already
+      if (idx < flag_limit)
+        return (bool)(((predef | redef) >> idx) & 1);
+      else
+        return (idx - flag_limit < (uint)overflow_count.length());
+    }
+    int& getCount(uint idx) {
+      assert(isIndex(idx));
+      if (idx < flag_limit)
+        return flag_count[idx];
+      else
+        return overflow_count.get(idx - flag_limit);
+    }
+    bool aborting()             { return u->aborting(); }
+    void abort(const char* msg) { u->abort(msg); }
+  };
+
+  attr_definitions attr_defs[ATTR_CONTEXT_LIMIT];
+
+  // Initialization
+  void         init(read_input_fn_t input_fn = null);
+  // Resets to a known sane state
+  void         reset();
+  // Deallocates all storage.
+  void         free();
+  // Deallocates temporary storage (volatile after next client call).
+  void         free_temps() { tsmallbuf.init(); tmallocs.freeAll(); }
+
+  // Option management methods
+  bool         set_option(const char* option, const char* value);
+  const char*  get_option(const char* option);
+
+  void         dump_options();
+
+  // Fetching input.
+  bool   ensure_input(jlong more);
+  byte*  input_scan()               { return rp; }
+  size_t input_remaining()          { return rplimit - rp; }
+  size_t input_consumed()           { return rp - input.base(); }
+
+  // Entry points to the unpack engine
+  static int   run(int argc, char **argv);   // Unix-style entry point.
+  void         check_options();
+  void         start(void* packptr = null, size_t len = 0);
+  void         redirect_stdio();
+  void         write_file_to_jar(file* f);
+  void         finish();
+
+  // Public post unpack methods
+  int          get_files_remaining()    { return files_remaining; }
+  int          get_segments_remaining() { return archive_next_count; }
+  file*        get_next_file();  // returns null on last file
+
+  // General purpose methods
+  void*        alloc(size_t size) { return alloc_heap(size, true); }
+  void*        temp_alloc(size_t size) { return alloc_heap(size, true, true); }
+  void*        alloc_heap(size_t size, bool smallOK = false, bool temp = false);
+  void         saveTo(bytes& b, const char* str) { saveTo(b, (byte*)str, strlen(str)); }
+  void         saveTo(bytes& b, bytes& data) { saveTo(b, data.ptr, data.len); }
+  void         saveTo(bytes& b, byte* ptr, size_t len); //{ b.ptr = U_NEW...}
+  const char*  saveStr(const char* str) { bytes buf; saveTo(buf, str); return buf.strval(); }
+  const char*  saveIntStr(int num) { char buf[30]; sprintf(buf, "%d", num); return saveStr(buf); }
+#ifndef PRODUCT
+  int printcr_if_verbose(int level, const char* fmt,...);
+#endif
+  const char*  get_abort_message();
+  void         abort(const char* s = null);
+  bool         aborting() { return abort_message != null; }
+  static unpacker* current();  // find current instance
+  void checkLegacy(const char* name);
+  // Output management
+  void set_output(fillbytes* which) {
+    assert(wp == null);
+    which->ensureSize(1 << 12);  // covers the average classfile
+    wpbase  = which->base();
+    wp      = which->limit();
+    wplimit = which->end();
+  }
+  fillbytes* close_output(fillbytes* which = null);  // inverse of set_output
+
+  // These take an implicit parameter of wp/wplimit, and resize as necessary:
+  byte*  put_space(size_t len);  // allocates space at wp, returns pointer
+  size_t put_empty(size_t s)    { byte* p = put_space(s); return p - wpbase; }
+  void   ensure_put_space(size_t len);
+  void   put_bytes(bytes& b)    { b.writeTo(put_space(b.len)); }
+  void   putu1(int n)           { putu1_at(put_space(1), n); }
+  void   putu1_fast(int n)      { putu1_at(wp++,         n); }
+  void   putu2(int n);       // { putu2_at(put_space(2), n); }
+  void   putu4(int n);       // { putu4_at(put_space(4), n); }
+  void   putu8(jlong n);     // { putu8_at(put_space(8), n); }
+  void   putref(entry* e);   // { putu2_at(put_space(2), putref_index(e, 2)); }
+  void   putu1ref(entry* e); // { putu1_at(put_space(1), putref_index(e, 1)); }
+  int    putref_index(entry* e, int size);  // size in [1..2]
+  void   put_label(int curIP, int size);    // size in {2,4}
+  void   putlayout(band** body);
+  void   put_stackmap_type();
+
+  size_t wpoffset() { return (size_t)(wp - wpbase); }  // (unvariant across overflow)
+  byte*  wp_at(size_t offset) { return wpbase + offset; }
+  uint to_bci(uint bii);
+  void get_code_header(int& max_stack,
+                       int& max_na_locals,
+                       int& handler_count,
+                       int& cflags);
+  band* ref_band_for_self_op(int bc, bool& isAloadVar, int& origBCVar);
+  band* ref_band_for_op(int bc);
+
+  // Definitions of standard classfile int formats:
+  static void putu1_at(byte* wp, int n) { assert(n == (n & 0xFF)); wp[0] = n; }
+  static void putu2_at(byte* wp, int n);
+  static void putu4_at(byte* wp, int n);
+  static void putu8_at(byte* wp, jlong n);
+
+  // Private stuff
+  void reset_cur_classfile();
+  void write_classfile_tail();
+  void write_classfile_head();
+  void write_code();
+  void write_bc_ops();
+  void write_members(int num, int attrc);  // attrc=ATTR_CONTEXT_FIELD/METHOD
+  int  write_attrs(int attrc, julong indexBits);
+  int  write_ics(int naOffset, int na);
+  int  write_bsms(int naOffset, int na);
+
+  // The readers
+  void read_bands();
+  void read_file_header();
+  void read_cp();
+  void read_cp_counts(value_stream& hdr);
+  void read_attr_defs();
+  void read_ics();
+  void read_attrs(int attrc, int obj_count);
+  void read_classes();
+  void read_code_headers();
+  void read_bcs();
+  void read_bc_ops();
+  void read_files();
+  void read_Utf8_values(entry* cpMap, int len);
+  void read_single_words(band& cp_band, entry* cpMap, int len);
+  void read_double_words(band& cp_bands, entry* cpMap, int len);
+  void read_single_refs(band& cp_band, byte refTag, entry* cpMap, int len);
+  void read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag, entry* cpMap, int len);
+  void read_signature_values(entry* cpMap, int len);
+  void read_method_handle(entry* cpMap, int len);
+  void read_method_type(entry* cpMap, int len);
+  void read_bootstrap_methods(entry* cpMap, int len);
+};
+
+inline void cpool::abort(const char* msg) { u->abort(msg); }
+inline bool cpool::aborting()             { return u->aborting(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2001, 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 <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include <sys/stat.h>
+
+#ifdef _MSC_VER
+#include <direct.h>
+#include <io.h>
+#include <process.h>
+#else
+#include <unistd.h>
+#endif
+
+#include "constants.h"
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+
+#include "unpack.h"
+
+void* must_malloc(size_t size) {
+  size_t msize = size;
+  #ifdef USE_MTRACE
+  if (msize >= 0 && msize < sizeof(int))
+    msize = sizeof(int);  // see 0xbaadf00d below
+  #endif
+  void* ptr = (msize > PSIZE_MAX || msize <= 0) ? null : malloc(msize);
+  if (ptr != null) {
+    memset(ptr, 0, size);
+  } else {
+    unpack_abort(ERROR_ENOMEM);
+  }
+  mtrace('m', ptr, size);
+  return ptr;
+}
+
+void mkdirs(int oklen, char* path) {
+
+  if (strlen(path) <= (size_t)oklen)  return;
+  char dir[PATH_MAX];
+
+  strcpy(dir, path);
+  char* slash = strrchr(dir, '/');
+  if (slash == 0)  return;
+  *slash = 0;
+  mkdirs(oklen, dir);
+  MKDIR(dir);
+}
+
+
+#ifndef PRODUCT
+void breakpoint() { }  // hook for debugger
+int assert_failed(const char* p) {
+  char message[1<<12];
+  sprintf(message, "@assert failed: %s\n", p);
+  fprintf(stdout, 1+message);
+  breakpoint();
+  unpack_abort(message);
+  return 0;
+}
+#endif
+
+void unpack_abort(const char* msg, unpacker* u) {
+  if (msg == null)  msg = "corrupt pack file or internal error";
+  if (u == null)
+    u = unpacker::current();
+  if (u == null) {
+    fprintf(stderr, "Error: unpacker: %s\n", msg);
+    ::abort();
+    return;
+  }
+  u->abort(msg);
+}
+
+bool unpack_aborting(unpacker* u) {
+  if (u == null)
+    u = unpacker::current();
+  if (u == null) {
+    fprintf(stderr, "Error: unpacker: no current instance\n");
+    ::abort();
+    return true;
+  }
+  return u->aborting();
+}
+
+#ifdef USE_MTRACE
+// Use this occasionally for detecting storage leaks in unpack.
+void mtrace(char c, void* ptr, size_t size) {
+  if (c == 'f')  *(int*)ptr = 0xbaadf00d;
+  static FILE* mtfp;
+  if (mtfp == (FILE*)-1)  return;
+  if (mtfp == null) {
+    if (getenv("USE_MTRACE") == null) {
+      mtfp = (FILE*)-1;
+      return;
+    }
+    char fname[1024];
+    sprintf(fname, "mtr%d.txt", getpid());
+    mtfp = fopen(fname, "w");
+    if (mtfp == null)
+      mtfp = stdout;
+  }
+  fprintf(mtfp, "%c %p %p\n", c, ptr, (void*)size);
+}
+
+/* # Script for processing memory traces.
+   # It should report only a limited number (2) of "suspended" blocks,
+   # even if a large number of archive segments are processed.
+   # It should report no "leaked" blocks at all.
+   nawk < mtr*.txt '
+   function checkleaks(what) {
+     nd = 0
+     for (ptr in allocated) {
+       if (allocated[ptr] == 1) {
+         print NR ": " what " " ptr
+         #allocated[ptr] = 0  # stop the dangle
+         nd++
+       }
+     }
+     if (nd > 0)  print NR ": count " what " " nd
+   }
+
+   /^[mfr]/ {
+       ptr = $2
+       a1 = ($1 == "m")? 1: 0
+       a0 = 0+allocated[ptr]
+       allocated[ptr] = a1
+       if (a0 + a1 != 1) {
+         if (a0 == 0 && a1 == 0)
+           print NR ": double free " ptr
+         else if (a0 == 1 && a1 == 1)
+           print NR ": double malloc " ptr
+         else
+           print NR ": oddity " $0
+       }
+       next
+     }
+
+   /^s/ {
+     checkleaks("suspended")
+     next
+   }
+
+   {
+     print NR ": unrecognized " $0
+   }
+   END {
+     checkleaks("leaked")
+   }
+'
+*/
+#endif // USE_MTRACE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/utils.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+//Definitions of our util functions
+
+void* must_malloc(size_t size);
+#ifndef USE_MTRACE
+#define mtrace(c, ptr, size)
+#else
+void mtrace(char c, void* ptr, size_t size);
+#endif
+
+// overflow management
+#define OVERFLOW ((uint)-1)
+#define PSIZE_MAX (OVERFLOW/2)  /* normal size limit */
+
+inline size_t scale_size(size_t size, size_t scale) {
+  return (size > PSIZE_MAX / scale) ? OVERFLOW : size * scale;
+}
+
+inline size_t add_size(size_t size1, size_t size2) {
+  return ((size1 | size2 | (size1 + size2)) > PSIZE_MAX)
+    ? OVERFLOW
+    : size1 + size2;
+}
+
+inline size_t add_size(size_t size1, size_t size2, int size3) {
+  return add_size(add_size(size1, size2), size3);
+}
+
+// These may be expensive, because they have to go via Java TSD,
+// if the optional u argument is missing.
+struct unpacker;
+extern void unpack_abort(const char* msg, unpacker* u = null);
+extern bool unpack_aborting(unpacker* u = null);
+
+#ifndef PRODUCT
+inline bool endsWith(const char* str, const char* suf) {
+  size_t len1 = strlen(str);
+  size_t len2 = strlen(suf);
+  return (len1 > len2 && 0 == strcmp(str + (len1-len2), suf));
+}
+#endif
+
+void mkdirs(int oklen, char* path);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,668 @@
+/*
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ * Note: Lifted from uncrunch.c from jdk sources
+ */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
+#include <stdlib.h>
+
+#ifndef _MSC_VER
+#include <strings.h>
+#endif
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+
+#include "constants.h"
+#include "unpack.h"
+
+#include "zip.h"
+
+#ifdef NO_ZLIB
+
+inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
+  return false;
+}
+inline uint jar::get_crc32(uint c, uchar *ptr, uint len) { return 0; }
+#define Z_NULL NULL
+
+#else // Have ZLIB
+
+#include <zlib.h>
+
+inline uint jar::get_crc32(uint c, uchar *ptr, uint len) { return crc32(c, ptr, len); }
+
+#endif // End of ZLIB
+
+#ifdef _BIG_ENDIAN
+#define SWAP_BYTES(a) \
+    ((((a) << 8) & 0xff00) | 0x00ff) & (((a) >> 8) | 0xff00)
+#else
+#define SWAP_BYTES(a)  (a)
+#endif
+
+#define GET_INT_LO(a) \
+    SWAP_BYTES(a & 0xFFFF)
+
+#define GET_INT_HI(a) \
+    SWAP_BYTES((a >> 16) & 0xFFFF)
+
+static const ushort jarmagic[2] = { SWAP_BYTES(0xCAFE), 0 };
+
+void jar::init(unpacker* u_) {
+  BYTES_OF(*this).clear();
+  u = u_;
+  u->jarout = this;
+}
+
+// Write data to the ZIP output stream.
+void jar::write_data(void* buff, int len) {
+  while (len > 0) {
+    int rc = (int)fwrite(buff, 1, len, jarfp);
+    if (rc <= 0) {
+      fprintf(u->errstrm, "Error: write on output file failed err=%d\n",errno);
+      exit(1); // Called only from the native standalone unpacker
+    }
+    output_file_offset += rc;
+    buff = ((char *)buff) + rc;
+    len -= rc;
+  }
+}
+
+void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
+                               int len, int clen, uLong crc) {
+  uint fname_length = (uint)strlen(fname);
+  ushort header[23];
+  if (modtime == 0)  modtime = default_modtime;
+  uLong dostime = get_dostime(modtime);
+
+  header[0] = (ushort)SWAP_BYTES(0x4B50);
+  header[1] = (ushort)SWAP_BYTES(0x0201);
+  header[2] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
+
+  // required version
+  header[3] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
+
+  // Flags - UTF-8 compression and separating crc and sizes
+  // into separate headers for deflated file
+  header[4] = ( store ) ? SWAP_BYTES(0x0800) : 0x0808;
+
+  // Compression method 8=deflate.
+  header[5] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
+
+  // Last modified date and time.
+  header[6] = (ushort)GET_INT_LO(dostime);
+  header[7] = (ushort)GET_INT_HI(dostime);
+
+  // CRC
+  header[8] = (ushort)GET_INT_LO(crc);
+  header[9] = (ushort)GET_INT_HI(crc);
+
+  // Compressed length:
+  header[10] = (ushort)GET_INT_LO(clen);
+  header[11] = (ushort)GET_INT_HI(clen);
+
+  // Uncompressed length.
+  header[12] = (ushort)GET_INT_LO(len);
+  header[13] = (ushort)GET_INT_HI(len);
+
+  // Filename length
+  header[14] = (ushort)SWAP_BYTES(fname_length);
+  // So called "extra field" length.
+  // If it's the first record we must add JAR magic sequence
+  header[15] = ( central_directory_count ) ? 0 : (ushort)SWAP_BYTES(4);
+  // So called "comment" length.
+  header[16] = 0;
+  // Disk number start
+  header[17] = 0;
+  // File flags => binary
+  header[18] = 0;
+  // More file flags
+  header[19] = 0;
+  header[20] = 0;
+  // Offset within ZIP file.
+  header[21] = (ushort)GET_INT_LO(output_file_offset);
+  header[22] = (ushort)GET_INT_HI(output_file_offset);
+
+  // Copy the whole thing into the central directory.
+  central_directory.append(header, sizeof(header));
+
+  // Copy the fname to the header.
+  central_directory.append(fname, fname_length);
+
+  // Add jar magic for the first record
+  if (central_directory_count == 0) {
+    central_directory.append((void *)jarmagic, sizeof(jarmagic));
+  }
+
+  central_directory_count++;
+}
+
+void jar::write_jar_header(const char* fname, bool store, int modtime,
+                           int len, int clen, uint crc) {
+  uint fname_length = (uint)strlen(fname);
+  ushort header[15];
+  if (modtime == 0)  modtime = default_modtime;
+  uLong dostime = get_dostime(modtime);
+
+  // ZIP LOC magic.
+  header[0] = (ushort)SWAP_BYTES(0x4B50);
+  header[1] = (ushort)SWAP_BYTES(0x0403);
+
+  // Version
+  header[2] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
+
+  // General purpose flags - same as in the Central Directory
+  header[3] = ( store ) ? SWAP_BYTES(0x0800) : 0x0808;
+
+  // Compression method = deflate
+  header[4] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
+
+  // Last modified date and time.
+  header[5] = (ushort)GET_INT_LO(dostime);
+  header[6] = (ushort)GET_INT_HI(dostime);
+
+  // CRC, 0 if deflated, will come separately in extra header
+  header[7] = ( store ) ? (ushort)GET_INT_LO(crc) : 0;
+  header[8] = ( store ) ? (ushort)GET_INT_HI(crc) : 0;
+
+  // Compressed length, 0 if deflated
+  header[9] = ( store ) ? (ushort)GET_INT_LO(clen) : 0;
+  header[10] = ( store ) ? (ushort)GET_INT_HI(clen) : 0;
+
+  // Uncompressed length, 0 if deflated
+  header[11] = ( store ) ? (ushort)GET_INT_LO(len) : 0;
+  header[12] = ( store ) ? (ushort)GET_INT_HI(len) : 0;
+
+  // Filename length
+  header[13] = (ushort)SWAP_BYTES(fname_length);
+  // So called "extra field" length.
+  header[14] = ( central_directory_count - 1 ) ? 0 : (ushort)SWAP_BYTES(4);
+
+  // Write the LOC header to the output file.
+  write_data(header, (int)sizeof(header));
+
+  // Copy the fname to the header.
+  write_data((char*)fname, (int)fname_length);
+
+  if (central_directory_count == 1) {
+    // Write JAR magic sequence
+    write_data((void *)jarmagic, (int)sizeof(jarmagic));
+  }
+}
+
+void jar::write_jar_extra(int len, int clen, uint crc) {
+  ushort header[8];
+  // Extra field signature
+  header[0] = (ushort)SWAP_BYTES(0x4B50);
+  header[1] = (ushort)SWAP_BYTES(0x0807);
+  // CRC
+  header[2] = (ushort)GET_INT_LO(crc);
+  header[3] = (ushort)GET_INT_HI(crc);
+  // Compressed length
+  header[4] = (ushort)GET_INT_LO(clen);
+  header[5] = (ushort)GET_INT_HI(clen);
+  // Uncompressed length
+  header[6] = (ushort)GET_INT_LO(len);
+  header[7] = (ushort)GET_INT_HI(len);
+
+  write_data(header, sizeof(header));
+}
+
+static const char marker_comment[] = ZIP_ARCHIVE_MARKER_COMMENT;
+
+void jar::write_central_directory() {
+  bytes mc; mc.set(marker_comment);
+
+  ushort header[11];
+  ushort header64[38];
+
+  // Create the End of Central Directory structure.
+  header[0] = (ushort)SWAP_BYTES(0x4B50);
+  header[1] = (ushort)SWAP_BYTES(0x0605);
+  // disk numbers
+  header[2] = 0;
+  header[3] = 0;
+  // Number of entries in central directory.
+  header[4] = ( central_directory_count >= 0xffff ) ? 0xffff : (ushort)SWAP_BYTES(central_directory_count);
+  header[5] = ( central_directory_count >= 0xffff ) ? 0xffff : (ushort)SWAP_BYTES(central_directory_count);
+  // Size of the central directory}
+  header[6] = (ushort)GET_INT_LO((int)central_directory.size());
+  header[7] = (ushort)GET_INT_HI((int)central_directory.size());
+  // Offset of central directory within disk.
+  header[8] = (ushort)GET_INT_LO(output_file_offset);
+  header[9] = (ushort)GET_INT_HI(output_file_offset);
+  // zipfile comment length;
+  header[10] = (ushort)SWAP_BYTES((int)mc.len);
+
+  // Write the central directory.
+  PRINTCR((2, "Central directory at %d\n", output_file_offset));
+  write_data(central_directory.b);
+
+  // If number of records exceeds the 0xFFFF we need to prepend extended
+  // Zip64 End of Central Directory record and its locator to the old
+  // style ECD record
+  if (central_directory_count > 0xFFFF) {
+    // Zip64 END signature
+    header64[0] = (ushort)SWAP_BYTES(0x4B50);
+    header64[1] = (ushort)0x0606;
+    // Size of header (long)
+    header64[2] = (ushort)SWAP_BYTES(44);;
+    header64[3] = 0;
+    header64[4] = 0;
+    header64[5] = 0;
+    // Version produced and required (short)
+    header64[6] = (ushort)SWAP_BYTES(45);
+    header64[7] = (ushort)SWAP_BYTES(45);
+    // Current disk number (int)
+    header64[8] = 0;
+    header64[9] = 0;
+    // Central directory start disk (int)
+    header64[10] = 0;
+    header64[11] = 0;
+    // Count of records on disk (long)
+    header64[12] = (ushort)GET_INT_LO(central_directory_count);
+    header64[13] = (ushort)GET_INT_HI(central_directory_count);
+    header64[14] = 0;
+    header64[15] = 0;
+    // Count of records totally (long)
+    header64[16] = (ushort)GET_INT_LO(central_directory_count);
+    header64[17] = (ushort)GET_INT_HI(central_directory_count);
+    header64[18] = 0;
+    header64[19] = 0;
+    // Length of the central directory (long)
+    header64[20] = header[6];
+    header64[21] = header[7];
+    header64[22] = 0;
+    header64[23] = 0;
+    // Offset of central directory (long)
+    header64[24] = header[8];
+    header64[25] = header[9];
+    header64[26] = 0;
+    header64[27] = 0;
+    // Zip64 end of central directory locator
+    // Locator signature
+    header64[28] = (ushort)SWAP_BYTES(0x4B50);
+    header64[29] = (ushort)SWAP_BYTES(0x0706);
+    // Start disk number (int)
+    header64[30] = 0;
+    header64[31] = 0;
+    // Offset of zip64 END record (long)
+    header64[32] = (ushort)GET_INT_LO(output_file_offset);
+    header64[33] = (ushort)GET_INT_HI(output_file_offset);
+    header64[34] = 0;
+    header64[35] = 0;
+    // Total number of disks (int)
+    header64[36] = (ushort)SWAP_BYTES(1);
+    header64[37] = 0;
+    write_data(header64, (int)sizeof(header64));
+  }
+
+  // Write the End of Central Directory structure.
+  PRINTCR((2, "end-of-directory at %d\n", output_file_offset));
+  write_data(header, (int)sizeof(header));
+
+  PRINTCR((2, "writing zip comment\n"));
+  // Write the comment.
+  write_data(mc);
+}
+
+// Public API
+
+// Open a Jar file and initialize.
+void jar::openJarFile(const char* fname) {
+  if (!jarfp) {
+    PRINTCR((1, "jar::openJarFile: opening %s\n",fname));
+    jarfp = fopen(fname, "wb");
+    if (!jarfp) {
+      fprintf(u->errstrm, "Error: Could not open jar file: %s\n",fname);
+      exit(3); // Called only from the native standalone unpacker
+    }
+  }
+}
+
+// Add a ZIP entry and copy the file data
+void jar::addJarEntry(const char* fname,
+                      bool deflate_hint, int modtime,
+                      bytes& head, bytes& tail) {
+  int len = (int)(head.len + tail.len);
+  int clen = 0;
+
+  uint crc = get_crc32(0,Z_NULL,0);
+  if (head.len != 0)
+    crc = get_crc32(crc, (uchar *)head.ptr, (uint)head.len);
+  if (tail.len != 0)
+    crc = get_crc32(crc, (uchar *)tail.ptr, (uint)tail.len);
+
+  bool deflate = (deflate_hint && len > 0);
+
+  if (deflate) {
+    if (deflate_bytes(head, tail) == false) {
+      PRINTCR((2, "Reverting to store fn=%s\t%d -> %d\n",
+              fname, len, deflated.size()));
+      deflate = false;
+    }
+  }
+  clen = (int)((deflate) ? deflated.size() : len);
+  add_to_jar_directory(fname, !deflate, modtime, len, clen, crc);
+  write_jar_header(    fname, !deflate, modtime, len, clen, crc);
+
+  if (deflate) {
+    write_data(deflated.b);
+    // Write deflated information in extra header
+    write_jar_extra(len, clen, crc);
+  } else {
+    write_data(head);
+    write_data(tail);
+  }
+}
+
+// Add a ZIP entry for a directory name no data
+void jar::addDirectoryToJarFile(const char* dir_name) {
+  bool store = true;
+  add_to_jar_directory((const char*)dir_name, store, default_modtime, 0, 0, 0);
+  write_jar_header(    (const char*)dir_name, store, default_modtime, 0, 0, 0);
+}
+
+// Write out the central directory and close the jar file.
+void jar::closeJarFile(bool central) {
+  if (jarfp) {
+    fflush(jarfp);
+    if (central) write_central_directory();
+    fflush(jarfp);
+    fclose(jarfp);
+    PRINTCR((2, "jar::closeJarFile:closed jar-file\n"));
+  }
+  reset();
+}
+
+/* Convert the date y/n/d and time h:m:s to a four byte DOS date and
+ *  time (date in high two bytes, time in low two bytes allowing magnitude
+ *  comparison).
+ */
+inline
+uLong jar::dostime(int y, int n, int d, int h, int m, int s) {
+  return y < 1980 ? dostime(1980, 1, 1, 0, 0, 0) :
+    (((uLong)y - 1980) << 25) | ((uLong)n << 21) | ((uLong)d << 16) |
+    ((uLong)h << 11) | ((uLong)m << 5) | ((uLong)s >> 1);
+}
+
+#ifdef _REENTRANT // solaris
+extern "C" struct tm *gmtime_r(const time_t *, struct tm *);
+#else
+#define gmtime_r(t, s) gmtime(t)
+#endif
+/*
+ * Return the Unix time in DOS format
+ */
+uLong jar::get_dostime(int modtime) {
+  // see defines.h
+  if (modtime != 0 && modtime == modtime_cache)
+    return dostime_cache;
+  if (modtime != 0 && default_modtime == 0)
+    default_modtime = modtime;  // catch a reasonable default
+  time_t t = modtime;
+  struct tm sbuf;
+  (void)memset((void*)&sbuf,0, sizeof(sbuf));
+  struct tm* s = gmtime_r(&t, &sbuf);
+  if (s == NULL) {
+    fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n");
+    exit(-1);
+  }
+  modtime_cache = modtime;
+  dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
+                          s->tm_hour, s->tm_min, s->tm_sec);
+  //printf("modtime %d => %d\n", modtime_cache, dostime_cache);
+  return dostime_cache;
+}
+
+
+
+#ifndef NO_ZLIB
+
+/* Returns true on success, and will set the clen to the compressed
+   length, the caller should verify if true and clen less than the
+   input data
+*/
+bool jar::deflate_bytes(bytes& head, bytes& tail) {
+  int len = (int)(head.len + tail.len);
+
+  z_stream zs;
+  BYTES_OF(zs).clear();
+
+  // NOTE: the window size should always be -MAX_WBITS normally -15.
+  // unzip/zipup.c and java/Deflater.c
+
+  int error = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
+                           -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
+  if (error != Z_OK) {
+    switch (error) {
+    case Z_MEM_ERROR:
+      PRINTCR((2, "Error: deflate error : Out of memory \n"));
+      break;
+    case Z_STREAM_ERROR:
+      PRINTCR((2,"Error: deflate error : Invalid compression level \n"));
+      break;
+    case Z_VERSION_ERROR:
+      PRINTCR((2,"Error: deflate error : Invalid version\n"));
+      break;
+    default:
+      PRINTCR((2,"Error: Internal deflate error error = %d\n", error));
+    }
+    return false;
+  }
+
+  deflated.empty();
+  zs.next_out  = (uchar*) deflated.grow(add_size(len, (len/2)));
+  zs.avail_out = (int)deflated.size();
+
+  zs.next_in = (uchar*)head.ptr;
+  zs.avail_in = (int)head.len;
+
+  bytes* first = &head;
+  bytes* last  = &tail;
+  if (last->len == 0) {
+    first = null;
+    last = &head;
+  } else if (first->len == 0) {
+    first = null;
+  }
+
+  if (first != null && error == Z_OK) {
+    zs.next_in = (uchar*) first->ptr;
+    zs.avail_in = (int)first->len;
+    error = deflate(&zs, Z_NO_FLUSH);
+  }
+  if (error == Z_OK) {
+    zs.next_in = (uchar*) last->ptr;
+    zs.avail_in = (int)last->len;
+    error = deflate(&zs, Z_FINISH);
+  }
+  if (error == Z_STREAM_END) {
+    if ((int)zs.total_out > 0) {
+      // Even if compressed size is bigger than uncompressed, write it
+      PRINTCR((2, "deflate compressed data %d -> %d\n", len, zs.total_out));
+      deflated.b.len = zs.total_out;
+      deflateEnd(&zs);
+      return true;
+    }
+    PRINTCR((2, "deflate expanded data %d -> %d\n", len, zs.total_out));
+    deflateEnd(&zs);
+    return false;
+  }
+
+  deflateEnd(&zs);
+  PRINTCR((2, "Error: deflate error deflate did not finish error=%d\n",error));
+  return false;
+}
+
+// Callback for fetching data from a GZIP input stream
+static jlong read_input_via_gzip(unpacker* u,
+                                  void* buf, jlong minlen, jlong maxlen) {
+  assert(minlen <= maxlen);  // don't talk nonsense
+  jlong numread = 0;
+  char* bufptr = (char*) buf;
+  char* inbuf = u->gzin->inbuf;
+  size_t inbuflen = sizeof(u->gzin->inbuf);
+  unpacker::read_input_fn_t read_gzin_fn =
+    (unpacker::read_input_fn_t) u->gzin->read_input_fn;
+  z_stream& zs = *(z_stream*) u->gzin->zstream;
+  while (numread < minlen) {
+    int readlen = (1 << 16);  // pretty arbitrary
+    if (readlen > (maxlen - numread))
+      readlen = (int)(maxlen - numread);
+    zs.next_out = (uchar*) bufptr;
+    zs.avail_out = readlen;
+    if (zs.avail_in == 0) {
+      zs.avail_in = (int) read_gzin_fn(u, inbuf, 1, inbuflen);
+      zs.next_in = (uchar*) inbuf;
+    }
+    int error = inflate(&zs, Z_NO_FLUSH);
+    if (error != Z_OK && error != Z_STREAM_END) {
+      u->abort("error inflating input");
+      break;
+    }
+    int nr = readlen - zs.avail_out;
+    u->gzcrc = crc32(u->gzcrc, (const unsigned char *)bufptr, nr);
+    numread += nr;
+    bufptr += nr;
+    assert(numread <= maxlen);
+    if (error == Z_STREAM_END) {
+      enum { TRAILER_LEN = 8 };
+      // skip 8-byte trailer
+      if (zs.avail_in >= TRAILER_LEN) {
+        zs.avail_in -= TRAILER_LEN;
+      } else {
+        // Bug: 5023768,we read past the TRAILER_LEN to see if there is
+        // any extraneous data, as we don't support concatenated .gz
+        // files just yet.
+        int extra = (int) read_gzin_fn(u, inbuf, 1, inbuflen);
+        zs.avail_in += extra - TRAILER_LEN;
+      }
+      // %%% should check final CRC and length here
+      // %%% should check for concatenated *.gz files here
+      if (zs.avail_in > 0)
+        u->abort("garbage after end of deflated input stream");
+      // pop this filter off:
+      u->gzin->free();
+      break;
+    }
+  }
+
+  //fprintf(u->errstrm, "readInputFn(%d,%d) => %d (gunzip)\n",
+  //        (int)minlen, (int)maxlen, (int)numread);
+  return numread;
+}
+
+void gunzip::init(unpacker* u_) {
+  BYTES_OF(*this).clear();
+  u = u_;
+  assert(u->gzin == null);  // once only, please
+  read_input_fn = (void*)u->read_input_fn;
+  zstream = NEW(z_stream, 1);
+  u->gzin = this;
+  u->read_input_fn = read_input_via_gzip;
+  u->gzcrc = crc32(0L, Z_NULL, 0);
+}
+
+void gunzip::start(int magic) {
+  assert((magic & GZIP_MAGIC_MASK) == GZIP_MAGIC);
+  int gz_flg = (magic & 0xFF);  // keep "flg", discard other 3 bytes
+  enum {
+    FHCRC    = (1<<1),
+    FEXTRA   = (1<<2),
+    FNAME    = (1<<3),
+    FCOMMENT = (1<<4)
+  };
+  char gz_mtime[4];
+  char gz_xfl[1];
+  char gz_os[1];
+  char gz_extra_len[2];
+  char gz_hcrc[2];
+  char gz_ignore;
+  // do not save extra, name, comment
+  read_fixed_field(gz_mtime, sizeof(gz_mtime));
+  read_fixed_field(gz_xfl, sizeof(gz_xfl));
+  read_fixed_field(gz_os, sizeof(gz_os));
+  if (gz_flg & FEXTRA) {
+    read_fixed_field(gz_extra_len, sizeof(gz_extra_len));
+    int extra_len = gz_extra_len[0] & 0xFF;
+    extra_len += (gz_extra_len[1] & 0xFF) << 8;
+    for (; extra_len > 0; extra_len--) {
+      read_fixed_field(&gz_ignore, 1);
+    }
+  }
+  int null_terms = 0;
+  if (gz_flg & FNAME)     null_terms++;
+  if (gz_flg & FCOMMENT)  null_terms++;
+  for (; null_terms; null_terms--) {
+    for (;;) {
+      gz_ignore = 0;
+      read_fixed_field(&gz_ignore, 1);
+      if (gz_ignore == 0)  break;
+    }
+  }
+  if (gz_flg & FHCRC)
+    read_fixed_field(gz_hcrc, sizeof(gz_hcrc));
+
+  if (aborting())  return;
+
+  // now the input stream is ready to read into the inflater
+  int error = inflateInit2((z_stream*) zstream, -MAX_WBITS);
+  if (error != Z_OK) { abort("cannot create input"); return; }
+}
+
+void gunzip::free() {
+  assert(u->gzin == this);
+  u->gzin = null;
+  u->read_input_fn = (unpacker::read_input_fn_t) this->read_input_fn;
+  inflateEnd((z_stream*) zstream);
+  mtrace('f', zstream, 0);
+  ::free(zstream);
+  zstream = null;
+  mtrace('f', this, 0);
+  ::free(this);
+}
+
+void gunzip::read_fixed_field(char* buf, size_t buflen) {
+  if (aborting())  return;
+  jlong nr = ((unpacker::read_input_fn_t)read_input_fn)
+    (u, buf, buflen, buflen);
+  if ((size_t)nr != buflen)
+    u->abort("short stream header");
+}
+
+#else // NO_ZLIB
+
+void gunzip::free() {
+}
+
+#endif // NO_ZLIB
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/common-unpack/zip.h	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+#define ushort unsigned short
+#define uint   unsigned int
+#define uchar  unsigned char
+
+struct unpacker;
+
+struct jar {
+  // JAR file writer
+  FILE*       jarfp;
+  int         default_modtime;
+
+  // Used by unix2dostime:
+  int         modtime_cache;
+  uLong       dostime_cache;
+
+  // Private members
+  fillbytes   central_directory;
+  uint        central_directory_count;
+  uint        output_file_offset;
+  fillbytes   deflated;  // temporary buffer
+
+  // pointer to outer unpacker, for error checks etc.
+  unpacker* u;
+
+  // Public Methods
+  void openJarFile(const char* fname);
+  void addJarEntry(const char* fname,
+                   bool deflate_hint, int modtime,
+                   bytes& head, bytes& tail);
+  void addDirectoryToJarFile(const char* dir_name);
+  void closeJarFile(bool central);
+
+  void init(unpacker* u_);
+
+  void free() {
+    central_directory.free();
+    deflated.free();
+  }
+
+  void reset() {
+    free();
+    init(u);
+  }
+
+  // Private Methods
+  void write_data(void* ptr, int len);
+  void write_data(bytes& b) { write_data(b.ptr, (int)b.len); }
+  void add_to_jar_directory(const char* fname, bool store, int modtime,
+                            int len, int clen, uLong crc);
+  void write_jar_header(const char* fname, bool store, int modtime,
+                        int len, int clen, unsigned int crc);
+  void write_jar_extra(int len, int clen, unsigned int crc);
+  void write_central_directory();
+  uLong dostime(int y, int n, int d, int h, int m, int s);
+  uLong get_dostime(int modtime);
+
+  // The definitions of these depend on the NO_ZLIB option:
+  bool deflate_bytes(bytes& head, bytes& tail);
+  static uint get_crc32(uint c, unsigned char *ptr, uint len);
+
+  // error handling
+  void abort(const char* msg) { unpack_abort(msg, u); }
+  bool aborting()             { return unpack_aborting(u); }
+};
+
+struct gunzip {
+  // optional gzip input stream control block
+
+  // pointer to outer unpacker, for error checks etc.
+  unpacker* u;
+
+  void* read_input_fn;  // underlying byte stream
+  void* zstream;        // inflater state
+  char inbuf[1 << 14];   // input buffer
+
+  void init(unpacker* u_);  // pushes new value on u->read_input_fn
+
+  void free();
+
+  void start(int magic);
+
+  // private stuff
+  void read_fixed_field(char* buf, size_t buflen);
+
+  // error handling
+  void abort(const char* msg) { unpack_abort(msg, u); }
+  bool aborting()             { return unpack_aborting(u); }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/libunpack/jni.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,345 @@
+/*
+ * 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.
+ */
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+
+#include <limits.h>
+
+#include <com_sun_java_util_jar_pack_NativeUnpack.h>
+
+#include "jni_util.h"
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+#include "coding.h"
+#include "bands.h"
+#include "constants.h"
+#include "zip.h"
+#include "unpack.h"
+
+
+static jfieldID  unpackerPtrFID;
+static jmethodID currentInstMID;
+static jmethodID readInputMID;
+static jclass    NIclazz;
+static jmethodID getUnpackerPtrMID;
+
+static char* dbg = null;
+
+#define THROW_IOE(x) JNU_ThrowIOException(env,x)
+
+#define CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(CERVTI_exception, CERVTI_message) \
+    do { \
+        if ((env)->ExceptionOccurred()) { \
+            THROW_IOE(CERVTI_message); \
+            return; \
+        } \
+        if ((CERVTI_exception) == NULL) { \
+                THROW_IOE(CERVTI_message); \
+                return; \
+        } \
+    } while (JNI_FALSE)
+
+
+#define CHECK_EXCEPTION_RETURN_VALUE(CERL_exception, CERL_return_value) \
+    do { \
+        if ((env)->ExceptionOccurred()) { \
+            return CERL_return_value; \
+        } \
+        if ((CERL_exception) == NULL) { \
+            return CERL_return_value; \
+        } \
+    } while (JNI_FALSE)
+
+
+// If these useful macros aren't defined in jni_util.h then define them here
+#ifndef CHECK_NULL_RETURN
+#define CHECK_NULL_RETURN(x, y) \
+    do { \
+        if ((x) == NULL) return (y); \
+    } while (JNI_FALSE)
+#endif
+
+#ifndef CHECK_EXCEPTION_RETURN
+#define CHECK_EXCEPTION_RETURN(env, y) \
+    do { \
+        if ((*env)->ExceptionCheck(env)) return (y); \
+    } while (JNI_FALSE)
+#endif
+
+static jlong read_input_via_jni(unpacker* self,
+                                void* buf, jlong minlen, jlong maxlen);
+
+static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
+  unpacker* uPtr;
+  jlong p = env->CallLongMethod(pObj, getUnpackerPtrMID);
+  uPtr = (unpacker*)jlong2ptr(p);
+  if (uPtr == null) {
+    if (noCreate)  return null;
+    uPtr = new unpacker();
+    if (uPtr == null) {
+      THROW_IOE(ERROR_ENOMEM);
+      return null;
+    }
+    //fprintf(stderr, "get_unpacker(%p) uPtr=%p initializing\n", pObj, uPtr);
+    uPtr->init(read_input_via_jni);
+    uPtr->jniobj = (void*) env->NewGlobalRef(pObj);
+    env->SetLongField(pObj, unpackerPtrFID, ptr2jlong(uPtr));
+  }
+  uPtr->jnienv = env;  // keep refreshing this in case of MT access
+  return uPtr;
+}
+
+// This is the harder trick:  Pull the current state out of mid-air.
+static unpacker* get_unpacker() {
+  //fprintf(stderr, "get_unpacker()\n");
+  JavaVM* vm = null;
+  jsize nVM = 0;
+  jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM);
+  // other VM implements may differ, thus for correctness, we need these checks
+  if (retval != JNI_OK || nVM != 1)
+    return null;
+  void* envRaw = null;
+  vm->GetEnv(&envRaw, JNI_VERSION_1_1);
+  JNIEnv* env = (JNIEnv*) envRaw;
+  //fprintf(stderr, "get_unpacker() env=%p\n", env);
+  CHECK_NULL_RETURN(env, NULL);
+  jobject pObj = env->CallStaticObjectMethod(NIclazz, currentInstMID);
+  // We should check upon the known non-null variable because here we want to check
+  // only for pending exceptions. If pObj is null we'll deal with it later.
+  CHECK_EXCEPTION_RETURN_VALUE(env, NULL);
+  //fprintf(stderr, "get_unpacker0() pObj=%p\n", pObj);
+  if (pObj != null) {
+    // Got pObj and env; now do it the easy way.
+    return get_unpacker(env, pObj);
+  }
+  // this should really not happen, if it does something is seriously
+  // wrong throw an exception
+  THROW_IOE(ERROR_INTERNAL);
+  return null;
+}
+
+static void free_unpacker(JNIEnv *env, jobject pObj, unpacker* uPtr) {
+  if (uPtr != null) {
+    //fprintf(stderr, "free_unpacker(%p) uPtr=%p\n", pObj, uPtr);
+    env->DeleteGlobalRef((jobject) uPtr->jniobj);
+    uPtr->jniobj = null;
+    uPtr->free();
+    delete uPtr;
+    env->SetLongField(pObj, unpackerPtrFID, (jlong)null);
+   }
+}
+
+unpacker* unpacker::current() {
+  return get_unpacker();
+}
+
+// Callback for fetching data, Java style.  Calls NativeUnpack.readInputFn().
+static jlong read_input_via_jni(unpacker* self,
+                                void* buf, jlong minlen, jlong maxlen) {
+  JNIEnv* env = (JNIEnv*) self->jnienv;
+  jobject pbuf = env->NewDirectByteBuffer(buf, maxlen);
+  return env->CallLongMethod((jobject) self->jniobj, readInputMID,
+                             pbuf, minlen);
+}
+
+JNIEXPORT void JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz) {
+#ifndef PRODUCT
+  dbg = getenv("DEBUG_ATTACH");
+  while( dbg != null) { sleep(10); }
+#endif
+  NIclazz = (jclass) env->NewGlobalRef(clazz);
+
+  unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J");
+  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(unpackerPtrFID, ERROR_INIT);
+
+  currentInstMID = env->GetStaticMethodID(clazz, "currentInstance",
+                                          "()Ljava/lang/Object;");
+  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(currentInstMID, ERROR_INIT);
+
+  readInputMID = env->GetMethodID(clazz, "readInputFn",
+                                  "(Ljava/nio/ByteBuffer;J)J");
+  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(readInputMID, ERROR_INIT);
+
+  getUnpackerPtrMID = env->GetMethodID(clazz, "getUnpackerPtr", "()J");
+  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(getUnpackerPtrMID, ERROR_INIT);
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_start(JNIEnv *env, jobject pObj,
+                                   jobject pBuf, jlong offset) {
+  // try to get the unpacker pointer the hard way first, we do this to ensure
+  // valid object pointers and env is intact, if not now is good time to bail.
+  unpacker* uPtr = get_unpacker();
+  //fprintf(stderr, "start(%p) uPtr=%p initializing\n", pObj, uPtr);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, -1);
+  // redirect our io to the default log file or whatever.
+  uPtr->redirect_stdio();
+
+  void*  buf    = null;
+  size_t buflen = 0;
+  if (pBuf != null) {
+    buf    = env->GetDirectBufferAddress(pBuf);
+    buflen = (size_t)env->GetDirectBufferCapacity(pBuf);
+    if (buflen == 0)  buf = null;
+    if (buf == null) { THROW_IOE(ERROR_INTERNAL); return 0; }
+    if ((size_t)offset >= buflen)
+      { buf = null; buflen = 0; }
+    else
+      { buf = (char*)buf + (size_t)offset; buflen -= (size_t)offset; }
+  }
+  // before we start off we make sure there is no other error by the time we
+  // get here
+  if (uPtr->aborting()) {
+    THROW_IOE(uPtr->get_abort_message());
+    return 0;
+  }
+  uPtr->start(buf, buflen);
+  if (uPtr->aborting()) {
+    THROW_IOE(uPtr->get_abort_message());
+    return 0;
+  }
+
+  return ((jlong)
+          uPtr->get_segments_remaining() << 32)
+    + uPtr->get_files_remaining();
+}
+
+JNIEXPORT jboolean JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_getNextFile(JNIEnv *env, jobject pObj,
+                                         jobjectArray pParts) {
+
+  unpacker* uPtr = get_unpacker(env, pObj);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
+  unpacker::file* filep = uPtr->get_next_file();
+
+  if (uPtr->aborting()) {
+    THROW_IOE(uPtr->get_abort_message());
+    return false;
+  }
+
+  CHECK_NULL_RETURN(filep, false);
+  assert(filep == &uPtr->cur_file);
+
+  int pidx = 0, iidx = 0;
+  jintArray pIntParts = (jintArray) env->GetObjectArrayElement(pParts, pidx++);
+  CHECK_EXCEPTION_RETURN_VALUE(pIntParts, false);
+  jint*     intParts  = env->GetIntArrayElements(pIntParts, null);
+  intParts[iidx++] = (jint)( (julong)filep->size >> 32 );
+  intParts[iidx++] = (jint)( (julong)filep->size >>  0 );
+  intParts[iidx++] = filep->modtime;
+  intParts[iidx++] = filep->deflate_hint() ? 1 : 0;
+  env->ReleaseIntArrayElements(pIntParts, intParts, JNI_COMMIT);
+  jstring filename = env->NewStringUTF(filep->name);
+  CHECK_EXCEPTION_RETURN_VALUE(filename, false);
+  env->SetObjectArrayElement(pParts, pidx++, filename);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
+  jobject pDataBuf = null;
+  if (filep->data[0].len > 0) {
+    pDataBuf = env->NewDirectByteBuffer(filep->data[0].ptr,
+                                        filep->data[0].len);
+    CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
+  }
+  env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
+  pDataBuf = null;
+  if (filep->data[1].len > 0) {
+    pDataBuf = env->NewDirectByteBuffer(filep->data[1].ptr,
+                                        filep->data[1].len);
+    CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
+  }
+  env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
+
+  return true;
+}
+
+
+JNIEXPORT jobject JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject pObj) {
+  unpacker* uPtr = get_unpacker(env, pObj);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
+  unpacker::file* filep = &uPtr->cur_file;
+
+  if (uPtr->aborting()) {
+    THROW_IOE(uPtr->get_abort_message());
+    return false;
+  }
+
+  // We have fetched all the files.
+  // Now swallow up any remaining input.
+  if (uPtr->input_remaining() == 0) {
+    return null;
+  } else {
+    bytes remaining_bytes;
+    remaining_bytes.malloc(uPtr->input_remaining());
+    remaining_bytes.copyFrom(uPtr->input_scan(), uPtr->input_remaining());
+    return env->NewDirectByteBuffer(remaining_bytes.ptr, remaining_bytes.len);
+  }
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv *env, jobject pObj) {
+  unpacker* uPtr = get_unpacker(env, pObj, false);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
+  size_t consumed = uPtr->input_consumed();
+  free_unpacker(env, pObj, uPtr);
+  return consumed;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_setOption(JNIEnv *env, jobject pObj,
+                                       jstring pProp, jstring pValue) {
+  unpacker*   uPtr  = get_unpacker(env, pObj);
+  const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
+  CHECK_EXCEPTION_RETURN_VALUE(prop, false);
+  const char* value = env->GetStringUTFChars(pValue, JNI_FALSE);
+  CHECK_EXCEPTION_RETURN_VALUE(value, false);
+  jboolean   retval = uPtr->set_option(prop, value);
+  env->ReleaseStringUTFChars(pProp,  prop);
+  env->ReleaseStringUTFChars(pValue, value);
+  return retval;
+}
+
+JNIEXPORT jstring JNICALL
+Java_com_sun_java_util_jar_pack_NativeUnpack_getOption(JNIEnv *env, jobject pObj,
+                                       jstring pProp) {
+
+  unpacker*   uPtr  = get_unpacker(env, pObj);
+  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
+  const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
+  CHECK_EXCEPTION_RETURN_VALUE(prop, NULL);
+  const char* value = uPtr->get_option(prop);
+  CHECK_EXCEPTION_RETURN_VALUE(value, NULL);
+  env->ReleaseStringUTFChars(pProp, prop);
+  return env->NewStringUTF(value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/share/native/unpack200/main.cpp	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+#ifdef _ALLBSD_SOURCE
+#include <stdint.h>
+#define THRTYPE intptr_t
+#else
+#define THRTYPE int
+#endif
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#include <limits.h>
+#include <time.h>
+
+#if defined(unix) && !defined(PRODUCT)
+#include "pthread.h"
+#define THREAD_SELF ((THRTYPE)pthread_self())
+#endif
+
+#include "defines.h"
+#include "bytes.h"
+#include "utils.h"
+#include "coding.h"
+#include "bands.h"
+
+#include "constants.h"
+
+#include "zip.h"
+
+#include "unpack.h"
+
+
+int main(int argc, char **argv) {
+    return unpacker::run(argc, argv);
+}
+
+// Dealing with big-endian arch
+#ifdef _BIG_ENDIAN
+#define SWAP_INT(a) (((a>>24)&0xff) | ((a<<8)&0xff0000) | ((a>>8)&0xff00) | ((a<<24)&0xff000000))
+#else
+#define SWAP_INT(a) (a)
+#endif
+
+// Single-threaded, implementation, not reentrant.
+// Includes a weak error check against MT access.
+#ifndef THREAD_SELF
+#define THREAD_SELF ((THRTYPE) 0)
+#endif
+NOT_PRODUCT(static THRTYPE uThread = -1;)
+
+unpacker* unpacker::non_mt_current = null;
+unpacker* unpacker::current() {
+  //assert(uThread == THREAD_SELF);
+  return non_mt_current;
+}
+static void set_current_unpacker(unpacker* u) {
+  unpacker::non_mt_current = u;
+  assert(((uThread = (u == null) ? (THRTYPE) -1 : THREAD_SELF),
+          true));
+}
+
+// Callback for fetching data, Unix style.
+static jlong read_input_via_stdio(unpacker* u,
+                                  void* buf, jlong minlen, jlong maxlen) {
+  assert(minlen <= maxlen);  // don't talk nonsense
+  jlong numread = 0;
+  char* bufptr = (char*) buf;
+  while (numread < minlen) {
+    // read available input, up to buf.length or maxlen
+    int readlen = (1<<16);
+    if (readlen > (maxlen - numread))
+      readlen = (int)(maxlen - numread);
+    int nr = 0;
+    if (u->infileptr != null) {
+      nr = (int)fread(bufptr, 1, readlen, u->infileptr);
+    } else {
+#ifndef WIN32
+      // we prefer unbuffered inputs
+      nr = (int)read(u->infileno, bufptr, readlen);
+#else
+      nr = (int)fread(bufptr, 1, readlen, stdin);
+#endif
+    }
+    if (nr <= 0) {
+      if (errno != EINTR)
+        break;
+      nr = 0;
+    }
+    numread += nr;
+    bufptr += nr;
+    assert(numread <= maxlen);
+  }
+  //fprintf(u->errstrm, "readInputFn(%d,%d) => %d\n",
+  //        (int)minlen, (int)maxlen, (int)numread);
+  return numread;
+}
+
+enum { EOF_MAGIC = 0, BAD_MAGIC = -1 };
+static int read_magic(unpacker* u, char peek[], int peeklen) {
+  assert(peeklen == 4);  // magic numbers are always 4 bytes
+  jlong nr = (u->read_input_fn)(u, peek, peeklen, peeklen);
+  if (nr != peeklen) {
+    return (nr == 0) ? EOF_MAGIC : BAD_MAGIC;
+  }
+  int magic = 0;
+  for (int i = 0; i < peeklen; i++) {
+    magic <<= 8;
+    magic += peek[i] & 0xFF;
+  }
+  return magic;
+}
+
+static void setup_gzin(unpacker* u) {
+  gunzip* gzin = NEW(gunzip, 1);
+  gzin->init(u);
+}
+
+static const char* nbasename(const char* progname) {
+  const char* slash = strrchr(progname, '/');
+  if (slash != null)  progname = ++slash;
+  return progname;
+}
+
+static const char* usage_lines[] = {
+  "Usage:  %s [-opt... | --option=value]... x.pack[.gz] y.jar\n",
+    "\n",
+    "Unpacking Options\n",
+    "  -H{h}, --deflate-hint={h}     override transmitted deflate hint: true, false, or keep (default)\n",
+    "  -r, --remove-pack-file        remove input file after unpacking\n",
+    "  -v, --verbose                 increase program verbosity\n",
+    "  -q, --quiet                   set verbosity to lowest level\n",
+    "  -l{F}, --log-file={F}         output to the given log file, or '-' for standard output (default)\n",
+    "  -?, -h, --help                print this message\n",
+    "  -V, --version                 print program version\n",
+    "  -J{X}                         Java VM argument (ignored)\n",
+    null
+};
+
+static void usage(unpacker* u, const char* progname, bool full = false) {
+  // WinMain does not set argv[0] to the progrname
+  progname = (progname != null) ? nbasename(progname) : "unpack200";
+  for (int i = 0; usage_lines[i] != null; i++) {
+    fprintf(u->errstrm, usage_lines[i], progname);
+    if (!full) {
+      fprintf(u->errstrm,
+              "(For more information, run %s --help .)\n", progname);
+      break;
+    }
+  }
+}
+
+// argument parsing
+static char** init_args(int argc, char** argv, int &envargc) {
+  const char* env = getenv("UNPACK200_FLAGS");
+  ptrlist envargs;
+  envargs.init();
+  if (env != null) {
+    char* buf = (char*) strdup(env);
+    const char* delim = "\n\t ";
+    for (char* p = strtok(buf, delim); p != null; p = strtok(null, delim)) {
+      envargs.add(p);
+    }
+  }
+  // allocate extra margin at both head and tail
+  char** argp = NEW(char*, envargs.length()+argc+1);
+  char** argp0 = argp;
+  int i;
+  for (i = 0; i < envargs.length(); i++) {
+    *argp++ = (char*) envargs.get(i);
+  }
+  for (i = 1; i < argc; i++) {
+    // note: skip argv[0] (program name)
+    *argp++ = (char*) strdup(argv[i]);  // make a scratch copy
+  }
+  *argp = null; // sentinel
+  envargc = envargs.length();  // report this count to next_arg
+  envargs.free();
+  return argp0;
+}
+
+static int strpcmp(const char* str, const char* pfx) {
+  return strncmp(str, pfx, strlen(pfx));
+}
+
+static const char flag_opts[] = "vqrVh?";
+static const char string_opts[] = "HlJ";
+
+static int next_arg(char** &argp) {
+  char* arg = *argp;
+  if (arg == null || arg[0] != '-') { // end of option list
+    return 0;
+  }
+  //printf("opt: %s\n", arg);
+  char ach = arg[1];
+  if (ach == '\0') {
+    // ++argp;  // do not pop this arg
+    return 0;  // bare "-" is stdin/stdout
+  } else if (arg[1] == '-') {  // --foo option
+    static const char* keys[] = {
+      "Hdeflate-hint=",
+      "vverbose",
+      "qquiet",
+      "rremove-pack-file",
+      "llog-file=",
+      "Vversion",
+      "hhelp",
+      null };
+    if (arg[2] == '\0') {  // end of option list
+      ++argp;  // pop the "--"
+      return 0;
+    }
+    for (int i = 0; keys[i] != null; i++) {
+      const char* key = keys[i];
+      char kch = *key++;
+      if (strchr(key, '=') == null) {
+        if (!strcmp(arg+2, key)) {
+          ++argp;  // pop option arg
+          return kch;
+        }
+      } else {
+        if (!strpcmp(arg+2, key)) {
+          *argp += 2 + strlen(key);  // remove "--"+key from arg
+          return kch;
+        }
+      }
+    }
+  } else if (strchr(flag_opts, ach) != null) {  // plain option
+    if (arg[2] == '\0') {
+      ++argp;
+    } else {
+      // in-place edit of "-vxyz" to "-xyz"
+      arg += 1;  // skip original '-'
+      arg[0] = '-';
+      *argp = arg;
+    }
+    //printf("  key => %c\n", ach);
+    return ach;
+  } else if (strchr(string_opts, ach) != null) {  // argument-bearing option
+    if (arg[2] == '\0') {
+      if (argp[1] == null)  return -1;  // no next arg
+      ++argp;  // leave the argument in place
+    } else {
+      // in-place edit of "-Hxyz" to "xyz"
+      arg += 2;  // skip original '-H'
+      *argp = arg;
+    }
+    //printf("  key => %c\n", ach);
+    return ach;
+  }
+  return -1;  // bad argument
+}
+
+static const char sccsver[] = "1.30, 07/05/05";
+
+// Usage:  unpackage input.pack output.jar
+int unpacker::run(int argc, char **argv) {
+  unpacker u;
+  u.init(read_input_via_stdio);
+  set_current_unpacker(&u);
+
+  jar jarout;
+  jarout.init(&u);
+
+  int envargc = 0;
+  char** argbuf = init_args(argc, argv, envargc);
+  char** arg0 = argbuf+envargc;
+  char** argp = argbuf;
+
+  int verbose = 0;
+  char* logfile = null;
+
+  for (;;) {
+    const char* arg = (*argp == null)? "": u.saveStr(*argp);
+    bool isenvarg = (argp < arg0);
+    int ach = next_arg(argp);
+    bool hasoptarg = (ach != 0 && strchr(string_opts, ach) != null);
+    if (ach == 0 && argp >= arg0)  break;
+    if (isenvarg && argp == arg0 && hasoptarg)  ach = 0;  // don't pull from cmdline
+    switch (ach) {
+    case 'H':  u.set_option(UNPACK_DEFLATE_HINT,*argp++); break;
+    case 'v':  ++verbose; break;
+    case 'q':  verbose = 0; break;
+    case 'r':  u.set_option(UNPACK_REMOVE_PACKFILE,"1"); break;
+    case 'l':  logfile = *argp++; break;
+    case 'J':  argp += 1; break;  // skip ignored -Jxxx parameter
+
+    case 'V':
+      fprintf(u.errstrm, VERSION_STRING, nbasename(argv[0]), sccsver);
+      exit(0);
+
+    case 'h':
+    case '?':
+      usage(&u, argv[0], true);
+      exit(1);
+
+    default:
+      const char* inenv = isenvarg? " in ${UNPACK200_FLAGS}": "";
+      if (hasoptarg)
+        fprintf(u.errstrm, "Missing option string%s: %s\n", inenv, arg);
+      else
+        fprintf(u.errstrm, "Unrecognized argument%s: %s\n", inenv, arg);
+      usage(&u, argv[0]);
+      exit(2);
+    }
+  }
+
+  if (verbose != 0) {
+    u.set_option(DEBUG_VERBOSE, u.saveIntStr(verbose));
+  }
+  if (logfile != null) {
+    u.set_option(UNPACK_LOG_FILE, logfile);
+  }
+
+  u.redirect_stdio();
+
+  const char* source_file      = *argp++;
+  const char* destination_file = *argp++;
+
+  if (source_file == null || destination_file == null || *argp != null) {
+    usage(&u, argv[0]);
+    exit(2);
+  }
+
+  if (verbose != 0) {
+    fprintf(u.errstrm,
+            "Unpacking from %s to %s\n", source_file, destination_file);
+  }
+  bool& remove_source = u.remove_packfile;
+
+  if (strcmp(source_file, "-") == 0) {
+    remove_source = false;
+    u.infileno = fileno(stdin);
+  } else {
+    u.infileptr = fopen(source_file, "rb");
+    if (u.infileptr == null) {
+       fprintf(u.errstrm,
+               "Error: Could not open input file: %s\n", source_file);
+       exit(3); // Called only from the native standalone unpacker
+    }
+  }
+
+  if (strcmp(destination_file, "-") == 0) {
+    jarout.jarfp = stdout;
+    if (u.errstrm == stdout) // do not mix output
+      u.set_option(UNPACK_LOG_FILE, LOGFILE_STDERR);
+  } else {
+    jarout.openJarFile(destination_file);
+    assert(jarout.jarfp != null);
+  }
+
+  if (verbose != 0)
+    u.dump_options();
+
+  char peek[4];
+  int magic;
+
+  // check for GZIP input
+  magic = read_magic(&u, peek, (int)sizeof(peek));
+  if ((magic & GZIP_MAGIC_MASK) == GZIP_MAGIC) {
+    // Oops; must slap an input filter on this data.
+    setup_gzin(&u);
+    u.gzin->start(magic);
+    if (!u.aborting()) {
+      u.start();
+    }
+  } else {
+    u.gzcrc = 0;
+    u.start(peek, sizeof(peek));
+  }
+
+  // Note:  The checks to u.aborting() are necessary to gracefully
+  // terminate processing when the first segment throws an error.
+
+  for (;;) {
+    if (u.aborting())  break;
+
+    // Each trip through this loop unpacks one segment
+    // and then resets the unpacker.
+    for (unpacker::file* filep; (filep = u.get_next_file()) != null; ) {
+      if (u.aborting())  break;
+      u.write_file_to_jar(filep);
+    }
+    if (u.aborting())  break;
+
+    // Peek ahead for more data.
+    magic = read_magic(&u, peek, (int)sizeof(peek));
+    if (magic != (int)JAVA_PACKAGE_MAGIC) {
+      if (magic != EOF_MAGIC)
+        u.abort("garbage after end of pack archive");
+      break;   // all done
+    }
+
+    // Release all storage from parsing the old segment.
+    u.reset();
+
+    // Restart, beginning with the peek-ahead.
+    u.start(peek, sizeof(peek));
+  }
+
+
+
+  int status = 0;
+  if (u.aborting()) {
+    fprintf(u.errstrm, "Error: %s\n", u.get_abort_message());
+    status = 1;
+  }
+
+  if (!u.aborting() && u.infileptr != null) {
+    if (u.gzcrc != 0) {
+      // Read the CRC information from the gzip container
+      fseek(u.infileptr, -8, SEEK_END);
+      uint filecrc;
+      fread(&filecrc, sizeof(filecrc), 1, u.infileptr);
+      if (u.gzcrc != SWAP_INT(filecrc)) { // CRC error
+        if (strcmp(destination_file, "-") != 0) {
+          // Output is not stdout, remove it, it's broken
+          if (u.jarout != null)
+            u.jarout->closeJarFile(false);
+          remove(destination_file);
+        }
+        // Print out the error and exit with return code != 0
+        u.abort("CRC error, invalid compressed data.");
+      }
+    }
+    fclose(u.infileptr);
+    u.infileptr = null;
+  }
+
+  if (!u.aborting() && remove_source)
+    remove(source_file);
+
+  if (verbose != 0) {
+    fprintf(u.errstrm, "unpacker completed with status=%d\n", status);
+  }
+
+  u.finish();
+
+  u.free();  // tidy up malloc blocks
+  set_current_unpacker(null);  // clean up global pointer
+
+  return status;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
+  <assemblyIdentity version="IMVERSION"
+     processorArchitecture="X86"
+     name="unpack200.exe"
+     type="win32"/> 
+
+  <description>Java(TM) SE Runtime Environment unpack200 Process.</description> 
+  <!-- Identify the application security requirements. -->
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="asInvoker"
+          uiAccess="false"/>
+        </requestedPrivileges>
+       </security>
+  </trustInfo>
+</assembly>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_de.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_es.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_it.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java	Wed Jul 05 20:24:03 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.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java	Wed Jul 05 20:24:03 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/native/common-unpack/bands.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,486 +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.
- */
-
-// -*- C++ -*-
-// Small program for unpacking specially compressed Java packages.
-// John R. Rose
-
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-#include "coding.h"
-#include "bands.h"
-
-#include "constants.h"
-#include "unpack.h"
-
-inline void band::abort(const char* msg) { u->abort(msg); }
-inline bool band::aborting() { return u->aborting(); }
-
-void band::readData(int expectedLength) {
-  CHECK;
-  assert(expectedLength >= 0);
-  assert(vs[0].cmk == cmk_ERROR);
-  if (expectedLength != 0) {
-    assert(length == 0);
-    length = expectedLength;
-  }
-  if (length == 0) {
-    assert((rplimit = cm.vs0.rp = u->rp) != null);
-    return;
-  }
-  assert(length > 0);
-
-  bool is_BYTE1 = (defc->spec == BYTE1_spec);
-
-  if (is_BYTE1) {
-    // No possibility of coding change.  Sizing is exact.
-    u->ensure_input(length);
-  } else {
-    // Make a conservatively generous estimate of band size in bytes.
-    // Assume B == 5 everywhere.
-    // Assume awkward pop with all {U} values (2*5 per value)
-    jlong generous = (jlong) length * (B_MAX*3+1) + C_SLOP;
-    u->ensure_input(generous);
-  }
-
-  // Read one value to see what it might be.
-  int XB = _meta_default;
-  int cp1 = 0, cp2 = 0;
-  if (!is_BYTE1) {
-    // must be a variable-length coding
-    assert(defc->B() > 1 && defc->L() > 0);
-    // must have already read from previous band:
-    assert(bn >= BAND_LIMIT || bn <= 0
-           || bn == e_cp_Utf8_big_chars
-           || endsWith(name, "_lo")  // preceded by _hi conditional band
-           || bn == e_file_options  // preceded by conditional band
-           || u->rp == u->all_bands[bn-1].maxRP()
-           || u->all_bands[bn-1].defc == null);
-
-    value_stream xvs;
-    coding* valc = defc;
-    if (valc->D() != 0) {
-      valc = coding::findBySpec(defc->B(), defc->H(), defc->S());
-      assert(!valc->isMalloc);
-    }
-    xvs.init(u->rp, u->rplimit, valc);
-    CHECK;
-    int X = xvs.getInt();
-    if (valc->S() != 0) {
-      assert(valc->min <= -256);
-      XB = -1-X;
-    } else {
-      int L = valc->L();
-      assert(valc->max >= L+255);
-      XB = X-L;
-    }
-    if (0 <= XB && XB < 256) {
-      // Skip over the escape value.
-      u->rp = xvs.rp;
-      cp1 = 1;
-    } else {
-      // No, it's still default.
-      XB = _meta_default;
-    }
-  }
-
-  if (XB <= _meta_canon_max) {
-    byte XB_byte = (byte) XB;
-    byte* XB_ptr = &XB_byte;
-    cm.init(u->rp, u->rplimit, XB_ptr, 0, defc, length, null);
-    CHECK;
-  } else {
-    NOT_PRODUCT(byte* meta_rp0 = u->meta_rp);
-    assert(u->meta_rp != null);
-    // Scribble the initial byte onto the band.
-    byte* save_meta_rp = --u->meta_rp;
-    byte  save_meta_xb = (*save_meta_rp);
-    (*save_meta_rp) = (byte) XB;
-    cm.init(u->rp, u->rplimit, u->meta_rp, 0, defc, length, null);
-    (*save_meta_rp) = save_meta_xb;  // put it back, just to be tidy
-    NOT_PRODUCT(cp2 = (int)(u->meta_rp - meta_rp0));
-  }
-  rplimit = u->rp;
-
-  rewind();
-
-#ifndef PRODUCT
-  PRINTCR((3,"readFrom %s at %p [%d values, %d bytes, cp=%d/%d]",
-           (name?name:"(band)"), minRP(), length, size(), cp1, cp2));
-  if (u->verbose_bands || u->verbose >= 4) dump();
-
-  if (ix != null && u->verbose != 0 && length > 0) {
-    // Check referential integrity early, for easier debugging.
-    band saved = (*this);  // save state
-    for (int i = 0; i < length; i++) {
-      int n = vs[0].getInt() - nullOK;
-      entry *ref = ix->get(n);
-      assert(ref != null || n == -1);
-    }
-    (*this) = saved;
-  }
-#endif
-}
-
-#ifndef PRODUCT
-void band::dump() {
-  band saved = (*this);  // save state
-  const char* b_name = name;
-  char b_name_buf[100];
-  if (b_name == null) {
-    char* bp = &b_name_buf[0];
-    b_name = bp;
-    sprintf(bp, "#%d/%d", bn, le_kind); bp += strlen(bp);
-    if (le_bci != 0)  { sprintf(bp, "/bci%d",  le_bci);  bp += strlen(bp); }
-    if (le_back != 0) { sprintf(bp, "/back%d", le_back); bp += strlen(bp); }
-    if (le_len != 0)  { sprintf(bp, "/len%d",  le_len);  bp += strlen(bp); }
-  }
-  fprintf(u->errstrm, "band %s[%d]%s", b_name, length, (length==0?"\n":" {"));
-  if (length > 0) {
-    for (int i = 0; i < length; i++) {
-      const char* eol = (length > 10 && i % 10 == 0) ? "\n" : " ";
-      fprintf(u->errstrm, "%s%d", eol, vs[0].getInt());
-    }
-    fprintf(u->errstrm, " }\n");
-  }
-  (*this) = saved;
-}
-#endif
-
-void band::setIndex(cpindex* ix_) {
-  assert(ix_ == null || ixTag == ix_->ixTag);
-  ix = ix_;
-}
-void band::setIndexByTag(byte tag) {
-  setIndex(u->cp.getIndex(tag));
-}
-
-entry* band::getRefCommon(cpindex* ix_, bool nullOKwithCaller) {
-  CHECK_0;
-  if (ix_ == NULL) {
-      abort("no index");
-      return NULL;
-  }
-  assert(ix_->ixTag == ixTag
-         || ((ixTag == CONSTANT_All ||
-              ixTag == CONSTANT_LoadableValue ||
-              ixTag == CONSTANT_AnyMember)
-         || (ixTag == CONSTANT_FieldSpecific &&
-              ix_->ixTag >= CONSTANT_Integer  &&
-              ix_->ixTag <= CONSTANT_String))
-         );
-  int n = vs[0].getInt() - nullOK;
-  // Note: band-local nullOK means null encodes as 0.
-  // But nullOKwithCaller means caller is willing to tolerate a null.
-  entry *ref = ix_->get(n);
-  if (ref == null && !(nullOKwithCaller && n == -1))
-    abort(n == -1 ? "null ref" : "bad ref");
-  return ref;
-}
-
-jlong band::getLong(band& lo_band, bool have_hi) {
-  band& hi_band = (*this);
-  assert(lo_band.bn == hi_band.bn + 1);
-  uint lo = lo_band.getInt();
-  if (!have_hi) {
-    assert(hi_band.length == 0);
-    return makeLong(0, lo);
-  }
-  uint hi = hi_band.getInt();
-  return makeLong(hi, lo);
-}
-
-int band::getIntTotal() {
-  CHECK_0;
-  if (length == 0)  return 0;
-  if (total_memo > 0)  return total_memo-1;
-  int total = getInt();
-  // overflow checks require that none of the addends are <0,
-  // and that the partial sums never overflow (wrap negative)
-  if (total < 0) {
-    abort("overflow detected");
-    return 0;
-  }
-  for (int k = length-1; k > 0; k--) {
-    int prev_total = total;
-    total += vs[0].getInt();
-    if (total < prev_total) {
-      abort("overflow detected");
-      return 0;
-    }
-  }
-  rewind();
-  total_memo = total+1;
-  return total;
-}
-
-int band::getIntCount(int tag) {
-  CHECK_0;
-  if (length == 0)  return 0;
-  if (tag >= HIST0_MIN && tag <= HIST0_MAX) {
-    if (hist0 == null) {
-      // Lazily calculate an approximate histogram.
-      hist0 = U_NEW(int, (HIST0_MAX - HIST0_MIN)+1);
-      CHECK_0;
-      for (int k = length; k > 0; k--) {
-        int x = vs[0].getInt();
-        if (x >= HIST0_MIN && x <= HIST0_MAX)
-          hist0[x - HIST0_MIN] += 1;
-      }
-      rewind();
-    }
-    return hist0[tag - HIST0_MIN];
-  }
-  int total = 0;
-  for (int k = length; k > 0; k--) {
-    total += (vs[0].getInt() == tag) ? 1 : 0;
-  }
-  rewind();
-  return total;
-}
-
-#define INDEX_INIT(tag, nullOK, subindex) \
-        ((tag) + (subindex)*SUBINDEX_BIT + (nullOK)*256)
-
-#define INDEX(tag)          INDEX_INIT(tag, 0, 0)
-#define NULL_OR_INDEX(tag)  INDEX_INIT(tag, 1, 0)
-#define SUB_INDEX(tag)      INDEX_INIT(tag, 0, 1)
-#define NO_INDEX            0
-
-struct band_init {
-  int         bn;
-  const char* name;
-  int   defc;
-  int   index;
-};
-
-#define BAND_INIT(name, cspec, ix) \
-  { e_##name,  #name, /*debug only*/ \
-    cspec, ix }
-
-const band_init all_band_inits[BAND_LIMIT+1] = {
-//BAND_INIT(archive_magic, BYTE1_spec, 0),
-//BAND_INIT(archive_header, UNSIGNED5_spec, 0),
-//BAND_INIT(band_headers, BYTE1_spec, 0),
-  BAND_INIT(cp_Utf8_prefix, DELTA5_spec, 0),
-  BAND_INIT(cp_Utf8_suffix, UNSIGNED5_spec, 0),
-  BAND_INIT(cp_Utf8_chars, CHAR3_spec, 0),
-  BAND_INIT(cp_Utf8_big_suffix, DELTA5_spec, 0),
-  BAND_INIT(cp_Utf8_big_chars, DELTA5_spec, 0),
-  BAND_INIT(cp_Int, UDELTA5_spec, 0),
-  BAND_INIT(cp_Float, UDELTA5_spec, 0),
-  BAND_INIT(cp_Long_hi, UDELTA5_spec, 0),
-  BAND_INIT(cp_Long_lo, DELTA5_spec, 0),
-  BAND_INIT(cp_Double_hi, UDELTA5_spec, 0),
-  BAND_INIT(cp_Double_lo, DELTA5_spec, 0),
-  BAND_INIT(cp_String, UDELTA5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(cp_Class, UDELTA5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(cp_Signature_form, DELTA5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(cp_Signature_classes, UDELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(cp_Descr_name, DELTA5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(cp_Descr_type, UDELTA5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(cp_Field_class, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(cp_Field_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(cp_Method_class, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(cp_Method_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(cp_Imethod_class, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(cp_Imethod_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(cp_MethodHandle_refkind, DELTA5_spec, 0),
-  BAND_INIT(cp_MethodHandle_member, UDELTA5_spec, INDEX(CONSTANT_AnyMember)),
-  BAND_INIT(cp_MethodType, UDELTA5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(cp_BootstrapMethod_ref, DELTA5_spec, INDEX(CONSTANT_MethodHandle)),
-  BAND_INIT(cp_BootstrapMethod_arg_count, UDELTA5_spec, 0),
-  BAND_INIT(cp_BootstrapMethod_arg, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
-  BAND_INIT(cp_InvokeDynamic_spec, DELTA5_spec, INDEX(CONSTANT_BootstrapMethod)),
-  BAND_INIT(cp_InvokeDynamic_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(attr_definition_headers, BYTE1_spec, 0),
-  BAND_INIT(attr_definition_name, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(attr_definition_layout, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(ic_this_class, UDELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(ic_flags, UNSIGNED5_spec, 0),
-  BAND_INIT(ic_outer_class, DELTA5_spec, NULL_OR_INDEX(CONSTANT_Class)),
-  BAND_INIT(ic_name, DELTA5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
-  BAND_INIT(class_this, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(class_super, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(class_interface_count, DELTA5_spec, 0),
-  BAND_INIT(class_interface, DELTA5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(class_field_count, DELTA5_spec, 0),
-  BAND_INIT(class_method_count, DELTA5_spec, 0),
-  BAND_INIT(field_descr, DELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(field_flags_hi, UNSIGNED5_spec, 0),
-  BAND_INIT(field_flags_lo, UNSIGNED5_spec, 0),
-  BAND_INIT(field_attr_count, UNSIGNED5_spec, 0),
-  BAND_INIT(field_attr_indexes, UNSIGNED5_spec, 0),
-  BAND_INIT(field_attr_calls, UNSIGNED5_spec, 0),
-  BAND_INIT(field_ConstantValue_KQ, UNSIGNED5_spec, INDEX(CONSTANT_FieldSpecific)),
-  BAND_INIT(field_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(field_metadata_bands, -1, -1),
-  BAND_INIT(field_attr_bands, -1, -1),
-  BAND_INIT(method_descr, MDELTA5_spec, INDEX(CONSTANT_NameandType)),
-  BAND_INIT(method_flags_hi, UNSIGNED5_spec, 0),
-  BAND_INIT(method_flags_lo, UNSIGNED5_spec, 0),
-  BAND_INIT(method_attr_count, UNSIGNED5_spec, 0),
-  BAND_INIT(method_attr_indexes, UNSIGNED5_spec, 0),
-  BAND_INIT(method_attr_calls, UNSIGNED5_spec, 0),
-  BAND_INIT(method_Exceptions_N, UNSIGNED5_spec, 0),
-  BAND_INIT(method_Exceptions_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(method_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(method_metadata_bands, -1, -1),
-  BAND_INIT(method_MethodParameters_NB, BYTE1_spec, 0),
-  BAND_INIT(method_MethodParameters_name_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
-  BAND_INIT(method_MethodParameters_flag_FH, UNSIGNED5_spec, 0),
-  BAND_INIT(method_attr_bands, -1, -1),
-  BAND_INIT(class_flags_hi, UNSIGNED5_spec, 0),
-  BAND_INIT(class_flags_lo, UNSIGNED5_spec, 0),
-  BAND_INIT(class_attr_count, UNSIGNED5_spec, 0),
-  BAND_INIT(class_attr_indexes, UNSIGNED5_spec, 0),
-  BAND_INIT(class_attr_calls, UNSIGNED5_spec, 0),
-  BAND_INIT(class_SourceFile_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
-  BAND_INIT(class_EnclosingMethod_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(class_EnclosingMethod_RDN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_NameandType)),
-  BAND_INIT(class_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(class_metadata_bands, -1, -1),
-  BAND_INIT(class_InnerClasses_N, UNSIGNED5_spec, 0),
-  BAND_INIT(class_InnerClasses_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(class_InnerClasses_F, UNSIGNED5_spec, 0),
-  BAND_INIT(class_InnerClasses_outer_RCN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
-  BAND_INIT(class_InnerClasses_name_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)),
-  BAND_INIT(class_ClassFile_version_minor_H, UNSIGNED5_spec, 0),
-  BAND_INIT(class_ClassFile_version_major_H, UNSIGNED5_spec, 0),
-  BAND_INIT(class_attr_bands, -1, -1),
-  BAND_INIT(code_headers, BYTE1_spec, 0),
-  BAND_INIT(code_max_stack, UNSIGNED5_spec, 0),
-  BAND_INIT(code_max_na_locals, UNSIGNED5_spec, 0),
-  BAND_INIT(code_handler_count, UNSIGNED5_spec, 0),
-  BAND_INIT(code_handler_start_P, BCI5_spec, 0),
-  BAND_INIT(code_handler_end_PO, BRANCH5_spec, 0),
-  BAND_INIT(code_handler_catch_PO, BRANCH5_spec, 0),
-  BAND_INIT(code_handler_class_RCN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
-  BAND_INIT(code_flags_hi, UNSIGNED5_spec, 0),
-  BAND_INIT(code_flags_lo, UNSIGNED5_spec, 0),
-  BAND_INIT(code_attr_count, UNSIGNED5_spec, 0),
-  BAND_INIT(code_attr_indexes, UNSIGNED5_spec, 0),
-  BAND_INIT(code_attr_calls, UNSIGNED5_spec, 0),
-  BAND_INIT(code_StackMapTable_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_StackMapTable_frame_T, BYTE1_spec, 0),
-  BAND_INIT(code_StackMapTable_local_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_StackMapTable_stack_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_StackMapTable_offset, UNSIGNED5_spec, 0),
-  BAND_INIT(code_StackMapTable_T, BYTE1_spec, 0),
-  BAND_INIT(code_StackMapTable_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)),
-  BAND_INIT(code_StackMapTable_P, BCI5_spec, 0),
-  BAND_INIT(code_LineNumberTable_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_LineNumberTable_bci_P, BCI5_spec, 0),
-  BAND_INIT(code_LineNumberTable_line, UNSIGNED5_spec, 0),
-  BAND_INIT(code_LocalVariableTable_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_LocalVariableTable_bci_P, BCI5_spec, 0),
-  BAND_INIT(code_LocalVariableTable_span_O, BRANCH5_spec, 0),
-  BAND_INIT(code_LocalVariableTable_name_RU, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(code_LocalVariableTable_type_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(code_LocalVariableTable_slot, UNSIGNED5_spec, 0),
-  BAND_INIT(code_LocalVariableTypeTable_N, UNSIGNED5_spec, 0),
-  BAND_INIT(code_LocalVariableTypeTable_bci_P, BCI5_spec, 0),
-  BAND_INIT(code_LocalVariableTypeTable_span_O, BRANCH5_spec, 0),
-  BAND_INIT(code_LocalVariableTypeTable_name_RU, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(code_LocalVariableTypeTable_type_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
-  BAND_INIT(code_LocalVariableTypeTable_slot, UNSIGNED5_spec, 0),
-  BAND_INIT(code_attr_bands, -1, -1),
-  BAND_INIT(bc_codes, BYTE1_spec, 0),
-  BAND_INIT(bc_case_count, UNSIGNED5_spec, 0),
-  BAND_INIT(bc_case_value, DELTA5_spec, 0),
-  BAND_INIT(bc_byte, BYTE1_spec, 0),
-  BAND_INIT(bc_short, DELTA5_spec, 0),
-  BAND_INIT(bc_local, UNSIGNED5_spec, 0),
-  BAND_INIT(bc_label, BRANCH5_spec, 0),
-  BAND_INIT(bc_intref, DELTA5_spec, INDEX(CONSTANT_Integer)),
-  BAND_INIT(bc_floatref, DELTA5_spec, INDEX(CONSTANT_Float)),
-  BAND_INIT(bc_longref, DELTA5_spec, INDEX(CONSTANT_Long)),
-  BAND_INIT(bc_doubleref, DELTA5_spec, INDEX(CONSTANT_Double)),
-  BAND_INIT(bc_stringref, DELTA5_spec, INDEX(CONSTANT_String)),
-  BAND_INIT(bc_loadablevalueref, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
-  BAND_INIT(bc_classref, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
-  BAND_INIT(bc_fieldref, DELTA5_spec, INDEX(CONSTANT_Fieldref)),
-  BAND_INIT(bc_methodref, UNSIGNED5_spec, INDEX(CONSTANT_Methodref)),
-  BAND_INIT(bc_imethodref, DELTA5_spec, INDEX(CONSTANT_InterfaceMethodref)),
-  BAND_INIT(bc_indyref, DELTA5_spec, INDEX(CONSTANT_InvokeDynamic)),
-  BAND_INIT(bc_thisfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
-  BAND_INIT(bc_superfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
-  BAND_INIT(bc_thismethod, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
-  BAND_INIT(bc_supermethod, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
-  BAND_INIT(bc_initref, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
-  BAND_INIT(bc_escref, UNSIGNED5_spec, INDEX(CONSTANT_All)),
-  BAND_INIT(bc_escrefsize, UNSIGNED5_spec, 0),
-  BAND_INIT(bc_escsize, UNSIGNED5_spec, 0),
-  BAND_INIT(bc_escbyte, BYTE1_spec, 0),
-  BAND_INIT(file_name, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
-  BAND_INIT(file_size_hi, UNSIGNED5_spec, 0),
-  BAND_INIT(file_size_lo, UNSIGNED5_spec, 0),
-  BAND_INIT(file_modtime, DELTA5_spec, 0),
-  BAND_INIT(file_options, UNSIGNED5_spec, 0),
-//BAND_INIT(file_bits, BYTE1_spec, 0),
-  { 0, NULL, 0, 0 }
-};
-
-band* band::makeBands(unpacker* u) {
-  band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
-  for (int i = 0; i < BAND_LIMIT; i++) {
-    assert((byte*)&all_band_inits[i+1]
-           < (byte*)all_band_inits+sizeof(all_band_inits));
-    const band_init& bi = all_band_inits[i];
-    band&            b  = tmp_all_bands[i];
-    coding*          defc = coding::findBySpec(bi.defc);
-    assert((defc == null) == (bi.defc == -1));  // no garbage, please
-    assert(defc == null || !defc->isMalloc);
-    assert(bi.bn == i);  // band array consistent w/ band enum
-    b.init(u, i, defc);
-    if (bi.index > 0) {
-      b.nullOK = ((bi.index >> 8) & 1);
-      b.ixTag = (bi.index & 0xFF);
-    }
-#ifndef PRODUCT
-    b.name = bi.name;
-#endif
-  }
-  return tmp_all_bands;
-}
-
-void band::initIndexes(unpacker* u) {
-  band* tmp_all_bands = u->all_bands;
-  for (int i = 0; i < BAND_LIMIT; i++) {
-    band* scan = &tmp_all_bands[i];
-    uint tag = scan->ixTag;  // Cf. #define INDEX(tag) above
-    if (tag != 0 && tag != CONSTANT_FieldSpecific && (tag & SUBINDEX_BIT) == 0) {
-      scan->setIndex(u->cp.getIndex(tag));
-    }
-  }
-}
--- a/jdk/src/jdk.runtime/share/native/common-unpack/bands.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,481 +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.
- */
-
-// -*- C++ -*-
-struct entry;
-struct cpindex;
-struct unpacker;
-
-struct band {
-  const char*   name;
-  int           bn;             // band_number of this band
-  coding*       defc;           // default coding method
-  cpindex*      ix;             // CP entry mapping, if CPRefBand
-  byte          ixTag;          // 0 or 1; null is coded as (nullOK?0:-1)
-  byte          nullOK;         // 0 or 1; null is coded as (nullOK?0:-1)
-  int           length;         // expected # values
-  unpacker*     u;              // back pointer
-
-  value_stream  vs[2];         // source of values
-  coding_method cm;            // method used for initial state of vs[0]
-  byte*         rplimit;       // end of band (encoded, transmitted)
-
-  int           total_memo;    // cached value of getIntTotal, or -1
-  int*          hist0;         // approximate. histogram
-  enum { HIST0_MIN = 0, HIST0_MAX = 255 }; // catches the usual cases
-
-  // properties for attribute layout elements:
-  byte          le_kind;       // EK_XXX
-  byte          le_bci;        // 0,EK_BCI,EK_BCD,EK_BCO
-  byte          le_back;       // ==EF_BACK
-  byte          le_len;        // 0,1,2,4 (size in classfile), or call addr
-  band**        le_body;       // body of repl, union, call (null-terminated)
-  // Note:  EK_CASE elements use hist0 to record union tags.
-  #define       le_casetags    hist0
-
-  band& nextBand() { return this[1]; }
-  band& prevBand() { return this[-1]; }
-
-  void init(unpacker* u_, int bn_, coding* defc_) {
-    u    = u_;
-    cm.u = u_;
-    bn   = bn_;
-    defc = defc_;
-  }
-  void init(unpacker* u_, int bn_, int defcSpec) {
-    init(u_, bn_, coding::findBySpec(defcSpec));
-  }
-  void initRef(int ixTag_ = 0, bool nullOK_ = false) {
-    ixTag  = ixTag_;
-    nullOK = nullOK_;
-    setIndexByTag(ixTag);
-  }
-
-  void expectMoreLength(int l) {
-    assert(length >= 0);      // able to accept a length
-    assert((int)l >= 0);      // no overflow
-    assert(rplimit == null);  // readData not yet called
-    length += l;
-    assert(length >= l);      // no overflow
-  }
-
-  void setIndex(cpindex* ix_);
-  void setIndexByTag(byte tag);
-
-  // Parse the band and its meta-coding header.
-  void readData(int expectedLength = 0);
-
-  // Reset the band for another pass (Cf. Java Band.resetForSecondPass.)
-  void rewind() {
-    cm.reset(&vs[0]);
-  }
-
-  byte* &curRP()    { return vs[0].rp; }
-  byte*  minRP()    { return cm.vs0.rp; }
-  byte*  maxRP()    { return rplimit; }
-  size_t size()     { return maxRP() - minRP(); }
-
-  int    getByte()  { assert(ix == null); return vs[0].getByte(); }
-  int    getInt()   { assert(ix == null); return vs[0].getInt(); }
-  entry* getRefN()  { return getRefCommon(ix, true); }
-  entry* getRef()   { return getRefCommon(ix, false); }
-  entry* getRefUsing(cpindex* ix2)
-                    { assert(ix == null); return getRefCommon(ix2, true); }
-  entry* getRefCommon(cpindex* ix, bool nullOK);
-  jlong  getLong(band& lo_band, bool have_hi);
-
-  static jlong makeLong(uint hi, uint lo) {
-    return ((julong)hi << 32) + (((julong)lo << 32) >> 32);
-  }
-
-  int    getIntTotal();
-  int    getIntCount(int tag);
-
-  static band* makeBands(unpacker* u);
-  static void initIndexes(unpacker* u);
-
-#ifndef PRODUCT
-  void dump();
-#endif
-
-  void abort(const char* msg = null); //{ u->abort(msg); }
-  bool aborting(); //{ return u->aborting(); }
-};
-
-extern band all_bands[];
-
-#define BAND_LOCAL /* \
-  band* band_temp = all_bands; \
-  band* all_bands = band_temp */
-
-// Band schema:
-enum band_number {
-  //e_archive_magic,
-  //e_archive_header,
-  //e_band_headers,
-
-    // constant pool contents
-    e_cp_Utf8_prefix,
-    e_cp_Utf8_suffix,
-    e_cp_Utf8_chars,
-    e_cp_Utf8_big_suffix,
-    e_cp_Utf8_big_chars,
-    e_cp_Int,
-    e_cp_Float,
-    e_cp_Long_hi,
-    e_cp_Long_lo,
-    e_cp_Double_hi,
-    e_cp_Double_lo,
-    e_cp_String,
-    e_cp_Class,
-    e_cp_Signature_form,
-    e_cp_Signature_classes,
-    e_cp_Descr_name,
-    e_cp_Descr_type,
-    e_cp_Field_class,
-    e_cp_Field_desc,
-    e_cp_Method_class,
-    e_cp_Method_desc,
-    e_cp_Imethod_class,
-    e_cp_Imethod_desc,
-    e_cp_MethodHandle_refkind,
-    e_cp_MethodHandle_member,
-    e_cp_MethodType,
-    e_cp_BootstrapMethod_ref,
-    e_cp_BootstrapMethod_arg_count,
-    e_cp_BootstrapMethod_arg,
-    e_cp_InvokeDynamic_spec,
-    e_cp_InvokeDynamic_desc,
-
-    // bands which define transmission of attributes
-    e_attr_definition_headers,
-    e_attr_definition_name,
-    e_attr_definition_layout,
-
-    // band for hardwired InnerClasses attribute (shared across the package)
-    e_ic_this_class,
-    e_ic_flags,
-    // These bands contain data only where flags sets ACC_IC_LONG_FORM:
-    e_ic_outer_class,
-    e_ic_name,
-
-    // bands for carrying class schema information:
-    e_class_this,
-    e_class_super,
-    e_class_interface_count,
-    e_class_interface,
-
-    // bands for class members
-    e_class_field_count,
-    e_class_method_count,
-
-    e_field_descr,
-    e_field_flags_hi,
-    e_field_flags_lo,
-    e_field_attr_count,
-    e_field_attr_indexes,
-    e_field_attr_calls,
-    e_field_ConstantValue_KQ,
-    e_field_Signature_RS,
-    e_field_metadata_bands,
-    e_field_attr_bands,
-
-    e_method_descr,
-    e_method_flags_hi,
-    e_method_flags_lo,
-    e_method_attr_count,
-    e_method_attr_indexes,
-    e_method_attr_calls,
-    e_method_Exceptions_N,
-    e_method_Exceptions_RC,
-    e_method_Signature_RS,
-    e_method_metadata_bands,
-    e_method_MethodParameters_NB,
-    e_method_MethodParameters_name_RUN,
-    e_method_MethodParameters_flag_FH,
-    e_method_attr_bands,
-
-    e_class_flags_hi,
-    e_class_flags_lo,
-    e_class_attr_count,
-    e_class_attr_indexes,
-    e_class_attr_calls,
-    e_class_SourceFile_RUN,
-    e_class_EnclosingMethod_RC,
-    e_class_EnclosingMethod_RDN,
-    e_class_Signature_RS,
-    e_class_metadata_bands,
-    e_class_InnerClasses_N,
-    e_class_InnerClasses_RC,
-    e_class_InnerClasses_F,
-    e_class_InnerClasses_outer_RCN,
-    e_class_InnerClasses_name_RUN,
-    e_class_ClassFile_version_minor_H,
-    e_class_ClassFile_version_major_H,
-    e_class_attr_bands,
-
-    e_code_headers,
-    e_code_max_stack,
-    e_code_max_na_locals,
-    e_code_handler_count,
-    e_code_handler_start_P,
-    e_code_handler_end_PO,
-    e_code_handler_catch_PO,
-    e_code_handler_class_RCN,
-
-    // code attributes
-    e_code_flags_hi,
-    e_code_flags_lo,
-    e_code_attr_count,
-    e_code_attr_indexes,
-    e_code_attr_calls,
-    e_code_StackMapTable_N,
-    e_code_StackMapTable_frame_T,
-    e_code_StackMapTable_local_N,
-    e_code_StackMapTable_stack_N,
-    e_code_StackMapTable_offset,
-    e_code_StackMapTable_T,
-    e_code_StackMapTable_RC,
-    e_code_StackMapTable_P,
-    e_code_LineNumberTable_N,
-    e_code_LineNumberTable_bci_P,
-    e_code_LineNumberTable_line,
-    e_code_LocalVariableTable_N,
-    e_code_LocalVariableTable_bci_P,
-    e_code_LocalVariableTable_span_O,
-    e_code_LocalVariableTable_name_RU,
-    e_code_LocalVariableTable_type_RS,
-    e_code_LocalVariableTable_slot,
-    e_code_LocalVariableTypeTable_N,
-    e_code_LocalVariableTypeTable_bci_P,
-    e_code_LocalVariableTypeTable_span_O,
-    e_code_LocalVariableTypeTable_name_RU,
-    e_code_LocalVariableTypeTable_type_RS,
-    e_code_LocalVariableTypeTable_slot,
-    e_code_attr_bands,
-
-    // bands for bytecodes
-    e_bc_codes,
-    // remaining bands provide typed opcode fields required by the bc_codes
-
-    e_bc_case_count,
-    e_bc_case_value,
-    e_bc_byte,
-    e_bc_short,
-    e_bc_local,
-    e_bc_label,
-
-    // ldc* operands:
-    e_bc_intref,
-    e_bc_floatref,
-    e_bc_longref,
-    e_bc_doubleref,
-    e_bc_stringref,
-    e_bc_loadablevalueref,
-    e_bc_classref,
-
-    e_bc_fieldref,
-    e_bc_methodref,
-    e_bc_imethodref,
-    e_bc_indyref,
-
-    // _self_linker_op family
-    e_bc_thisfield,
-    e_bc_superfield,
-    e_bc_thismethod,
-    e_bc_supermethod,
-
-    // bc_invokeinit family:
-    e_bc_initref,
-
-    // bytecode escape sequences
-    e_bc_escref,
-    e_bc_escrefsize,
-    e_bc_escsize,
-    e_bc_escbyte,
-
-    // file attributes and contents
-    e_file_name,
-    e_file_size_hi,
-    e_file_size_lo,
-    e_file_modtime,
-    e_file_options,
-    //e_file_bits,  // handled specially as an appendix
-
-    BAND_LIMIT
-};
-
-// Symbolic names for bands, as if in a giant global struct:
-//#define archive_magic all_bands[e_archive_magic]
-//#define archive_header all_bands[e_archive_header]
-//#define band_headers all_bands[e_band_headers]
-#define cp_Utf8_prefix all_bands[e_cp_Utf8_prefix]
-#define cp_Utf8_suffix all_bands[e_cp_Utf8_suffix]
-#define cp_Utf8_chars all_bands[e_cp_Utf8_chars]
-#define cp_Utf8_big_suffix all_bands[e_cp_Utf8_big_suffix]
-#define cp_Utf8_big_chars all_bands[e_cp_Utf8_big_chars]
-#define cp_Int all_bands[e_cp_Int]
-#define cp_Float all_bands[e_cp_Float]
-#define cp_Long_hi all_bands[e_cp_Long_hi]
-#define cp_Long_lo all_bands[e_cp_Long_lo]
-#define cp_Double_hi all_bands[e_cp_Double_hi]
-#define cp_Double_lo all_bands[e_cp_Double_lo]
-#define cp_String all_bands[e_cp_String]
-#define cp_Class all_bands[e_cp_Class]
-#define cp_Signature_form all_bands[e_cp_Signature_form]
-#define cp_Signature_classes all_bands[e_cp_Signature_classes]
-#define cp_Descr_name all_bands[e_cp_Descr_name]
-#define cp_Descr_type all_bands[e_cp_Descr_type]
-#define cp_Field_class all_bands[e_cp_Field_class]
-#define cp_Field_desc all_bands[e_cp_Field_desc]
-#define cp_Method_class all_bands[e_cp_Method_class]
-#define cp_Method_desc all_bands[e_cp_Method_desc]
-#define cp_Imethod_class all_bands[e_cp_Imethod_class]
-#define cp_Imethod_desc all_bands[e_cp_Imethod_desc]
-#define cp_MethodHandle_refkind all_bands[e_cp_MethodHandle_refkind]
-#define cp_MethodHandle_member all_bands[e_cp_MethodHandle_member]
-#define cp_MethodType all_bands[e_cp_MethodType]
-#define cp_BootstrapMethod_ref all_bands[e_cp_BootstrapMethod_ref]
-#define cp_BootstrapMethod_arg_count all_bands[e_cp_BootstrapMethod_arg_count]
-#define cp_BootstrapMethod_arg all_bands[e_cp_BootstrapMethod_arg]
-#define cp_InvokeDynamic_spec  all_bands[e_cp_InvokeDynamic_spec]
-#define cp_InvokeDynamic_desc all_bands[e_cp_InvokeDynamic_desc]
-#define attr_definition_headers all_bands[e_attr_definition_headers]
-#define attr_definition_name all_bands[e_attr_definition_name]
-#define attr_definition_layout all_bands[e_attr_definition_layout]
-#define ic_this_class all_bands[e_ic_this_class]
-#define ic_flags all_bands[e_ic_flags]
-#define ic_outer_class all_bands[e_ic_outer_class]
-#define ic_name all_bands[e_ic_name]
-#define class_this all_bands[e_class_this]
-#define class_super all_bands[e_class_super]
-#define class_interface_count all_bands[e_class_interface_count]
-#define class_interface all_bands[e_class_interface]
-#define class_field_count all_bands[e_class_field_count]
-#define class_method_count all_bands[e_class_method_count]
-#define field_descr all_bands[e_field_descr]
-#define field_flags_hi all_bands[e_field_flags_hi]
-#define field_flags_lo all_bands[e_field_flags_lo]
-#define field_attr_count all_bands[e_field_attr_count]
-#define field_attr_indexes all_bands[e_field_attr_indexes]
-#define field_ConstantValue_KQ all_bands[e_field_ConstantValue_KQ]
-#define field_Signature_RS all_bands[e_field_Signature_RS]
-#define field_attr_bands all_bands[e_field_attr_bands]
-#define method_descr all_bands[e_method_descr]
-#define method_flags_hi all_bands[e_method_flags_hi]
-#define method_flags_lo all_bands[e_method_flags_lo]
-#define method_attr_count all_bands[e_method_attr_count]
-#define method_attr_indexes all_bands[e_method_attr_indexes]
-#define method_Exceptions_N all_bands[e_method_Exceptions_N]
-#define method_Exceptions_RC all_bands[e_method_Exceptions_RC]
-#define method_Signature_RS all_bands[e_method_Signature_RS]
-#define method_MethodParameters_NB all_bands[e_method_MethodParameters_NB]
-#define method_MethodParameters_name_RUN all_bands[e_method_MethodParameters_name_RUN]
-#define method_MethodParameters_flag_FH all_bands[e_method_MethodParameters_flag_FH]
-#define method_attr_bands all_bands[e_method_attr_bands]
-#define class_flags_hi all_bands[e_class_flags_hi]
-#define class_flags_lo all_bands[e_class_flags_lo]
-#define class_attr_count all_bands[e_class_attr_count]
-#define class_attr_indexes all_bands[e_class_attr_indexes]
-#define class_SourceFile_RUN all_bands[e_class_SourceFile_RUN]
-#define class_EnclosingMethod_RC all_bands[e_class_EnclosingMethod_RC]
-#define class_EnclosingMethod_RDN all_bands[e_class_EnclosingMethod_RDN]
-#define class_Signature_RS all_bands[e_class_Signature_RS]
-#define class_InnerClasses_N all_bands[e_class_InnerClasses_N]
-#define class_InnerClasses_RC all_bands[e_class_InnerClasses_RC]
-#define class_InnerClasses_F all_bands[e_class_InnerClasses_F]
-#define class_InnerClasses_outer_RCN all_bands[e_class_InnerClasses_outer_RCN]
-#define class_InnerClasses_name_RUN all_bands[e_class_InnerClasses_name_RUN]
-#define class_ClassFile_version_minor_H all_bands[e_class_ClassFile_version_minor_H]
-#define class_ClassFile_version_major_H all_bands[e_class_ClassFile_version_major_H]
-#define class_attr_bands all_bands[e_class_attr_bands]
-#define code_headers all_bands[e_code_headers]
-#define code_max_stack all_bands[e_code_max_stack]
-#define code_max_na_locals all_bands[e_code_max_na_locals]
-#define code_handler_count all_bands[e_code_handler_count]
-#define code_handler_start_P all_bands[e_code_handler_start_P]
-#define code_handler_end_PO all_bands[e_code_handler_end_PO]
-#define code_handler_catch_PO all_bands[e_code_handler_catch_PO]
-#define code_handler_class_RCN all_bands[e_code_handler_class_RCN]
-#define code_flags_hi all_bands[e_code_flags_hi]
-#define code_flags_lo all_bands[e_code_flags_lo]
-#define code_attr_count all_bands[e_code_attr_count]
-#define code_attr_indexes all_bands[e_code_attr_indexes]
-#define code_StackMapTable_N all_bands[e_code_StackMapTable_N]
-#define code_StackMapTable_frame_T all_bands[e_code_StackMapTable_frame_T]
-#define code_StackMapTable_local_N all_bands[e_code_StackMapTable_local_N]
-#define code_StackMapTable_stack_N all_bands[e_code_StackMapTable_stack_N]
-#define code_StackMapTable_offset all_bands[e_code_StackMapTable_offset]
-#define code_StackMapTable_T all_bands[e_code_StackMapTable_T]
-#define code_StackMapTable_RC all_bands[e_code_StackMapTable_RC]
-#define code_StackMapTable_P all_bands[e_code_StackMapTable_P]
-#define code_LineNumberTable_N all_bands[e_code_LineNumberTable_N]
-#define code_LineNumberTable_bci_P all_bands[e_code_LineNumberTable_bci_P]
-#define code_LineNumberTable_line all_bands[e_code_LineNumberTable_line]
-#define code_LocalVariableTable_N all_bands[e_code_LocalVariableTable_N]
-#define code_LocalVariableTable_bci_P all_bands[e_code_LocalVariableTable_bci_P]
-#define code_LocalVariableTable_span_O all_bands[e_code_LocalVariableTable_span_O]
-#define code_LocalVariableTable_name_RU all_bands[e_code_LocalVariableTable_name_RU]
-#define code_LocalVariableTable_type_RS all_bands[e_code_LocalVariableTable_type_RS]
-#define code_LocalVariableTable_slot all_bands[e_code_LocalVariableTable_slot]
-#define code_LocalVariableTypeTable_N all_bands[e_code_LocalVariableTypeTable_N]
-#define code_LocalVariableTypeTable_bci_P all_bands[e_code_LocalVariableTypeTable_bci_P]
-#define code_LocalVariableTypeTable_span_O all_bands[e_code_LocalVariableTypeTable_span_O]
-#define code_LocalVariableTypeTable_name_RU all_bands[e_code_LocalVariableTypeTable_name_RU]
-#define code_LocalVariableTypeTable_type_RS all_bands[e_code_LocalVariableTypeTable_type_RS]
-#define code_LocalVariableTypeTable_slot all_bands[e_code_LocalVariableTypeTable_slot]
-#define code_attr_bands all_bands[e_code_attr_bands]
-#define bc_codes all_bands[e_bc_codes]
-#define bc_case_count all_bands[e_bc_case_count]
-#define bc_case_value all_bands[e_bc_case_value]
-#define bc_byte all_bands[e_bc_byte]
-#define bc_short all_bands[e_bc_short]
-#define bc_local all_bands[e_bc_local]
-#define bc_label all_bands[e_bc_label]
-#define bc_intref all_bands[e_bc_intref]
-#define bc_floatref all_bands[e_bc_floatref]
-#define bc_longref all_bands[e_bc_longref]
-#define bc_doubleref all_bands[e_bc_doubleref]
-#define bc_stringref all_bands[e_bc_stringref]
-#define bc_loadablevalueref all_bands[e_bc_loadablevalueref]
-#define bc_classref all_bands[e_bc_classref]
-#define bc_fieldref all_bands[e_bc_fieldref]
-#define bc_methodref all_bands[e_bc_methodref]
-#define bc_imethodref all_bands[e_bc_imethodref]
-#define bc_indyref all_bands[e_bc_indyref]
-#define bc_thisfield all_bands[e_bc_thisfield]
-#define bc_superfield all_bands[e_bc_superfield]
-#define bc_thismethod all_bands[e_bc_thismethod]
-#define bc_supermethod all_bands[e_bc_supermethod]
-#define bc_initref all_bands[e_bc_initref]
-#define bc_escref all_bands[e_bc_escref]
-#define bc_escrefsize all_bands[e_bc_escrefsize]
-#define bc_escsize all_bands[e_bc_escsize]
-#define bc_escbyte all_bands[e_bc_escbyte]
-#define file_name all_bands[e_file_name]
-#define file_size_hi all_bands[e_file_size_hi]
-#define file_size_lo all_bands[e_file_size_lo]
-#define file_modtime all_bands[e_file_modtime]
-#define file_options all_bands[e_file_options]
--- a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-
-
-static byte dummy[1 << 10];
-
-bool bytes::inBounds(const void* p) {
-  return p >= ptr && p < limit();
-}
-
-void bytes::malloc(size_t len_) {
-  len = len_;
-  ptr = NEW(byte, add_size(len_, 1));  // add trailing zero byte always
-  if (ptr == null) {
-    // set ptr to some victim memory, to ease escape
-    set(dummy, sizeof(dummy)-1);
-    unpack_abort(ERROR_ENOMEM);
-  }
-}
-
-void bytes::realloc(size_t len_) {
-  if (len == len_)   return;  // nothing to do
-  if (ptr == dummy)  return;  // escaping from an error
-  if (ptr == null) {
-    malloc(len_);
-    return;
-  }
-  byte* oldptr = ptr;
-  ptr = (len_ >= PSIZE_MAX) ? null : (byte*)::realloc(ptr, add_size(len_, 1));
-  if (ptr != null)  {
-    mtrace('r', oldptr, 0);
-    mtrace('m', ptr, len_+1);
-    if (len < len_)  memset(ptr+len, 0, len_-len);
-    ptr[len_] = 0;
-    len = len_;
-  } else {
-    ptr = oldptr;  // ease our escape
-    unpack_abort(ERROR_ENOMEM);
-  }
-}
-
-void bytes::free() {
-  if (ptr == dummy)  return;  // escaping from an error
-  if (ptr != null) {
-    mtrace('f', ptr, 0);
-    ::free(ptr);
-  }
-  len = 0;
-  ptr = 0;
-}
-
-int bytes::indexOf(byte c) {
-  byte* p = (byte*) memchr(ptr, c, len);
-  return (p == 0) ? -1 : (int)(p - ptr);
-}
-
-byte* bytes::writeTo(byte* bp) {
-  memcpy(bp, ptr, len);
-  return bp+len;
-}
-
-int bytes::compareTo(bytes& other) {
-  size_t l1 = len;
-  size_t l2 = other.len;
-  int cmp = memcmp(ptr, other.ptr, (l1 < l2) ? l1 : l2);
-  if (cmp != 0)  return cmp;
-  return (l1 < l2) ? -1 : (l1 > l2) ? 1 : 0;
-}
-
-void bytes::saveFrom(const void* ptr_, size_t len_) {
-  malloc(len_);
-  // Save as much as possible.  (Helps unpacker::abort.)
-  if (len_ > len) {
-    assert(ptr == dummy);  // error recovery
-    len_ = len;
-  }
-  copyFrom(ptr_, len_);
-}
-
-//#TODO: Need to fix for exception handling
-void bytes::copyFrom(const void* ptr_, size_t len_, size_t offset) {
-  assert(len_ == 0 || inBounds(ptr + offset));
-  assert(len_ == 0 || inBounds(ptr + offset+len_-1));
-  memcpy(ptr+offset, ptr_, len_);
-}
-
-
-#ifndef PRODUCT
-const char* bytes::string() {
-  if (len == 0)  return "";
-  if (ptr[len] == 0 && strlen((char*)ptr) == len)  return (const char*) ptr;
-  bytes junk;
-  junk.saveFrom(*this);
-  return (char*) junk.ptr;
-}
-#endif
-
-// Make sure there are 'o' bytes beyond the fill pointer,
-// advance the fill pointer, and return the old fill pointer.
-byte* fillbytes::grow(size_t s) {
-  size_t nlen = add_size(b.len, s);
-  if (nlen <= allocated) {
-    b.len = nlen;
-    return limit()-s;
-  }
-  size_t maxlen = nlen;
-  if (maxlen < 128)          maxlen = 128;
-  if (maxlen < allocated*2)  maxlen = allocated*2;
-  if (allocated == 0) {
-    // Initial buffer was not malloced.  Do not reallocate it.
-    bytes old = b;
-    b.malloc(maxlen);
-    if (b.len == maxlen)
-      old.writeTo(b.ptr);
-  } else {
-    b.realloc(maxlen);
-  }
-  allocated = b.len;
-  if (allocated != maxlen) {
-    assert(unpack_aborting());
-    b.len = nlen-s;  // back up
-    return dummy;    // scribble during error recov.
-  }
-  // after realloc, recompute pointers
-  b.len = nlen;
-  assert(b.len <= allocated);
-  return limit()-s;
-}
-
-void fillbytes::ensureSize(size_t s) {
-  if (allocated >= s)  return;
-  size_t len0 = b.len;
-  grow(s - size());
-  b.len = len0;  // put it back
-}
-
-int ptrlist::indexOf(const void* x) {
-  int len = length();
-  for (int i = 0; i < len; i++) {
-    if (get(i) == x)  return i;
-  }
-  return -1;
-}
-
-void ptrlist::freeAll() {
-  int len = length();
-  for (int i = 0; i < len; i++) {
-    void* p = (void*) get(i);
-    if (p != null)  {
-      mtrace('f', p, 0);
-      ::free(p);
-    }
-  }
-  free();
-}
-
-int intlist::indexOf(int x) {
-  int len = length();
-  for (int i = 0; i < len; i++) {
-    if (get(i) == x)  return i;
-  }
-  return -1;
-}
--- a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-#ifdef WIN32_LEAN_AND_MEAN
-typedef signed char byte ;
-#endif
-
-struct bytes {
-  byte*  ptr;
-  size_t len;
-  byte*  limit() { return ptr+len; }
-
-  void set(byte* ptr_, size_t len_) { ptr = ptr_; len = len_; }
-  void set(const char* str)         { ptr = (byte*)str; len = strlen(str); }
-  bool inBounds(const void* p);     // p in [ptr, limit)
-  void malloc(size_t len_);
-  void realloc(size_t len_);
-  void free();
-  void copyFrom(const void* ptr_, size_t len_, size_t offset = 0);
-  void saveFrom(const void* ptr_, size_t len_);
-  void saveFrom(const char* str) { saveFrom(str, strlen(str)); }
-  void copyFrom(bytes& other, size_t offset = 0) {
-    copyFrom(other.ptr, other.len, offset);
-  }
-  void saveFrom(bytes& other) {
-    saveFrom(other.ptr, other.len);
-  }
-  void clear(int fill_byte = 0) { memset(ptr, fill_byte, len); }
-  byte* writeTo(byte* bp);
-  bool equals(bytes& other) { return 0 == compareTo(other); }
-  int compareTo(bytes& other);
-  bool contains(byte c) { return indexOf(c) >= 0; }
-  int indexOf(byte c);
-  // substrings:
-  static bytes of(byte* ptr, size_t len) {
-    bytes res;
-    res.set(ptr, len);
-    return res;
-  }
-  bytes slice(size_t beg, size_t end) {
-    bytes res;
-    res.ptr = ptr + beg;
-    res.len = end - beg;
-    assert(res.len == 0 || inBounds(res.ptr) && inBounds(res.limit()-1));
-    return res;
-  }
-  // building C strings inside byte buffers:
-  bytes& strcat(const char* str) { ::strcat((char*)ptr, str); return *this; }
-  bytes& strcat(bytes& other) { ::strncat((char*)ptr, (char*)other.ptr, other.len); return *this; }
-  char* strval() { assert(strlen((char*)ptr) == len); return (char*) ptr; }
-#ifdef PRODUCT
-  const char* string() { return 0; }
-#else
-  const char* string();
-#endif
-};
-#define BYTES_OF(var) (bytes::of((byte*)&(var), sizeof(var)))
-
-struct fillbytes {
-  bytes b;
-  size_t allocated;
-
-  byte*  base()               { return b.ptr; }
-  size_t size()               { return b.len; }
-  byte*  limit()              { return b.limit(); }          // logical limit
-  void   setLimit(byte* lp)   { assert(isAllocated(lp)); b.len = lp - b.ptr; }
-  byte*  end()                { return b.ptr + allocated; }  // physical limit
-  byte*  loc(size_t o)        { assert(o < b.len); return b.ptr + o; }
-  void   init()               { allocated = 0; b.set(null, 0); }
-  void   init(size_t s)       { init(); ensureSize(s); }
-  void   free()               { if (allocated != 0) b.free(); allocated = 0; }
-  void   empty()              { b.len = 0; }
-  byte*  grow(size_t s);      // grow so that limit() += s
-  int    getByte(uint i)      { return *loc(i) & 0xFF; }
-  void   addByte(byte x)      { *grow(1) = x; }
-  void   ensureSize(size_t s); // make sure allocated >= s
-  void   trimToSize()         { if (allocated > size())  b.realloc(allocated = size()); }
-  bool   canAppend(size_t s)  { return allocated > b.len+s; }
-  bool   isAllocated(byte* p) { return p >= base() && p <= end(); } //asserts
-  void   set(bytes& src)      { set(src.ptr, src.len); }
-
-  void set(byte* ptr, size_t len) {
-    b.set(ptr, len);
-    allocated = 0;   // mark as not reallocatable
-  }
-
-  // block operations on resizing byte buffer:
-  fillbytes& append(const void* ptr_, size_t len_)
-    { memcpy(grow(len_), ptr_, len_); return (*this); }
-  fillbytes& append(bytes& other)
-    { return append(other.ptr, other.len); }
-  fillbytes& append(const char* str)
-    { return append(str, strlen(str)); }
-};
-
-struct ptrlist : fillbytes {
-  typedef const void* cvptr;
-  int    length()     { return (int)(size() / sizeof(cvptr)); }
-  cvptr* base()       { return (cvptr*) fillbytes::base(); }
-  cvptr& get(int i)   { return *(cvptr*)loc(i * sizeof(cvptr)); }
-  cvptr* limit()      { return (cvptr*) fillbytes::limit(); }
-  void   add(cvptr x) { *(cvptr*)grow(sizeof(x)) = x; }
-  void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(cvptr); }
-  int    indexOf(cvptr x);
-  bool   contains(cvptr x) { return indexOf(x) >= 0; }
-  void   freeAll();   // frees every ptr on the list, plus the list itself
-};
-// Use a macro rather than mess with subtle mismatches
-// between member and non-member function pointers.
-#define PTRLIST_QSORT(ptrls, fn) \
-  ::qsort((ptrls).base(), (ptrls).length(), sizeof(void*), fn)
-
-struct intlist : fillbytes {
-  int    length()     { return (int)(size() / sizeof(int)); }
-  int*   base()       { return (int*) fillbytes::base(); }
-  int&   get(int i)   { return *(int*)loc(i * sizeof(int)); }
-  int*   limit()      { return (int*) fillbytes::limit(); }
-  void   add(int x)   { *(int*)grow(sizeof(x)) = x; }
-  void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(int); }
-  int    indexOf(int x);
-  bool   contains(int x) { return indexOf(x) >= 0; }
-};
--- a/jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,989 +0,0 @@
-/*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-// -*- C++ -*-
-// Small program for unpacking specially compressed Java packages.
-// John R. Rose
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "jni_util.h"
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-#include "coding.h"
-
-#include "constants.h"
-#include "unpack.h"
-
-extern coding basic_codings[];
-
-#define CODING_PRIVATE(spec) \
-  int spec_ = spec; \
-  int B = CODING_B(spec_); \
-  int H = CODING_H(spec_); \
-  int L = 256 - H; \
-  int S = CODING_S(spec_); \
-  int D = CODING_D(spec_)
-
-#define IS_NEG_CODE(S, codeVal) \
-  ( (((int)(codeVal)+1) & ((1<<S)-1)) == 0 )
-
-#define DECODE_SIGN_S1(ux) \
-  ( ((uint)(ux) >> 1) ^ -((int)(ux) & 1) )
-
-static maybe_inline
-int decode_sign(int S, uint ux) {  // == Coding.decodeSign32
-  assert(S > 0);
-  uint sigbits = (ux >> S);
-  if (IS_NEG_CODE(S, ux))
-    return (int)(    ~sigbits);
-  else
-    return (int)(ux - sigbits);
-  // Note that (int)(ux-sigbits) can be negative, if ux is large enough.
-}
-
-coding* coding::init() {
-  if (umax > 0)  return this;  // already done
-  assert(spec != 0);  // sanity
-
-  // fill in derived fields
-  CODING_PRIVATE(spec);
-
-  // Return null if 'arb(BHSD)' parameter constraints are not met:
-  if (B < 1 || B > B_MAX)  return null;
-  if (H < 1 || H > 256)    return null;
-  if (S < 0 || S > 2)      return null;
-  if (D < 0 || D > 1)      return null;
-  if (B == 1 && H != 256)  return null;  // 1-byte coding must be fixed-size
-  if (B >= 5 && H == 256)  return null;  // no 5-byte fixed-size coding
-
-  // first compute the range of the coding, in 64 bits
-  jlong range = 0;
-  {
-    jlong H_i = 1;
-    for (int i = 0; i < B; i++) {
-      range += H_i;
-      H_i *= H;
-    }
-    range *= L;
-    range += H_i;
-  }
-  assert(range > 0);  // no useless codings, please
-
-  int this_umax;
-
-  // now, compute min and max
-  if (range >= ((jlong)1 << 32)) {
-    this_umax  = INT_MAX_VALUE;
-    this->umin = INT_MIN_VALUE;
-    this->max  = INT_MAX_VALUE;
-    this->min  = INT_MIN_VALUE;
-  } else {
-    this_umax = (range > INT_MAX_VALUE) ? INT_MAX_VALUE : (int)range-1;
-    this->max = this_umax;
-    this->min = this->umin = 0;
-    if (S != 0 && range != 0) {
-      int Smask = (1<<S)-1;
-      jlong maxPosCode = range-1;
-      jlong maxNegCode = range-1;
-      while (IS_NEG_CODE(S,  maxPosCode))  --maxPosCode;
-      while (!IS_NEG_CODE(S, maxNegCode))  --maxNegCode;
-      int maxPos = decode_sign(S, (uint)maxPosCode);
-      if (maxPos < 0)
-        this->max = INT_MAX_VALUE;  // 32-bit wraparound
-      else
-        this->max = maxPos;
-      if (maxNegCode < 0)
-        this->min = 0;  // No negative codings at all.
-      else
-        this->min = decode_sign(S, (uint)maxNegCode);
-    }
-  }
-
-  assert(!(isFullRange | isSigned | isSubrange)); // init
-  if (min < 0)
-    this->isSigned = true;
-  if (max < INT_MAX_VALUE && range <= INT_MAX_VALUE)
-    this->isSubrange = true;
-  if (max == INT_MAX_VALUE && min == INT_MIN_VALUE)
-    this->isFullRange = true;
-
-  // do this last, to reduce MT exposure (should have a membar too)
-  this->umax = this_umax;
-
-  return this;
-}
-
-coding* coding::findBySpec(int spec) {
-  for (coding* scan = &basic_codings[0]; ; scan++) {
-    if (scan->spec == spec)
-      return scan->init();
-    if (scan->spec == 0)
-      break;
-  }
-  coding* ptr = NEW(coding, 1);
-  CHECK_NULL_RETURN(ptr, 0);
-  coding* c = ptr->initFrom(spec);
-  if (c == null) {
-    mtrace('f', ptr, 0);
-    ::free(ptr);
-  } else
-    // else caller should free it...
-    c->isMalloc = true;
-  return c;
-}
-
-coding* coding::findBySpec(int B, int H, int S, int D) {
-  if (B < 1 || B > B_MAX)  return null;
-  if (H < 1 || H > 256)    return null;
-  if (S < 0 || S > 2)      return null;
-  if (D < 0 || D > 1)      return null;
-  return findBySpec(CODING_SPEC(B, H, S, D));
-}
-
-void coding::free() {
-  if (isMalloc) {
-    mtrace('f', this, 0);
-    ::free(this);
-  }
-}
-
-void coding_method::reset(value_stream* state) {
-  assert(state->rp == state->rplimit);  // not in mid-stream, please
-  //assert(this == vs0.cm);
-  state[0] = vs0;
-  if (uValues != null) {
-    uValues->reset(state->helper());
-  }
-}
-
-maybe_inline
-uint coding::parse(byte* &rp, int B, int H) {
-  int L = 256-H;
-  byte* ptr = rp;
-  // hand peel the i==0 part of the loop:
-  uint b_i = *ptr++ & 0xFF;
-  if (B == 1 || b_i < (uint)L)
-    { rp = ptr; return b_i; }
-  uint sum = b_i;
-  uint H_i = H;
-  assert(B <= B_MAX);
-  for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
-    b_i = *ptr++ & 0xFF;
-    sum += b_i * H_i;
-    if (i == B || b_i < (uint)L)
-      { rp = ptr; return sum; }
-    H_i *= H;
-  }
-  assert(false);
-  return 0;
-}
-
-maybe_inline
-uint coding::parse_lgH(byte* &rp, int B, int H, int lgH) {
-  assert(H == (1<<lgH));
-  int L = 256-(1<<lgH);
-  byte* ptr = rp;
-  // hand peel the i==0 part of the loop:
-  uint b_i = *ptr++ & 0xFF;
-  if (B == 1 || b_i < (uint)L)
-    { rp = ptr; return b_i; }
-  uint sum = b_i;
-  uint lg_H_i = lgH;
-  assert(B <= B_MAX);
-  for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
-    b_i = *ptr++ & 0xFF;
-    sum += b_i << lg_H_i;
-    if (i == B || b_i < (uint)L)
-      { rp = ptr; return sum; }
-    lg_H_i += lgH;
-  }
-  assert(false);
-  return 0;
-}
-
-static const char ERB[] = "EOF reading band";
-
-maybe_inline
-void coding::parseMultiple(byte* &rp, int N, byte* limit, int B, int H) {
-  if (N < 0) {
-    abort("bad value count");
-    return;
-  }
-  byte* ptr = rp;
-  if (B == 1 || H == 256) {
-    size_t len = (size_t)N*B;
-    if (len / B != (size_t)N || ptr+len > limit) {
-      abort(ERB);
-      return;
-    }
-    rp = ptr+len;
-    return;
-  }
-  // Note:  We assume rp has enough zero-padding.
-  int L = 256-H;
-  int n = B;
-  while (N > 0) {
-    ptr += 1;
-    if (--n == 0) {
-      // end of encoding at B bytes, regardless of byte value
-    } else {
-      int b = (ptr[-1] & 0xFF);
-      if (b >= L) {
-        // keep going, unless we find a byte < L
-        continue;
-      }
-    }
-    // found the last byte
-    N -= 1;
-    n = B;   // reset length counter
-    // do an error check here
-    if (ptr > limit) {
-      abort(ERB);
-      return;
-    }
-  }
-  rp = ptr;
-  return;
-}
-
-bool value_stream::hasHelper() {
-  // If my coding method is a pop-style method,
-  // then I need a second value stream to transmit
-  // unfavored values.
-  // This can be determined by examining fValues.
-  return cm->fValues != null;
-}
-
-void value_stream::init(byte* rp_, byte* rplimit_, coding* defc) {
-  rp = rp_;
-  rplimit = rplimit_;
-  sum = 0;
-  cm = null;  // no need in the simple case
-  setCoding(defc);
-}
-
-void value_stream::setCoding(coding* defc) {
-  if (defc == null) {
-    unpack_abort("bad coding");
-    defc = coding::findByIndex(_meta_canon_min);  // random pick for recovery
-  }
-
-  c = (*defc);
-
-  // choose cmk
-  cmk = cmk_ERROR;
-  switch (c.spec) {
-  case BYTE1_spec:      cmk = cmk_BYTE1;        break;
-  case CHAR3_spec:      cmk = cmk_CHAR3;        break;
-  case UNSIGNED5_spec:  cmk = cmk_UNSIGNED5;    break;
-  case DELTA5_spec:     cmk = cmk_DELTA5;       break;
-  case BCI5_spec:       cmk = cmk_BCI5;         break;
-  case BRANCH5_spec:    cmk = cmk_BRANCH5;      break;
-  default:
-    if (c.D() == 0) {
-      switch (c.S()) {
-      case 0:  cmk = cmk_BHS0;  break;
-      case 1:  cmk = cmk_BHS1;  break;
-      default: cmk = cmk_BHS;   break;
-      }
-    } else {
-      if (c.S() == 1) {
-        if (c.isFullRange)   cmk = cmk_BHS1D1full;
-        if (c.isSubrange)    cmk = cmk_BHS1D1sub;
-      }
-      if (cmk == cmk_ERROR)  cmk = cmk_BHSD1;
-    }
-  }
-}
-
-static maybe_inline
-int getPopValue(value_stream* self, uint uval) {
-  if (uval > 0) {
-    // note that the initial parse performed a range check
-    assert(uval <= (uint)self->cm->fVlength);
-    return self->cm->fValues[uval-1];
-  } else {
-    // take an unfavored value
-    return self->helper()->getInt();
-  }
-}
-
-maybe_inline
-int coding::sumInUnsignedRange(int x, int y) {
-  assert(isSubrange);
-  int range = (int)(umax+1);
-  assert(range > 0);
-  x += y;
-  if (x != (int)((jlong)(x-y) + (jlong)y)) {
-    // 32-bit overflow interferes with range reduction.
-    // Back off from the overflow by adding a multiple of range:
-    if (x < 0) {
-      x -= range;
-      assert(x >= 0);
-    } else {
-      x += range;
-      assert(x < 0);
-    }
-  }
-  if (x < 0) {
-    x += range;
-    if (x >= 0)  return x;
-  } else if (x >= range) {
-    x -= range;
-    if (x < range)  return x;
-  } else {
-    // in range
-    return x;
-  }
-  // do it the hard way
-  x %= range;
-  if (x < 0)  x += range;
-  return x;
-}
-
-static maybe_inline
-int getDeltaValue(value_stream* self, uint uval, bool isSubrange) {
-  assert((uint)(self->c.isSubrange) == (uint)isSubrange);
-  assert(self->c.isSubrange | self->c.isFullRange);
-  if (isSubrange)
-    return self->sum = self->c.sumInUnsignedRange(self->sum, (int)uval);
-  else
-    return self->sum += (int) uval;
-}
-
-bool value_stream::hasValue() {
-  if (rp < rplimit)      return true;
-  if (cm == null)        return false;
-  if (cm->next == null)  return false;
-  cm->next->reset(this);
-  return hasValue();
-}
-
-int value_stream::getInt() {
-  if (rp >= rplimit) {
-    // Advance to next coding segment.
-    if (rp > rplimit || cm == null || cm->next == null) {
-      // Must perform this check and throw an exception on bad input.
-      unpack_abort(ERB);
-      return 0;
-    }
-    cm->next->reset(this);
-    return getInt();
-  }
-
-  CODING_PRIVATE(c.spec);
-  uint uval;
-  enum {
-    B5 = 5,
-    B3 = 3,
-    H128 = 128,
-    H64 = 64,
-    H4 = 4
-  };
-  switch (cmk) {
-  case cmk_BHS:
-    assert(D == 0);
-    uval = coding::parse(rp, B, H);
-    if (S == 0)
-      return (int) uval;
-    return decode_sign(S, uval);
-
-  case cmk_BHS0:
-    assert(S == 0 && D == 0);
-    uval = coding::parse(rp, B, H);
-    return (int) uval;
-
-  case cmk_BHS1:
-    assert(S == 1 && D == 0);
-    uval = coding::parse(rp, B, H);
-    return DECODE_SIGN_S1(uval);
-
-  case cmk_BYTE1:
-    assert(c.spec == BYTE1_spec);
-    assert(B == 1 && H == 256 && S == 0 && D == 0);
-    return *rp++ & 0xFF;
-
-  case cmk_CHAR3:
-    assert(c.spec == CHAR3_spec);
-    assert(B == B3 && H == H128 && S == 0 && D == 0);
-    return coding::parse_lgH(rp, B3, H128, 7);
-
-  case cmk_UNSIGNED5:
-    assert(c.spec == UNSIGNED5_spec);
-    assert(B == B5 && H == H64 && S == 0 && D == 0);
-    return coding::parse_lgH(rp, B5, H64, 6);
-
-  case cmk_BHSD1:
-    assert(D == 1);
-    uval = coding::parse(rp, B, H);
-    if (S != 0)
-      uval = (uint) decode_sign(S, uval);
-    return getDeltaValue(this, uval, (bool)c.isSubrange);
-
-  case cmk_BHS1D1full:
-    assert(S == 1 && D == 1 && c.isFullRange);
-    uval = coding::parse(rp, B, H);
-    uval = (uint) DECODE_SIGN_S1(uval);
-    return getDeltaValue(this, uval, false);
-
-  case cmk_BHS1D1sub:
-    assert(S == 1 && D == 1 && c.isSubrange);
-    uval = coding::parse(rp, B, H);
-    uval = (uint) DECODE_SIGN_S1(uval);
-    return getDeltaValue(this, uval, true);
-
-  case cmk_DELTA5:
-    assert(c.spec == DELTA5_spec);
-    assert(B == B5 && H == H64 && S == 1 && D == 1 && c.isFullRange);
-    uval = coding::parse_lgH(rp, B5, H64, 6);
-    sum += DECODE_SIGN_S1(uval);
-    return sum;
-
-  case cmk_BCI5:
-    assert(c.spec == BCI5_spec);
-    assert(B == B5 && H == H4 && S == 0 && D == 0);
-    return coding::parse_lgH(rp, B5, H4, 2);
-
-  case cmk_BRANCH5:
-    assert(c.spec == BRANCH5_spec);
-    assert(B == B5 && H == H4 && S == 2 && D == 0);
-    uval = coding::parse_lgH(rp, B5, H4, 2);
-    return decode_sign(S, uval);
-
-  case cmk_pop:
-    uval = coding::parse(rp, B, H);
-    if (S != 0) {
-      uval = (uint) decode_sign(S, uval);
-    }
-    if (D != 0) {
-      assert(c.isSubrange | c.isFullRange);
-      if (c.isSubrange)
-        sum = c.sumInUnsignedRange(sum, (int) uval);
-      else
-        sum += (int) uval;
-      uval = (uint) sum;
-    }
-    return getPopValue(this, uval);
-
-  case cmk_pop_BHS0:
-    assert(S == 0 && D == 0);
-    uval = coding::parse(rp, B, H);
-    return getPopValue(this, uval);
-
-  case cmk_pop_BYTE1:
-    assert(c.spec == BYTE1_spec);
-    assert(B == 1 && H == 256 && S == 0 && D == 0);
-    return getPopValue(this, *rp++ & 0xFF);
-
-  default:
-    break;
-  }
-  assert(false);
-  return 0;
-}
-
-static maybe_inline
-int moreCentral(int x, int y) {  // used to find end of Pop.{F}
-  // Suggested implementation from the Pack200 specification:
-  uint kx = (x >> 31) ^ (x << 1);
-  uint ky = (y >> 31) ^ (y << 1);
-  return (kx < ky? x: y);
-}
-//static maybe_inline
-//int moreCentral2(int x, int y, int min) {
-//  // Strict implementation of buggy 150.7 specification.
-//  // The bug is that the spec. says absolute-value ties are broken
-//  // in favor of positive numbers, but the suggested implementation
-//  // (also mentioned in the spec.) breaks ties in favor of negative numbers.
-//  if ((x + y) != 0)
-//    return min;
-//  else
-//    // return the other value, which breaks a tie in the positive direction
-//    return (x > y)? x: y;
-//}
-
-static const byte* no_meta[] = {null};
-#define NO_META (*(byte**)no_meta)
-enum { POP_FAVORED_N = -2 };
-
-// mode bits
-#define DISABLE_RUN  1  // used immediately inside ACodee
-#define DISABLE_POP  2  // used recursively in all pop sub-bands
-
-// This function knows all about meta-coding.
-void coding_method::init(byte* &band_rp, byte* band_limit,
-                         byte* &meta_rp, int mode,
-                         coding* defc, int N,
-                         intlist* valueSink) {
-  assert(N != 0);
-
-  assert(u != null);  // must be pre-initialized
-  //if (u == null)  u = unpacker::current();  // expensive
-
-  int op = (meta_rp == null) ? _meta_default :  (*meta_rp++ & 0xFF);
-  coding* foundc = null;
-  coding* to_free = null;
-
-  if (op == _meta_default) {
-    foundc = defc;
-    // and fall through
-
-  } else if (op >= _meta_canon_min && op <= _meta_canon_max) {
-    foundc = coding::findByIndex(op);
-    // and fall through
-
-  } else if (op == _meta_arb) {
-    int args = (*meta_rp++ & 0xFF);
-    // args = (D:[0..1] + 2*S[0..2] + 8*(B:[1..5]-1))
-    int D = ((args >> 0) & 1);
-    int S = ((args >> 1) & 3);
-    int B = ((args >> 3) & -1) + 1;
-    // & (H[1..256]-1)
-    int H = (*meta_rp++ & 0xFF) + 1;
-    foundc = coding::findBySpec(B, H, S, D);
-    to_free = foundc;  // findBySpec may dynamically allocate
-    if (foundc == null) {
-      abort("illegal arb. coding");
-      return;
-    }
-    // and fall through
-
-  } else if (op >= _meta_run && op < _meta_pop) {
-    int args = (op - _meta_run);
-    // args: KX:[0..3] + 4*(KBFlag:[0..1]) + 8*(ABDef:[0..2])
-    int KX     = ((args >> 0) & 3);
-    int KBFlag = ((args >> 2) & 1);
-    int ABDef  = ((args >> 3) & -1);
-    assert(ABDef <= 2);
-    // & KB: one of [0..255] if KBFlag=1
-    int KB     = (!KBFlag? 3: (*meta_rp++ & 0xFF));
-    int K      = (KB+1) << (KX * 4);
-    int N2 = (N >= 0) ? N-K : N;
-    if (N == 0 || (N2 <= 0 && N2 != N)) {
-      abort("illegal run encoding");
-      return;
-    }
-    if ((mode & DISABLE_RUN) != 0) {
-      abort("illegal nested run encoding");
-      return;
-    }
-
-    // & Enc{ ACode } if ADef=0  (ABDef != 1)
-    // No direct nesting of 'run' in ACode, but in BCode it's OK.
-    int disRun = mode | DISABLE_RUN;
-    if (ABDef == 1) {
-      this->init(band_rp, band_limit, NO_META, disRun, defc, K, valueSink);
-    } else {
-      this->init(band_rp, band_limit, meta_rp, disRun, defc, K, valueSink);
-    }
-    CHECK;
-
-    // & Enc{ BCode } if BDef=0  (ABDef != 2)
-    coding_method* tail = U_NEW(coding_method, 1);
-    CHECK_NULL(tail);
-    tail->u = u;
-
-    // The 'run' codings may be nested indirectly via 'pop' codings.
-    // This means that this->next may already be filled in, if
-    // ACode was of type 'pop' with a 'run' token coding.
-    // No problem:  Just chain the upcoming BCode onto the end.
-    for (coding_method* self = this; ; self = self->next) {
-      if (self->next == null) {
-        self->next = tail;
-        break;
-      }
-    }
-
-    if (ABDef == 2) {
-      tail->init(band_rp, band_limit, NO_META, mode, defc, N2, valueSink);
-    } else {
-      tail->init(band_rp, band_limit, meta_rp, mode, defc, N2, valueSink);
-    }
-    // Note:  The preceding calls to init should be tail-recursive.
-
-    return;  // done; no falling through
-
-  } else if (op >= _meta_pop && op < _meta_limit) {
-    int args = (op - _meta_pop);
-    // args: (FDef:[0..1]) + 2*UDef:[0..1] + 4*(TDefL:[0..11])
-    int FDef  = ((args >> 0) & 1);
-    int UDef  = ((args >> 1) & 1);
-    int TDefL = ((args >> 2) & -1);
-    assert(TDefL <= 11);
-    int TDef  = (TDefL > 0);
-    int TL    = (TDefL <= 6) ? (2 << TDefL) : (256 - (4 << (11-TDefL)));
-    int TH    = (256-TL);
-    if (N <= 0) {
-      abort("illegal pop encoding");
-      return;
-    }
-    if ((mode & DISABLE_POP) != 0) {
-      abort("illegal nested pop encoding");
-      return;
-    }
-
-    // No indirect nesting of 'pop', but 'run' is OK.
-    int disPop = DISABLE_POP;
-
-    // & Enc{ FCode } if FDef=0
-    int FN = POP_FAVORED_N;
-    assert(valueSink == null);
-    intlist fValueSink; fValueSink.init();
-    coding_method fval;
-    BYTES_OF(fval).clear(); fval.u = u;
-    if (FDef != 0) {
-      fval.init(band_rp, band_limit, NO_META, disPop, defc, FN, &fValueSink);
-    } else {
-      fval.init(band_rp, band_limit, meta_rp, disPop, defc, FN, &fValueSink);
-    }
-    bytes fvbuf;
-    fValues  = (u->saveTo(fvbuf, fValueSink.b), (int*) fvbuf.ptr);
-    fVlength = fValueSink.length();  // i.e., the parameter K
-    fValueSink.free();
-    CHECK;
-
-    // Skip the first {F} run in all subsequent passes.
-    // The next call to this->init(...) will set vs0.rp to point after the {F}.
-
-    // & Enc{ TCode } if TDef=0  (TDefL==0)
-    if (TDef != 0) {
-      coding* tcode = coding::findBySpec(1, 256);  // BYTE1
-      // find the most narrowly sufficient code:
-      for (int B = 2; B <= B_MAX; B++) {
-        if (fVlength <= tcode->umax)  break;  // found it
-        tcode->free();
-        tcode = coding::findBySpec(B, TH);
-        CHECK_NULL(tcode);
-      }
-      if (!(fVlength <= tcode->umax)) {
-        abort("pop.L value too small");
-        return;
-      }
-      this->init(band_rp, band_limit, NO_META, disPop, tcode, N, null);
-      tcode->free();
-    } else {
-      this->init(band_rp, band_limit, meta_rp, disPop,  defc, N, null);
-    }
-    CHECK;
-
-    // Count the number of zero tokens right now.
-    // Also verify that they are in bounds.
-    int UN = 0;   // one {U} for each zero in {T}
-    value_stream vs = vs0;
-    for (int i = 0; i < N; i++) {
-      uint val = vs.getInt();
-      if (val == 0)  UN += 1;
-      if (!(val <= (uint)fVlength)) {
-        abort("pop token out of range");
-        return;
-      }
-    }
-    vs.done();
-
-    // & Enc{ UCode } if UDef=0
-    if (UN != 0) {
-      uValues = U_NEW(coding_method, 1);
-      CHECK_NULL(uValues);
-      uValues->u = u;
-      if (UDef != 0) {
-        uValues->init(band_rp, band_limit, NO_META, disPop, defc, UN, null);
-      } else {
-        uValues->init(band_rp, band_limit, meta_rp, disPop, defc, UN, null);
-      }
-    } else {
-      if (UDef == 0) {
-        int uop = (*meta_rp++ & 0xFF);
-        if (uop > _meta_canon_max)
-          // %%% Spec. requires the more strict (uop != _meta_default).
-          abort("bad meta-coding for empty pop/U");
-      }
-    }
-
-    // Bug fix for 6259542
-    // Last of all, adjust vs0.cmk to the 'pop' flavor
-    for (coding_method* self = this; self != null; self = self->next) {
-        coding_method_kind cmk2 = cmk_pop;
-        switch (self->vs0.cmk) {
-        case cmk_BHS0:   cmk2 = cmk_pop_BHS0;   break;
-        case cmk_BYTE1:  cmk2 = cmk_pop_BYTE1;  break;
-        default: break;
-        }
-        self->vs0.cmk = cmk2;
-        if (self != this) {
-          assert(self->fValues == null); // no double init
-          self->fValues  = this->fValues;
-          self->fVlength = this->fVlength;
-          assert(self->uValues == null); // must stay null
-        }
-    }
-
-    return;  // done; no falling through
-
-  } else {
-    abort("bad meta-coding");
-    return;
-  }
-
-  // Common code here skips a series of values with one coding.
-  assert(foundc != null);
-
-  assert(vs0.cmk == cmk_ERROR);  // no garbage, please
-  assert(vs0.rp == null);  // no garbage, please
-  assert(vs0.rplimit == null);  // no garbage, please
-  assert(vs0.sum == 0);  // no garbage, please
-
-  vs0.init(band_rp, band_limit, foundc);
-
-  // Done with foundc.  Free if necessary.
-  if (to_free != null) {
-    to_free->free();
-    to_free = null;
-  }
-  foundc = null;
-
-  coding& c = vs0.c;
-  CODING_PRIVATE(c.spec);
-  // assert sane N
-  assert((uint)N < INT_MAX_VALUE || N == POP_FAVORED_N);
-
-  // Look at the values, or at least skip over them quickly.
-  if (valueSink == null) {
-    // Skip and ignore values in the first pass.
-    c.parseMultiple(band_rp, N, band_limit, B, H);
-  } else if (N >= 0) {
-    // Pop coding, {F} sequence, initial run of values...
-    assert((mode & DISABLE_POP) != 0);
-    value_stream vs = vs0;
-    for (int n = 0; n < N; n++) {
-      int val = vs.getInt();
-      valueSink->add(val);
-    }
-    band_rp = vs.rp;
-  } else {
-    // Pop coding, {F} sequence, final run of values...
-    assert((mode & DISABLE_POP) != 0);
-    assert(N == POP_FAVORED_N);
-    int min = INT_MIN_VALUE;  // farthest from the center
-    // min2 is based on the buggy specification of centrality in version 150.7
-    // no known implementations transmit this value, but just in case...
-    //int min2 = INT_MIN_VALUE;
-    int last = 0;
-    // if there were initial runs, find the potential sentinels in them:
-    for (int i = 0; i < valueSink->length(); i++) {
-      last = valueSink->get(i);
-      min = moreCentral(min, last);
-      //min2 = moreCentral2(min2, last, min);
-    }
-    value_stream vs = vs0;
-    for (;;) {
-      int val = vs.getInt();
-      if (valueSink->length() > 0 &&
-          (val == last || val == min)) //|| val == min2
-        break;
-      valueSink->add(val);
-      CHECK;
-      last = val;
-      min = moreCentral(min, last);
-      //min2 = moreCentral2(min2, last, min);
-    }
-    band_rp = vs.rp;
-  }
-  CHECK;
-
-  // Get an accurate upper limit now.
-  vs0.rplimit = band_rp;
-  vs0.cm = this;
-
-  return; // success
-}
-
-coding basic_codings[] = {
-  // This one is not a usable irregular coding, but is used by cp_Utf8_chars.
-  CODING_INIT(3,128,0,0),
-
-  // Fixed-length codings:
-  CODING_INIT(1,256,0,0),
-  CODING_INIT(1,256,1,0),
-  CODING_INIT(1,256,0,1),
-  CODING_INIT(1,256,1,1),
-  CODING_INIT(2,256,0,0),
-  CODING_INIT(2,256,1,0),
-  CODING_INIT(2,256,0,1),
-  CODING_INIT(2,256,1,1),
-  CODING_INIT(3,256,0,0),
-  CODING_INIT(3,256,1,0),
-  CODING_INIT(3,256,0,1),
-  CODING_INIT(3,256,1,1),
-  CODING_INIT(4,256,0,0),
-  CODING_INIT(4,256,1,0),
-  CODING_INIT(4,256,0,1),
-  CODING_INIT(4,256,1,1),
-
-  // Full-range variable-length codings:
-  CODING_INIT(5,  4,0,0),
-  CODING_INIT(5,  4,1,0),
-  CODING_INIT(5,  4,2,0),
-  CODING_INIT(5, 16,0,0),
-  CODING_INIT(5, 16,1,0),
-  CODING_INIT(5, 16,2,0),
-  CODING_INIT(5, 32,0,0),
-  CODING_INIT(5, 32,1,0),
-  CODING_INIT(5, 32,2,0),
-  CODING_INIT(5, 64,0,0),
-  CODING_INIT(5, 64,1,0),
-  CODING_INIT(5, 64,2,0),
-  CODING_INIT(5,128,0,0),
-  CODING_INIT(5,128,1,0),
-  CODING_INIT(5,128,2,0),
-
-  CODING_INIT(5,  4,0,1),
-  CODING_INIT(5,  4,1,1),
-  CODING_INIT(5,  4,2,1),
-  CODING_INIT(5, 16,0,1),
-  CODING_INIT(5, 16,1,1),
-  CODING_INIT(5, 16,2,1),
-  CODING_INIT(5, 32,0,1),
-  CODING_INIT(5, 32,1,1),
-  CODING_INIT(5, 32,2,1),
-  CODING_INIT(5, 64,0,1),
-  CODING_INIT(5, 64,1,1),
-  CODING_INIT(5, 64,2,1),
-  CODING_INIT(5,128,0,1),
-  CODING_INIT(5,128,1,1),
-  CODING_INIT(5,128,2,1),
-
-  // Variable length subrange codings:
-  CODING_INIT(2,192,0,0),
-  CODING_INIT(2,224,0,0),
-  CODING_INIT(2,240,0,0),
-  CODING_INIT(2,248,0,0),
-  CODING_INIT(2,252,0,0),
-
-  CODING_INIT(2,  8,0,1),
-  CODING_INIT(2,  8,1,1),
-  CODING_INIT(2, 16,0,1),
-  CODING_INIT(2, 16,1,1),
-  CODING_INIT(2, 32,0,1),
-  CODING_INIT(2, 32,1,1),
-  CODING_INIT(2, 64,0,1),
-  CODING_INIT(2, 64,1,1),
-  CODING_INIT(2,128,0,1),
-  CODING_INIT(2,128,1,1),
-  CODING_INIT(2,192,0,1),
-  CODING_INIT(2,192,1,1),
-  CODING_INIT(2,224,0,1),
-  CODING_INIT(2,224,1,1),
-  CODING_INIT(2,240,0,1),
-  CODING_INIT(2,240,1,1),
-  CODING_INIT(2,248,0,1),
-  CODING_INIT(2,248,1,1),
-
-  CODING_INIT(3,192,0,0),
-  CODING_INIT(3,224,0,0),
-  CODING_INIT(3,240,0,0),
-  CODING_INIT(3,248,0,0),
-  CODING_INIT(3,252,0,0),
-
-  CODING_INIT(3,  8,0,1),
-  CODING_INIT(3,  8,1,1),
-  CODING_INIT(3, 16,0,1),
-  CODING_INIT(3, 16,1,1),
-  CODING_INIT(3, 32,0,1),
-  CODING_INIT(3, 32,1,1),
-  CODING_INIT(3, 64,0,1),
-  CODING_INIT(3, 64,1,1),
-  CODING_INIT(3,128,0,1),
-  CODING_INIT(3,128,1,1),
-  CODING_INIT(3,192,0,1),
-  CODING_INIT(3,192,1,1),
-  CODING_INIT(3,224,0,1),
-  CODING_INIT(3,224,1,1),
-  CODING_INIT(3,240,0,1),
-  CODING_INIT(3,240,1,1),
-  CODING_INIT(3,248,0,1),
-  CODING_INIT(3,248,1,1),
-
-  CODING_INIT(4,192,0,0),
-  CODING_INIT(4,224,0,0),
-  CODING_INIT(4,240,0,0),
-  CODING_INIT(4,248,0,0),
-  CODING_INIT(4,252,0,0),
-
-  CODING_INIT(4,  8,0,1),
-  CODING_INIT(4,  8,1,1),
-  CODING_INIT(4, 16,0,1),
-  CODING_INIT(4, 16,1,1),
-  CODING_INIT(4, 32,0,1),
-  CODING_INIT(4, 32,1,1),
-  CODING_INIT(4, 64,0,1),
-  CODING_INIT(4, 64,1,1),
-  CODING_INIT(4,128,0,1),
-  CODING_INIT(4,128,1,1),
-  CODING_INIT(4,192,0,1),
-  CODING_INIT(4,192,1,1),
-  CODING_INIT(4,224,0,1),
-  CODING_INIT(4,224,1,1),
-  CODING_INIT(4,240,0,1),
-  CODING_INIT(4,240,1,1),
-  CODING_INIT(4,248,0,1),
-  CODING_INIT(4,248,1,1),
-  CODING_INIT(0,0,0,0)
-};
-#define BASIC_INDEX_LIMIT \
-        (int)(sizeof(basic_codings)/sizeof(basic_codings[0])-1)
-
-coding* coding::findByIndex(int idx) {
-#ifndef PRODUCT
-  /* Tricky assert here, constants and gcc complains about it without local. */
-  int index_limit = BASIC_INDEX_LIMIT;
-  assert(_meta_canon_min == 1 && _meta_canon_max+1 == index_limit);
-#endif
-  if (idx >= _meta_canon_min && idx <= _meta_canon_max)
-    return basic_codings[idx].init();
-  else
-    return null;
-}
-
-#ifndef PRODUCT
-const char* coding::string() {
-  CODING_PRIVATE(spec);
-  bytes buf;
-  buf.malloc(100);
-  char maxS[20], minS[20];
-  sprintf(maxS, "%d", max);
-  sprintf(minS, "%d", min);
-  if (max == INT_MAX_VALUE)  strcpy(maxS, "max");
-  if (min == INT_MIN_VALUE)  strcpy(minS, "min");
-  sprintf((char*)buf.ptr, "(%d,%d,%d,%d) L=%d r=[%s,%s]",
-          B,H,S,D,L,minS,maxS);
-  return (const char*) buf.ptr;
-}
-#endif
--- a/jdk/src/jdk.runtime/share/native/common-unpack/coding.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-struct unpacker;
-
-#define INT_MAX_VALUE ((int)0x7FFFFFFF)
-#define INT_MIN_VALUE ((int)0x80000000)
-
-#define CODING_SPEC(B, H, S, D) ((B)<<20|(H)<<8|(S)<<4|(D)<<0)
-#define CODING_B(x) ((x)>>20 & 0xF)
-#define CODING_H(x) ((x)>>8  & 0xFFF)
-#define CODING_S(x) ((x)>>4  & 0xF)
-#define CODING_D(x) ((x)>>0  & 0xF)
-
-#define CODING_INIT(B, H, S, D) \
-  { CODING_SPEC(B, H, S, D) , 0, 0, 0, 0, 0, 0, 0, 0}
-
-// For debugging purposes, some compilers do not like this and will complain.
-//    #define long do_not_use_C_long_types_use_jlong_or_int
-// Use of the type "long" is problematic, do not use it.
-
-struct coding {
-  int  spec;  // B,H,S,D
-
-  // Handy values derived from the spec:
-  int B() { return CODING_B(spec); }
-  int H() { return CODING_H(spec); }
-  int S() { return CODING_S(spec); }
-  int D() { return CODING_D(spec); }
-  int L() { return 256-CODING_H(spec); }
-  int  min, max;
-  int  umin, umax;
-  char isSigned, isSubrange, isFullRange, isMalloc;
-
-  coding* init();  // returns self or null if error
-  coding* initFrom(int spec_) {
-    assert(this->spec == 0);
-    this->spec = spec_;
-    return init();
-  }
-
-  static coding* findBySpec(int spec);
-  static coding* findBySpec(int B, int H, int S=0, int D=0);
-  static coding* findByIndex(int irregularCodingIndex);
-
-  static uint parse(byte* &rp, int B, int H);
-  static uint parse_lgH(byte* &rp, int B, int H, int lgH);
-  static void parseMultiple(byte* &rp, int N, byte* limit, int B, int H);
-
-  uint parse(byte* &rp) {
-    return parse(rp, CODING_B(spec), CODING_H(spec));
-  }
-  void parseMultiple(byte* &rp, int N, byte* limit) {
-    parseMultiple(rp, N, limit, CODING_B(spec), CODING_H(spec));
-  }
-
-  bool canRepresent(int x)         { return (x >= min  && x <= max);  }
-  bool canRepresentUnsigned(int x) { return (x >= umin && x <= umax); }
-
-  int sumInUnsignedRange(int x, int y);
-
-  int readFrom(byte* &rpVar, int* dbase);
-  void readArrayFrom(byte* &rpVar, int* dbase, int length, int* values);
-  void skipArrayFrom(byte* &rpVar, int length) {
-    readArrayFrom(rpVar, (int*)NULL, length, (int*)NULL);
-  }
-
-#ifndef PRODUCT
-  const char* string();
-#endif
-
-  void free();  // free self if isMalloc
-
-  // error handling
-  static void abort(const char* msg = null) { unpack_abort(msg); }
-};
-
-enum coding_method_kind {
-  cmk_ERROR,
-  cmk_BHS,
-  cmk_BHS0,
-  cmk_BHS1,
-  cmk_BHSD1,
-  cmk_BHS1D1full,  // isFullRange
-  cmk_BHS1D1sub,   // isSubRange
-
-  // special cases hand-optimized (~50% of all decoded values)
-  cmk_BYTE1,         //(1,256)      6%
-  cmk_CHAR3,         //(3,128)      7%
-  cmk_UNSIGNED5,     //(5,64)      13%
-  cmk_DELTA5,        //(5,64,1,1)   5%
-  cmk_BCI5,          //(5,4)       18%
-  cmk_BRANCH5,       //(5,4,2)      4%
-//cmk_UNSIGNED5H16,  //(5,16)       5%
-//cmk_UNSIGNED2H4,   //(2,4)        6%
-//cmk_DELTA4H8,      //(4,8,1,1)   10%
-//cmk_DELTA3H16,     //(3,16,1,1)   9%
-  cmk_BHS_LIMIT,
-
-  cmk_pop,
-  cmk_pop_BHS0,
-  cmk_pop_BYTE1,
-  cmk_pop_LIMIT,
-
-  cmk_LIMIT
-};
-
-enum {
-  BYTE1_spec       = CODING_SPEC(1, 256, 0, 0),
-  CHAR3_spec       = CODING_SPEC(3, 128, 0, 0),
-  UNSIGNED4_spec   = CODING_SPEC(4, 256, 0, 0),
-  UNSIGNED5_spec   = CODING_SPEC(5, 64, 0, 0),
-  SIGNED5_spec     = CODING_SPEC(5, 64, 1, 0),
-  DELTA5_spec      = CODING_SPEC(5, 64, 1, 1),
-  UDELTA5_spec     = CODING_SPEC(5, 64, 0, 1),
-  MDELTA5_spec     = CODING_SPEC(5, 64, 2, 1),
-  BCI5_spec        = CODING_SPEC(5, 4, 0, 0),
-  BRANCH5_spec     = CODING_SPEC(5, 4, 2, 0)
-};
-
-enum {
-  B_MAX = 5,
-  C_SLOP = B_MAX*10
-};
-
-struct coding_method;
-
-// iterator under the control of a meta-coding
-struct value_stream {
-  // current coding of values or values
-  coding c;               // B,H,S,D,etc.
-  coding_method_kind cmk; // type of decoding needed
-  byte* rp;               // read pointer
-  byte* rplimit;          // final value of read pointer
-  int sum;                // partial sum of all values so far (D=1 only)
-  coding_method* cm;      // coding method that defines this stream
-
-  void init(byte* band_rp, byte* band_limit, coding* defc);
-  void init(byte* band_rp, byte* band_limit, int spec)
-    { init(band_rp, band_limit, coding::findBySpec(spec)); }
-
-  void setCoding(coding* c);
-  void setCoding(int spec) { setCoding(coding::findBySpec(spec)); }
-
-  // Parse and decode a single value.
-  int getInt();
-
-  // Parse and decode a single byte, with no error checks.
-  int getByte() {
-    assert(cmk == cmk_BYTE1);
-    assert(rp < rplimit);
-    return *rp++ & 0xFF;
-  }
-
-  // Used only for asserts.
-  bool hasValue();
-
-  void done() { assert(!hasValue()); }
-
-  // Sometimes a value stream has an auxiliary (but there are never two).
-  value_stream* helper() {
-    assert(hasHelper());
-    return this+1;
-  }
-  bool hasHelper();
-
-  // error handling
-  //  inline void abort(const char* msg);
-  //  inline void aborting();
-};
-
-struct coding_method {
-  value_stream vs0;       // initial state snapshot (vs.meta==this)
-
-  coding_method* next;    // what to do when we run out of bytes
-
-  // these fields are used for pop codes only:
-  int* fValues;           // favored value array
-  int  fVlength;          // maximum favored value token
-  coding_method* uValues; // unfavored value stream
-
-  // pointer to outer unpacker, for error checks etc.
-  unpacker* u;
-
-  // Initialize a value stream.
-  void reset(value_stream* state);
-
-  // Parse a band header, size a band, and initialize for further action.
-  // band_rp advances (but not past band_limit), and meta_rp advances.
-  // The mode gives context, such as "inside a pop".
-  // The defc and N are the incoming parameters to a meta-coding.
-  // The value sink is used to collect output values, when desired.
-  void init(byte* &band_rp, byte* band_limit,
-            byte* &meta_rp, int mode,
-            coding* defc, int N,
-            intlist* valueSink);
-
-  // error handling
-  void abort(const char* msg) { unpack_abort(msg, u); }
-  bool aborting()             { return unpack_aborting(u); }
-};
-
-//inline void value_stream::abort(const char* msg) { cm->abort(msg); }
-//inline void value_stream::aborting()             { cm->aborting(); }
--- a/jdk/src/jdk.runtime/share/native/common-unpack/constants.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,517 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-/*
-  Java Class Version numbers history
-  1.0 to 1.3.X 45,3
-  1.4 to 1.4.X 46,0
-  1.5 to 1.5.X 49,0
-  1.6 to 1.5.x 50,0 NOTE Assumed for now
-*/
-
-// classfile constants
-#define JAVA_MAGIC 0xCAFEBABE
-#define JAVA_MIN_MAJOR_VERSION 45
-#define JAVA_MIN_MINOR_VERSION 3
-
-#define JAVA5_MAX_MAJOR_VERSION 49
-#define JAVA5_MAX_MINOR_VERSION 0
-
-#define JAVA6_MAX_MAJOR_VERSION 50
-#define JAVA6_MAX_MINOR_VERSION 0
-
-#define JAVA7_MAX_MAJOR_VERSION 51
-#define JAVA7_MAX_MINOR_VERSION 0
-
-#define JAVA8_MAX_MAJOR_VERSION 52
-#define JAVA8_MAX_MINOR_VERSION 0
-
-// package file constants
-#define JAVA_PACKAGE_MAGIC 0xCAFED00D
-#define JAVA5_PACKAGE_MAJOR_VERSION 150
-#define JAVA5_PACKAGE_MINOR_VERSION 7
-
-#define JAVA6_PACKAGE_MAJOR_VERSION 160
-#define JAVA6_PACKAGE_MINOR_VERSION 1
-
-#define JAVA7_PACKAGE_MAJOR_VERSION 170
-#define JAVA7_PACKAGE_MINOR_VERSION 1
-
-#define JAVA8_PACKAGE_MAJOR_VERSION 171
-#define JAVA8_PACKAGE_MINOR_VERSION 0
-
-// magic number for gzip streams (for processing pack200-gzip data)
-#define GZIP_MAGIC      0x1F8B0800
-#define GZIP_MAGIC_MASK 0xFFFFFF00  // last byte is variable "flg" field
-
-enum {
-    CONSTANT_None               = 0,
-    CONSTANT_Utf8               = 1,
-    CONSTANT_unused             = 2,     /* unused, was Unicode */
-    CONSTANT_Integer            = 3,
-    CONSTANT_Float              = 4,
-    CONSTANT_Long               = 5,
-    CONSTANT_Double             = 6,
-    CONSTANT_Class              = 7,
-    CONSTANT_String             = 8,
-    CONSTANT_Fieldref           = 9,
-    CONSTANT_Methodref          = 10,
-    CONSTANT_InterfaceMethodref = 11,
-    CONSTANT_NameandType        = 12,
-    CONSTANT_unused13           = 13,
-    CONSTANT_unused14           = 14,
-    CONSTANT_MethodHandle       = 15,
-    CONSTANT_MethodType         = 16,
-    CONSTANT_unused17           = 17,
-    CONSTANT_InvokeDynamic      = 18,
-    CONSTANT_Limit              = 19,
-    CONSTANT_Signature          = CONSTANT_unused13,
-    CONSTANT_BootstrapMethod    = CONSTANT_unused17, // used only for InvokeDynamic
-    CONSTANT_All                = 50,                // combined global map
-    CONSTANT_LoadableValue      = 51,                // used for 'KL' and qldc operands
-    CONSTANT_AnyMember          = 52,                // union of refs to field or (interface) method
-    CONSTANT_FieldSpecific      = 53,                // used only for 'KQ' ConstantValue attrs
-    CONSTANT_GroupFirst         = CONSTANT_All,      // start group marker
-    CONSTANT_GroupLimit         = 54,                // end group marker
-
-    // CONSTANT_MethodHandle reference kinds
-    REF_getField         = 1,
-    REF_getStatic        = 2,
-    REF_putField         = 3,
-    REF_putStatic        = 4,
-    REF_invokeVirtual    = 5,
-    REF_invokeStatic     = 6,
-    REF_invokeSpecial    = 7,
-    REF_newInvokeSpecial = 8,
-    REF_invokeInterface  = 9,
-
-    SUBINDEX_BIT = 64,  // combined with CONSTANT_xxx for ixTag
-
-    ACC_STATIC       = 0x0008,
-    ACC_IC_LONG_FORM = (1<<16), //for ic_flags
-
-    CLASS_ATTR_SourceFile                            = 17,
-    CLASS_ATTR_EnclosingMethod                       = 18,
-    CLASS_ATTR_InnerClasses                          = 23,
-    CLASS_ATTR_ClassFile_version                     = 24,
-    CLASS_ATTR_BootstrapMethods                      = 25,
-    FIELD_ATTR_ConstantValue                         = 17,
-    METHOD_ATTR_Code                                 = 17,
-    METHOD_ATTR_Exceptions                           = 18,
-    METHOD_ATTR_RuntimeVisibleParameterAnnotations   = 23,
-    METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24,
-    METHOD_ATTR_AnnotationDefault                    = 25,
-    METHOD_ATTR_MethodParameters                     = 26,
-    CODE_ATTR_StackMapTable          = 0,
-    CODE_ATTR_LineNumberTable        = 1,
-    CODE_ATTR_LocalVariableTable     = 2,
-    CODE_ATTR_LocalVariableTypeTable = 3,
-    //X_ATTR_Synthetic = 12,  // ACC_SYNTHETIC; not predefined
-    X_ATTR_Signature                   = 19,
-    X_ATTR_Deprecated                  = 20,
-    X_ATTR_RuntimeVisibleAnnotations   = 21,
-    X_ATTR_RuntimeInvisibleAnnotations = 22,
-    X_ATTR_RuntimeVisibleTypeAnnotations   = 27,
-    X_ATTR_RuntimeInvisibleTypeAnnotations = 28,
-    X_ATTR_OVERFLOW                    = 16,
-    X_ATTR_LIMIT_NO_FLAGS_HI           = 32,
-    X_ATTR_LIMIT_FLAGS_HI              = 63,
-
-#define O_ATTR_DO(F) \
-        F(X_ATTR_OVERFLOW,01) \
-          /*(end)*/
-#define X_ATTR_DO(F) \
-        O_ATTR_DO(F) \
-        F(X_ATTR_Signature,Signature) \
-        F(X_ATTR_Deprecated,Deprecated) \
-        F(X_ATTR_RuntimeVisibleAnnotations,RuntimeVisibleAnnotations) \
-        F(X_ATTR_RuntimeInvisibleAnnotations,RuntimeInvisibleAnnotations) \
-        F(X_ATTR_RuntimeVisibleTypeAnnotations,RuntimeVisibleTypeAnnotations) \
-        F(X_ATTR_RuntimeInvisibleTypeAnnotations,RuntimeInvisibleTypeAnnotations) \
-        /*F(X_ATTR_Synthetic,Synthetic)*/ \
-          /*(end)*/
-#define CLASS_ATTR_DO(F) \
-        F(CLASS_ATTR_SourceFile,SourceFile) \
-        F(CLASS_ATTR_InnerClasses,InnerClasses) \
-        F(CLASS_ATTR_EnclosingMethod,EnclosingMethod) \
-        F(CLASS_ATTR_ClassFile_version,02) \
-        F(CLASS_ATTR_BootstrapMethods,BootstrapMethods) \
-          /*(end)*/
-#define FIELD_ATTR_DO(F) \
-        F(FIELD_ATTR_ConstantValue,ConstantValue) \
-          /*(end)*/
-#define METHOD_ATTR_DO(F) \
-        F(METHOD_ATTR_Code,Code) \
-        F(METHOD_ATTR_Exceptions,Exceptions) \
-        F(METHOD_ATTR_RuntimeVisibleParameterAnnotations,RuntimeVisibleParameterAnnotations) \
-        F(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations) \
-        F(METHOD_ATTR_AnnotationDefault,AnnotationDefault) \
-        F(METHOD_ATTR_MethodParameters,MethodParameters) \
-          /*(end)*/
-#define CODE_ATTR_DO(F) \
-        F(CODE_ATTR_StackMapTable,StackMapTable) \
-        F(CODE_ATTR_LineNumberTable,LineNumberTable) \
-        F(CODE_ATTR_LocalVariableTable,LocalVariableTable) \
-        F(CODE_ATTR_LocalVariableTypeTable,LocalVariableTypeTable) \
-          /*(end)*/
-#define ALL_ATTR_DO(F) \
-        X_ATTR_DO(F) \
-        CLASS_ATTR_DO(F) \
-        FIELD_ATTR_DO(F) \
-        METHOD_ATTR_DO(F) \
-        CODE_ATTR_DO(F) \
-          /*(end)*/
-
-    // attribute "context types"
-    ATTR_CONTEXT_CLASS  = 0,
-    ATTR_CONTEXT_FIELD  = 1,
-    ATTR_CONTEXT_METHOD = 2,
-    ATTR_CONTEXT_CODE   = 3,
-    ATTR_CONTEXT_LIMIT  = 4,
-
-    // constants for parsed layouts (stored in band::le_kind)
-    EK_NONE = 0,     // not a layout element
-    EK_INT  = 'I',   // B H I SH etc., also FH etc.
-    EK_BCI  = 'P',   // PH etc.
-    EK_BCID = 'Q',   // POH etc.
-    EK_BCO  = 'O',   // OH etc.
-    EK_REPL = 'N',   // NH[...] etc.
-    EK_REF  = 'R',   // RUH, RUNH, KQH, etc.
-    EK_UN   = 'T',   // TB(...)[...] etc.
-    EK_CASE = 'K',   // (...)[...] etc.
-    EK_CALL = '(',   // (0), (1), etc.
-    EK_CBLE = '[',   // [...][...] etc.
-    NO_BAND_INDEX = -1,
-
-    // File option bits, from LSB in ascending bit position.
-    FO_DEFLATE_HINT           = 1<<0,
-    FO_IS_CLASS_STUB          = 1<<1,
-
-    // Archive option bits, from LSB in ascending bit position:
-    AO_HAVE_SPECIAL_FORMATS   = 1<<0,
-    AO_HAVE_CP_NUMBERS        = 1<<1,
-    AO_HAVE_ALL_CODE_FLAGS    = 1<<2,
-    AO_HAVE_CP_EXTRAS         = 1<<3,
-    AO_HAVE_FILE_HEADERS      = 1<<4,
-    AO_DEFLATE_HINT           = 1<<5,
-    AO_HAVE_FILE_MODTIME      = 1<<6,
-    AO_HAVE_FILE_OPTIONS      = 1<<7,
-    AO_HAVE_FILE_SIZE_HI      = 1<<8,
-    AO_HAVE_CLASS_FLAGS_HI    = 1<<9,
-    AO_HAVE_FIELD_FLAGS_HI    = 1<<10,
-    AO_HAVE_METHOD_FLAGS_HI   = 1<<11,
-    AO_HAVE_CODE_FLAGS_HI     = 1<<12,
-    AO_UNUSED_MBZ             = (-1)<<13, // options bits reserved for future use.
-
-#define ARCHIVE_BIT_DO(F) \
-         F(AO_HAVE_SPECIAL_FORMATS) \
-         F(AO_HAVE_CP_NUMBERS) \
-         F(AO_HAVE_ALL_CODE_FLAGS) \
-         F(AO_HAVE_CP_EXTRAS) \
-         F(AO_HAVE_FILE_HEADERS) \
-         F(AO_DEFLATE_HINT) \
-         F(AO_HAVE_FILE_MODTIME) \
-         F(AO_HAVE_FILE_OPTIONS) \
-         F(AO_HAVE_FILE_SIZE_HI) \
-         F(AO_HAVE_CLASS_FLAGS_HI) \
-         F(AO_HAVE_FIELD_FLAGS_HI) \
-         F(AO_HAVE_METHOD_FLAGS_HI) \
-         F(AO_HAVE_CODE_FLAGS_HI) \
-          /*(end)*/
-
-    // Constants for decoding attribute definition header bytes.
-    ADH_CONTEXT_MASK   = 0x3,  // (hdr & ADH_CONTEXT_MASK)
-    ADH_BIT_SHIFT      = 0x2,  // (hdr >> ADH_BIT_SHIFT)
-    ADH_BIT_IS_LSB     = 1,    // (hdr >> ADH_BIT_SHIFT) - ADH_BIT_IS_LSB
-#define ADH_BYTE(context, index) \
-        ((((index) + ADH_BIT_IS_LSB)<<ADH_BIT_SHIFT) + (context))
-#define ADH_BYTE_CONTEXT(adhb) \
-        ((adhb) & ADH_CONTEXT_MASK)
-#define ADH_BYTE_INDEX(adhb) \
-        (((adhb) >> ADH_BIT_SHIFT) - ADH_BIT_IS_LSB)
-
-    NO_MODTIME = 0,  // null modtime value
-
-    // meta-coding
-    _meta_default   = 0,
-    _meta_canon_min = 1,
-    _meta_canon_max = 115,
-    _meta_arb       = 116,
-    _meta_run       = 117,
-    _meta_pop       = 141,
-    _meta_limit     = 189,
-    _meta_error     = 255,
-
-    _xxx_1_end
-};
-
-// Bytecodes.
-
-enum {
-  bc_nop                  =   0, // 0x00
-  bc_aconst_null          =   1, // 0x01
-  bc_iconst_m1            =   2, // 0x02
-  bc_iconst_0             =   3, // 0x03
-  bc_iconst_1             =   4, // 0x04
-  bc_iconst_2             =   5, // 0x05
-  bc_iconst_3             =   6, // 0x06
-  bc_iconst_4             =   7, // 0x07
-  bc_iconst_5             =   8, // 0x08
-  bc_lconst_0             =   9, // 0x09
-  bc_lconst_1             =  10, // 0x0a
-  bc_fconst_0             =  11, // 0x0b
-  bc_fconst_1             =  12, // 0x0c
-  bc_fconst_2             =  13, // 0x0d
-  bc_dconst_0             =  14, // 0x0e
-  bc_dconst_1             =  15, // 0x0f
-  bc_bipush               =  16, // 0x10
-  bc_sipush               =  17, // 0x11
-  bc_ldc                  =  18, // 0x12
-  bc_ldc_w                =  19, // 0x13
-  bc_ldc2_w               =  20, // 0x14
-  bc_iload                =  21, // 0x15
-  bc_lload                =  22, // 0x16
-  bc_fload                =  23, // 0x17
-  bc_dload                =  24, // 0x18
-  bc_aload                =  25, // 0x19
-  bc_iload_0              =  26, // 0x1a
-  bc_iload_1              =  27, // 0x1b
-  bc_iload_2              =  28, // 0x1c
-  bc_iload_3              =  29, // 0x1d
-  bc_lload_0              =  30, // 0x1e
-  bc_lload_1              =  31, // 0x1f
-  bc_lload_2              =  32, // 0x20
-  bc_lload_3              =  33, // 0x21
-  bc_fload_0              =  34, // 0x22
-  bc_fload_1              =  35, // 0x23
-  bc_fload_2              =  36, // 0x24
-  bc_fload_3              =  37, // 0x25
-  bc_dload_0              =  38, // 0x26
-  bc_dload_1              =  39, // 0x27
-  bc_dload_2              =  40, // 0x28
-  bc_dload_3              =  41, // 0x29
-  bc_aload_0              =  42, // 0x2a
-  bc_aload_1              =  43, // 0x2b
-  bc_aload_2              =  44, // 0x2c
-  bc_aload_3              =  45, // 0x2d
-  bc_iaload               =  46, // 0x2e
-  bc_laload               =  47, // 0x2f
-  bc_faload               =  48, // 0x30
-  bc_daload               =  49, // 0x31
-  bc_aaload               =  50, // 0x32
-  bc_baload               =  51, // 0x33
-  bc_caload               =  52, // 0x34
-  bc_saload               =  53, // 0x35
-  bc_istore               =  54, // 0x36
-  bc_lstore               =  55, // 0x37
-  bc_fstore               =  56, // 0x38
-  bc_dstore               =  57, // 0x39
-  bc_astore               =  58, // 0x3a
-  bc_istore_0             =  59, // 0x3b
-  bc_istore_1             =  60, // 0x3c
-  bc_istore_2             =  61, // 0x3d
-  bc_istore_3             =  62, // 0x3e
-  bc_lstore_0             =  63, // 0x3f
-  bc_lstore_1             =  64, // 0x40
-  bc_lstore_2             =  65, // 0x41
-  bc_lstore_3             =  66, // 0x42
-  bc_fstore_0             =  67, // 0x43
-  bc_fstore_1             =  68, // 0x44
-  bc_fstore_2             =  69, // 0x45
-  bc_fstore_3             =  70, // 0x46
-  bc_dstore_0             =  71, // 0x47
-  bc_dstore_1             =  72, // 0x48
-  bc_dstore_2             =  73, // 0x49
-  bc_dstore_3             =  74, // 0x4a
-  bc_astore_0             =  75, // 0x4b
-  bc_astore_1             =  76, // 0x4c
-  bc_astore_2             =  77, // 0x4d
-  bc_astore_3             =  78, // 0x4e
-  bc_iastore              =  79, // 0x4f
-  bc_lastore              =  80, // 0x50
-  bc_fastore              =  81, // 0x51
-  bc_dastore              =  82, // 0x52
-  bc_aastore              =  83, // 0x53
-  bc_bastore              =  84, // 0x54
-  bc_castore              =  85, // 0x55
-  bc_sastore              =  86, // 0x56
-  bc_pop                  =  87, // 0x57
-  bc_pop2                 =  88, // 0x58
-  bc_dup                  =  89, // 0x59
-  bc_dup_x1               =  90, // 0x5a
-  bc_dup_x2               =  91, // 0x5b
-  bc_dup2                 =  92, // 0x5c
-  bc_dup2_x1              =  93, // 0x5d
-  bc_dup2_x2              =  94, // 0x5e
-  bc_swap                 =  95, // 0x5f
-  bc_iadd                 =  96, // 0x60
-  bc_ladd                 =  97, // 0x61
-  bc_fadd                 =  98, // 0x62
-  bc_dadd                 =  99, // 0x63
-  bc_isub                 = 100, // 0x64
-  bc_lsub                 = 101, // 0x65
-  bc_fsub                 = 102, // 0x66
-  bc_dsub                 = 103, // 0x67
-  bc_imul                 = 104, // 0x68
-  bc_lmul                 = 105, // 0x69
-  bc_fmul                 = 106, // 0x6a
-  bc_dmul                 = 107, // 0x6b
-  bc_idiv                 = 108, // 0x6c
-  bc_ldiv                 = 109, // 0x6d
-  bc_fdiv                 = 110, // 0x6e
-  bc_ddiv                 = 111, // 0x6f
-  bc_irem                 = 112, // 0x70
-  bc_lrem                 = 113, // 0x71
-  bc_frem                 = 114, // 0x72
-  bc_drem                 = 115, // 0x73
-  bc_ineg                 = 116, // 0x74
-  bc_lneg                 = 117, // 0x75
-  bc_fneg                 = 118, // 0x76
-  bc_dneg                 = 119, // 0x77
-  bc_ishl                 = 120, // 0x78
-  bc_lshl                 = 121, // 0x79
-  bc_ishr                 = 122, // 0x7a
-  bc_lshr                 = 123, // 0x7b
-  bc_iushr                = 124, // 0x7c
-  bc_lushr                = 125, // 0x7d
-  bc_iand                 = 126, // 0x7e
-  bc_land                 = 127, // 0x7f
-  bc_ior                  = 128, // 0x80
-  bc_lor                  = 129, // 0x81
-  bc_ixor                 = 130, // 0x82
-  bc_lxor                 = 131, // 0x83
-  bc_iinc                 = 132, // 0x84
-  bc_i2l                  = 133, // 0x85
-  bc_i2f                  = 134, // 0x86
-  bc_i2d                  = 135, // 0x87
-  bc_l2i                  = 136, // 0x88
-  bc_l2f                  = 137, // 0x89
-  bc_l2d                  = 138, // 0x8a
-  bc_f2i                  = 139, // 0x8b
-  bc_f2l                  = 140, // 0x8c
-  bc_f2d                  = 141, // 0x8d
-  bc_d2i                  = 142, // 0x8e
-  bc_d2l                  = 143, // 0x8f
-  bc_d2f                  = 144, // 0x90
-  bc_i2b                  = 145, // 0x91
-  bc_i2c                  = 146, // 0x92
-  bc_i2s                  = 147, // 0x93
-  bc_lcmp                 = 148, // 0x94
-  bc_fcmpl                = 149, // 0x95
-  bc_fcmpg                = 150, // 0x96
-  bc_dcmpl                = 151, // 0x97
-  bc_dcmpg                = 152, // 0x98
-  bc_ifeq                 = 153, // 0x99
-  bc_ifne                 = 154, // 0x9a
-  bc_iflt                 = 155, // 0x9b
-  bc_ifge                 = 156, // 0x9c
-  bc_ifgt                 = 157, // 0x9d
-  bc_ifle                 = 158, // 0x9e
-  bc_if_icmpeq            = 159, // 0x9f
-  bc_if_icmpne            = 160, // 0xa0
-  bc_if_icmplt            = 161, // 0xa1
-  bc_if_icmpge            = 162, // 0xa2
-  bc_if_icmpgt            = 163, // 0xa3
-  bc_if_icmple            = 164, // 0xa4
-  bc_if_acmpeq            = 165, // 0xa5
-  bc_if_acmpne            = 166, // 0xa6
-  bc_goto                 = 167, // 0xa7
-  bc_jsr                  = 168, // 0xa8
-  bc_ret                  = 169, // 0xa9
-  bc_tableswitch          = 170, // 0xaa
-  bc_lookupswitch         = 171, // 0xab
-  bc_ireturn              = 172, // 0xac
-  bc_lreturn              = 173, // 0xad
-  bc_freturn              = 174, // 0xae
-  bc_dreturn              = 175, // 0xaf
-  bc_areturn              = 176, // 0xb0
-  bc_return               = 177, // 0xb1
-  bc_getstatic            = 178, // 0xb2
-  bc_putstatic            = 179, // 0xb3
-  bc_getfield             = 180, // 0xb4
-  bc_putfield             = 181, // 0xb5
-  bc_invokevirtual        = 182, // 0xb6
-  bc_invokespecial        = 183, // 0xb7
-  bc_invokestatic         = 184, // 0xb8
-  bc_invokeinterface      = 185, // 0xb9
-  bc_invokedynamic        = 186, // 0xba
-  bc_new                  = 187, // 0xbb
-  bc_newarray             = 188, // 0xbc
-  bc_anewarray            = 189, // 0xbd
-  bc_arraylength          = 190, // 0xbe
-  bc_athrow               = 191, // 0xbf
-  bc_checkcast            = 192, // 0xc0
-  bc_instanceof           = 193, // 0xc1
-  bc_monitorenter         = 194, // 0xc2
-  bc_monitorexit          = 195, // 0xc3
-  bc_wide                 = 196, // 0xc4
-  bc_multianewarray       = 197, // 0xc5
-  bc_ifnull               = 198, // 0xc6
-  bc_ifnonnull            = 199, // 0xc7
-  bc_goto_w               = 200, // 0xc8
-  bc_jsr_w                = 201, // 0xc9
-  bc_bytecode_limit       = 202  // 0xca
-};
-
-enum {
-  bc_end_marker = 255,
-  bc_byte_escape = 254,
-  bc_ref_escape = 253,
-
-  _first_linker_op = bc_getstatic,
-  _last_linker_op  = bc_invokestatic,
-  _num_linker_ops  = (_last_linker_op - _first_linker_op) + 1,
-  _self_linker_op  = bc_bytecode_limit,
-  _self_linker_aload_flag = 1*_num_linker_ops,
-  _self_linker_super_flag = 2*_num_linker_ops,
-  _self_linker_limit = _self_linker_op + 4*_num_linker_ops,
-
-  _invokeinit_op = _self_linker_limit,
-  _invokeinit_self_option = 0,
-  _invokeinit_super_option = 1,
-  _invokeinit_new_option = 2,
-  _invokeinit_limit = _invokeinit_op+3,
-
-  _xldc_op = _invokeinit_limit,
-  bc_sldc = bc_ldc,      // previously named bc_aldc
-  bc_cldc = _xldc_op+0,
-  bc_ildc = _xldc_op+1,
-  bc_fldc = _xldc_op+2,
-  bc_sldc_w = bc_ldc_w,  // previously named bc_aldc_w
-  bc_cldc_w = _xldc_op+3,
-  bc_ildc_w = _xldc_op+4,
-  bc_fldc_w = _xldc_op+5,
-  bc_lldc2_w = bc_ldc2_w,
-  bc_dldc2_w = _xldc_op+6,
-  // anything other primitive, string, or class must be handled with qldc:
-  bc_qldc    = _xldc_op+7,
-  bc_qldc_w  = _xldc_op+8,
-  _xldc_limit = _xldc_op+9,
-  _invoke_int_op = _xldc_limit,
-  _invokespecial_int = _invoke_int_op+0,
-  _invokestatic_int = _invoke_int_op+1,
-  _invoke_int_limit =  _invoke_int_op+2,
-  _xxx_3_end
-};
--- a/jdk/src/jdk.runtime/share/native/common-unpack/defines.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-// random definitions
-
-#ifdef _MSC_VER
-#include <windows.h>
-#include <winuser.h>
-#else
-#include <unistd.h>
-#endif
-
-#ifndef NO_ZLIB
-#include <zconf.h>
-#endif
-
-#ifndef FULL
-#define FULL 1 /* Adds <500 bytes to the zipped final product. */
-#endif
-
-#if FULL  // define this if you want debugging and/or compile-time attributes
-#define IF_FULL(x) x
-#else
-#define IF_FULL(x) /*x*/
-#endif
-
-#ifdef PRODUCT
-#define IF_PRODUCT(xxx) xxx
-#define NOT_PRODUCT(xxx)
-#define assert(p)
-#define PRINTCR(args)
-#define VERSION_STRING "%s version %s\n"
-#else
-#define IF_PRODUCT(xxx)
-#define NOT_PRODUCT(xxx) xxx
-#define assert(p) ((p) || assert_failed(#p))
-#define PRINTCR(args)  u->verbose && u->printcr_if_verbose args
-#define VERSION_STRING "%s version non-product %s\n"
-extern "C" void breakpoint();
-extern int assert_failed(const char*);
-#define BREAK (breakpoint())
-#endif
-
-// Build-time control of some C++ inlining.
-// To make a slightly faster smaller binary, say "CC -Dmaybe_inline=inline"
-#ifndef maybe_inline
-#define maybe_inline /*inline*/
-#endif
-// By marking larger member functions inline, we remove external linkage.
-#ifndef local_inline
-#define local_inline inline
-#endif
-
-// Error messages that we have
-#define ERROR_ENOMEM    "Native allocation failed"
-#define ERROR_FORMAT    "Corrupted pack file"
-#define ERROR_RESOURCE  "Cannot extract resource file"
-#define ERROR_OVERFLOW  "Internal buffer overflow"
-#define ERROR_INTERNAL  "Internal error"
-#define ERROR_INIT      "cannot init class members"
-
-#define LOGFILE_STDOUT "-"
-#define LOGFILE_STDERR ""
-
-#define lengthof(array) (sizeof(array)/sizeof(array[0]))
-
-#define NEW(T, n)    (T*) must_malloc((int)(scale_size(n, sizeof(T))))
-#define U_NEW(T, n)  (T*) u->alloc(scale_size(n, sizeof(T)))
-#define T_NEW(T, n)  (T*) u->temp_alloc(scale_size(n, sizeof(T)))
-
-
-// bytes and byte arrays
-
-typedef unsigned int uint;
-#if defined(NO_ZLIB)
-#ifdef _LP64
-typedef unsigned int uLong; // Historical zlib, should be 32-bit.
-#else
-typedef unsigned long uLong;
-#endif
-#endif
-#ifdef _MSC_VER
-typedef LONGLONG        jlong;
-typedef DWORDLONG       julong;
-#define MKDIR(dir)      mkdir(dir)
-#define getpid()        _getpid()
-#define PATH_MAX        MAX_PATH
-#define dup2(a,b)       _dup2(a,b)
-#define strcasecmp(s1, s2) _stricmp(s1,s2)
-#define tempname        _tempname
-#define sleep           Sleep
-#define snprintf        _snprintf
-#else
-typedef signed char byte;
-#ifdef _LP64
-typedef long jlong;
-typedef long unsigned julong;
-#else
-typedef long long jlong;
-typedef long long unsigned julong;
-#endif
-#define MKDIR(dir) mkdir(dir, 0777);
-#endif
-
-#ifdef OLDCC
-typedef int bool;
-enum { false, true };
-#endif
-
-#define null (0)
-
-/* Must cast to void *, then size_t, then int. */
-#define ptrlowbits(x)  ((int)(size_t)(void*)(x))
-
-/* Back and forth from jlong to pointer */
-#define ptr2jlong(x)  ((jlong)(size_t)(void*)(x))
-#define jlong2ptr(x)  ((void*)(size_t)(x))
-
-// Keys used by Java:
-#define UNPACK_DEFLATE_HINT             "unpack.deflate.hint"
-
-#define COM_PREFIX                      "com.sun.java.util.jar.pack."
-#define UNPACK_MODIFICATION_TIME        COM_PREFIX"unpack.modification.time"
-#define DEBUG_VERBOSE                   COM_PREFIX"verbose"
-
-#define ZIP_ARCHIVE_MARKER_COMMENT      "PACK200"
-
-// The following are not known to the Java classes:
-#define UNPACK_LOG_FILE                 COM_PREFIX"unpack.log.file"
-#define UNPACK_REMOVE_PACKFILE          COM_PREFIX"unpack.remove.packfile"
-
-
-// Called from unpacker layers
-#define _CHECK_DO(t,x)          { if (t) {x;} }
-
-#define CHECK                   _CHECK_DO(aborting(), return)
-#define CHECK_(y)               _CHECK_DO(aborting(), return y)
-#define CHECK_0                 _CHECK_DO(aborting(), return 0)
-
-#define CHECK_COUNT(t)          if (t < 0){abort("bad value count");} CHECK
-
-#define STR_TRUE   "true"
-#define STR_FALSE  "false"
-
-#define STR_TF(x)  ((x) ?  STR_TRUE : STR_FALSE)
-#define BOOL_TF(x) (((x) != null && strcmp((x),STR_TRUE) == 0) ? true : false)
-
-#define DEFAULT_ARCHIVE_MODTIME 1060000000 // Aug 04, 2003 5:26 PM PDT
--- a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5215 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-// -*- C++ -*-
-// Program for unpacking specially compressed Java packages.
-// John R. Rose
-
-/*
- * When compiling for a 64bit LP64 system (longs and pointers being 64bits),
- *    the printf format %ld is correct and use of %lld will cause warning
- *    errors from some compilers (gcc/g++).
- * _LP64 can be explicitly set (used on Linux).
- * Should be checking for the Visual C++ since the _LP64 is set on the 64-bit
- * systems but the correct format prefix for 64-bit integers is ll.
- * Solaris compilers will define __sparcv9 or __x86_64 on 64bit compilations.
- */
-#if !defined (_MSC_VER) && \
-    (defined(_LP64) || defined(__sparcv9) || defined(__x86_64))
-  #define LONG_LONG_FORMAT "%ld"
-  #define LONG_LONG_HEX_FORMAT "%lx"
-#else
-  #define LONG_LONG_FORMAT "%lld"
-  #define LONG_LONG_HEX_FORMAT "%016llx"
-#endif
-
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include <limits.h>
-#include <time.h>
-
-
-
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-#include "coding.h"
-#include "bands.h"
-
-#include "constants.h"
-
-#include "zip.h"
-
-#include "unpack.h"
-
-
-// tags, in canonical order:
-static const byte TAGS_IN_ORDER[] = {
-  CONSTANT_Utf8,
-  CONSTANT_Integer,
-  CONSTANT_Float,
-  CONSTANT_Long,
-  CONSTANT_Double,
-  CONSTANT_String,
-  CONSTANT_Class,
-  CONSTANT_Signature,
-  CONSTANT_NameandType,
-  CONSTANT_Fieldref,
-  CONSTANT_Methodref,
-  CONSTANT_InterfaceMethodref,
-  // constants defined as of JDK 7
-  CONSTANT_MethodHandle,
-  CONSTANT_MethodType,
-  CONSTANT_BootstrapMethod,
-  CONSTANT_InvokeDynamic
-};
-#define N_TAGS_IN_ORDER (sizeof TAGS_IN_ORDER)
-
-#ifndef PRODUCT
-static const char* TAG_NAME[] = {
-  "*None",
-  "Utf8",
-  "*Unicode",
-  "Integer",
-  "Float",
-  "Long",
-  "Double",
-  "Class",
-  "String",
-  "Fieldref",
-  "Methodref",
-  "InterfaceMethodref",
-  "NameandType",
-  "*Signature",
-  "unused14",
-  "MethodHandle",
-  "MethodType",
-  "*BootstrapMethod",
-  "InvokeDynamic",
-  0
-};
-
-static const char* ATTR_CONTEXT_NAME[] = {  // match ATTR_CONTEXT_NAME, etc.
-  "class", "field", "method", "code"
-};
-
-#else
-
-#define ATTR_CONTEXT_NAME ((const char**)null)
-
-#endif
-
-// Note that REQUESTED_LDC comes first, then the normal REQUESTED,
-// in the regular constant pool.
-enum { REQUESTED_NONE = -1,
-       // The codes below REQUESTED_NONE are in constant pool output order,
-       // for the sake of outputEntry_cmp:
-       REQUESTED_LDC = -99, REQUESTED
-};
-
-#define NO_INORD ((uint)-1)
-
-struct entry {
-  byte tag;
-
-  #if 0
-  byte bits;
-  enum {
-    //EB_EXTRA = 1,
-    EB_SUPER = 2
-  };
-  #endif
-  unsigned short nrefs;  // pack w/ tag
-
-  int  outputIndex;
-  uint inord;   // &cp.entries[cp.tag_base[this->tag]+this->inord] == this
-
-  entry* *refs;
-
-  // put last to pack best
-  union {
-    bytes b;
-    int i;
-    jlong l;
-  } value;
-
-  void requestOutputIndex(cpool& cp, int req = REQUESTED);
-  int getOutputIndex() {
-    assert(outputIndex > REQUESTED_NONE);
-    return outputIndex;
-  }
-
-  entry* ref(int refnum) {
-    assert((uint)refnum < nrefs);
-    return refs[refnum];
-  }
-
-  const char* utf8String() {
-    assert(tagMatches(CONSTANT_Utf8));
-    assert(value.b.len == strlen((const char*)value.b.ptr));
-    return (const char*)value.b.ptr;
-  }
-
-  entry* className() {
-    assert(tagMatches(CONSTANT_Class));
-    return ref(0);
-  }
-
-  entry* memberClass() {
-    assert(tagMatches(CONSTANT_AnyMember));
-    return ref(0);
-  }
-
-  entry* memberDescr() {
-    assert(tagMatches(CONSTANT_AnyMember));
-    return ref(1);
-  }
-
-  entry* descrName() {
-    assert(tagMatches(CONSTANT_NameandType));
-    return ref(0);
-  }
-
-  entry* descrType() {
-    assert(tagMatches(CONSTANT_NameandType));
-    return ref(1);
-  }
-
-  int typeSize();
-
-  bytes& asUtf8();
-  int    asInteger() { assert(tag == CONSTANT_Integer); return value.i; }
-
-  bool isUtf8(bytes& b) { return tagMatches(CONSTANT_Utf8) && value.b.equals(b); }
-
-  bool isDoubleWord() { return tag == CONSTANT_Double || tag == CONSTANT_Long; }
-
-  bool tagMatches(byte tag2) {
-    return (tag2 == tag)
-      || (tag2 == CONSTANT_Utf8 && tag == CONSTANT_Signature)
-      #ifndef PRODUCT
-      || (tag2 == CONSTANT_FieldSpecific
-          && tag >= CONSTANT_Integer && tag <= CONSTANT_String && tag != CONSTANT_Class)
-      || (tag2 == CONSTANT_AnyMember
-          && tag >= CONSTANT_Fieldref && tag <= CONSTANT_InterfaceMethodref)
-      #endif
-      ;
-  }
-
-#ifdef PRODUCT
-  char* string() { return 0; }
-#else
-  char* string();  // see far below
-#endif
-};
-
-entry* cpindex::get(uint i) {
-  if (i >= len)
-    return null;
-  else if (base1 != null)
-    // primary index
-    return &base1[i];
-  else
-    // secondary index
-    return base2[i];
-}
-
-inline bytes& entry::asUtf8() {
-  assert(tagMatches(CONSTANT_Utf8));
-  return value.b;
-}
-
-int entry::typeSize() {
-  assert(tagMatches(CONSTANT_Utf8));
-  const char* sigp = (char*) value.b.ptr;
-  switch (*sigp) {
-  case '(': sigp++; break;  // skip opening '('
-  case 'D':
-  case 'J': return 2; // double field
-  default:  return 1; // field
-  }
-  int siglen = 0;
-  for (;;) {
-    int ch = *sigp++;
-    switch (ch) {
-    case 'D': case 'J':
-      siglen += 1;
-      break;
-    case '[':
-      // Skip rest of array info.
-      while (ch == '[') { ch = *sigp++; }
-      if (ch != 'L')  break;
-      // else fall through
-    case 'L':
-      sigp = strchr(sigp, ';');
-      if (sigp == null) {
-          unpack_abort("bad data");
-          return 0;
-      }
-      sigp += 1;
-      break;
-    case ')':  // closing ')'
-      return siglen;
-    }
-    siglen += 1;
-  }
-}
-
-inline cpindex* cpool::getFieldIndex(entry* classRef) {
-  if (classRef == NULL) { abort("missing class reference"); return NULL; }
-  assert(classRef->tagMatches(CONSTANT_Class));
-  assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
-  return &member_indexes[classRef->inord*2+0];
-}
-inline cpindex* cpool::getMethodIndex(entry* classRef) {
-  if (classRef == NULL) { abort("missing class reference"); return NULL; }
-  assert(classRef->tagMatches(CONSTANT_Class));
-  assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
-  return &member_indexes[classRef->inord*2+1];
-}
-
-struct inner_class {
-  entry* inner;
-  entry* outer;
-  entry* name;
-  int    flags;
-  inner_class* next_sibling;
-  bool   requested;
-};
-
-// Here is where everything gets deallocated:
-void unpacker::free() {
-  int i;
-  assert(jniobj == null); // caller resp.
-  assert(infileptr == null);  // caller resp.
-  if (jarout != null)  jarout->reset();
-  if (gzin != null)    { gzin->free(); gzin = null; }
-  if (free_input)  input.free();
-  // free everybody ever allocated with U_NEW or (recently) with T_NEW
-  assert(smallbuf.base()  == null || mallocs.contains(smallbuf.base()));
-  assert(tsmallbuf.base() == null || tmallocs.contains(tsmallbuf.base()));
-  mallocs.freeAll();
-  tmallocs.freeAll();
-  smallbuf.init();
-  tsmallbuf.init();
-  bcimap.free();
-  class_fixup_type.free();
-  class_fixup_offset.free();
-  class_fixup_ref.free();
-  code_fixup_type.free();
-  code_fixup_offset.free();
-  code_fixup_source.free();
-  requested_ics.free();
-  cp.requested_bsms.free();
-  cur_classfile_head.free();
-  cur_classfile_tail.free();
-  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
-    attr_defs[i].free();
-
-  // free CP state
-  cp.outputEntries.free();
-  for (i = 0; i < CONSTANT_Limit; i++)
-    cp.tag_extras[i].free();
-}
-
-// input handling
-// Attempts to advance rplimit so that (rplimit-rp) is at least 'more'.
-// Will eagerly read ahead by larger chunks, if possible.
-// Returns false if (rplimit-rp) is not at least 'more',
-// unless rplimit hits input.limit().
-bool unpacker::ensure_input(jlong more) {
-  julong want = more - input_remaining();
-  if ((jlong)want <= 0)          return true;  // it's already in the buffer
-  if (rplimit == input.limit())  return true;  // not expecting any more
-
-  if (read_input_fn == null) {
-    // assume it is already all there
-    bytes_read += input.limit() - rplimit;
-    rplimit = input.limit();
-    return true;
-  }
-  CHECK_0;
-
-  julong remaining = (input.limit() - rplimit);  // how much left to read?
-  byte* rpgoal = (want >= remaining)? input.limit(): rplimit + (size_t)want;
-  enum { CHUNK_SIZE = (1<<14) };
-  julong fetch = want;
-  if (fetch < CHUNK_SIZE)
-    fetch = CHUNK_SIZE;
-  if (fetch > remaining*3/4)
-    fetch = remaining;
-  // Try to fetch at least "more" bytes.
-  while ((jlong)fetch > 0) {
-    jlong nr = (*read_input_fn)(this, rplimit, fetch, remaining);
-    if (nr <= 0) {
-      return (rplimit >= rpgoal);
-    }
-    remaining -= nr;
-    rplimit += nr;
-    fetch -= nr;
-    bytes_read += nr;
-    assert(remaining == (julong)(input.limit() - rplimit));
-  }
-  return true;
-}
-
-// output handling
-
-fillbytes* unpacker::close_output(fillbytes* which) {
-  assert(wp != null);
-  if (which == null) {
-    if (wpbase == cur_classfile_head.base()) {
-      which = &cur_classfile_head;
-    } else {
-      which = &cur_classfile_tail;
-    }
-  }
-  assert(wpbase  == which->base());
-  assert(wplimit == which->end());
-  which->setLimit(wp);
-  wp      = null;
-  wplimit = null;
-  //wpbase = null;
-  return which;
-}
-
-//maybe_inline
-void unpacker::ensure_put_space(size_t size) {
-  if (wp + size <= wplimit)  return;
-  // Determine which segment needs expanding.
-  fillbytes* which = close_output();
-  byte* wp0 = which->grow(size);
-  wpbase  = which->base();
-  wplimit = which->end();
-  wp = wp0;
-}
-
-maybe_inline
-byte* unpacker::put_space(size_t size) {
-  byte* wp0 = wp;
-  byte* wp1 = wp0 + size;
-  if (wp1 > wplimit) {
-    ensure_put_space(size);
-    wp0 = wp;
-    wp1 = wp0 + size;
-  }
-  wp = wp1;
-  return wp0;
-}
-
-maybe_inline
-void unpacker::putu2_at(byte* wp, int n) {
-  if (n != (unsigned short)n) {
-    unpack_abort(ERROR_OVERFLOW);
-    return;
-  }
-  wp[0] = (n) >> 8;
-  wp[1] = (n) >> 0;
-}
-
-maybe_inline
-void unpacker::putu4_at(byte* wp, int n) {
-  wp[0] = (n) >> 24;
-  wp[1] = (n) >> 16;
-  wp[2] = (n) >> 8;
-  wp[3] = (n) >> 0;
-}
-
-maybe_inline
-void unpacker::putu8_at(byte* wp, jlong n) {
-  putu4_at(wp+0, (int)((julong)n >> 32));
-  putu4_at(wp+4, (int)((julong)n >> 0));
-}
-
-maybe_inline
-void unpacker::putu2(int n) {
-  putu2_at(put_space(2), n);
-}
-
-maybe_inline
-void unpacker::putu4(int n) {
-  putu4_at(put_space(4), n);
-}
-
-maybe_inline
-void unpacker::putu8(jlong n) {
-  putu8_at(put_space(8), n);
-}
-
-maybe_inline
-int unpacker::putref_index(entry* e, int size) {
-  if (e == null)
-    return 0;
-  else if (e->outputIndex > REQUESTED_NONE)
-    return e->outputIndex;
-  else if (e->tag == CONSTANT_Signature)
-    return putref_index(e->ref(0), size);
-  else {
-    e->requestOutputIndex(cp, (size == 1 ? REQUESTED_LDC : REQUESTED));
-    // Later on we'll fix the bits.
-    class_fixup_type.addByte(size);
-    class_fixup_offset.add((int)wpoffset());
-    class_fixup_ref.add(e);
-#ifdef PRODUCT
-    return 0;
-#else
-    return 0x20+size;  // 0x22 is easy to eyeball
-#endif
-  }
-}
-
-maybe_inline
-void unpacker::putref(entry* e) {
-  int oidx = putref_index(e, 2);
-  putu2_at(put_space(2), oidx);
-}
-
-maybe_inline
-void unpacker::putu1ref(entry* e) {
-  int oidx = putref_index(e, 1);
-  putu1_at(put_space(1), oidx);
-}
-
-
-static int total_cp_size[] = {0, 0};
-static int largest_cp_ref[] = {0, 0};
-static int hash_probes[] = {0, 0};
-
-// Allocation of small and large blocks.
-
-enum { CHUNK = (1 << 14), SMALL = (1 << 9) };
-
-// Call malloc.  Try to combine small blocks and free much later.
-void* unpacker::alloc_heap(size_t size, bool smallOK, bool temp) {
-  if (!smallOK || size > SMALL) {
-    void* res = must_malloc((int)size);
-    (temp ? &tmallocs : &mallocs)->add(res);
-    return res;
-  }
-  fillbytes& xsmallbuf = *(temp ? &tsmallbuf : &smallbuf);
-  if (!xsmallbuf.canAppend(size+1)) {
-    xsmallbuf.init(CHUNK);
-    (temp ? &tmallocs : &mallocs)->add(xsmallbuf.base());
-  }
-  int growBy = (int)size;
-  growBy += -growBy & 7;  // round up mod 8
-  return xsmallbuf.grow(growBy);
-}
-
-maybe_inline
-void unpacker::saveTo(bytes& b, byte* ptr, size_t len) {
-  b.ptr = U_NEW(byte, add_size(len,1));
-  if (aborting()) {
-    b.len = 0;
-    return;
-  }
-  b.len = len;
-  b.copyFrom(ptr, len);
-}
-
-bool testBit(int archive_options, int bitMask) {
-    return (archive_options & bitMask) != 0;
-}
-
-// Read up through band_headers.
-// Do the archive_size dance to set the size of the input mega-buffer.
-void unpacker::read_file_header() {
-  // Read file header to determine file type and total size.
-  enum {
-    MAGIC_BYTES = 4,
-    AH_LENGTH_0 = 3,  // archive_header_0 = {minver, majver, options}
-    AH_LENGTH_MIN = 15, // observed in spec {header_0[3], cp_counts[8], class_counts[4]}
-    AH_LENGTH_0_MAX = AH_LENGTH_0 + 1,  // options might have 2 bytes
-    AH_LENGTH   = 30, //maximum archive header length (w/ all fields)
-    // Length contributions from optional header fields:
-    AH_LENGTH_S = 2, // archive_header_S = optional {size_hi, size_lo}
-    AH_ARCHIVE_SIZE_HI = 0, // offset in archive_header_S
-    AH_ARCHIVE_SIZE_LO = 1, // offset in archive_header_S
-    AH_FILE_HEADER_LEN = 5, // file_counts = {{size_hi, size_lo), next, modtile, files}
-    AH_SPECIAL_FORMAT_LEN = 2, // special_count = {layouts, band_headers}
-    AH_CP_NUMBER_LEN = 4,      // cp_number_counts = {int, float, long, double}
-    AH_CP_EXTRA_LEN = 4,        // cp_attr_counts = {MH, MT, InDy, BSM}
-    ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S,
-    FIRST_READ  = MAGIC_BYTES + AH_LENGTH_MIN
-  };
-
-  assert(AH_LENGTH_MIN    == 15); // # of UNSIGNED5 fields required after archive_magic
-  // An absolute minimum null archive is magic[4], {minver,majver,options}[3],
-  // archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes.
-  // (Note that archive_size is optional; it may be 0..10 bytes in length.)
-  // The first read must capture everything up through the options field.
-  // This happens to work even if {minver,majver,options} is a pathological
-  // 15 bytes long.  Legal pack files limit those three fields to 1+1+2 bytes.
-  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0 * B_MAX);
-
-  // Up through archive_size, the largest possible archive header is
-  // magic[4], {minver,majver,options}[4], archive_size[10].
-  // (Note only the low 12 bits of options are allowed to be non-zero.)
-  // In order to parse archive_size, we need at least this many bytes
-  // in the first read.  Of course, if archive_size_hi is more than
-  // a byte, we probably will fail to allocate the buffer, since it
-  // will be many gigabytes long.  This is a practical, not an
-  // architectural limit to Pack200 archive sizes.
-  assert(FIRST_READ >= MAGIC_BYTES + AH_LENGTH_0_MAX + 2*B_MAX);
-
-  bool foreign_buf = (read_input_fn == null);
-  byte initbuf[(int)FIRST_READ + (int)C_SLOP + 200];  // 200 is for JAR I/O
-  if (foreign_buf) {
-    // inbytes is all there is
-    input.set(inbytes);
-    rp      = input.base();
-    rplimit = input.limit();
-  } else {
-    // inbytes, if not empty, contains some read-ahead we must use first
-    // ensure_input will take care of copying it into initbuf,
-    // then querying read_input_fn for any additional data needed.
-    // However, the caller must assume that we use up all of inbytes.
-    // There is no way to tell the caller that we used only part of them.
-    // Therefore, the caller must use only a bare minimum of read-ahead.
-    if (inbytes.len > FIRST_READ) {
-      abort("too much read-ahead");
-      return;
-    }
-    input.set(initbuf, sizeof(initbuf));
-    input.b.clear();
-    input.b.copyFrom(inbytes);
-    rplimit = rp = input.base();
-    rplimit += inbytes.len;
-    bytes_read += inbytes.len;
-  }
-  // Read only 19 bytes, which is certain to contain #archive_options fields,
-  // but is certain not to overflow past the archive_header.
-  input.b.len = FIRST_READ;
-  if (!ensure_input(FIRST_READ))
-    abort("EOF reading archive magic number");
-
-  if (rp[0] == 'P' && rp[1] == 'K') {
-#ifdef UNPACK_JNI
-    // Java driver must handle this case before we get this far.
-    abort("encountered a JAR header in unpacker");
-#else
-    // In the Unix-style program, we simply simulate a copy command.
-    // Copy until EOF; assume the JAR file is the last segment.
-    fprintf(errstrm, "Copy-mode.\n");
-    for (;;) {
-      jarout->write_data(rp, (int)input_remaining());
-      if (foreign_buf)
-        break;  // one-time use of a passed in buffer
-      if (input.size() < CHUNK) {
-        // Get some breathing room.
-        input.set(U_NEW(byte, (size_t) CHUNK + C_SLOP), (size_t) CHUNK);
-        CHECK;
-      }
-      rp = rplimit = input.base();
-      if (!ensure_input(1))
-        break;
-    }
-    jarout->closeJarFile(false);
-#endif
-    return;
-  }
-
-  // Read the magic number.
-  magic = 0;
-  for (int i1 = 0; i1 < (int)sizeof(magic); i1++) {
-    magic <<= 8;
-    magic += (*rp++ & 0xFF);
-  }
-
-  // Read the first 3 values from the header.
-  value_stream hdr;
-  int          hdrVals = 0;
-  int          hdrValsSkipped = 0;  // for assert
-  hdr.init(rp, rplimit, UNSIGNED5_spec);
-  minver = hdr.getInt();
-  majver = hdr.getInt();
-  hdrVals += 2;
-
-  int majmin[4][2] = {
-      {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION},
-      {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION},
-      {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION},
-      {JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION}
-  };
-  int majminfound = false;
-  for (int i = 0 ; i < 4 ; i++) {
-      if (majver == majmin[i][0] && minver == majmin[i][1]) {
-          majminfound = true;
-          break;
-      }
-  }
-  if (majminfound == null) {
-    char message[200];
-    sprintf(message, "@" ERROR_FORMAT ": magic/ver = "
-            "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n",
-            magic, majver, minver,
-            JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION,
-            JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION,
-            JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION,
-            JAVA_PACKAGE_MAGIC, JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION);
-    abort(message);
-  }
-  CHECK;
-
-  archive_options = hdr.getInt();
-  hdrVals += 1;
-  assert(hdrVals == AH_LENGTH_0);  // first three fields only
-  bool haveSizeHi = testBit(archive_options, AO_HAVE_FILE_SIZE_HI);
-  bool haveModTime = testBit(archive_options, AO_HAVE_FILE_MODTIME);
-  bool haveFileOpt = testBit(archive_options, AO_HAVE_FILE_OPTIONS);
-
-  bool haveSpecial = testBit(archive_options, AO_HAVE_SPECIAL_FORMATS);
-  bool haveFiles = testBit(archive_options, AO_HAVE_FILE_HEADERS);
-  bool haveNumbers = testBit(archive_options, AO_HAVE_CP_NUMBERS);
-  bool haveCPExtra = testBit(archive_options, AO_HAVE_CP_EXTRAS);
-
-  if (majver < JAVA7_PACKAGE_MAJOR_VERSION) {
-    if (haveCPExtra) {
-        abort("Format bits for Java 7 must be zero in previous releases");
-        return;
-    }
-  }
-  if (testBit(archive_options, AO_UNUSED_MBZ)) {
-    abort("High archive option bits are reserved and must be zero");
-    return;
-  }
-  if (haveFiles) {
-    uint hi = hdr.getInt();
-    uint lo = hdr.getInt();
-    julong x = band::makeLong(hi, lo);
-    archive_size = (size_t) x;
-    if (archive_size != x) {
-      // Silly size specified; force overflow.
-      archive_size = PSIZE_MAX+1;
-    }
-    hdrVals += 2;
-  } else {
-    hdrValsSkipped += 2;
-  }
-
-  // Now we can size the whole archive.
-  // Read everything else into a mega-buffer.
-  rp = hdr.rp;
-  int header_size_0 = (int)(rp - input.base()); // used-up header (4byte + 3int)
-  int header_size_1 = (int)(rplimit - rp);      // buffered unused initial fragment
-  int header_size   = header_size_0+header_size_1;
-  unsized_bytes_read = header_size_0;
-  CHECK;
-  if (foreign_buf) {
-    if (archive_size > (size_t)header_size_1) {
-      abort("EOF reading fixed input buffer");
-      return;
-    }
-  } else if (archive_size != 0) {
-    if (archive_size < ARCHIVE_SIZE_MIN) {
-      abort("impossible archive size");  // bad input data
-      return;
-    }
-    if (archive_size < header_size_1) {
-      abort("too much read-ahead");  // somehow we pre-fetched too much?
-      return;
-    }
-    input.set(U_NEW(byte, add_size(header_size_0, archive_size, C_SLOP)),
-              (size_t) header_size_0 + archive_size);
-    CHECK;
-    assert(input.limit()[0] == 0);
-    // Move all the bytes we read initially into the real buffer.
-    input.b.copyFrom(initbuf, header_size);
-    rp      = input.b.ptr + header_size_0;
-    rplimit = input.b.ptr + header_size;
-  } else {
-    // It's more complicated and painful.
-    // A zero archive_size means that we must read until EOF.
-    input.init(CHUNK*2);
-    CHECK;
-    input.b.len = input.allocated;
-    rp = rplimit = input.base();
-    // Set up input buffer as if we already read the header:
-    input.b.copyFrom(initbuf, header_size);
-    CHECK;
-    rplimit += header_size;
-    while (ensure_input(input.limit() - rp)) {
-      size_t dataSoFar = input_remaining();
-      size_t nextSize = add_size(dataSoFar, CHUNK);
-      input.ensureSize(nextSize);
-      CHECK;
-      input.b.len = input.allocated;
-      rp = rplimit = input.base();
-      rplimit += dataSoFar;
-    }
-    size_t dataSize = (rplimit - input.base());
-    input.b.len = dataSize;
-    input.grow(C_SLOP);
-    CHECK;
-    free_input = true;  // free it later
-    input.b.len = dataSize;
-    assert(input.limit()[0] == 0);
-    rp = rplimit = input.base();
-    rplimit += dataSize;
-    rp += header_size_0;  // already scanned these bytes...
-  }
-  live_input = true;    // mark as "do not reuse"
-  if (aborting()) {
-    abort("cannot allocate large input buffer for package file");
-    return;
-  }
-
-  // read the rest of the header fields  int assertSkipped = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
-  int remainingHeaders = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
-  if (haveSpecial)
-    remainingHeaders += AH_SPECIAL_FORMAT_LEN;
-  if (haveFiles)
-     remainingHeaders += AH_FILE_HEADER_LEN;
-  if (haveNumbers)
-    remainingHeaders += AH_CP_NUMBER_LEN;
-  if (haveCPExtra)
-    remainingHeaders += AH_CP_EXTRA_LEN;
-
-  ensure_input(remainingHeaders * B_MAX);
-  CHECK;
-  hdr.rp      = rp;
-  hdr.rplimit = rplimit;
-
-  if (haveFiles) {
-    archive_next_count = hdr.getInt();
-    CHECK_COUNT(archive_next_count);
-    archive_modtime = hdr.getInt();
-    file_count = hdr.getInt();
-    CHECK_COUNT(file_count);
-    hdrVals += 3;
-  } else {
-    hdrValsSkipped += 3;
-  }
-
-  if (haveSpecial) {
-    band_headers_size = hdr.getInt();
-    CHECK_COUNT(band_headers_size);
-    attr_definition_count = hdr.getInt();
-    CHECK_COUNT(attr_definition_count);
-    hdrVals += 2;
-  } else {
-    hdrValsSkipped += 2;
-  }
-
-  int cp_counts[N_TAGS_IN_ORDER];
-  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
-    if (!haveNumbers) {
-      switch (TAGS_IN_ORDER[k]) {
-      case CONSTANT_Integer:
-      case CONSTANT_Float:
-      case CONSTANT_Long:
-      case CONSTANT_Double:
-        cp_counts[k] = 0;
-        hdrValsSkipped += 1;
-        continue;
-      }
-    }
-    if (!haveCPExtra) {
-        switch(TAGS_IN_ORDER[k]) {
-        case CONSTANT_MethodHandle:
-        case CONSTANT_MethodType:
-        case CONSTANT_InvokeDynamic:
-        case CONSTANT_BootstrapMethod:
-          cp_counts[k] = 0;
-          hdrValsSkipped += 1;
-          continue;
-        }
-    }
-    cp_counts[k] = hdr.getInt();
-    CHECK_COUNT(cp_counts[k]);
-    hdrVals += 1;
-  }
-
-  ic_count = hdr.getInt();
-  CHECK_COUNT(ic_count);
-  default_class_minver = hdr.getInt();
-  default_class_majver = hdr.getInt();
-  class_count = hdr.getInt();
-  CHECK_COUNT(class_count);
-  hdrVals += 4;
-
-  // done with archive_header, time to reconcile to ensure
-  // we have read everything correctly
-  hdrVals += hdrValsSkipped;
-  assert(hdrVals == AH_LENGTH);
-  rp = hdr.rp;
-  if (rp > rplimit)
-    abort("EOF reading archive header");
-
-  // Now size the CP.
-#ifndef PRODUCT
-  // bool x = (N_TAGS_IN_ORDER == CONSTANT_Limit);
-  // assert(x);
-#endif //PRODUCT
-  cp.init(this, cp_counts);
-  CHECK;
-
-  default_file_modtime = archive_modtime;
-  if (default_file_modtime == 0 && haveModTime)
-    default_file_modtime = DEFAULT_ARCHIVE_MODTIME;  // taken from driver
-  if (testBit(archive_options, AO_DEFLATE_HINT))
-    default_file_options |= FO_DEFLATE_HINT;
-
-  // meta-bytes, if any, immediately follow archive header
-  //band_headers.readData(band_headers_size);
-  ensure_input(band_headers_size);
-  if (input_remaining() < (size_t)band_headers_size) {
-    abort("EOF reading band headers");
-    return;
-  }
-  bytes band_headers;
-  // The "1+" allows an initial byte to be pushed on the front.
-  band_headers.set(1+U_NEW(byte, 1+band_headers_size+C_SLOP),
-                   band_headers_size);
-  CHECK;
-  // Start scanning band headers here:
-  band_headers.copyFrom(rp, band_headers.len);
-  rp += band_headers.len;
-  assert(rp <= rplimit);
-  meta_rp = band_headers.ptr;
-  // Put evil meta-codes at the end of the band headers,
-  // so we are sure to throw an error if we run off the end.
-  bytes::of(band_headers.limit(), C_SLOP).clear(_meta_error);
-}
-
-void unpacker::finish() {
-  if (verbose >= 1) {
-    fprintf(errstrm,
-            "A total of "
-            LONG_LONG_FORMAT " bytes were read in %d segment(s).\n",
-            (bytes_read_before_reset+bytes_read),
-            segments_read_before_reset+1);
-    fprintf(errstrm,
-            "A total of "
-            LONG_LONG_FORMAT " file content bytes were written.\n",
-            (bytes_written_before_reset+bytes_written));
-    fprintf(errstrm,
-            "A total of %d files (of which %d are classes) were written to output.\n",
-            files_written_before_reset+files_written,
-            classes_written_before_reset+classes_written);
-  }
-  if (jarout != null)
-    jarout->closeJarFile(true);
-  if (errstrm != null) {
-    if (errstrm == stdout || errstrm == stderr) {
-      fflush(errstrm);
-    } else {
-      fclose(errstrm);
-    }
-    errstrm = null;
-    errstrm_name = null;
-  }
-}
-
-
-// Cf. PackageReader.readConstantPoolCounts
-void cpool::init(unpacker* u_, int counts[CONSTANT_Limit]) {
-  this->u = u_;
-
-  // Fill-pointer for CP.
-  int next_entry = 0;
-
-  // Size the constant pool:
-  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
-    byte tag = TAGS_IN_ORDER[k];
-    int  len = counts[k];
-    tag_count[tag] = len;
-    tag_base[tag] = next_entry;
-    next_entry += len;
-    // Detect and defend against constant pool size overflow.
-    // (Pack200 forbids the sum of CP counts to exceed 2^29-1.)
-    enum {
-      CP_SIZE_LIMIT = (1<<29),
-      IMPLICIT_ENTRY_COUNT = 1  // empty Utf8 string
-    };
-    if (len >= (1<<29) || len < 0
-        || next_entry >= CP_SIZE_LIMIT+IMPLICIT_ENTRY_COUNT) {
-      abort("archive too large:  constant pool limit exceeded");
-      return;
-    }
-  }
-
-  // Close off the end of the CP:
-  nentries = next_entry;
-
-  // place a limit on future CP growth:
-  int generous = 0;
-  generous = add_size(generous, u->ic_count); // implicit name
-  generous = add_size(generous, u->ic_count); // outer
-  generous = add_size(generous, u->ic_count); // outer.utf8
-  generous = add_size(generous, 40); // WKUs, misc
-  generous = add_size(generous, u->class_count); // implicit SourceFile strings
-  maxentries = add_size(nentries, generous);
-
-  // Note that this CP does not include "empty" entries
-  // for longs and doubles.  Those are introduced when
-  // the entries are renumbered for classfile output.
-
-  entries = U_NEW(entry, maxentries);
-  CHECK;
-
-  first_extra_entry = &entries[nentries];
-
-  // Initialize the standard indexes.
-  for (int tag = 0; tag < CONSTANT_Limit; tag++) {
-    entry* cpMap = &entries[tag_base[tag]];
-    tag_index[tag].init(tag_count[tag], cpMap, tag);
-  }
-
-  // Initialize *all* our entries once
-  for (int i = 0 ; i < maxentries ; i++)
-    entries[i].outputIndex = REQUESTED_NONE;
-
-  initGroupIndexes();
-  // Initialize hashTab to a generous power-of-two size.
-  uint pow2 = 1;
-  uint target = maxentries + maxentries/2;  // 60% full
-  while (pow2 < target)  pow2 <<= 1;
-  hashTab = U_NEW(entry*, hashTabLength = pow2);
-}
-
-static byte* store_Utf8_char(byte* cp, unsigned short ch) {
-  if (ch >= 0x001 && ch <= 0x007F) {
-    *cp++ = (byte) ch;
-  } else if (ch <= 0x07FF) {
-    *cp++ = (byte) (0xC0 | ((ch >>  6) & 0x1F));
-    *cp++ = (byte) (0x80 | ((ch >>  0) & 0x3F));
-  } else {
-    *cp++ = (byte) (0xE0 | ((ch >> 12) & 0x0F));
-    *cp++ = (byte) (0x80 | ((ch >>  6) & 0x3F));
-    *cp++ = (byte) (0x80 | ((ch >>  0) & 0x3F));
-  }
-  return cp;
-}
-
-static byte* skip_Utf8_chars(byte* cp, int len) {
-  for (;; cp++) {
-    int ch = *cp & 0xFF;
-    if ((ch & 0xC0) != 0x80) {
-      if (len-- == 0)
-        return cp;
-      if (ch < 0x80 && len == 0)
-        return cp+1;
-    }
-  }
-}
-
-static int compare_Utf8_chars(bytes& b1, bytes& b2) {
-  int l1 = (int)b1.len;
-  int l2 = (int)b2.len;
-  int l0 = (l1 < l2) ? l1 : l2;
-  byte* p1 = b1.ptr;
-  byte* p2 = b2.ptr;
-  int c0 = 0;
-  for (int i = 0; i < l0; i++) {
-    int c1 = p1[i] & 0xFF;
-    int c2 = p2[i] & 0xFF;
-    if (c1 != c2) {
-      // Before returning the obvious answer,
-      // check to see if c1 or c2 is part of a 0x0000,
-      // which encodes as {0xC0,0x80}.  The 0x0000 is the
-      // lowest-sorting Java char value, and yet it encodes
-      // as if it were the first char after 0x7F, which causes
-      // strings containing nulls to sort too high.  All other
-      // comparisons are consistent between Utf8 and Java chars.
-      if (c1 == 0xC0 && (p1[i+1] & 0xFF) == 0x80)  c1 = 0;
-      if (c2 == 0xC0 && (p2[i+1] & 0xFF) == 0x80)  c2 = 0;
-      if (c0 == 0xC0) {
-        assert(((c1|c2) & 0xC0) == 0x80);  // c1 & c2 are extension chars
-        if (c1 == 0x80)  c1 = 0;  // will sort below c2
-        if (c2 == 0x80)  c2 = 0;  // will sort below c1
-      }
-      return c1 - c2;
-    }
-    c0 = c1;  // save away previous char
-  }
-  // common prefix is identical; return length difference if any
-  return l1 - l2;
-}
-
-// Cf. PackageReader.readUtf8Bands
-local_inline
-void unpacker::read_Utf8_values(entry* cpMap, int len) {
-  // Implicit first Utf8 string is the empty string.
-  enum {
-    // certain bands begin with implicit zeroes
-    PREFIX_SKIP_2 = 2,
-    SUFFIX_SKIP_1 = 1
-  };
-
-  int i;
-
-  // First band:  Read lengths of shared prefixes.
-  if (len > PREFIX_SKIP_2)
-    cp_Utf8_prefix.readData(len - PREFIX_SKIP_2);
-    NOT_PRODUCT(else cp_Utf8_prefix.readData(0));  // for asserts
-
-  // Second band:  Read lengths of unshared suffixes:
-  if (len > SUFFIX_SKIP_1)
-    cp_Utf8_suffix.readData(len - SUFFIX_SKIP_1);
-    NOT_PRODUCT(else cp_Utf8_suffix.readData(0));  // for asserts
-
-  bytes* allsuffixes = T_NEW(bytes, len);
-  CHECK;
-
-  int nbigsuf = 0;
-  fillbytes charbuf;    // buffer to allocate small strings
-  charbuf.init();
-
-  // Third band:  Read the char values in the unshared suffixes:
-  cp_Utf8_chars.readData(cp_Utf8_suffix.getIntTotal());
-  for (i = 0; i < len; i++) {
-    int suffix = (i < SUFFIX_SKIP_1)? 0: cp_Utf8_suffix.getInt();
-    if (suffix < 0) {
-      abort("bad utf8 suffix");
-      return;
-    }
-    if (suffix == 0 && i >= SUFFIX_SKIP_1) {
-      // chars are packed in cp_Utf8_big_chars
-      nbigsuf += 1;
-      continue;
-    }
-    bytes& chars  = allsuffixes[i];
-    uint size3    = suffix * 3;     // max Utf8 length
-    bool isMalloc = (suffix > SMALL);
-    if (isMalloc) {
-      chars.malloc(size3);
-    } else {
-      if (!charbuf.canAppend(size3+1)) {
-        assert(charbuf.allocated == 0 || tmallocs.contains(charbuf.base()));
-        charbuf.init(CHUNK);  // Reset to new buffer.
-        tmallocs.add(charbuf.base());
-      }
-      chars.set(charbuf.grow(size3+1), size3);
-    }
-    CHECK;
-    byte* chp = chars.ptr;
-    for (int j = 0; j < suffix; j++) {
-      unsigned short ch = cp_Utf8_chars.getInt();
-      chp = store_Utf8_char(chp, ch);
-    }
-    // shrink to fit:
-    if (isMalloc) {
-      chars.realloc(chp - chars.ptr);
-      CHECK;
-      tmallocs.add(chars.ptr); // free it later
-    } else {
-      int shrink = (int)(chars.limit() - chp);
-      chars.len -= shrink;
-      charbuf.b.len -= shrink;  // ungrow to reclaim buffer space
-      // Note that we did not reclaim the final '\0'.
-      assert(chars.limit() == charbuf.limit()-1);
-      assert(strlen((char*)chars.ptr) == chars.len);
-    }
-  }
-  //cp_Utf8_chars.done();
-#ifndef PRODUCT
-  charbuf.b.set(null, 0); // tidy
-#endif
-
-  // Fourth band:  Go back and size the specially packed strings.
-  int maxlen = 0;
-  cp_Utf8_big_suffix.readData(nbigsuf);
-  cp_Utf8_suffix.rewind();
-  for (i = 0; i < len; i++) {
-    int suffix = (i < SUFFIX_SKIP_1)? 0: cp_Utf8_suffix.getInt();
-    int prefix = (i < PREFIX_SKIP_2)? 0: cp_Utf8_prefix.getInt();
-    if (prefix < 0 || prefix+suffix < 0) {
-       abort("bad utf8 prefix");
-       return;
-    }
-    bytes& chars = allsuffixes[i];
-    if (suffix == 0 && i >= SUFFIX_SKIP_1) {
-      suffix = cp_Utf8_big_suffix.getInt();
-      assert(chars.ptr == null);
-      chars.len = suffix;  // just a momentary hack
-    } else {
-      assert(chars.ptr != null);
-    }
-    if (maxlen < prefix + suffix) {
-      maxlen = prefix + suffix;
-    }
-  }
-  //cp_Utf8_suffix.done();      // will use allsuffixes[i].len (ptr!=null)
-  //cp_Utf8_big_suffix.done();  // will use allsuffixes[i].len
-
-  // Fifth band(s):  Get the specially packed characters.
-  cp_Utf8_big_suffix.rewind();
-  for (i = 0; i < len; i++) {
-    bytes& chars = allsuffixes[i];
-    if (chars.ptr != null)  continue;  // already input
-    int suffix = (int)chars.len;  // pick up the hack
-    uint size3 = suffix * 3;
-    if (suffix == 0)  continue;  // done with empty string
-    chars.malloc(size3);
-    CHECK;
-    byte* chp = chars.ptr;
-    band saved_band = cp_Utf8_big_chars;
-    cp_Utf8_big_chars.readData(suffix);
-    CHECK;
-    for (int j = 0; j < suffix; j++) {
-      unsigned short ch = cp_Utf8_big_chars.getInt();
-      CHECK;
-      chp = store_Utf8_char(chp, ch);
-    }
-    chars.realloc(chp - chars.ptr);
-    CHECK;
-    tmallocs.add(chars.ptr);  // free it later
-    //cp_Utf8_big_chars.done();
-    cp_Utf8_big_chars = saved_band;  // reset the band for the next string
-  }
-  cp_Utf8_big_chars.readData(0);  // zero chars
-  //cp_Utf8_big_chars.done();
-
-  // Finally, sew together all the prefixes and suffixes.
-  bytes bigbuf;
-  bigbuf.malloc(maxlen * 3 + 1);  // max Utf8 length, plus slop for null
-  CHECK;
-  int prevlen = 0;  // previous string length (in chars)
-  tmallocs.add(bigbuf.ptr);  // free after this block
-  CHECK;
-  cp_Utf8_prefix.rewind();
-  for (i = 0; i < len; i++) {
-    bytes& chars = allsuffixes[i];
-    int prefix = (i < PREFIX_SKIP_2)? 0: cp_Utf8_prefix.getInt();
-    CHECK;
-    int suffix = (int)chars.len;
-    byte* fillp;
-    // by induction, the buffer is already filled with the prefix
-    // make sure the prefix value is not corrupted, though:
-    if (prefix > prevlen) {
-       abort("utf8 prefix overflow");
-       return;
-    }
-    fillp = skip_Utf8_chars(bigbuf.ptr, prefix);
-    // copy the suffix into the same buffer:
-    fillp = chars.writeTo(fillp);
-    assert(bigbuf.inBounds(fillp));
-    *fillp = 0;  // bigbuf must contain a well-formed Utf8 string
-    int length = (int)(fillp - bigbuf.ptr);
-    bytes& value = cpMap[i].value.b;
-    value.set(U_NEW(byte, add_size(length,1)), length);
-    value.copyFrom(bigbuf.ptr, length);
-    CHECK;
-    // Index all Utf8 strings
-    entry* &htref = cp.hashTabRef(CONSTANT_Utf8, value);
-    if (htref == null) {
-      // Note that if two identical strings are transmitted,
-      // the first is taken to be the canonical one.
-      htref = &cpMap[i];
-    }
-    prevlen = prefix + suffix;
-  }
-  //cp_Utf8_prefix.done();
-
-  // Free intermediate buffers.
-  free_temps();
-}
-
-local_inline
-void unpacker::read_single_words(band& cp_band, entry* cpMap, int len) {
-  cp_band.readData(len);
-  for (int i = 0; i < len; i++) {
-    cpMap[i].value.i = cp_band.getInt();  // coding handles signs OK
-  }
-}
-
-maybe_inline
-void unpacker::read_double_words(band& cp_bands, entry* cpMap, int len) {
-  band& cp_band_hi = cp_bands;
-  band& cp_band_lo = cp_bands.nextBand();
-  cp_band_hi.readData(len);
-  cp_band_lo.readData(len);
-  for (int i = 0; i < len; i++) {
-    cpMap[i].value.l = cp_band_hi.getLong(cp_band_lo, true);
-  }
-  //cp_band_hi.done();
-  //cp_band_lo.done();
-}
-
-maybe_inline
-void unpacker::read_single_refs(band& cp_band, byte refTag, entry* cpMap, int len) {
-  assert(refTag == CONSTANT_Utf8);
-  cp_band.setIndexByTag(refTag);
-  cp_band.readData(len);
-  CHECK;
-  int indexTag = (cp_band.bn == e_cp_Class) ? CONSTANT_Class : 0;
-  for (int i = 0; i < len; i++) {
-    entry& e = cpMap[i];
-    e.refs = U_NEW(entry*, e.nrefs = 1);
-    entry* utf = cp_band.getRef();
-    CHECK;
-    e.refs[0] = utf;
-    e.value.b = utf->value.b;  // copy value of Utf8 string to self
-    if (indexTag != 0) {
-      // Maintain cross-reference:
-      entry* &htref = cp.hashTabRef(indexTag, e.value.b);
-      if (htref == null) {
-        // Note that if two identical classes are transmitted,
-        // the first is taken to be the canonical one.
-        htref = &e;
-      }
-    }
-  }
-  //cp_band.done();
-}
-
-maybe_inline
-void unpacker::read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag,
-                                entry* cpMap, int len) {
-  band& cp_band1 = cp_band;
-  band& cp_band2 = cp_band.nextBand();
-  cp_band1.setIndexByTag(ref1Tag);
-  cp_band2.setIndexByTag(ref2Tag);
-  cp_band1.readData(len);
-  cp_band2.readData(len);
-  CHECK;
-  for (int i = 0; i < len; i++) {
-    entry& e = cpMap[i];
-    e.refs = U_NEW(entry*, e.nrefs = 2);
-    e.refs[0] = cp_band1.getRef();
-    CHECK;
-    e.refs[1] = cp_band2.getRef();
-    CHECK;
-  }
-  //cp_band1.done();
-  //cp_band2.done();
-}
-
-// Cf. PackageReader.readSignatureBands
-maybe_inline
-void unpacker::read_signature_values(entry* cpMap, int len) {
-  cp_Signature_form.setIndexByTag(CONSTANT_Utf8);
-  cp_Signature_form.readData(len);
-  CHECK;
-  int ncTotal = 0;
-  int i;
-  for (i = 0; i < len; i++) {
-    entry& e = cpMap[i];
-    entry& form = *cp_Signature_form.getRef();
-    CHECK;
-    int nc = 0;
-
-    for ( const char* ncp = form.utf8String() ; *ncp; ncp++) {
-      if (*ncp == 'L')  nc++;
-    }
-
-    ncTotal += nc;
-    e.refs = U_NEW(entry*, cpMap[i].nrefs = 1 + nc);
-    CHECK;
-    e.refs[0] = &form;
-  }
-  //cp_Signature_form.done();
-  cp_Signature_classes.setIndexByTag(CONSTANT_Class);
-  cp_Signature_classes.readData(ncTotal);
-  for (i = 0; i < len; i++) {
-    entry& e = cpMap[i];
-    for (int j = 1; j < e.nrefs; j++) {
-      e.refs[j] = cp_Signature_classes.getRef();
-      CHECK;
-    }
-  }
-  //cp_Signature_classes.done();
-}
-
-maybe_inline
-void unpacker::checkLegacy(const char* name) {
-  if (u->majver < JAVA7_PACKAGE_MAJOR_VERSION) {
-      char message[100];
-      snprintf(message, 99, "unexpected band %s\n", name);
-      abort(message);
-  }
-}
-
-maybe_inline
-void unpacker::read_method_handle(entry* cpMap, int len) {
-  if (len > 0) {
-    checkLegacy(cp_MethodHandle_refkind.name);
-  }
-  cp_MethodHandle_refkind.readData(len);
-  cp_MethodHandle_member.setIndexByTag(CONSTANT_AnyMember);
-  cp_MethodHandle_member.readData(len);
-  for (int i = 0 ; i < len ; i++) {
-    entry& e = cpMap[i];
-    e.value.i = cp_MethodHandle_refkind.getInt();
-    e.refs = U_NEW(entry*, e.nrefs = 1);
-    e.refs[0] = cp_MethodHandle_member.getRef();
-    CHECK;
-  }
-}
-
-maybe_inline
-void unpacker::read_method_type(entry* cpMap, int len) {
-  if (len > 0) {
-    checkLegacy(cp_MethodType.name);
-  }
-  cp_MethodType.setIndexByTag(CONSTANT_Signature);
-  cp_MethodType.readData(len);
-  for (int i = 0 ; i < len ; i++) {
-      entry& e = cpMap[i];
-      e.refs = U_NEW(entry*, e.nrefs = 1);
-      e.refs[0] = cp_MethodType.getRef();
-      CHECK;
-  }
-}
-
-maybe_inline
-void unpacker::read_bootstrap_methods(entry* cpMap, int len) {
-  if (len > 0) {
-    checkLegacy(cp_BootstrapMethod_ref.name);
-  }
-  cp_BootstrapMethod_ref.setIndexByTag(CONSTANT_MethodHandle);
-  cp_BootstrapMethod_ref.readData(len);
-
-  cp_BootstrapMethod_arg_count.readData(len);
-  int totalArgCount = cp_BootstrapMethod_arg_count.getIntTotal();
-  cp_BootstrapMethod_arg.setIndexByTag(CONSTANT_LoadableValue);
-  cp_BootstrapMethod_arg.readData(totalArgCount);
-  for (int i = 0; i < len; i++) {
-    entry& e = cpMap[i];
-    int argc = cp_BootstrapMethod_arg_count.getInt();
-    e.value.i = argc;
-    e.refs = U_NEW(entry*, e.nrefs = argc + 1);
-    e.refs[0] = cp_BootstrapMethod_ref.getRef();
-    for (int j = 1 ; j < e.nrefs ; j++) {
-      e.refs[j] = cp_BootstrapMethod_arg.getRef();
-      CHECK;
-    }
-  }
-}
-// Cf. PackageReader.readConstantPool
-void unpacker::read_cp() {
-  byte* rp0 = rp;
-
-  int i;
-
-  for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
-    byte tag = TAGS_IN_ORDER[k];
-    int  len = cp.tag_count[tag];
-    int base = cp.tag_base[tag];
-
-    PRINTCR((1,"Reading %d %s entries...", len, NOT_PRODUCT(TAG_NAME[tag])+0));
-    entry* cpMap = &cp.entries[base];
-    for (i = 0; i < len; i++) {
-      cpMap[i].tag = tag;
-      cpMap[i].inord = i;
-    }
-    // Initialize the tag's CP index right away, since it might be needed
-    // in the next pass to initialize the CP for another tag.
-#ifndef PRODUCT
-    cpindex* ix = &cp.tag_index[tag];
-    assert(ix->ixTag == tag);
-    assert((int)ix->len   == len);
-    assert(ix->base1 == cpMap);
-#endif
-
-    switch (tag) {
-    case CONSTANT_Utf8:
-      read_Utf8_values(cpMap, len);
-      break;
-    case CONSTANT_Integer:
-      read_single_words(cp_Int, cpMap, len);
-      break;
-    case CONSTANT_Float:
-      read_single_words(cp_Float, cpMap, len);
-      break;
-    case CONSTANT_Long:
-      read_double_words(cp_Long_hi /*& cp_Long_lo*/, cpMap, len);
-      break;
-    case CONSTANT_Double:
-      read_double_words(cp_Double_hi /*& cp_Double_lo*/, cpMap, len);
-      break;
-    case CONSTANT_String:
-      read_single_refs(cp_String, CONSTANT_Utf8, cpMap, len);
-      break;
-    case CONSTANT_Class:
-      read_single_refs(cp_Class, CONSTANT_Utf8, cpMap, len);
-      break;
-    case CONSTANT_Signature:
-      read_signature_values(cpMap, len);
-      break;
-    case CONSTANT_NameandType:
-      read_double_refs(cp_Descr_name /*& cp_Descr_type*/,
-                       CONSTANT_Utf8, CONSTANT_Signature,
-                       cpMap, len);
-      break;
-    case CONSTANT_Fieldref:
-      read_double_refs(cp_Field_class /*& cp_Field_desc*/,
-                       CONSTANT_Class, CONSTANT_NameandType,
-                       cpMap, len);
-      break;
-    case CONSTANT_Methodref:
-      read_double_refs(cp_Method_class /*& cp_Method_desc*/,
-                       CONSTANT_Class, CONSTANT_NameandType,
-                       cpMap, len);
-      break;
-    case CONSTANT_InterfaceMethodref:
-      read_double_refs(cp_Imethod_class /*& cp_Imethod_desc*/,
-                       CONSTANT_Class, CONSTANT_NameandType,
-                       cpMap, len);
-      break;
-    case CONSTANT_MethodHandle:
-      // consumes cp_MethodHandle_refkind and cp_MethodHandle_member
-      read_method_handle(cpMap, len);
-      break;
-    case CONSTANT_MethodType:
-      // consumes cp_MethodType
-      read_method_type(cpMap, len);
-      break;
-    case CONSTANT_InvokeDynamic:
-      read_double_refs(cp_InvokeDynamic_spec, CONSTANT_BootstrapMethod,
-                       CONSTANT_NameandType,
-                       cpMap, len);
-      break;
-    case CONSTANT_BootstrapMethod:
-      // consumes cp_BootstrapMethod_ref, cp_BootstrapMethod_arg_count and cp_BootstrapMethod_arg
-      read_bootstrap_methods(cpMap, len);
-      break;
-    default:
-      assert(false);
-      break;
-    }
-    CHECK;
-  }
-
-  cp.expandSignatures();
-  CHECK;
-  cp.initMemberIndexes();
-  CHECK;
-
-  PRINTCR((1,"parsed %d constant pool entries in %d bytes", cp.nentries, (rp - rp0)));
-
-  #define SNAME(n,s) #s "\0"
-  const char* symNames = (
-    ALL_ATTR_DO(SNAME)
-    "<init>"
-  );
-  #undef SNAME
-
-  for (int sn = 0; sn < cpool::s_LIMIT; sn++) {
-    assert(symNames[0] >= '0' && symNames[0] <= 'Z');  // sanity
-    bytes name; name.set(symNames);
-    if (name.len > 0 && name.ptr[0] != '0') {
-      cp.sym[sn] = cp.ensureUtf8(name);
-      PRINTCR((4, "well-known sym %d=%s", sn, cp.sym[sn]->string()));
-    }
-    symNames += name.len + 1;  // skip trailing null to next name
-  }
-
-  band::initIndexes(this);
-}
-
-static band* no_bands[] = { null };  // shared empty body
-
-inline
-band& unpacker::attr_definitions::fixed_band(int e_class_xxx) {
-  return u->all_bands[xxx_flags_hi_bn + (e_class_xxx-e_class_flags_hi)];
-}
-inline band& unpacker::attr_definitions::xxx_flags_hi()
-  { return fixed_band(e_class_flags_hi); }
-inline band& unpacker::attr_definitions::xxx_flags_lo()
-  { return fixed_band(e_class_flags_lo); }
-inline band& unpacker::attr_definitions::xxx_attr_count()
-  { return fixed_band(e_class_attr_count); }
-inline band& unpacker::attr_definitions::xxx_attr_indexes()
-  { return fixed_band(e_class_attr_indexes); }
-inline band& unpacker::attr_definitions::xxx_attr_calls()
-  { return fixed_band(e_class_attr_calls); }
-
-
-inline
-unpacker::layout_definition*
-unpacker::attr_definitions::defineLayout(int idx,
-                                         entry* nameEntry,
-                                         const char* layout) {
-  const char* name = nameEntry->value.b.strval();
-  layout_definition* lo = defineLayout(idx, name, layout);
-  CHECK_0;
-  lo->nameEntry = nameEntry;
-  return lo;
-}
-
-unpacker::layout_definition*
-unpacker::attr_definitions::defineLayout(int idx,
-                                         const char* name,
-                                         const char* layout) {
-  assert(flag_limit != 0);  // must be set up already
-  if (idx >= 0) {
-    // Fixed attr.
-    if (idx >= (int)flag_limit)
-      abort("attribute index too large");
-    if (isRedefined(idx))
-      abort("redefined attribute index");
-    redef |= ((julong)1<<idx);
-  } else {
-    idx = flag_limit + overflow_count.length();
-    overflow_count.add(0);  // make a new counter
-  }
-  layout_definition* lo = U_NEW(layout_definition, 1);
-  CHECK_0;
-  lo->idx = idx;
-  lo->name = name;
-  lo->layout = layout;
-  for (int adds = (idx+1) - layouts.length(); adds > 0; adds--) {
-    layouts.add(null);
-  }
-  CHECK_0;
-  layouts.get(idx) = lo;
-  return lo;
-}
-
-band**
-unpacker::attr_definitions::buildBands(unpacker::layout_definition* lo) {
-  int i;
-  if (lo->elems != null)
-    return lo->bands();
-  if (lo->layout[0] == '\0') {
-    lo->elems = no_bands;
-  } else {
-    // Create bands for this attribute by parsing the layout.
-    bool hasCallables = lo->hasCallables();
-    bands_made = 0x10000;  // base number for bands made
-    const char* lp = lo->layout;
-    lp = parseLayout(lp, lo->elems, -1);
-    CHECK_0;
-    if (lp[0] != '\0' || band_stack.length() > 0) {
-      abort("garbage at end of layout");
-    }
-    band_stack.popTo(0);
-    CHECK_0;
-
-    // Fix up callables to point at their callees.
-    band** bands = lo->elems;
-    assert(bands == lo->bands());
-    int num_callables = 0;
-    if (hasCallables) {
-      while (bands[num_callables] != null) {
-        if (bands[num_callables]->le_kind != EK_CBLE) {
-          abort("garbage mixed with callables");
-          break;
-        }
-        num_callables += 1;
-      }
-    }
-    for (i = 0; i < calls_to_link.length(); i++) {
-      band& call = *(band*) calls_to_link.get(i);
-      assert(call.le_kind == EK_CALL);
-      // Determine the callee.
-      int call_num = call.le_len;
-      if (call_num < 0 || call_num >= num_callables) {
-        abort("bad call in layout");
-        break;
-      }
-      band& cble = *bands[call_num];
-      // Link the call to it.
-      call.le_body[0] = &cble;
-      // Distinguish backward calls and callables:
-      assert(cble.le_kind == EK_CBLE);
-      assert(cble.le_len == call_num);
-      cble.le_back |= call.le_back;
-    }
-    calls_to_link.popTo(0);
-  }
-  return lo->elems;
-}
-
-/* attribute layout language parser
-
-  attribute_layout:
-        ( layout_element )* | ( callable )+
-  layout_element:
-        ( integral | replication | union | call | reference )
-
-  callable:
-        '[' body ']'
-  body:
-        ( layout_element )+
-
-  integral:
-        ( unsigned_int | signed_int | bc_index | bc_offset | flag )
-  unsigned_int:
-        uint_type
-  signed_int:
-        'S' uint_type
-  any_int:
-        ( unsigned_int | signed_int )
-  bc_index:
-        ( 'P' uint_type | 'PO' uint_type )
-  bc_offset:
-        'O' any_int
-  flag:
-        'F' uint_type
-  uint_type:
-        ( 'B' | 'H' | 'I' | 'V' )
-
-  replication:
-        'N' uint_type '[' body ']'
-
-  union:
-        'T' any_int (union_case)* '(' ')' '[' (body)? ']'
-  union_case:
-        '(' union_case_tag (',' union_case_tag)* ')' '[' (body)? ']'
-  union_case_tag:
-        ( numeral | numeral '-' numeral )
-  call:
-        '(' numeral ')'
-
-  reference:
-        reference_type ( 'N' )? uint_type
-  reference_type:
-        ( constant_ref | schema_ref | utf8_ref | untyped_ref )
-  constant_ref:
-        ( 'KI' | 'KJ' | 'KF' | 'KD' | 'KS' | 'KQ' )
-  schema_ref:
-        ( 'RC' | 'RS' | 'RD' | 'RF' | 'RM' | 'RI' )
-  utf8_ref:
-        'RU'
-  untyped_ref:
-        'RQ'
-
-  numeral:
-        '(' ('-')? (digit)+ ')'
-  digit:
-        ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
-
-*/
-
-const char*
-unpacker::attr_definitions::parseIntLayout(const char* lp, band* &res,
-                                           byte le_kind, bool can_be_signed) {
-  const char* lp0 = lp;
-  band* b = U_NEW(band, 1);
-  CHECK_(lp);
-  char le = *lp++;
-  int spec = UNSIGNED5_spec;
-  if (le == 'S' && can_be_signed) {
-    // Note:  This is the last use of sign.  There is no 'EF_SIGN'.
-    spec = SIGNED5_spec;
-    le = *lp++;
-  } else if (le == 'B') {
-    spec = BYTE1_spec;  // unsigned byte
-  }
-  b->init(u, bands_made++, spec);
-  b->le_kind = le_kind;
-  int le_len = 0;
-  switch (le) {
-  case 'B': le_len = 1; break;
-  case 'H': le_len = 2; break;
-  case 'I': le_len = 4; break;
-  case 'V': le_len = 0; break;
-  default:  abort("bad layout element");
-  }
-  b->le_len = le_len;
-  band_stack.add(b);
-  res = b;
-  return lp;
-}
-
-const char*
-unpacker::attr_definitions::parseNumeral(const char* lp, int &res) {
-  const char* lp0 = lp;
-  bool sgn = false;
-  if (*lp == '0') { res = 0; return lp+1; }  // special case '0'
-  if (*lp == '-') { sgn = true; lp++; }
-  const char* dp = lp;
-  int con = 0;
-  while (*dp >= '0' && *dp <= '9') {
-    int con0 = con;
-    con *= 10;
-    con += (*dp++) - '0';
-    if (con <= con0) { con = -1; break; }  //  numeral overflow
-  }
-  if (lp == dp) {
-    abort("missing numeral in layout");
-    return "";
-  }
-  lp = dp;
-  if (con < 0 && !(sgn && con == -con)) {
-    // (Portability note:  Misses the error if int is not 32 bits.)
-    abort("numeral overflow");
-    return "" ;
-  }
-  if (sgn)  con = -con;
-  res = con;
-  return lp;
-}
-
-band**
-unpacker::attr_definitions::popBody(int bs_base) {
-  // Return everything that was pushed, as a null-terminated pointer array.
-  int bs_limit = band_stack.length();
-  if (bs_base == bs_limit) {
-    return no_bands;
-  } else {
-    int nb = bs_limit - bs_base;
-    band** res = U_NEW(band*, add_size(nb, 1));
-    CHECK_(no_bands);
-    for (int i = 0; i < nb; i++) {
-      band* b = (band*) band_stack.get(bs_base + i);
-      res[i] = b;
-    }
-    band_stack.popTo(bs_base);
-    return res;
-  }
-}
-
-const char*
-unpacker::attr_definitions::parseLayout(const char* lp, band** &res,
-                                        int curCble) {
-  const char* lp0 = lp;
-  int bs_base = band_stack.length();
-  bool top_level = (bs_base == 0);
-  band* b;
-  enum { can_be_signed = true };  // optional arg to parseIntLayout
-
-  for (bool done = false; !done; ) {
-    switch (*lp++) {
-    case 'B': case 'H': case 'I': case 'V': // unsigned_int
-    case 'S': // signed_int
-      --lp; // reparse
-    case 'F':
-      lp = parseIntLayout(lp, b, EK_INT);
-      break;
-    case 'P':
-      {
-        int le_bci = EK_BCI;
-        if (*lp == 'O') {
-          ++lp;
-          le_bci = EK_BCID;
-        }
-        assert(*lp != 'S');  // no PSH, etc.
-        lp = parseIntLayout(lp, b, EK_INT);
-        b->le_bci = le_bci;
-        if (le_bci == EK_BCI)
-          b->defc = coding::findBySpec(BCI5_spec);
-        else
-          b->defc = coding::findBySpec(BRANCH5_spec);
-      }
-      break;
-    case 'O':
-      lp = parseIntLayout(lp, b, EK_INT, can_be_signed);
-      b->le_bci = EK_BCO;
-      b->defc = coding::findBySpec(BRANCH5_spec);
-      break;
-    case 'N': // replication: 'N' uint '[' elem ... ']'
-      lp = parseIntLayout(lp, b, EK_REPL);
-      assert(*lp == '[');
-      ++lp;
-      lp = parseLayout(lp, b->le_body, curCble);
-      CHECK_(lp);
-      break;
-    case 'T': // union: 'T' any_int union_case* '(' ')' '[' body ']'
-      lp = parseIntLayout(lp, b, EK_UN, can_be_signed);
-      {
-        int union_base = band_stack.length();
-        for (;;) {   // for each case
-          band& k_case = *U_NEW(band, 1);
-          CHECK_(lp);
-          band_stack.add(&k_case);
-          k_case.le_kind = EK_CASE;
-          k_case.bn = bands_made++;
-          if (*lp++ != '(') {
-            abort("bad union case");
-            return "";
-          }
-          if (*lp++ != ')') {
-            --lp;  // reparse
-            // Read some case values.  (Use band_stack for temp. storage.)
-            int case_base = band_stack.length();
-            for (;;) {
-              int caseval = 0;
-              lp = parseNumeral(lp, caseval);
-              band_stack.add((void*)(size_t)caseval);
-              if (*lp == '-') {
-                // new in version 160, allow (1-5) for (1,2,3,4,5)
-                if (u->majver < JAVA6_PACKAGE_MAJOR_VERSION) {
-                  abort("bad range in union case label (old archive format)");
-                  return "";
-                }
-                int caselimit = caseval;
-                lp++;
-                lp = parseNumeral(lp, caselimit);
-                if (caseval >= caselimit
-                    || (uint)(caselimit - caseval) > 0x10000) {
-                  // Note:  0x10000 is arbitrary implementation restriction.
-                  // We can remove it later if it's important to.
-                  abort("bad range in union case label");
-                  return "";
-                }
-                for (;;) {
-                  ++caseval;
-                  band_stack.add((void*)(size_t)caseval);
-                  if (caseval == caselimit)  break;
-                }
-              }
-              if (*lp != ',')  break;
-              lp++;
-            }
-            if (*lp++ != ')') {
-              abort("bad case label");
-              return "";
-            }
-            // save away the case labels
-            int ntags = band_stack.length() - case_base;
-            int* tags = U_NEW(int, add_size(ntags, 1));
-            CHECK_(lp);
-            k_case.le_casetags = tags;
-            *tags++ = ntags;
-            for (int i = 0; i < ntags; i++) {
-              *tags++ = ptrlowbits(band_stack.get(case_base+i));
-            }
-            band_stack.popTo(case_base);
-            CHECK_(lp);
-          }
-          // Got le_casetags.  Now grab the body.
-          assert(*lp == '[');
-          ++lp;
-          lp = parseLayout(lp, k_case.le_body, curCble);
-          CHECK_(lp);
-          if (k_case.le_casetags == null)  break;  // done
-        }
-        b->le_body = popBody(union_base);
-      }
-      break;
-    case '(': // call: '(' -?NN* ')'
-      {
-        band& call = *U_NEW(band, 1);
-        CHECK_(lp);
-        band_stack.add(&call);
-        call.le_kind = EK_CALL;
-        call.bn = bands_made++;
-        call.le_body = U_NEW(band*, 2); // fill in later
-        int call_num = 0;
-        lp = parseNumeral(lp, call_num);
-        call.le_back = (call_num <= 0);
-        call_num += curCble;  // numeral is self-relative offset
-        call.le_len = call_num;  //use le_len as scratch
-        calls_to_link.add(&call);
-        CHECK_(lp);
-        if (*lp++ != ')') {
-          abort("bad call label");
-          return "";
-        }
-      }
-      break;
-    case 'K': // reference_type: constant_ref
-    case 'R': // reference_type: schema_ref
-      {
-        int ixTag = CONSTANT_None;
-        if (lp[-1] == 'K') {
-          switch (*lp++) {
-          case 'I': ixTag = CONSTANT_Integer; break;
-          case 'J': ixTag = CONSTANT_Long; break;
-          case 'F': ixTag = CONSTANT_Float; break;
-          case 'D': ixTag = CONSTANT_Double; break;
-          case 'S': ixTag = CONSTANT_String; break;
-          case 'Q': ixTag = CONSTANT_FieldSpecific; break;
-
-          // new in 1.7
-          case 'M': ixTag = CONSTANT_MethodHandle; break;
-          case 'T': ixTag = CONSTANT_MethodType; break;
-          case 'L': ixTag = CONSTANT_LoadableValue; break;
-          }
-        } else {
-          switch (*lp++) {
-          case 'C': ixTag = CONSTANT_Class; break;
-          case 'S': ixTag = CONSTANT_Signature; break;
-          case 'D': ixTag = CONSTANT_NameandType; break;
-          case 'F': ixTag = CONSTANT_Fieldref; break;
-          case 'M': ixTag = CONSTANT_Methodref; break;
-          case 'I': ixTag = CONSTANT_InterfaceMethodref; break;
-          case 'U': ixTag = CONSTANT_Utf8; break; //utf8_ref
-          case 'Q': ixTag = CONSTANT_All; break; //untyped_ref
-
-          // new in 1.7
-          case 'Y': ixTag = CONSTANT_InvokeDynamic; break;
-          case 'B': ixTag = CONSTANT_BootstrapMethod; break;
-          case 'N': ixTag = CONSTANT_AnyMember; break;
-          }
-        }
-        if (ixTag == CONSTANT_None) {
-          abort("bad reference layout");
-          break;
-        }
-        bool nullOK = false;
-        if (*lp == 'N') {
-          nullOK = true;
-          lp++;
-        }
-        lp = parseIntLayout(lp, b, EK_REF);
-        b->defc = coding::findBySpec(UNSIGNED5_spec);
-        b->initRef(ixTag, nullOK);
-      }
-      break;
-    case '[':
-      {
-        // [callable1][callable2]...
-        if (!top_level) {
-          abort("bad nested callable");
-          break;
-        }
-        curCble += 1;
-        NOT_PRODUCT(int call_num = band_stack.length() - bs_base);
-        band& cble = *U_NEW(band, 1);
-        CHECK_(lp);
-        band_stack.add(&cble);
-        cble.le_kind = EK_CBLE;
-        NOT_PRODUCT(cble.le_len = call_num);
-        cble.bn = bands_made++;
-        lp = parseLayout(lp, cble.le_body, curCble);
-      }
-      break;
-    case ']':
-      // Hit a closing brace.  This ends whatever body we were in.
-      done = true;
-      break;
-    case '\0':
-      // Hit a null.  Also ends the (top-level) body.
-      --lp;  // back up, so caller can see the null also
-      done = true;
-      break;
-    default:
-      abort("bad layout");
-      break;
-    }
-    CHECK_(lp);
-  }
-
-  // Return the accumulated bands:
-  res = popBody(bs_base);
-  return lp;
-}
-
-void unpacker::read_attr_defs() {
-  int i;
-
-  // Tell each AD which attrc it is and where its fixed flags are:
-  attr_defs[ATTR_CONTEXT_CLASS].attrc            = ATTR_CONTEXT_CLASS;
-  attr_defs[ATTR_CONTEXT_CLASS].xxx_flags_hi_bn  = e_class_flags_hi;
-  attr_defs[ATTR_CONTEXT_FIELD].attrc            = ATTR_CONTEXT_FIELD;
-  attr_defs[ATTR_CONTEXT_FIELD].xxx_flags_hi_bn  = e_field_flags_hi;
-  attr_defs[ATTR_CONTEXT_METHOD].attrc           = ATTR_CONTEXT_METHOD;
-  attr_defs[ATTR_CONTEXT_METHOD].xxx_flags_hi_bn = e_method_flags_hi;
-  attr_defs[ATTR_CONTEXT_CODE].attrc             = ATTR_CONTEXT_CODE;
-  attr_defs[ATTR_CONTEXT_CODE].xxx_flags_hi_bn   = e_code_flags_hi;
-
-  // Decide whether bands for the optional high flag words are present.
-  attr_defs[ATTR_CONTEXT_CLASS]
-    .setHaveLongFlags(testBit(archive_options, AO_HAVE_CLASS_FLAGS_HI));
-  attr_defs[ATTR_CONTEXT_FIELD]
-    .setHaveLongFlags(testBit(archive_options, AO_HAVE_FIELD_FLAGS_HI));
-  attr_defs[ATTR_CONTEXT_METHOD]
-    .setHaveLongFlags(testBit(archive_options, AO_HAVE_METHOD_FLAGS_HI));
-  attr_defs[ATTR_CONTEXT_CODE]
-    .setHaveLongFlags(testBit(archive_options, AO_HAVE_CODE_FLAGS_HI));
-
-  // Set up built-in attrs.
-  // (The simple ones are hard-coded.  The metadata layouts are not.)
-  const char* md_layout = (
-    // parameter annotations:
-#define MDL0 \
-    "[NB[(1)]]"
-    MDL0
-    // annotations:
-#define MDL1 \
-    "[NH[(1)]]"
-    MDL1
-#define MDL2 \
-    "[RSHNH[RUH(1)]]"
-    MDL2
-    // element_value:
-#define MDL3 \
-    "[TB"                        \
-      "(66,67,73,83,90)[KIH]"    \
-      "(68)[KDH]"                \
-      "(70)[KFH]"                \
-      "(74)[KJH]"                \
-      "(99)[RSH]"                \
-      "(101)[RSHRUH]"            \
-      "(115)[RUH]"               \
-      "(91)[NH[(0)]]"            \
-      "(64)["                    \
-        /* nested annotation: */ \
-        "RSH"                    \
-        "NH[RUH(0)]"             \
-        "]"                      \
-      "()[]"                     \
-    "]"
-    MDL3
-    );
-
-  const char* md_layout_P = md_layout;
-  const char* md_layout_A = md_layout+strlen(MDL0);
-  const char* md_layout_V = md_layout+strlen(MDL0 MDL1 MDL2);
-  assert(0 == strncmp(&md_layout_A[-3], ")]][", 4));
-  assert(0 == strncmp(&md_layout_V[-3], ")]][", 4));
-
-const char* type_md_layout(
-    "[NH[(1)(2)(3)]]"
-    // target-type + target_info
-    "[TB"
-       "(0,1)[B]"
-       "(16)[FH]"
-       "(17,18)[BB]"
-       "(19,20,21)[]"
-       "(22)[B]"
-       "(23)[H]"
-       "(64,65)[NH[PHOHH]]"
-       "(66)[H]"
-       "(67,68,69,70)[PH]"
-       "(71,72,73,74,75)[PHB]"
-       "()[]]"
-    // target-path
-    "[NB[BB]]"
-    // annotation + element_value
-    MDL2
-    MDL3
-);
-
-  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
-    attr_definitions& ad = attr_defs[i];
-    if (i != ATTR_CONTEXT_CODE) {
-      ad.defineLayout(X_ATTR_RuntimeVisibleAnnotations,
-                      "RuntimeVisibleAnnotations", md_layout_A);
-      ad.defineLayout(X_ATTR_RuntimeInvisibleAnnotations,
-                      "RuntimeInvisibleAnnotations", md_layout_A);
-      if (i == ATTR_CONTEXT_METHOD) {
-        ad.defineLayout(METHOD_ATTR_RuntimeVisibleParameterAnnotations,
-                        "RuntimeVisibleParameterAnnotations", md_layout_P);
-        ad.defineLayout(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,
-                        "RuntimeInvisibleParameterAnnotations", md_layout_P);
-        ad.defineLayout(METHOD_ATTR_AnnotationDefault,
-                        "AnnotationDefault", md_layout_V);
-      }
-    }
-    ad.defineLayout(X_ATTR_RuntimeVisibleTypeAnnotations,
-                    "RuntimeVisibleTypeAnnotations", type_md_layout);
-    ad.defineLayout(X_ATTR_RuntimeInvisibleTypeAnnotations,
-                    "RuntimeInvisibleTypeAnnotations", type_md_layout);
-  }
-
-  attr_definition_headers.readData(attr_definition_count);
-  attr_definition_name.readData(attr_definition_count);
-  attr_definition_layout.readData(attr_definition_count);
-
-  CHECK;
-
-  // Initialize correct predef bits, to distinguish predefs from new defs.
-#define ORBIT(n,s) |((julong)1<<n)
-  attr_defs[ATTR_CONTEXT_CLASS].predef
-    = (0 X_ATTR_DO(ORBIT) CLASS_ATTR_DO(ORBIT));
-  attr_defs[ATTR_CONTEXT_FIELD].predef
-    = (0 X_ATTR_DO(ORBIT) FIELD_ATTR_DO(ORBIT));
-  attr_defs[ATTR_CONTEXT_METHOD].predef
-    = (0 X_ATTR_DO(ORBIT) METHOD_ATTR_DO(ORBIT));
-  attr_defs[ATTR_CONTEXT_CODE].predef
-    = (0 O_ATTR_DO(ORBIT) CODE_ATTR_DO(ORBIT));
-#undef ORBIT
-  // Clear out the redef bits, folding them back into predef.
-  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
-    attr_defs[i].predef |= attr_defs[i].redef;
-    attr_defs[i].redef = 0;
-  }
-
-  // Now read the transmitted locally defined attrs.
-  // This will set redef bits again.
-  for (i = 0; i < attr_definition_count; i++) {
-    int    header  = attr_definition_headers.getByte();
-    int    attrc   = ADH_BYTE_CONTEXT(header);
-    int    idx     = ADH_BYTE_INDEX(header);
-    entry* name    = attr_definition_name.getRef();
-    CHECK;
-    entry* layout  = attr_definition_layout.getRef();
-    CHECK;
-    attr_defs[attrc].defineLayout(idx, name, layout->value.b.strval());
-  }
-}
-
-#define NO_ENTRY_YET ((entry*)-1)
-
-static bool isDigitString(bytes& x, int beg, int end) {
-  if (beg == end)  return false;  // null string
-  byte* xptr = x.ptr;
-  for (int i = beg; i < end; i++) {
-    char ch = xptr[i];
-    if (!(ch >= '0' && ch <= '9'))  return false;
-  }
-  return true;
-}
-
-enum {  // constants for parsing class names
-  SLASH_MIN = '.',
-  SLASH_MAX = '/',
-  DOLLAR_MIN = 0,
-  DOLLAR_MAX = '-'
-};
-
-static int lastIndexOf(int chmin, int chmax, bytes& x, int pos) {
-  byte* ptr = x.ptr;
-  for (byte* cp = ptr + pos; --cp >= ptr; ) {
-    assert(x.inBounds(cp));
-    if (*cp >= chmin && *cp <= chmax)
-      return (int)(cp - ptr);
-  }
-  return -1;
-}
-
-maybe_inline
-inner_class* cpool::getIC(entry* inner) {
-  if (inner == null)  return null;
-  assert(inner->tag == CONSTANT_Class);
-  if (inner->inord == NO_INORD)  return null;
-  inner_class* ic = ic_index[inner->inord];
-  assert(ic == null || ic->inner == inner);
-  return ic;
-}
-
-maybe_inline
-inner_class* cpool::getFirstChildIC(entry* outer) {
-  if (outer == null)  return null;
-  assert(outer->tag == CONSTANT_Class);
-  if (outer->inord == NO_INORD)  return null;
-  inner_class* ic = ic_child_index[outer->inord];
-  assert(ic == null || ic->outer == outer);
-  return ic;
-}
-
-maybe_inline
-inner_class* cpool::getNextChildIC(inner_class* child) {
-  inner_class* ic = child->next_sibling;
-  assert(ic == null || ic->outer == child->outer);
-  return ic;
-}
-
-void unpacker::read_ics() {
-  int i;
-  int index_size = cp.tag_count[CONSTANT_Class];
-  inner_class** ic_index       = U_NEW(inner_class*, index_size);
-  inner_class** ic_child_index = U_NEW(inner_class*, index_size);
-  cp.ic_index = ic_index;
-  cp.ic_child_index = ic_child_index;
-  ics = U_NEW(inner_class, ic_count);
-  ic_this_class.readData(ic_count);
-  ic_flags.readData(ic_count);
-  CHECK;
-  // Scan flags to get count of long-form bands.
-  int long_forms = 0;
-  for (i = 0; i < ic_count; i++) {
-    int flags = ic_flags.getInt();  // may be long form!
-    if ((flags & ACC_IC_LONG_FORM) != 0) {
-      long_forms += 1;
-      ics[i].name = NO_ENTRY_YET;
-    }
-    flags &= ~ACC_IC_LONG_FORM;
-    entry* inner = ic_this_class.getRef();
-    CHECK;
-    uint inord = inner->inord;
-    assert(inord < (uint)cp.tag_count[CONSTANT_Class]);
-    if (ic_index[inord] != null) {
-      abort("identical inner class");
-      break;
-    }
-    ic_index[inord] = &ics[i];
-    ics[i].inner = inner;
-    ics[i].flags = flags;
-    assert(cp.getIC(inner) == &ics[i]);
-  }
-  CHECK;
-  //ic_this_class.done();
-  //ic_flags.done();
-  ic_outer_class.readData(long_forms);
-  ic_name.readData(long_forms);
-  for (i = 0; i < ic_count; i++) {
-    if (ics[i].name == NO_ENTRY_YET) {
-      // Long form.
-      ics[i].outer = ic_outer_class.getRefN();
-      CHECK;
-      ics[i].name  = ic_name.getRefN();
-      CHECK;
-    } else {
-      // Fill in outer and name based on inner.
-      bytes& n = ics[i].inner->value.b;
-      bytes pkgOuter;
-      bytes number;
-      bytes name;
-      // Parse n into pkgOuter and name (and number).
-      PRINTCR((5, "parse short IC name %s", n.ptr));
-      int dollar1, dollar2;  // pointers to $ in the pattern
-      // parse n = (<pkg>/)*<outer>($<number>)?($<name>)?
-      int nlen = (int)n.len;
-      int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, nlen) + 1;
-      dollar2    = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, nlen);
-      if (dollar2 < 0) {
-         abort();
-         return;
-      }
-      assert(dollar2 >= pkglen);
-      if (isDigitString(n, dollar2+1, nlen)) {
-        // n = (<pkg>/)*<outer>$<number>
-        number = n.slice(dollar2+1, nlen);
-        name.set(null,0);
-        dollar1 = dollar2;
-      } else if (pkglen < (dollar1
-                           = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, dollar2-1))
-                 && isDigitString(n, dollar1+1, dollar2)) {
-        // n = (<pkg>/)*<outer>$<number>$<name>
-        number = n.slice(dollar1+1, dollar2);
-        name = n.slice(dollar2+1, nlen);
-      } else {
-        // n = (<pkg>/)*<outer>$<name>
-        dollar1 = dollar2;
-        number.set(null,0);
-        name = n.slice(dollar2+1, nlen);
-      }
-      if (number.ptr == null)
-        pkgOuter = n.slice(0, dollar1);
-      else
-        pkgOuter.set(null,0);
-      PRINTCR((5,"=> %s$ 0%s $%s",
-              pkgOuter.string(), number.string(), name.string()));
-
-      if (pkgOuter.ptr != null)
-        ics[i].outer = cp.ensureClass(pkgOuter);
-
-      if (name.ptr != null)
-        ics[i].name = cp.ensureUtf8(name);
-    }
-
-    // update child/sibling list
-    if (ics[i].outer != null) {
-      uint outord = ics[i].outer->inord;
-      if (outord != NO_INORD) {
-        assert(outord < (uint)cp.tag_count[CONSTANT_Class]);
-        ics[i].next_sibling = ic_child_index[outord];
-        ic_child_index[outord] = &ics[i];
-      }
-    }
-  }
-  //ic_outer_class.done();
-  //ic_name.done();
-}
-
-void unpacker::read_classes() {
-  PRINTCR((1,"  ...scanning %d classes...", class_count));
-  class_this.readData(class_count);
-  class_super.readData(class_count);
-  class_interface_count.readData(class_count);
-  class_interface.readData(class_interface_count.getIntTotal());
-
-  CHECK;
-
-  #if 0
-  int i;
-  // Make a little mark on super-classes.
-  for (i = 0; i < class_count; i++) {
-    entry* e = class_super.getRefN();
-    if (e != null)  e->bits |= entry::EB_SUPER;
-  }
-  class_super.rewind();
-  #endif
-
-  // Members.
-  class_field_count.readData(class_count);
-  class_method_count.readData(class_count);
-
-  CHECK;
-
-  int field_count = class_field_count.getIntTotal();
-  int method_count = class_method_count.getIntTotal();
-
-  field_descr.readData(field_count);
-  read_attrs(ATTR_CONTEXT_FIELD, field_count);
-  CHECK;
-
-  method_descr.readData(method_count);
-  read_attrs(ATTR_CONTEXT_METHOD, method_count);
-
-  CHECK;
-
-  read_attrs(ATTR_CONTEXT_CLASS, class_count);
-  CHECK;
-
-  read_code_headers();
-
-  PRINTCR((1,"scanned %d classes, %d fields, %d methods, %d code headers",
-          class_count, field_count, method_count, code_count));
-}
-
-maybe_inline
-int unpacker::attr_definitions::predefCount(uint idx) {
-  return isPredefined(idx) ? flag_count[idx] : 0;
-}
-
-void unpacker::read_attrs(int attrc, int obj_count) {
-  attr_definitions& ad = attr_defs[attrc];
-  assert(ad.attrc == attrc);
-
-  int i, idx, count;
-
-  CHECK;
-
-  bool haveLongFlags = ad.haveLongFlags();
-
-  band& xxx_flags_hi = ad.xxx_flags_hi();
-  assert(endsWith(xxx_flags_hi.name, "_flags_hi"));
-  if (haveLongFlags)
-    xxx_flags_hi.readData(obj_count);
-  CHECK;
-
-  band& xxx_flags_lo = ad.xxx_flags_lo();
-  assert(endsWith(xxx_flags_lo.name, "_flags_lo"));
-  xxx_flags_lo.readData(obj_count);
-  CHECK;
-
-  // pre-scan flags, counting occurrences of each index bit
-  julong indexMask = ad.flagIndexMask();  // which flag bits are index bits?
-  for (i = 0; i < obj_count; i++) {
-    julong indexBits = xxx_flags_hi.getLong(xxx_flags_lo, haveLongFlags);
-    if ((indexBits & ~indexMask) > (ushort)-1) {
-      abort("undefined attribute flag bit");
-      return;
-    }
-    indexBits &= indexMask;  // ignore classfile flag bits
-    for (idx = 0; indexBits != 0; idx++, indexBits >>= 1) {
-      ad.flag_count[idx] += (int)(indexBits & 1);
-    }
-  }
-  // we'll scan these again later for output:
-  xxx_flags_lo.rewind();
-  xxx_flags_hi.rewind();
-
-  band& xxx_attr_count = ad.xxx_attr_count();
-  assert(endsWith(xxx_attr_count.name, "_attr_count"));
-  // There is one count element for each 1<<16 bit set in flags:
-  xxx_attr_count.readData(ad.predefCount(X_ATTR_OVERFLOW));
-  CHECK;
-
-  band& xxx_attr_indexes = ad.xxx_attr_indexes();
-  assert(endsWith(xxx_attr_indexes.name, "_attr_indexes"));
-  int overflowIndexCount = xxx_attr_count.getIntTotal();
-  xxx_attr_indexes.readData(overflowIndexCount);
-  CHECK;
-  // pre-scan attr indexes, counting occurrences of each value
-  for (i = 0; i < overflowIndexCount; i++) {
-    idx = xxx_attr_indexes.getInt();
-    if (!ad.isIndex(idx)) {
-      abort("attribute index out of bounds");
-      return;
-    }
-    ad.getCount(idx) += 1;
-  }
-  xxx_attr_indexes.rewind();  // we'll scan it again later for output
-
-  // We will need a backward call count for each used backward callable.
-  int backwardCounts = 0;
-  for (idx = 0; idx < ad.layouts.length(); idx++) {
-    layout_definition* lo = ad.getLayout(idx);
-    if (lo != null && ad.getCount(idx) != 0) {
-      // Build the bands lazily, only when they are used.
-      band** bands = ad.buildBands(lo);
-      CHECK;
-      if (lo->hasCallables()) {
-        for (i = 0; bands[i] != null; i++) {
-          if (bands[i]->le_back) {
-            assert(bands[i]->le_kind == EK_CBLE);
-            backwardCounts += 1;
-          }
-        }
-      }
-    }
-  }
-  ad.xxx_attr_calls().readData(backwardCounts);
-  CHECK;
-
-  // Read built-in bands.
-  // Mostly, these are hand-coded equivalents to readBandData().
-  switch (attrc) {
-  case ATTR_CONTEXT_CLASS:
-
-    count = ad.predefCount(CLASS_ATTR_SourceFile);
-    class_SourceFile_RUN.readData(count);
-    CHECK;
-
-    count = ad.predefCount(CLASS_ATTR_EnclosingMethod);
-    class_EnclosingMethod_RC.readData(count);
-    class_EnclosingMethod_RDN.readData(count);
-    CHECK;
-
-    count = ad.predefCount(X_ATTR_Signature);
-    class_Signature_RS.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
-    CHECK;
-
-    count = ad.predefCount(CLASS_ATTR_InnerClasses);
-    class_InnerClasses_N.readData(count);
-    CHECK;
-
-    count = class_InnerClasses_N.getIntTotal();
-    class_InnerClasses_RC.readData(count);
-    class_InnerClasses_F.readData(count);
-    CHECK;
-    // Drop remaining columns wherever flags are zero:
-    count -= class_InnerClasses_F.getIntCount(0);
-    class_InnerClasses_outer_RCN.readData(count);
-    class_InnerClasses_name_RUN.readData(count);
-    CHECK;
-
-    count = ad.predefCount(CLASS_ATTR_ClassFile_version);
-    class_ClassFile_version_minor_H.readData(count);
-    class_ClassFile_version_major_H.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
-    CHECK;
-    break;
-
-  case ATTR_CONTEXT_FIELD:
-
-    count = ad.predefCount(FIELD_ATTR_ConstantValue);
-    field_ConstantValue_KQ.readData(count);
-    CHECK;
-
-    count = ad.predefCount(X_ATTR_Signature);
-    field_Signature_RS.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
-    CHECK;
-    break;
-
-  case ATTR_CONTEXT_METHOD:
-
-    code_count = ad.predefCount(METHOD_ATTR_Code);
-    // Code attrs are handled very specially below...
-
-    count = ad.predefCount(METHOD_ATTR_Exceptions);
-    method_Exceptions_N.readData(count);
-    count = method_Exceptions_N.getIntTotal();
-    method_Exceptions_RC.readData(count);
-    CHECK;
-
-    count = ad.predefCount(X_ATTR_Signature);
-    method_Signature_RS.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleAnnotations);
-    ad.readBandData(METHOD_ATTR_RuntimeVisibleParameterAnnotations);
-    ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations);
-    ad.readBandData(METHOD_ATTR_AnnotationDefault);
-    CHECK;
-
-    count = ad.predefCount(METHOD_ATTR_MethodParameters);
-    method_MethodParameters_NB.readData(count);
-    count = method_MethodParameters_NB.getIntTotal();
-    method_MethodParameters_name_RUN.readData(count);
-    method_MethodParameters_flag_FH.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
-    CHECK;
-
-    break;
-
-  case ATTR_CONTEXT_CODE:
-    // (keep this code aligned with its brother in unpacker::write_attrs)
-    count = ad.predefCount(CODE_ATTR_StackMapTable);
-    // disable this feature in old archives!
-    if (count != 0 && majver < JAVA6_PACKAGE_MAJOR_VERSION) {
-      abort("undefined StackMapTable attribute (old archive format)");
-      return;
-    }
-    code_StackMapTable_N.readData(count);
-    CHECK;
-    count = code_StackMapTable_N.getIntTotal();
-    code_StackMapTable_frame_T.readData(count);
-    CHECK;
-    // the rest of it depends in a complicated way on frame tags
-    {
-      int fat_frame_count = 0;
-      int offset_count = 0;
-      int type_count = 0;
-      for (int k = 0; k < count; k++) {
-        int tag = code_StackMapTable_frame_T.getByte();
-        if (tag <= 127) {
-          // (64-127)  [(2)]
-          if (tag >= 64)  type_count++;
-        } else if (tag <= 251) {
-          // (247)     [(1)(2)]
-          // (248-251) [(1)]
-          if (tag >= 247)  offset_count++;
-          if (tag == 247)  type_count++;
-        } else if (tag <= 254) {
-          // (252)     [(1)(2)]
-          // (253)     [(1)(2)(2)]
-          // (254)     [(1)(2)(2)(2)]
-          offset_count++;
-          type_count += (tag - 251);
-        } else {
-          // (255)     [(1)NH[(2)]NH[(2)]]
-          fat_frame_count++;
-        }
-      }
-
-      // done pre-scanning frame tags:
-      code_StackMapTable_frame_T.rewind();
-
-      // deal completely with fat frames:
-      offset_count += fat_frame_count;
-      code_StackMapTable_local_N.readData(fat_frame_count);
-      CHECK;
-      type_count += code_StackMapTable_local_N.getIntTotal();
-      code_StackMapTable_stack_N.readData(fat_frame_count);
-      type_count += code_StackMapTable_stack_N.getIntTotal();
-      CHECK;
-      // read the rest:
-      code_StackMapTable_offset.readData(offset_count);
-      code_StackMapTable_T.readData(type_count);
-      CHECK;
-      // (7) [RCH]
-      count = code_StackMapTable_T.getIntCount(7);
-      code_StackMapTable_RC.readData(count);
-      CHECK;
-      // (8) [PH]
-      count = code_StackMapTable_T.getIntCount(8);
-      code_StackMapTable_P.readData(count);
-      CHECK;
-    }
-
-    count = ad.predefCount(CODE_ATTR_LineNumberTable);
-    code_LineNumberTable_N.readData(count);
-    CHECK;
-    count = code_LineNumberTable_N.getIntTotal();
-    code_LineNumberTable_bci_P.readData(count);
-    code_LineNumberTable_line.readData(count);
-    CHECK;
-
-    count = ad.predefCount(CODE_ATTR_LocalVariableTable);
-    code_LocalVariableTable_N.readData(count);
-    CHECK;
-    count = code_LocalVariableTable_N.getIntTotal();
-    code_LocalVariableTable_bci_P.readData(count);
-    code_LocalVariableTable_span_O.readData(count);
-    code_LocalVariableTable_name_RU.readData(count);
-    code_LocalVariableTable_type_RS.readData(count);
-    code_LocalVariableTable_slot.readData(count);
-    CHECK;
-
-    count = ad.predefCount(CODE_ATTR_LocalVariableTypeTable);
-    code_LocalVariableTypeTable_N.readData(count);
-    count = code_LocalVariableTypeTable_N.getIntTotal();
-    code_LocalVariableTypeTable_bci_P.readData(count);
-    code_LocalVariableTypeTable_span_O.readData(count);
-    code_LocalVariableTypeTable_name_RU.readData(count);
-    code_LocalVariableTypeTable_type_RS.readData(count);
-    code_LocalVariableTypeTable_slot.readData(count);
-    CHECK;
-
-    ad.readBandData(X_ATTR_RuntimeVisibleTypeAnnotations);
-    ad.readBandData(X_ATTR_RuntimeInvisibleTypeAnnotations);
-    CHECK;
-
-    break;
-  }
-
-  // Read compressor-defined bands.
-  for (idx = 0; idx < ad.layouts.length(); idx++) {
-    if (ad.getLayout(idx) == null)
-      continue;  // none at this fixed index <32
-    if (idx < (int)ad.flag_limit && ad.isPredefined(idx))
-      continue;  // already handled
-    if (ad.getCount(idx) == 0)
-      continue;  // no attributes of this type (then why transmit layouts?)
-    ad.readBandData(idx);
-  }
-}
-
-void unpacker::attr_definitions::readBandData(int idx) {
-  int j;
-  uint count = getCount(idx);
-  if (count == 0)  return;
-  layout_definition* lo = getLayout(idx);
-  if (lo != null) {
-    PRINTCR((1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
-            count, isRedefined(idx), isPredefined(idx),
-            ATTR_CONTEXT_NAME[attrc], lo->name));
-  }
-  bool hasCallables = lo->hasCallables();
-  band** bands = lo->bands();
-  if (!hasCallables) {
-    // Read through the rest of the bands in a regular way.
-    readBandData(bands, count);
-  } else {
-    // Deal with the callables.
-    // First set up the forward entry count for each callable.
-    // This is stored on band::length of the callable.
-    bands[0]->expectMoreLength(count);
-    for (j = 0; bands[j] != null; j++) {
-      band& j_cble = *bands[j];
-      assert(j_cble.le_kind == EK_CBLE);
-      if (j_cble.le_back) {
-        // Add in the predicted effects of backward calls, too.
-        int back_calls = xxx_attr_calls().getInt();
-        j_cble.expectMoreLength(back_calls);
-        // In a moment, more forward calls may increment j_cble.length.
-      }
-    }
-    // Now consult whichever callables have non-zero entry counts.
-    readBandData(bands, (uint)-1);
-  }
-}
-
-// Recursive helper to the previous function:
-void unpacker::attr_definitions::readBandData(band** body, uint count) {
-  int j, k;
-  for (j = 0; body[j] != null; j++) {
-    band& b = *body[j];
-    if (b.defc != null) {
-      // It has data, so read it.
-      b.readData(count);
-    }
-    switch (b.le_kind) {
-    case EK_REPL:
-      {
-        int reps = b.getIntTotal();
-        readBandData(b.le_body, reps);
-      }
-      break;
-    case EK_UN:
-      {
-        int remaining = count;
-        for (k = 0; b.le_body[k] != null; k++) {
-          band& k_case = *b.le_body[k];
-          int   k_count = 0;
-          if (k_case.le_casetags == null) {
-            k_count = remaining;  // last (empty) case
-          } else {
-            int* tags = k_case.le_casetags;
-            int ntags = *tags++;  // 1st element is length (why not?)
-            while (ntags-- > 0) {
-              int tag = *tags++;
-              k_count += b.getIntCount(tag);
-            }
-          }
-          readBandData(k_case.le_body, k_count);
-          remaining -= k_count;
-        }
-        assert(remaining == 0);
-      }
-      break;
-    case EK_CALL:
-      // Push the count forward, if it is not a backward call.
-      if (!b.le_back) {
-        band& cble = *b.le_body[0];
-        assert(cble.le_kind == EK_CBLE);
-        cble.expectMoreLength(count);
-      }
-      break;
-    case EK_CBLE:
-      assert((int)count == -1);  // incoming count is meaningless
-      k = b.length;
-      assert(k >= 0);
-      // This is intended and required for non production mode.
-      assert((b.length = -1)); // make it unable to accept more calls now.
-      readBandData(b.le_body, k);
-      break;
-    }
-  }
-}
-
-static inline
-band** findMatchingCase(int matchTag, band** cases) {
-  for (int k = 0; cases[k] != null; k++) {
-    band& k_case = *cases[k];
-    if (k_case.le_casetags != null) {
-      // If it has tags, it must match a tag.
-      int* tags = k_case.le_casetags;
-      int ntags = *tags++;  // 1st element is length
-      for (; ntags > 0; ntags--) {
-        int tag = *tags++;
-        if (tag == matchTag)
-          break;
-      }
-      if (ntags == 0)
-        continue;   // does not match
-    }
-    return k_case.le_body;
-  }
-  return null;
-}
-
-// write attribute band data:
-void unpacker::putlayout(band** body) {
-  int i;
-  int prevBII = -1;
-  int prevBCI = -1;
-  if (body == NULL) {
-    abort("putlayout: unexpected NULL for body");
-    return;
-  }
-  for (i = 0; body[i] != null; i++) {
-    band& b = *body[i];
-    byte le_kind = b.le_kind;
-
-    // Handle scalar part, if any.
-    int    x = 0;
-    entry* e = null;
-    if (b.defc != null) {
-      // It has data, so unparse an element.
-      if (b.ixTag != CONSTANT_None) {
-        assert(le_kind == EK_REF);
-        if (b.ixTag == CONSTANT_FieldSpecific)
-          e = b.getRefUsing(cp.getKQIndex());
-        else
-          e = b.getRefN();
-        CHECK;
-        switch (b.le_len) {
-        case 0: break;
-        case 1: putu1ref(e); break;
-        case 2: putref(e); break;
-        case 4: putu2(0); putref(e); break;
-        default: assert(false);
-        }
-      } else {
-        assert(le_kind == EK_INT || le_kind == EK_REPL || le_kind == EK_UN);
-        x = b.getInt();
-
-        assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
-        switch (b.le_bci) {
-        case EK_BCI:   // PH:  transmit R(bci), store bci
-          x = to_bci(prevBII = x);
-          prevBCI = x;
-          break;
-        case EK_BCID:  // POH: transmit D(R(bci)), store bci
-          x = to_bci(prevBII += x);
-          prevBCI = x;
-          break;
-        case EK_BCO:   // OH:  transmit D(R(bci)), store D(bci)
-          x = to_bci(prevBII += x) - prevBCI;
-          prevBCI += x;
-          break;
-        }
-        assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
-
-        switch (b.le_len) {
-        case 0: break;
-        case 1: putu1(x); break;
-        case 2: putu2(x); break;
-        case 4: putu4(x); break;
-        default: assert(false);
-        }
-      }
-    }
-
-    // Handle subparts, if any.
-    switch (le_kind) {
-    case EK_REPL:
-      // x is the repeat count
-      while (x-- > 0) {
-        putlayout(b.le_body);
-      }
-      break;
-    case EK_UN:
-      // x is the tag
-      putlayout(findMatchingCase(x, b.le_body));
-      break;
-    case EK_CALL:
-      {
-        band& cble = *b.le_body[0];
-        assert(cble.le_kind == EK_CBLE);
-        assert(cble.le_len == b.le_len);
-        putlayout(cble.le_body);
-      }
-      break;
-
-    #ifndef PRODUCT
-    case EK_CBLE:
-    case EK_CASE:
-      assert(false);  // should not reach here
-    #endif
-    }
-  }
-}
-
-void unpacker::read_files() {
-  file_name.readData(file_count);
-  if (testBit(archive_options, AO_HAVE_FILE_SIZE_HI))
-    file_size_hi.readData(file_count);
-  file_size_lo.readData(file_count);
-  if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
-    file_modtime.readData(file_count);
-  int allFiles = file_count + class_count;
-  if (testBit(archive_options, AO_HAVE_FILE_OPTIONS)) {
-    file_options.readData(file_count);
-    // FO_IS_CLASS_STUB might be set, causing overlap between classes and files
-    for (int i = 0; i < file_count; i++) {
-      if ((file_options.getInt() & FO_IS_CLASS_STUB) != 0) {
-        allFiles -= 1;  // this one counts as both class and file
-      }
-    }
-    file_options.rewind();
-  }
-  assert((default_file_options & FO_IS_CLASS_STUB) == 0);
-  files_remaining = allFiles;
-}
-
-maybe_inline
-void unpacker::get_code_header(int& max_stack,
-                               int& max_na_locals,
-                               int& handler_count,
-                               int& cflags) {
-  int sc = code_headers.getByte();
-  if (sc == 0) {
-    max_stack = max_na_locals = handler_count = cflags = -1;
-    return;
-  }
-  // Short code header is the usual case:
-  int nh;
-  int mod;
-  if (sc < 1 + 12*12) {
-    sc -= 1;
-    nh = 0;
-    mod = 12;
-  } else if (sc < 1 + 12*12 + 8*8) {
-    sc -= 1 + 12*12;
-    nh = 1;
-    mod = 8;
-  } else {
-    assert(sc < 1 + 12*12 + 8*8 + 7*7);
-    sc -= 1 + 12*12 + 8*8;
-    nh = 2;
-    mod = 7;
-  }
-  max_stack     = sc % mod;
-  max_na_locals = sc / mod;  // caller must add static, siglen
-  handler_count = nh;
-  if (testBit(archive_options, AO_HAVE_ALL_CODE_FLAGS))
-    cflags      = -1;
-  else
-    cflags      = 0;  // this one has no attributes
-}
-
-// Cf. PackageReader.readCodeHeaders
-void unpacker::read_code_headers() {
-  code_headers.readData(code_count);
-  CHECK;
-  int totalHandlerCount = 0;
-  int totalFlagsCount   = 0;
-  for (int i = 0; i < code_count; i++) {
-    int max_stack, max_locals, handler_count, cflags;
-    get_code_header(max_stack, max_locals, handler_count, cflags);
-    if (max_stack < 0)      code_max_stack.expectMoreLength(1);
-    if (max_locals < 0)     code_max_na_locals.expectMoreLength(1);
-    if (handler_count < 0)  code_handler_count.expectMoreLength(1);
-    else                    totalHandlerCount += handler_count;
-    if (cflags < 0)         totalFlagsCount += 1;
-  }
-  code_headers.rewind();  // replay later during writing
-
-  code_max_stack.readData();
-  code_max_na_locals.readData();
-  code_handler_count.readData();
-  totalHandlerCount += code_handler_count.getIntTotal();
-  CHECK;
-
-  // Read handler specifications.
-  // Cf. PackageReader.readCodeHandlers.
-  code_handler_start_P.readData(totalHandlerCount);
-  code_handler_end_PO.readData(totalHandlerCount);
-  code_handler_catch_PO.readData(totalHandlerCount);
-  code_handler_class_RCN.readData(totalHandlerCount);
-  CHECK;
-
-  read_attrs(ATTR_CONTEXT_CODE, totalFlagsCount);
-  CHECK;
-}
-
-static inline bool is_in_range(uint n, uint min, uint max) {
-  return n - min <= max - min;  // unsigned arithmetic!
-}
-static inline bool is_field_op(int bc) {
-  return is_in_range(bc, bc_getstatic, bc_putfield);
-}
-static inline bool is_invoke_init_op(int bc) {
-  return is_in_range(bc, _invokeinit_op, _invokeinit_limit-1);
-}
-static inline bool is_self_linker_op(int bc) {
-  return is_in_range(bc, _self_linker_op, _self_linker_limit-1);
-}
-static bool is_branch_op(int bc) {
-  return is_in_range(bc, bc_ifeq,   bc_jsr)
-      || is_in_range(bc, bc_ifnull, bc_jsr_w);
-}
-static bool is_local_slot_op(int bc) {
-  return is_in_range(bc, bc_iload,  bc_aload)
-      || is_in_range(bc, bc_istore, bc_astore)
-      || bc == bc_iinc || bc == bc_ret;
-}
-band* unpacker::ref_band_for_op(int bc) {
-  switch (bc) {
-  case bc_ildc:
-  case bc_ildc_w:
-    return &bc_intref;
-  case bc_fldc:
-  case bc_fldc_w:
-    return &bc_floatref;
-  case bc_lldc2_w:
-    return &bc_longref;
-  case bc_dldc2_w:
-    return &bc_doubleref;
-  case bc_sldc:
-  case bc_sldc_w:
-    return &bc_stringref;
-  case bc_cldc:
-  case bc_cldc_w:
-    return &bc_classref;
-  case bc_qldc: case bc_qldc_w:
-    return &bc_loadablevalueref;
-
-  case bc_getstatic:
-  case bc_putstatic:
-  case bc_getfield:
-  case bc_putfield:
-    return &bc_fieldref;
-
-  case _invokespecial_int:
-  case _invokestatic_int:
-    return &bc_imethodref;
-  case bc_invokevirtual:
-  case bc_invokespecial:
-  case bc_invokestatic:
-    return &bc_methodref;
-  case bc_invokeinterface:
-    return &bc_imethodref;
-  case bc_invokedynamic:
-    return &bc_indyref;
-
-  case bc_new:
-  case bc_anewarray:
-  case bc_checkcast:
-  case bc_instanceof:
-  case bc_multianewarray:
-    return &bc_classref;
-  }
-  return null;
-}
-
-maybe_inline
-band* unpacker::ref_band_for_self_op(int bc, bool& isAloadVar, int& origBCVar) {
-  if (!is_self_linker_op(bc))  return null;
-  int idx = (bc - _self_linker_op);
-  bool isSuper = (idx >= _self_linker_super_flag);
-  if (isSuper)  idx -= _self_linker_super_flag;
-  bool isAload = (idx >= _self_linker_aload_flag);
-  if (isAload)  idx -= _self_linker_aload_flag;
-  int origBC = _first_linker_op + idx;
-  bool isField = is_field_op(origBC);
-  isAloadVar = isAload;
-  origBCVar  = _first_linker_op + idx;
-  if (!isSuper)
-    return isField? &bc_thisfield: &bc_thismethod;
-  else
-    return isField? &bc_superfield: &bc_supermethod;
-}
-
-// Cf. PackageReader.readByteCodes
-inline  // called exactly once => inline
-void unpacker::read_bcs() {
-  PRINTCR((3, "reading compressed bytecodes and operands for %d codes...",
-          code_count));
-
-  // read from bc_codes and bc_case_count
-  fillbytes all_switch_ops;
-  all_switch_ops.init();
-  CHECK;
-
-  // Read directly from rp/rplimit.
-  //Do this later:  bc_codes.readData(...)
-  byte* rp0 = rp;
-
-  band* bc_which;
-  byte* opptr = rp;
-  byte* oplimit = rplimit;
-
-  bool  isAload;  // passed by ref and then ignored
-  int   junkBC;   // passed by ref and then ignored
-  for (int k = 0; k < code_count; k++) {
-    // Scan one method:
-    for (;;) {
-      if (opptr+2 > oplimit) {
-        rp = opptr;
-        ensure_input(2);
-        oplimit = rplimit;
-        rp = rp0;  // back up
-      }
-      if (opptr == oplimit) { abort(); break; }
-      int bc = *opptr++ & 0xFF;
-      bool isWide = false;
-      if (bc == bc_wide) {
-        if (opptr == oplimit) { abort(); break; }
-        bc = *opptr++ & 0xFF;
-        isWide = true;
-      }
-      // Adjust expectations of various band sizes.
-      switch (bc) {
-      case bc_tableswitch:
-      case bc_lookupswitch:
-        all_switch_ops.addByte(bc);
-        break;
-      case bc_iinc:
-        bc_local.expectMoreLength(1);
-        bc_which = isWide ? &bc_short : &bc_byte;
-        bc_which->expectMoreLength(1);
-        break;
-      case bc_sipush:
-        bc_short.expectMoreLength(1);
-        break;
-      case bc_bipush:
-        bc_byte.expectMoreLength(1);
-        break;
-      case bc_newarray:
-        bc_byte.expectMoreLength(1);
-        break;
-      case bc_multianewarray:
-        assert(ref_band_for_op(bc) == &bc_classref);
-        bc_classref.expectMoreLength(1);
-        bc_byte.expectMoreLength(1);
-        break;
-      case bc_ref_escape:
-        bc_escrefsize.expectMoreLength(1);
-        bc_escref.expectMoreLength(1);
-        break;
-      case bc_byte_escape:
-        bc_escsize.expectMoreLength(1);
-        // bc_escbyte will have to be counted too
-        break;
-      default:
-        if (is_invoke_init_op(bc)) {
-          bc_initref.expectMoreLength(1);
-          break;
-        }
-        bc_which = ref_band_for_self_op(bc, isAload, junkBC);
-        if (bc_which != null) {
-          bc_which->expectMoreLength(1);
-          break;
-        }
-        if (is_branch_op(bc)) {
-          bc_label.expectMoreLength(1);
-          break;
-        }
-        bc_which = ref_band_for_op(bc);
-        if (bc_which != null) {
-          bc_which->expectMoreLength(1);
-          assert(bc != bc_multianewarray);  // handled elsewhere
-          break;
-        }
-        if (is_local_slot_op(bc)) {
-          bc_local.expectMoreLength(1);
-          break;
-        }
-        break;
-      case bc_end_marker:
-        // Increment k and test against code_count.
-        goto doneScanningMethod;
-      }
-    }
-  doneScanningMethod:{}
-    if (aborting())  break;
-  }
-
-  // Go through the formality, so we can use it in a regular fashion later:
-  assert(rp == rp0);
-  bc_codes.readData((int)(opptr - rp));
-
-  int i = 0;
-
-  // To size instruction bands correctly, we need info on switches:
-  bc_case_count.readData((int)all_switch_ops.size());
-  for (i = 0; i < (int)all_switch_ops.size(); i++) {
-    int caseCount = bc_case_count.getInt();
-    int bc        = all_switch_ops.getByte(i);
-    bc_label.expectMoreLength(1+caseCount); // default label + cases
-    bc_case_value.expectMoreLength(bc == bc_tableswitch ? 1 : caseCount);
-    PRINTCR((2, "switch bc=%d caseCount=%d", bc, caseCount));
-  }
-  bc_case_count.rewind();  // uses again for output
-
-  all_switch_ops.free();
-
-  for (i = e_bc_case_value; i <= e_bc_escsize; i++) {
-    all_bands[i].readData();
-  }
-
-  // The bc_escbyte band is counted by the immediately previous band.
-  bc_escbyte.readData(bc_escsize.getIntTotal());
-
-  PRINTCR((3, "scanned %d opcode and %d operand bytes for %d codes...",
-          (int)(bc_codes.size()),
-          (int)(bc_escsize.maxRP() - bc_case_value.minRP()),
-          code_count));
-}
-
-void unpacker::read_bands() {
-  byte* rp0 = rp;
-  CHECK;
-  read_file_header();
-  CHECK;
-
-  if (cp.nentries == 0) {
-    // read_file_header failed to read a CP, because it copied a JAR.
-    return;
-  }
-
-  // Do this after the file header has been read:
-  check_options();
-
-  read_cp();
-  CHECK;
-  read_attr_defs();
-  CHECK;
-  read_ics();
-  CHECK;
-  read_classes();
-  CHECK;
-  read_bcs();
-  CHECK;
-  read_files();
-}
-
-/// CP routines
-
-entry*& cpool::hashTabRef(byte tag, bytes& b) {
-  PRINTCR((5, "hashTabRef tag=%d %s[%d]", tag, b.string(), b.len));
-  uint hash = tag + (int)b.len;
-  for (int i = 0; i < (int)b.len; i++) {
-    hash = hash * 31 + (0xFF & b.ptr[i]);
-  }
-  entry**  ht = hashTab;
-  int    hlen = hashTabLength;
-  assert((hlen & (hlen-1)) == 0);  // must be power of 2
-  uint hash1 = hash & (hlen-1);    // == hash % hlen
-  uint hash2 = 0;                  // lazily computed (requires mod op.)
-  int probes = 0;
-  while (ht[hash1] != null) {
-    entry& e = *ht[hash1];
-    if (e.value.b.equals(b) && e.tag == tag)
-      break;
-    if (hash2 == 0)
-      // Note:  hash2 must be relatively prime to hlen, hence the "|1".
-      hash2 = (((hash % 499) & (hlen-1)) | 1);
-    hash1 += hash2;
-    if (hash1 >= (uint)hlen)  hash1 -= hlen;
-    assert(hash1 < (uint)hlen);
-    assert(++probes < hlen);
-  }
-  #ifndef PRODUCT
-  hash_probes[0] += 1;
-  hash_probes[1] += probes;
-  #endif
-  PRINTCR((5, " => @%d %p", hash1, ht[hash1]));
-  return ht[hash1];
-}
-
-maybe_inline
-static void insert_extra(entry* e, ptrlist& extras) {
-  // This ordering helps implement the Pack200 requirement
-  // of a predictable CP order in the class files produced.
-  e->inord = NO_INORD;  // mark as an "extra"
-  extras.add(e);
-  // Note:  We will sort the list (by string-name) later.
-}
-
-entry* cpool::ensureUtf8(bytes& b) {
-  entry*& ix = hashTabRef(CONSTANT_Utf8, b);
-  if (ix != null)  return ix;
-  // Make one.
-  if (nentries == maxentries) {
-    abort("cp utf8 overflow");
-    return &entries[tag_base[CONSTANT_Utf8]];  // return something
-  }
-  entry& e = entries[nentries++];
-  e.tag = CONSTANT_Utf8;
-  u->saveTo(e.value.b, b);
-  assert(&e >= first_extra_entry);
-  insert_extra(&e, tag_extras[CONSTANT_Utf8]);
-  PRINTCR((4,"ensureUtf8 miss %s", e.string()));
-  return ix = &e;
-}
-
-entry* cpool::ensureClass(bytes& b) {
-  entry*& ix = hashTabRef(CONSTANT_Class, b);
-  if (ix != null)  return ix;
-  // Make one.
-  if (nentries == maxentries) {
-    abort("cp class overflow");
-    return &entries[tag_base[CONSTANT_Class]];  // return something
-  }
-  entry& e = entries[nentries++];
-  e.tag = CONSTANT_Class;
-  e.nrefs = 1;
-  e.refs = U_NEW(entry*, 1);
-  ix = &e;  // hold my spot in the index
-  entry* utf = ensureUtf8(b);
-  e.refs[0] = utf;
-  e.value.b = utf->value.b;
-  assert(&e >= first_extra_entry);
-  insert_extra(&e, tag_extras[CONSTANT_Class]);
-  PRINTCR((4,"ensureClass miss %s", e.string()));
-  return &e;
-}
-
-void cpool::expandSignatures() {
-  int i;
-  int nsigs = 0;
-  int nreused = 0;
-  int first_sig = tag_base[CONSTANT_Signature];
-  int sig_limit = tag_count[CONSTANT_Signature] + first_sig;
-  fillbytes buf;
-  buf.init(1<<10);
-  CHECK;
-  for (i = first_sig; i < sig_limit; i++) {
-    entry& e = entries[i];
-    assert(e.tag == CONSTANT_Signature);
-    int refnum = 0;
-    bytes form = e.refs[refnum++]->asUtf8();
-    buf.empty();
-    for (int j = 0; j < (int)form.len; j++) {
-      int c = form.ptr[j];
-      buf.addByte(c);
-      if (c == 'L') {
-        entry* cls = e.refs[refnum++];
-        buf.append(cls->className()->asUtf8());
-      }
-    }
-    assert(refnum == e.nrefs);
-    bytes& sig = buf.b;
-    PRINTCR((5,"signature %d %s -> %s", i, form.ptr, sig.ptr));
-
-    // try to find a pre-existing Utf8:
-    entry* &e2 = hashTabRef(CONSTANT_Utf8, sig);
-    if (e2 != null) {
-      assert(e2->isUtf8(sig));
-      e.value.b = e2->value.b;
-      e.refs[0] = e2;
-      e.nrefs = 1;
-      PRINTCR((5,"signature replaced %d => %s", i, e.string()));
-      nreused++;
-    } else {
-      // there is no other replacement; reuse this CP entry as a Utf8
-      u->saveTo(e.value.b, sig);
-      e.tag = CONSTANT_Utf8;
-      e.nrefs = 0;
-      e2 = &e;
-      PRINTCR((5,"signature changed %d => %s", e.inord, e.string()));
-    }
-    nsigs++;
-  }
-  PRINTCR((1,"expanded %d signatures (reused %d utfs)", nsigs, nreused));
-  buf.free();
-
-  // go expunge all references to remaining signatures:
-  for (i = 0; i < (int)nentries; i++) {
-    entry& e = entries[i];
-    for (int j = 0; j < e.nrefs; j++) {
-      entry*& e2 = e.refs[j];
-      if (e2 != null && e2->tag == CONSTANT_Signature)
-        e2 = e2->refs[0];
-    }
-  }
-}
-
-bool isLoadableValue(int tag) {
-  switch(tag) {
-    case CONSTANT_Integer:
-    case CONSTANT_Float:
-    case CONSTANT_Long:
-    case CONSTANT_Double:
-    case CONSTANT_String:
-    case CONSTANT_Class:
-    case CONSTANT_MethodHandle:
-    case CONSTANT_MethodType:
-      return true;
-    default:
-      return false;
-  }
-}
-/*
- * this method can be used to size an array using null as the parameter,
- * thereafter can be reused to initialize the array using a valid pointer
- * as a parameter.
- */
-int cpool::initLoadableValues(entry** loadable_entries) {
-  int loadable_count = 0;
-  for (int i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
-    int tag = TAGS_IN_ORDER[i];
-    if (!isLoadableValue(tag))
-      continue;
-    if (loadable_entries != NULL) {
-      for (int n = 0 ; n < tag_count[tag] ; n++) {
-        loadable_entries[loadable_count + n] = &entries[tag_base[tag] + n];
-      }
-    }
-    loadable_count += tag_count[tag];
-  }
-  return loadable_count;
-}
-
-// Initialize various views into the constant pool.
-void cpool::initGroupIndexes() {
-  // Initialize All
-  int all_count = 0;
-  for (int tag = CONSTANT_None ; tag < CONSTANT_Limit ; tag++) {
-    all_count += tag_count[tag];
-  }
-  entry* all_entries = &entries[tag_base[CONSTANT_None]];
-  tag_group_count[CONSTANT_All - CONSTANT_All] = all_count;
-  tag_group_index[CONSTANT_All - CONSTANT_All].init(all_count, all_entries, CONSTANT_All);
-
-  // Initialize LoadableValues
-  int loadable_count = initLoadableValues(NULL);
-  entry** loadable_entries = U_NEW(entry*, loadable_count);
-  initLoadableValues(loadable_entries);
-  tag_group_count[CONSTANT_LoadableValue - CONSTANT_All] = loadable_count;
-  tag_group_index[CONSTANT_LoadableValue - CONSTANT_All].init(loadable_count,
-                  loadable_entries, CONSTANT_LoadableValue);
-
-// Initialize AnyMembers
-  int any_count = tag_count[CONSTANT_Fieldref] +
-                  tag_count[CONSTANT_Methodref] +
-                  tag_count[CONSTANT_InterfaceMethodref];
-  entry *any_entries = &entries[tag_base[CONSTANT_Fieldref]];
-  tag_group_count[CONSTANT_AnyMember - CONSTANT_All] = any_count;
-  tag_group_index[CONSTANT_AnyMember - CONSTANT_All].init(any_count,
-                                               any_entries, CONSTANT_AnyMember);
-}
-
-void cpool::initMemberIndexes() {
-  // This function does NOT refer to any class schema.
-  // It is totally internal to the cpool.
-  int i, j;
-
-  // Get the pre-existing indexes:
-  int   nclasses = tag_count[CONSTANT_Class];
-  entry* classes = tag_base[CONSTANT_Class] + entries;
-  int   nfields  = tag_count[CONSTANT_Fieldref];
-  entry* fields  = tag_base[CONSTANT_Fieldref] + entries;
-  int   nmethods = tag_count[CONSTANT_Methodref];
-  entry* methods = tag_base[CONSTANT_Methodref] + entries;
-
-  int*     field_counts  = T_NEW(int, nclasses);
-  int*     method_counts = T_NEW(int, nclasses);
-  cpindex* all_indexes   = U_NEW(cpindex, nclasses*2);
-  entry**  field_ix      = U_NEW(entry*, add_size(nfields, nclasses));
-  entry**  method_ix     = U_NEW(entry*, add_size(nmethods, nclasses));
-
-  for (j = 0; j < nfields; j++) {
-    entry& f = fields[j];
-    i = f.memberClass()->inord;
-    assert(i < nclasses);
-    field_counts[i]++;
-  }
-  for (j = 0; j < nmethods; j++) {
-    entry& m = methods[j];
-    i = m.memberClass()->inord;
-    assert(i < nclasses);
-    method_counts[i]++;
-  }
-
-  int fbase = 0, mbase = 0;
-  for (i = 0; i < nclasses; i++) {
-    int fc = field_counts[i];
-    int mc = method_counts[i];
-    all_indexes[i*2+0].init(fc, field_ix+fbase,
-                            CONSTANT_Fieldref  + SUBINDEX_BIT);
-    all_indexes[i*2+1].init(mc, method_ix+mbase,
-                            CONSTANT_Methodref + SUBINDEX_BIT);
-    // reuse field_counts and member_counts as fill pointers:
-    field_counts[i] = fbase;
-    method_counts[i] = mbase;
-    PRINTCR((3, "class %d fields @%d[%d] methods @%d[%d]",
-            i, fbase, fc, mbase, mc));
-    fbase += fc+1;
-    mbase += mc+1;
-    // (the +1 leaves a space between every subarray)
-  }
-  assert(fbase == nfields+nclasses);
-  assert(mbase == nmethods+nclasses);
-
-  for (j = 0; j < nfields; j++) {
-    entry& f = fields[j];
-    i = f.memberClass()->inord;
-    field_ix[field_counts[i]++] = &f;
-  }
-  for (j = 0; j < nmethods; j++) {
-    entry& m = methods[j];
-    i = m.memberClass()->inord;
-    method_ix[method_counts[i]++] = &m;
-  }
-
-  member_indexes = all_indexes;
-
-#ifndef PRODUCT
-  // Test the result immediately on every class and field.
-  int fvisited = 0, mvisited = 0;
-  int prevord, len;
-  for (i = 0; i < nclasses; i++) {
-    entry*   cls = &classes[i];
-    cpindex* fix = getFieldIndex(cls);
-    cpindex* mix = getMethodIndex(cls);
-    PRINTCR((2, "field and method index for %s [%d] [%d]",
-            cls->string(), mix->len, fix->len));
-    prevord = -1;
-    for (j = 0, len = fix->len; j < len; j++) {
-      entry* f = fix->get(j);
-      assert(f != null);
-      PRINTCR((3, "- field %s", f->string()));
-      assert(f->memberClass() == cls);
-      assert(prevord < (int)f->inord);
-      prevord = f->inord;
-      fvisited++;
-    }
-    assert(fix->base2[j] == null);
-    prevord = -1;
-    for (j = 0, len = mix->len; j < len; j++) {
-      entry* m = mix->get(j);
-      assert(m != null);
-      PRINTCR((3, "- method %s", m->string()));
-      assert(m->memberClass() == cls);
-      assert(prevord < (int)m->inord);
-      prevord = m->inord;
-      mvisited++;
-    }
-    assert(mix->base2[j] == null);
-  }
-  assert(fvisited == nfields);
-  assert(mvisited == nmethods);
-#endif
-
-  // Free intermediate buffers.
-  u->free_temps();
-}
-
-void entry::requestOutputIndex(cpool& cp, int req) {
-  assert(outputIndex <= REQUESTED_NONE);  // must not have assigned indexes yet
-  if (tag == CONSTANT_Signature) {
-    ref(0)->requestOutputIndex(cp, req);
-    return;
-  }
-  assert(req == REQUESTED || req == REQUESTED_LDC);
-  if (outputIndex != REQUESTED_NONE) {
-    if (req == REQUESTED_LDC)
-      outputIndex = req;  // this kind has precedence
-    return;
-  }
-  outputIndex = req;
-  //assert(!cp.outputEntries.contains(this));
-  assert(tag != CONSTANT_Signature);
-  // The BSMs are jetisoned to a side table, however all references
-  // that the BSMs refer to,  need to be considered.
-  if (tag == CONSTANT_BootstrapMethod) {
-    // this is a a pseudo-op entry; an attribute will be generated later on
-    cp.requested_bsms.add(this);
-  } else {
-    // all other tag types go into real output file CP:
-    cp.outputEntries.add(this);
-  }
-  for (int j = 0; j < nrefs; j++) {
-    ref(j)->requestOutputIndex(cp);
-  }
-}
-
-void cpool::resetOutputIndexes() {
-    /*
-     * reset those few entries that are being used in the current class
-     * (Caution since this method is called after every class written, a loop
-     * over every global constant pool entry would be a quadratic cost.)
-     */
-
-  int noes    = outputEntries.length();
-  entry** oes = (entry**) outputEntries.base();
-  for (int i = 0 ; i < noes ; i++) {
-    entry& e = *oes[i];
-    e.outputIndex = REQUESTED_NONE;
-  }
-
-  // do the same for bsms and reset them if required
-  int nbsms = requested_bsms.length();
-  entry** boes = (entry**) requested_bsms.base();
-  for (int i = 0 ; i < nbsms ; i++) {
-    entry& e = *boes[i];
-    e.outputIndex = REQUESTED_NONE;
-  }
-  outputIndexLimit = 0;
-  outputEntries.empty();
-#ifndef PRODUCT
-  // ensure things are cleared out
-  for (int i = 0; i < (int)maxentries; i++)
-    assert(entries[i].outputIndex == REQUESTED_NONE);
-#endif
-}
-
-static const byte TAG_ORDER[CONSTANT_Limit] = {
-  0, 1, 0, 2, 3, 4, 5, 7, 6, 10, 11, 12, 9, 8, 0, 13, 14, 15, 16
-};
-
-extern "C"
-int outputEntry_cmp(const void* e1p, const void* e2p) {
-  // Sort entries according to the Pack200 rules for deterministic
-  // constant pool ordering.
-  //
-  // The four sort keys as follows, in order of decreasing importance:
-  //   1. ldc first, then non-ldc guys
-  //   2. normal cp_All entries by input order (i.e., address order)
-  //   3. after that, extra entries by lexical order (as in tag_extras[*])
-  entry& e1 = *(entry*) *(void**) e1p;
-  entry& e2 = *(entry*) *(void**) e2p;
-  int   oi1 = e1.outputIndex;
-  int   oi2 = e2.outputIndex;
-  assert(oi1 == REQUESTED || oi1 == REQUESTED_LDC);
-  assert(oi2 == REQUESTED || oi2 == REQUESTED_LDC);
-  if (oi1 != oi2) {
-    if (oi1 == REQUESTED_LDC)  return 0-1;
-    if (oi2 == REQUESTED_LDC)  return 1-0;
-    // Else fall through; neither is an ldc request.
-  }
-  if (e1.inord != NO_INORD || e2.inord != NO_INORD) {
-    // One or both is normal.  Use input order.
-    if (&e1 > &e2)  return 1-0;
-    if (&e1 < &e2)  return 0-1;
-    return 0;  // equal pointers
-  }
-  // Both are extras.  Sort by tag and then by value.
-  if (e1.tag != e2.tag) {
-    return TAG_ORDER[e1.tag] - TAG_ORDER[e2.tag];
-  }
-  // If the tags are the same, use string comparison.
-  return compare_Utf8_chars(e1.value.b, e2.value.b);
-}
-
-void cpool::computeOutputIndexes() {
-  int i;
-
-#ifndef PRODUCT
-  // outputEntries must be a complete list of those requested:
-  static uint checkStart = 0;
-  int checkStep = 1;
-  if (nentries > 100)  checkStep = nentries / 100;
-  for (i = (int)(checkStart++ % checkStep); i < (int)nentries; i += checkStep) {
-    entry& e = entries[i];
-    if (e.tag == CONSTANT_BootstrapMethod) {
-      if (e.outputIndex != REQUESTED_NONE) {
-        assert(requested_bsms.contains(&e));
-      } else {
-        assert(!requested_bsms.contains(&e));
-      }
-    } else {
-      if (e.outputIndex != REQUESTED_NONE) {
-        assert(outputEntries.contains(&e));
-      } else {
-        assert(!outputEntries.contains(&e));
-      }
-    }
-  }
-
-  // check hand-initialization of TAG_ORDER
-  for (i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
-    byte tag = TAGS_IN_ORDER[i];
-    assert(TAG_ORDER[tag] == i+1);
-  }
-#endif
-
-  int    noes =           outputEntries.length();
-  entry** oes = (entry**) outputEntries.base();
-
-  // Sort the output constant pool into the order required by Pack200.
-  PTRLIST_QSORT(outputEntries, outputEntry_cmp);
-
-  // Allocate a new index for each entry that needs one.
-  // We do this in two passes, one for LDC entries and one for the rest.
-  int nextIndex = 1;  // always skip index #0 in output cpool
-  for (i = 0; i < noes; i++) {
-    entry& e = *oes[i];
-    assert(e.outputIndex >= REQUESTED_LDC);
-    e.outputIndex = nextIndex++;
-    if (e.isDoubleWord())  nextIndex++;  // do not use the next index
-  }
-  outputIndexLimit = nextIndex;
-  PRINTCR((3,"renumbering CP to %d entries", outputIndexLimit));
-}
-
-#ifndef PRODUCT
-// debugging goo
-
-unpacker* debug_u;
-
-static bytes& getbuf(int len) {  // for debugging only!
-  static int bn = 0;
-  static bytes bufs[8];
-  bytes& buf = bufs[bn++ & 7];
-  while ((int)buf.len < len+10)
-    buf.realloc(buf.len ? buf.len * 2 : 1000);
-  buf.ptr[0] = 0;  // for the sake of strcat
-  return buf;
-}
-
-char* entry::string() {
-  bytes buf;
-  switch (tag) {
-  case CONSTANT_None:
-    return (char*)"<empty>";
-  case CONSTANT_Signature:
-    if (value.b.ptr == null)
-      return ref(0)->string();
-    // else fall through:
-  case CONSTANT_Utf8:
-    buf = value.b;
-    break;
-  case CONSTANT_Integer:
-  case CONSTANT_Float:
-    buf = getbuf(12);
-    sprintf((char*)buf.ptr, "0x%08x", value.i);
-    break;
-  case CONSTANT_Long:
-  case CONSTANT_Double:
-    buf = getbuf(24);
-    sprintf((char*)buf.ptr, "0x" LONG_LONG_HEX_FORMAT, value.l);
-    break;
-  default:
-    if (nrefs == 0) {
-      buf = getbuf(20);
-      sprintf((char*)buf.ptr, TAG_NAME[tag]);
-    } else if (nrefs == 1) {
-      return refs[0]->string();
-    } else {
-      char* s1 = refs[0]->string();
-      char* s2 = refs[1]->string();
-      buf = getbuf((int)strlen(s1) + 1 + (int)strlen(s2) + 4 + 1);
-      buf.strcat(s1).strcat(" ").strcat(s2);
-      if (nrefs > 2)  buf.strcat(" ...");
-    }
-  }
-  return (char*)buf.ptr;
-}
-
-void print_cp_entry(int i) {
-  entry& e = debug_u->cp.entries[i];
-  char buf[30];
-  sprintf(buf, ((uint)e.tag < CONSTANT_Limit)? TAG_NAME[e.tag]: "%d", e.tag);
-  printf(" %d\t%s %s\n", i, buf, e.string());
-}
-
-void print_cp_entries(int beg, int end) {
-  for (int i = beg; i < end; i++)
-    print_cp_entry(i);
-}
-
-void print_cp() {
-  print_cp_entries(0, debug_u->cp.nentries);
-}
-
-#endif
-
-// Unpacker Start
-
-const char str_tf[] = "true\0false";
-#undef STR_TRUE
-#undef STR_FALSE
-#define STR_TRUE   (&str_tf[0])
-#define STR_FALSE  (&str_tf[5])
-
-const char* unpacker::get_option(const char* prop) {
-  if (prop == null )  return null;
-  if (strcmp(prop, UNPACK_DEFLATE_HINT) == 0) {
-    return deflate_hint_or_zero == 0? null : STR_TF(deflate_hint_or_zero > 0);
-#ifdef HAVE_STRIP
-  } else if (strcmp(prop, UNPACK_STRIP_COMPILE) == 0) {
-    return STR_TF(strip_compile);
-  } else if (strcmp(prop, UNPACK_STRIP_DEBUG) == 0) {
-    return STR_TF(strip_debug);
-  } else if (strcmp(prop, UNPACK_STRIP_JCOV) == 0) {
-    return STR_TF(strip_jcov);
-#endif /*HAVE_STRIP*/
-  } else if (strcmp(prop, UNPACK_REMOVE_PACKFILE) == 0) {
-    return STR_TF(remove_packfile);
-  } else if (strcmp(prop, DEBUG_VERBOSE) == 0) {
-    return saveIntStr(verbose);
-  } else if (strcmp(prop, UNPACK_MODIFICATION_TIME) == 0) {
-    return (modification_time_or_zero == 0)? null:
-      saveIntStr(modification_time_or_zero);
-  } else if (strcmp(prop, UNPACK_LOG_FILE) == 0) {
-    return log_file;
-  } else {
-    return NULL; // unknown option ignore
-  }
-}
-
-bool unpacker::set_option(const char* prop, const char* value) {
-  if (prop == NULL)  return false;
-  if (strcmp(prop, UNPACK_DEFLATE_HINT) == 0) {
-    deflate_hint_or_zero = ( (value == null || strcmp(value, "keep") == 0)
-                                ? 0: BOOL_TF(value) ? +1: -1);
-#ifdef HAVE_STRIP
-  } else if (strcmp(prop, UNPACK_STRIP_COMPILE) == 0) {
-    strip_compile = STR_TF(value);
-  } else if (strcmp(prop, UNPACK_STRIP_DEBUG) == 0) {
-    strip_debug = STR_TF(value);
-  } else if (strcmp(prop, UNPACK_STRIP_JCOV) == 0) {
-    strip_jcov = STR_TF(value);
-#endif /*HAVE_STRIP*/
-  } else if (strcmp(prop, UNPACK_REMOVE_PACKFILE) == 0) {
-    remove_packfile = STR_TF(value);
-  } else if (strcmp(prop, DEBUG_VERBOSE) == 0) {
-    verbose = (value == null)? 0: atoi(value);
-  } else if (strcmp(prop, DEBUG_VERBOSE ".bands") == 0) {
-#ifndef PRODUCT
-    verbose_bands = (value == null)? 0: atoi(value);
-#endif
-  } else if (strcmp(prop, UNPACK_MODIFICATION_TIME) == 0) {
-    if (value == null || (strcmp(value, "keep") == 0)) {
-      modification_time_or_zero = 0;
-    } else if (strcmp(value, "now") == 0) {
-      time_t now;
-      time(&now);
-      modification_time_or_zero = (int) now;
-    } else {
-      modification_time_or_zero = atoi(value);
-      if (modification_time_or_zero == 0)
-        modification_time_or_zero = 1;  // make non-zero
-    }
-  } else if (strcmp(prop, UNPACK_LOG_FILE) == 0) {
-    log_file = (value == null)? value: saveStr(value);
-  } else {
-    return false; // unknown option ignore
-  }
-  return true;
-}
-
-// Deallocate all internal storage and reset to a clean state.
-// Do not disturb any input or output connections, including
-// infileptr, infileno, inbytes, read_input_fn, jarout, or errstrm.
-// Do not reset any unpack options.
-void unpacker::reset() {
-  bytes_read_before_reset      += bytes_read;
-  bytes_written_before_reset   += bytes_written;
-  files_written_before_reset   += files_written;
-  classes_written_before_reset += classes_written;
-  segments_read_before_reset   += 1;
-  if (verbose >= 2) {
-    fprintf(errstrm,
-            "After segment %d, "
-            LONG_LONG_FORMAT " bytes read and "
-            LONG_LONG_FORMAT " bytes written.\n",
-            segments_read_before_reset-1,
-            bytes_read_before_reset, bytes_written_before_reset);
-    fprintf(errstrm,
-            "After segment %d, %d files (of which %d are classes) written to output.\n",
-            segments_read_before_reset-1,
-            files_written_before_reset, classes_written_before_reset);
-    if (archive_next_count != 0) {
-      fprintf(errstrm,
-              "After segment %d, %d segment%s remaining (estimated).\n",
-              segments_read_before_reset-1,
-              archive_next_count, archive_next_count==1?"":"s");
-    }
-  }
-
-  unpacker save_u = (*this);  // save bytewise image
-  infileptr = null;  // make asserts happy
-  jniobj = null;  // make asserts happy
-  jarout = null;  // do not close the output jar
-  gzin = null;  // do not close the input gzip stream
-  bytes esn;
-  if (errstrm_name != null) {
-    esn.saveFrom(errstrm_name);
-  } else {
-    esn.set(null, 0);
-  }
-  this->free();
-  mtrace('s', 0, 0);  // note the boundary between segments
-  this->init(read_input_fn);
-
-  // restore selected interface state:
-#define SAVE(x) this->x = save_u.x
-  SAVE(jniobj);
-  SAVE(jnienv);
-  SAVE(infileptr);  // buffered
-  SAVE(infileno);   // unbuffered
-  SAVE(inbytes);    // direct
-  SAVE(jarout);
-  SAVE(gzin);
-  //SAVE(read_input_fn);
-  SAVE(errstrm);
-  SAVE(verbose);  // verbose level, 0 means no output
-  SAVE(strip_compile);
-  SAVE(strip_debug);
-  SAVE(strip_jcov);
-  SAVE(remove_packfile);
-  SAVE(deflate_hint_or_zero);  // ==0 means not set, otherwise -1 or 1
-  SAVE(modification_time_or_zero);
-  SAVE(bytes_read_before_reset);
-  SAVE(bytes_written_before_reset);
-  SAVE(files_written_before_reset);
-  SAVE(classes_written_before_reset);
-  SAVE(segments_read_before_reset);
-#undef SAVE
-  if (esn.len > 0) {
-    errstrm_name = saveStr(esn.strval());
-    esn.free();
-  }
-  log_file = errstrm_name;
-  // Note:  If we use strip_names, watch out:  They get nuked here.
-}
-
-void unpacker::init(read_input_fn_t input_fn) {
-  int i;
-  NOT_PRODUCT(debug_u = this);
-  BYTES_OF(*this).clear();
-#ifndef PRODUCT
-  free();  // just to make sure freeing is idempotent
-#endif
-  this->u = this;    // self-reference for U_NEW macro
-  errstrm = stdout;  // default error-output
-  log_file = LOGFILE_STDOUT;
-  read_input_fn = input_fn;
-  all_bands = band::makeBands(this);
-  // Make a default jar buffer; caller may safely overwrite it.
-  jarout = U_NEW(jar, 1);
-  jarout->init(this);
-  for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
-    attr_defs[i].u = u;  // set up outer ptr
-}
-
-const char* unpacker::get_abort_message() {
-   return abort_message;
-}
-
-void unpacker::dump_options() {
-  static const char* opts[] = {
-    UNPACK_LOG_FILE,
-    UNPACK_DEFLATE_HINT,
-#ifdef HAVE_STRIP
-    UNPACK_STRIP_COMPILE,
-    UNPACK_STRIP_DEBUG,
-    UNPACK_STRIP_JCOV,
-#endif /*HAVE_STRIP*/
-    UNPACK_REMOVE_PACKFILE,
-    DEBUG_VERBOSE,
-    UNPACK_MODIFICATION_TIME,
-    null
-  };
-  for (int i = 0; opts[i] != null; i++) {
-    const char* str = get_option(opts[i]);
-    if (str == null) {
-      if (verbose == 0)  continue;
-      str = "(not set)";
-    }
-    fprintf(errstrm, "%s=%s\n", opts[i], str);
-  }
-}
-
-
-// Usage: unpack a byte buffer
-// packptr is a reference to byte buffer containing a
-// packed file and len is the length of the buffer.
-// If null, the callback is used to fill an internal buffer.
-void unpacker::start(void* packptr, size_t len) {
-  CHECK;
-  NOT_PRODUCT(debug_u = this);
-  if (packptr != null && len != 0) {
-    inbytes.set((byte*) packptr, len);
-  }
-  CHECK;
-  read_bands();
-}
-
-void unpacker::check_options() {
-  const char* strue  = "true";
-  const char* sfalse = "false";
-  if (deflate_hint_or_zero != 0) {
-    bool force_deflate_hint = (deflate_hint_or_zero > 0);
-    if (force_deflate_hint)
-      default_file_options |= FO_DEFLATE_HINT;
-    else
-      default_file_options &= ~FO_DEFLATE_HINT;
-    // Turn off per-file deflate hint by force.
-    suppress_file_options |= FO_DEFLATE_HINT;
-  }
-  if (modification_time_or_zero != 0) {
-    default_file_modtime = modification_time_or_zero;
-    // Turn off per-file modtime by force.
-    archive_options &= ~AO_HAVE_FILE_MODTIME;
-  }
-  // %%% strip_compile, etc...
-}
-
-// classfile writing
-
-void unpacker::reset_cur_classfile() {
-  // set defaults
-  cur_class_minver = default_class_minver;
-  cur_class_majver = default_class_majver;
-
-  // reset constant pool state
-  cp.resetOutputIndexes();
-
-  // reset fixups
-  class_fixup_type.empty();
-  class_fixup_offset.empty();
-  class_fixup_ref.empty();
-  requested_ics.empty();
-  cp.requested_bsms.empty();
-}
-
-cpindex* cpool::getKQIndex() {
-  char ch = '?';
-  if (u->cur_descr != null) {
-    entry* type = u->cur_descr->descrType();
-    ch = type->value.b.ptr[0];
-  }
-  byte tag = CONSTANT_Integer;
-  switch (ch) {
-  case 'L': tag = CONSTANT_String;   break;
-  case 'I': tag = CONSTANT_Integer;  break;
-  case 'J': tag = CONSTANT_Long;     break;
-  case 'F': tag = CONSTANT_Float;    break;
-  case 'D': tag = CONSTANT_Double;   break;
-  case 'B': case 'S': case 'C':
-  case 'Z': tag = CONSTANT_Integer;  break;
-  default:  abort("bad KQ reference"); break;
-  }
-  return getIndex(tag);
-}
-
-uint unpacker::to_bci(uint bii) {
-  uint  len =         bcimap.length();
-  uint* map = (uint*) bcimap.base();
-  assert(len > 0);  // must be initialized before using to_bci
-  if (bii < len)
-    return map[bii];
-  // Else it's a fractional or out-of-range BCI.
-  uint key = bii-len;
-  for (int i = len; ; i--) {
-    if (map[i-1]-(i-1) <= key)
-      break;
-    else
-      --bii;
-  }
-  return bii;
-}
-
-void unpacker::put_stackmap_type() {
-  int tag = code_StackMapTable_T.getByte();
-  putu1(tag);
-  switch (tag) {
-  case 7: // (7) [RCH]
-    putref(code_StackMapTable_RC.getRef());
-    break;
-  case 8: // (8) [PH]
-    putu2(to_bci(code_StackMapTable_P.getInt()));
-    break;
-  }
-}
-
-// Functions for writing code.
-
-maybe_inline
-void unpacker::put_label(int curIP, int size) {
-  code_fixup_type.addByte(size);
-  code_fixup_offset.add((int)put_empty(size));
-  code_fixup_source.add(curIP);
-}
-
-inline  // called exactly once => inline
-void unpacker::write_bc_ops() {
-  bcimap.empty();
-  code_fixup_type.empty();
-  code_fixup_offset.empty();
-  code_fixup_source.empty();
-
-  band* bc_which;
-
-  byte*  opptr = bc_codes.curRP();
-  // No need for oplimit, since the codes are pre-counted.
-
-  size_t codeBase = wpoffset();
-
-  bool   isAload;  // copy-out result
-  int    origBC;
-
-  entry* thisClass  = cur_class;
-  entry* superClass = cur_super;
-  entry* newClass   = null;  // class of last _new opcode
-
-  // overwrite any prior index on these bands; it changes w/ current class:
-  bc_thisfield.setIndex(    cp.getFieldIndex( thisClass));
-  bc_thismethod.setIndex(   cp.getMethodIndex(thisClass));
-  if (superClass != null) {
-    bc_superfield.setIndex( cp.getFieldIndex( superClass));
-    bc_supermethod.setIndex(cp.getMethodIndex(superClass));
-  } else {
-    NOT_PRODUCT(bc_superfield.setIndex(null));
-    NOT_PRODUCT(bc_supermethod.setIndex(null));
-  }
-  CHECK;
-
-  for (int curIP = 0; ; curIP++) {
-    int curPC = (int)(wpoffset() - codeBase);
-    bcimap.add(curPC);
-    ensure_put_space(10);  // covers most instrs w/o further bounds check
-    int bc = *opptr++ & 0xFF;
-
-    putu1_fast(bc);
-    // Note:  See '--wp' below for pseudo-bytecodes like bc_end_marker.
-
-    bool isWide = false;
-    if (bc == bc_wide) {
-      bc = *opptr++ & 0xFF;
-      putu1_fast(bc);
-      isWide = true;
-    }
-    switch (bc) {
-    case bc_end_marker:
-      --wp;  // not really part of the code
-      assert(opptr <= bc_codes.maxRP());
-      bc_codes.curRP() = opptr;  // advance over this in bc_codes
-      goto doneScanningMethod;
-    case bc_tableswitch: // apc:  (df, lo, hi, (hi-lo+1)*(label))
-    case bc_lookupswitch: // apc:  (df, nc, nc*(case, label))
-      {
-        int caseCount = bc_case_count.getInt();
-        while (((wpoffset() - codeBase) % 4) != 0)  putu1_fast(0);
-        ensure_put_space(30 + caseCount*8);
-        put_label(curIP, 4);  //int df = bc_label.getInt();
-        if (bc == bc_tableswitch) {
-          int lo = bc_case_value.getInt();
-          int hi = lo + caseCount-1;
-          putu4(lo);
-          putu4(hi);
-          for (int j = 0; j < caseCount; j++) {
-            put_label(curIP, 4); //int lVal = bc_label.getInt();
-            //int cVal = lo + j;
-          }
-        } else {
-          putu4(caseCount);
-          for (int j = 0; j < caseCount; j++) {
-            int cVal = bc_case_value.getInt();
-            putu4(cVal);
-            put_label(curIP, 4); //int lVal = bc_label.getInt();
-          }
-        }
-        assert((int)to_bci(curIP) == curPC);
-        continue;
-      }
-    case bc_iinc:
-      {
-        int local = bc_local.getInt();
-        int delta = (isWide ? bc_short : bc_byte).getInt();
-        if (isWide) {
-          putu2(local);
-          putu2(delta);
-        } else {
-          putu1_fast(local);
-          putu1_fast(delta);
-        }
-        continue;
-      }
-    case bc_sipush:
-      {
-        int val = bc_short.getInt();
-        putu2(val);
-        continue;
-      }
-    case bc_bipush:
-    case bc_newarray:
-      {
-        int val = bc_byte.getByte();
-        putu1_fast(val);
-        continue;
-      }
-    case bc_ref_escape:
-      {
-        // Note that insnMap has one entry for this.
-        --wp;  // not really part of the code
-        int size = bc_escrefsize.getInt();
-        entry* ref = bc_escref.getRefN();
-        CHECK;
-        switch (size) {
-        case 1: putu1ref(ref); break;
-        case 2: putref(ref);   break;
-        default: assert(false);
-        }
-        continue;
-      }
-    case bc_byte_escape:
-      {
-        // Note that insnMap has one entry for all these bytes.
-        --wp;  // not really part of the code
-        int size = bc_escsize.getInt();
-        ensure_put_space(size);
-        for (int j = 0; j < size; j++)
-          putu1_fast(bc_escbyte.getByte());
-        continue;
-      }
-    default:
-      if (is_invoke_init_op(bc)) {
-        origBC = bc_invokespecial;
-        entry* classRef;
-        switch (bc - _invokeinit_op) {
-        case _invokeinit_self_option:   classRef = thisClass;  break;
-        case _invokeinit_super_option:  classRef = superClass; break;
-        default: assert(bc == _invokeinit_op+_invokeinit_new_option);
-        case _invokeinit_new_option:    classRef = newClass;   break;
-        }
-        wp[-1] = origBC;  // overwrite with origBC
-        int coding = bc_initref.getInt();
-        // Find the nth overloading of <init> in classRef.
-        entry*   ref = null;
-        cpindex* ix = cp.getMethodIndex(classRef);
-        CHECK;
-        for (int j = 0, which_init = 0; ; j++) {
-          ref = (ix == null)? null: ix->get(j);
-          if (ref == null)  break;  // oops, bad input
-          assert(ref->tag == CONSTANT_Methodref);
-          if (ref->memberDescr()->descrName() == cp.sym[cpool::s_lt_init_gt]) {
-            if (which_init++ == coding)  break;
-          }
-        }
-        putref(ref);
-        continue;
-      }
-      bc_which = ref_band_for_self_op(bc, isAload, origBC);
-      if (bc_which != null) {
-        if (!isAload) {
-          wp[-1] = origBC;  // overwrite with origBC
-        } else {
-          wp[-1] = bc_aload_0;  // overwrite with _aload_0
-          // Note: insnMap keeps the _aload_0 separate.
-          bcimap.add(++curPC);
-          ++curIP;
-          putu1_fast(origBC);
-        }
-        entry* ref = bc_which->getRef();
-        CHECK;
-        putref(ref);
-        continue;
-      }
-      if (is_branch_op(bc)) {
-        //int lVal = bc_label.getInt();
-        if (bc < bc_goto_w) {
-          put_label(curIP, 2);  //putu2(lVal & 0xFFFF);
-        } else {
-          assert(bc <= bc_jsr_w);
-          put_label(curIP, 4);  //putu4(lVal);
-        }
-        assert((int)to_bci(curIP) == curPC);
-        continue;
-      }
-      bc_which = ref_band_for_op(bc);
-      if (bc_which != null) {
-        entry* ref = bc_which->getRefCommon(bc_which->ix, bc_which->nullOK);
-        CHECK;
-        if (ref == null && bc_which == &bc_classref) {
-          // Shorthand for class self-references.
-          ref = thisClass;
-        }
-        origBC = bc;
-        switch (bc) {
-        case _invokestatic_int:
-          origBC = bc_invokestatic;
-          break;
-        case _invokespecial_int:
-          origBC = bc_invokespecial;
-          break;
-        case bc_ildc:
-        case bc_cldc:
-        case bc_fldc:
-        case bc_sldc:
-        case bc_qldc:
-          origBC = bc_ldc;
-          break;
-        case bc_ildc_w:
-        case bc_cldc_w:
-        case bc_fldc_w:
-        case bc_sldc_w:
-        case bc_qldc_w:
-          origBC = bc_ldc_w;
-          break;
-        case bc_lldc2_w:
-        case bc_dldc2_w:
-          origBC = bc_ldc2_w;
-          break;
-        case bc_new:
-          newClass = ref;
-          break;
-        }
-        wp[-1] = origBC;  // overwrite with origBC
-        if (origBC == bc_ldc) {
-          putu1ref(ref);
-        } else {
-          putref(ref);
-        }
-        if (origBC == bc_multianewarray) {
-          // Copy the trailing byte also.
-          int val = bc_byte.getByte();
-          putu1_fast(val);
-        } else if (origBC == bc_invokeinterface) {
-          int argSize = ref->memberDescr()->descrType()->typeSize();
-          putu1_fast(1 + argSize);
-          putu1_fast(0);
-        } else if (origBC == bc_invokedynamic) {
-          // pad the next two byte
-          putu1_fast(0);
-          putu1_fast(0);
-        }
-        continue;
-      }
-      if (is_local_slot_op(bc)) {
-        int local = bc_local.getInt();
-        if (isWide) {
-          putu2(local);
-          if (bc == bc_iinc) {
-            int iVal = bc_short.getInt();
-            putu2(iVal);
-          }
-        } else {
-          putu1_fast(local);
-          if (bc == bc_iinc) {
-            int iVal = bc_byte.getByte();
-            putu1_fast(iVal);
-          }
-        }
-        continue;
-      }
-      // Random bytecode.  Just copy it.
-      assert(bc < bc_bytecode_limit);
-    }
-  }
- doneScanningMethod:{}
-  //bcimap.add(curPC);  // PC limit is already also in map, from bc_end_marker
-
-  // Armed with a bcimap, we can now fix up all the labels.
-  for (int i = 0; i < (int)code_fixup_type.size(); i++) {
-    int   type   = code_fixup_type.getByte(i);
-    byte* bp     = wp_at(code_fixup_offset.get(i));
-    int   curIP  = code_fixup_source.get(i);
-    int   destIP = curIP + bc_label.getInt();
-    int   span   = to_bci(destIP) - to_bci(curIP);
-    switch (type) {
-    case 2: putu2_at(bp, (ushort)span); break;
-    case 4: putu4_at(bp,         span); break;
-    default: assert(false);
-    }
-  }
-}
-
-inline  // called exactly once => inline
-void unpacker::write_code() {
-  int j;
-
-  int max_stack, max_locals, handler_count, cflags;
-  get_code_header(max_stack, max_locals, handler_count, cflags);
-
-  if (max_stack < 0)      max_stack = code_max_stack.getInt();
-  if (max_locals < 0)     max_locals = code_max_na_locals.getInt();
-  if (handler_count < 0)  handler_count = code_handler_count.getInt();
-
-  int siglen = cur_descr->descrType()->typeSize();
-  CHECK;
-  if ((cur_descr_flags & ACC_STATIC) == 0)  siglen++;
-  max_locals += siglen;
-
-  putu2(max_stack);
-  putu2(max_locals);
-  size_t bcbase = put_empty(4);
-
-  // Write the bytecodes themselves.
-  write_bc_ops();
-  CHECK;
-
-  byte* bcbasewp = wp_at(bcbase);
-  putu4_at(bcbasewp, (int)(wp - (bcbasewp+4)));  // size of code attr
-
-  putu2(handler_count);
-  for (j = 0; j < handler_count; j++) {
-    int bii = code_handler_start_P.getInt();
-    putu2(to_bci(bii));
-    bii    += code_handler_end_PO.getInt();
-    putu2(to_bci(bii));
-    bii    += code_handler_catch_PO.getInt();
-    putu2(to_bci(bii));
-    putref(code_handler_class_RCN.getRefN());
-    CHECK;
-  }
-
-  julong indexBits = cflags;
-  if (cflags < 0) {
-    bool haveLongFlags = attr_defs[ATTR_CONTEXT_CODE].haveLongFlags();
-    indexBits = code_flags_hi.getLong(code_flags_lo, haveLongFlags);
-  }
-  write_attrs(ATTR_CONTEXT_CODE, indexBits);
-}
-
-int unpacker::write_attrs(int attrc, julong indexBits) {
-  CHECK_0;
-  if (indexBits == 0) {
-    // Quick short-circuit.
-    putu2(0);
-    return 0;
-  }
-
-  attr_definitions& ad = attr_defs[attrc];
-
-  int i, j, j2, idx, count;
-
-  int oiCount = 0;
-  if (ad.isPredefined(X_ATTR_OVERFLOW)
-      && (indexBits & ((julong)1<<X_ATTR_OVERFLOW)) != 0) {
-    indexBits -= ((julong)1<<X_ATTR_OVERFLOW);
-    oiCount = ad.xxx_attr_count().getInt();
-  }
-
-  int bitIndexes[X_ATTR_LIMIT_FLAGS_HI];
-  int biCount = 0;
-
-  // Fill bitIndexes with index bits, in order.
-  for (idx = 0; indexBits != 0; idx++, indexBits >>= 1) {
-    if ((indexBits & 1) != 0)
-      bitIndexes[biCount++] = idx;
-  }
-  assert(biCount <= (int)lengthof(bitIndexes));
-
-  // Write a provisional attribute count, perhaps to be corrected later.
-  int naOffset = (int)wpoffset();
-  int na0 = biCount + oiCount;
-  putu2(na0);
-
-  int na = 0;
-  for (i = 0; i < na0; i++) {
-    if (i < biCount)
-      idx = bitIndexes[i];
-    else
-      idx = ad.xxx_attr_indexes().getInt();
-    assert(ad.isIndex(idx));
-    entry* aname = null;
-    entry* ref;  // scratch
-    size_t abase = put_empty(2+4);
-    CHECK_0;
-    if (idx < (int)ad.flag_limit && ad.isPredefined(idx)) {
-      // Switch on the attrc and idx simultaneously.
-      switch (ADH_BYTE(attrc, idx)) {
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS,  X_ATTR_OVERFLOW):
-      case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_OVERFLOW):
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_OVERFLOW):
-      case ADH_BYTE(ATTR_CONTEXT_CODE,   X_ATTR_OVERFLOW):
-        // no attribute at all, so back up on this one
-        wp = wp_at(abase);
-        continue;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_ClassFile_version):
-        cur_class_minver = class_ClassFile_version_minor_H.getInt();
-        cur_class_majver = class_ClassFile_version_major_H.getInt();
-        // back up; not a real attribute
-        wp = wp_at(abase);
-        continue;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_InnerClasses):
-        // note the existence of this attr, but save for later
-        if (cur_class_has_local_ics)
-          abort("too many InnerClasses attrs");
-        cur_class_has_local_ics = true;
-        wp = wp_at(abase);
-        continue;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_SourceFile):
-        aname = cp.sym[cpool::s_SourceFile];
-        ref = class_SourceFile_RUN.getRefN();
-        CHECK_0;
-        if (ref == null) {
-          bytes& n = cur_class->ref(0)->value.b;
-          // parse n = (<pkg>/)*<outer>?($<id>)*
-          int pkglen = lastIndexOf(SLASH_MIN,  SLASH_MAX,  n, (int)n.len)+1;
-          bytes prefix = n.slice(pkglen, n.len);
-          for (;;) {
-            // Work backwards, finding all '$', '#', etc.
-            int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, (int)prefix.len);
-            if (dollar < 0)  break;
-            prefix = prefix.slice(0, dollar);
-          }
-          const char* suffix = ".java";
-          int len = (int)(prefix.len + strlen(suffix));
-          bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
-          name.strcat(prefix).strcat(suffix);
-          ref = cp.ensureUtf8(name);
-        }
-        putref(ref);
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS, CLASS_ATTR_EnclosingMethod):
-        aname = cp.sym[cpool::s_EnclosingMethod];
-        putref(class_EnclosingMethod_RC.getRefN());
-        CHECK_0;
-        putref(class_EnclosingMethod_RDN.getRefN());
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_FIELD, FIELD_ATTR_ConstantValue):
-        aname = cp.sym[cpool::s_ConstantValue];
-        putref(field_ConstantValue_KQ.getRefUsing(cp.getKQIndex()));
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Code):
-        aname = cp.sym[cpool::s_Code];
-        write_code();
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_Exceptions):
-        aname = cp.sym[cpool::s_Exceptions];
-        putu2(count = method_Exceptions_N.getInt());
-        for (j = 0; j < count; j++) {
-          putref(method_Exceptions_RC.getRefN());
-          CHECK_0;
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_MethodParameters):
-        aname = cp.sym[cpool::s_MethodParameters];
-        putu1(count = method_MethodParameters_NB.getByte());
-        for (j = 0; j < count; j++) {
-          putref(method_MethodParameters_name_RUN.getRefN());
-          putu2(method_MethodParameters_flag_FH.getInt());
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable):
-        aname = cp.sym[cpool::s_StackMapTable];
-        // (keep this code aligned with its brother in unpacker::read_attrs)
-        putu2(count = code_StackMapTable_N.getInt());
-        for (j = 0; j < count; j++) {
-          int tag = code_StackMapTable_frame_T.getByte();
-          putu1(tag);
-          if (tag <= 127) {
-            // (64-127)  [(2)]
-            if (tag >= 64)  put_stackmap_type();
-          } else if (tag <= 251) {
-            // (247)     [(1)(2)]
-            // (248-251) [(1)]
-            if (tag >= 247)  putu2(code_StackMapTable_offset.getInt());
-            if (tag == 247)  put_stackmap_type();
-          } else if (tag <= 254) {
-            // (252)     [(1)(2)]
-            // (253)     [(1)(2)(2)]
-            // (254)     [(1)(2)(2)(2)]
-            putu2(code_StackMapTable_offset.getInt());
-            CHECK_0;
-            for (int k = (tag - 251); k > 0; k--) {
-              put_stackmap_type();
-              CHECK_0;
-            }
-          } else {
-            // (255)     [(1)NH[(2)]NH[(2)]]
-            putu2(code_StackMapTable_offset.getInt());
-            putu2(j2 = code_StackMapTable_local_N.getInt());
-            while (j2-- > 0) {put_stackmap_type(); CHECK_0;}
-            putu2(j2 = code_StackMapTable_stack_N.getInt());
-            while (j2-- > 0)  {put_stackmap_type(); CHECK_0;}
-          }
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LineNumberTable):
-        aname = cp.sym[cpool::s_LineNumberTable];
-        putu2(count = code_LineNumberTable_N.getInt());
-        for (j = 0; j < count; j++) {
-          putu2(to_bci(code_LineNumberTable_bci_P.getInt()));
-          putu2(code_LineNumberTable_line.getInt());
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTable):
-        aname = cp.sym[cpool::s_LocalVariableTable];
-        putu2(count = code_LocalVariableTable_N.getInt());
-        for (j = 0; j < count; j++) {
-          int bii = code_LocalVariableTable_bci_P.getInt();
-          int bci = to_bci(bii);
-          putu2(bci);
-          bii    += code_LocalVariableTable_span_O.getInt();
-          putu2(to_bci(bii) - bci);
-          putref(code_LocalVariableTable_name_RU.getRefN());
-          CHECK_0;
-          putref(code_LocalVariableTable_type_RS.getRefN());
-          CHECK_0;
-          putu2(code_LocalVariableTable_slot.getInt());
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_LocalVariableTypeTable):
-        aname = cp.sym[cpool::s_LocalVariableTypeTable];
-        putu2(count = code_LocalVariableTypeTable_N.getInt());
-        for (j = 0; j < count; j++) {
-          int bii = code_LocalVariableTypeTable_bci_P.getInt();
-          int bci = to_bci(bii);
-          putu2(bci);
-          bii    += code_LocalVariableTypeTable_span_O.getInt();
-          putu2(to_bci(bii) - bci);
-          putref(code_LocalVariableTypeTable_name_RU.getRefN());
-          CHECK_0;
-          putref(code_LocalVariableTypeTable_type_RS.getRefN());
-          CHECK_0;
-          putu2(code_LocalVariableTypeTable_slot.getInt());
-        }
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS, X_ATTR_Signature):
-        aname = cp.sym[cpool::s_Signature];
-        putref(class_Signature_RS.getRefN());
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_FIELD, X_ATTR_Signature):
-        aname = cp.sym[cpool::s_Signature];
-        putref(field_Signature_RS.getRefN());
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Signature):
-        aname = cp.sym[cpool::s_Signature];
-        putref(method_Signature_RS.getRefN());
-        break;
-
-      case ADH_BYTE(ATTR_CONTEXT_CLASS,  X_ATTR_Deprecated):
-      case ADH_BYTE(ATTR_CONTEXT_FIELD,  X_ATTR_Deprecated):
-      case ADH_BYTE(ATTR_CONTEXT_METHOD, X_ATTR_Deprecated):
-        aname = cp.sym[cpool::s_Deprecated];
-        // no data
-        break;
-      }
-    }
-    CHECK_0;
-    if (aname == null) {
-      // Unparse a compressor-defined attribute.
-      layout_definition* lo = ad.getLayout(idx);
-      if (lo == null) {
-        abort("bad layout index");
-        break;
-      }
-      assert((int)lo->idx == idx);
-      aname = lo->nameEntry;
-      if (aname == null) {
-        bytes nameb; nameb.set(lo->name);
-        aname = cp.ensureUtf8(nameb);
-        // Cache the name entry for next time.
-        lo->nameEntry = aname;
-      }
-      // Execute all the layout elements.
-      band** bands = lo->bands();
-      if (lo->hasCallables()) {
-        band& cble = *bands[0];
-        assert(cble.le_kind == EK_CBLE);
-        bands = cble.le_body;
-      }
-      putlayout(bands);
-    }
-
-    if (aname == null)
-      abort("bad attribute index");
-    CHECK_0;
-
-    byte* wp1 = wp;
-    wp = wp_at(abase);
-
-    // DTRT if this attr is on the strip-list.
-    // (Note that we emptied the data out of the band first.)
-    if (ad.strip_names.contains(aname)) {
-      continue;
-    }
-
-    // patch the name and length
-    putref(aname);
-    putu4((int)(wp1 - (wp+4)));  // put the attr size
-    wp = wp1;
-    na++;  // count the attrs actually written
-  }
-
-  if (na != na0)
-    // Refresh changed count.
-    putu2_at(wp_at(naOffset), na);
-  return na;
-}
-
-void unpacker::write_members(int num, int attrc) {
-  CHECK;
-  attr_definitions& ad = attr_defs[attrc];
-  band& member_flags_hi = ad.xxx_flags_hi();
-  band& member_flags_lo = ad.xxx_flags_lo();
-  band& member_descr = (&member_flags_hi)[e_field_descr-e_field_flags_hi];
-  assert(endsWith(member_descr.name, "_descr"));
-  assert(endsWith(member_flags_lo.name, "_flags_lo"));
-  assert(endsWith(member_flags_lo.name, "_flags_lo"));
-  bool haveLongFlags = ad.haveLongFlags();
-
-  putu2(num);
-  julong indexMask = attr_defs[attrc].flagIndexMask();
-  for (int i = 0; i < num; i++) {
-    julong mflags = member_flags_hi.getLong(member_flags_lo, haveLongFlags);
-    entry* mdescr = member_descr.getRef();
-    cur_descr = mdescr;
-    putu2(cur_descr_flags = (ushort)(mflags & ~indexMask));
-    CHECK;
-    putref(mdescr->descrName());
-    putref(mdescr->descrType());
-    write_attrs(attrc, (mflags & indexMask));
-    CHECK;
-  }
-  cur_descr = null;
-}
-
-extern "C"
-int raw_address_cmp(const void* p1p, const void* p2p) {
-  void* p1 = *(void**) p1p;
-  void* p2 = *(void**) p2p;
-  return (p1 > p2)? 1: (p1 < p2)? -1: 0;
-}
-
-/*
- * writes the InnerClass attributes and returns the updated attribute
- */
-int  unpacker::write_ics(int naOffset, int na) {
-#ifdef ASSERT
-  for (int i = 0; i < ic_count; i++) {
-    assert(!ics[i].requested);
-  }
-#endif
-  // First, consult the global table and the local constant pool,
-  // and decide on the globally implied inner classes.
-  // (Note that we read the cpool's outputIndex fields, but we
-  // do not yet write them, since the local IC attribute might
-  // reverse a global decision to declare an IC.)
-  assert(requested_ics.length() == 0);  // must start out empty
-  // Always include all members of the current class.
-  for (inner_class* child = cp.getFirstChildIC(cur_class);
-       child != null;
-       child = cp.getNextChildIC(child)) {
-    child->requested = true;
-    requested_ics.add(child);
-  }
-  // And, for each inner class mentioned in the constant pool,
-  // include it and all its outers.
-  int    noes =           cp.outputEntries.length();
-  entry** oes = (entry**) cp.outputEntries.base();
-  for (int i = 0; i < noes; i++) {
-    entry& e = *oes[i];
-    if (e.tag != CONSTANT_Class)  continue;  // wrong sort
-    for (inner_class* ic = cp.getIC(&e);
-         ic != null;
-         ic = cp.getIC(ic->outer)) {
-      if (ic->requested)  break;  // already processed
-      ic->requested = true;
-      requested_ics.add(ic);
-    }
-  }
-  int local_ics = requested_ics.length();
-  // Second, consult a local attribute (if any) and adjust the global set.
-  inner_class* extra_ics = null;
-  int      num_extra_ics = 0;
-  if (cur_class_has_local_ics) {
-    // adjust the set of ICs by symmetric set difference w/ the locals
-    num_extra_ics = class_InnerClasses_N.getInt();
-    if (num_extra_ics == 0) {
-      // Explicit zero count has an irregular meaning:  It deletes the attr.
-      local_ics = 0;  // (short-circuit all tests of requested bits)
-    } else {
-      extra_ics = T_NEW(inner_class, num_extra_ics);
-      // Note:  extra_ics will be freed up by next call to get_next_file().
-    }
-  }
-  for (int i = 0; i < num_extra_ics; i++) {
-    inner_class& extra_ic = extra_ics[i];
-    extra_ic.inner = class_InnerClasses_RC.getRef();
-    CHECK_0;
-    // Find the corresponding equivalent global IC:
-    inner_class* global_ic = cp.getIC(extra_ic.inner);
-    int flags = class_InnerClasses_F.getInt();
-    if (flags == 0) {
-      // The extra IC is simply a copy of a global IC.
-      if (global_ic == null) {
-        abort("bad reference to inner class");
-        break;
-      }
-      extra_ic = (*global_ic);  // fill in rest of fields
-    } else {
-      flags &= ~ACC_IC_LONG_FORM;  // clear high bit if set to get clean zero
-      extra_ic.flags = flags;
-      extra_ic.outer = class_InnerClasses_outer_RCN.getRefN();
-      CHECK_0;
-      extra_ic.name  = class_InnerClasses_name_RUN.getRefN();
-      CHECK_0;
-      // Detect if this is an exact copy of the global tuple.
-      if (global_ic != null) {
-        if (global_ic->flags != extra_ic.flags ||
-            global_ic->outer != extra_ic.outer ||
-            global_ic->name  != extra_ic.name) {
-          global_ic = null;  // not really the same, so break the link
-        }
-      }
-    }
-    if (global_ic != null && global_ic->requested) {
-      // This local repetition reverses the globally implied request.
-      global_ic->requested = false;
-      extra_ic.requested = false;
-      local_ics -= 1;
-    } else {
-      // The global either does not exist, or is not yet requested.
-      extra_ic.requested = true;
-      local_ics += 1;
-    }
-  }
-  // Finally, if there are any that survived, put them into an attribute.
-  // (Note that a zero-count attribute is always deleted.)
-  // The putref calls below will tell the constant pool to add any
-  // necessary local CP references to support the InnerClasses attribute.
-  // This step must be the last round of additions to the local CP.
-  if (local_ics > 0) {
-    // append the new attribute:
-    putref(cp.sym[cpool::s_InnerClasses]);
-    putu4(2 + 2*4*local_ics);
-    putu2(local_ics);
-    PTRLIST_QSORT(requested_ics, raw_address_cmp);
-    int num_global_ics = requested_ics.length();
-    for (int i = -num_global_ics; i < num_extra_ics; i++) {
-      inner_class* ic;
-      if (i < 0)
-        ic = (inner_class*) requested_ics.get(num_global_ics+i);
-      else
-        ic = &extra_ics[i];
-      if (ic->requested) {
-        putref(ic->inner);
-        putref(ic->outer);
-        putref(ic->name);
-        putu2(ic->flags);
-        NOT_PRODUCT(local_ics--);
-      }
-    }
-    assert(local_ics == 0);           // must balance
-    putu2_at(wp_at(naOffset), ++na);  // increment class attr count
-  }
-
-  // Tidy up global 'requested' bits:
-  for (int i = requested_ics.length(); --i >= 0; ) {
-    inner_class* ic = (inner_class*) requested_ics.get(i);
-    ic->requested = false;
-  }
-  requested_ics.empty();
-  return na;
-}
-
-/*
- * Writes the BootstrapMethods attribute and returns the updated attribute count
- */
-int unpacker::write_bsms(int naOffset, int na) {
-  cur_class_local_bsm_count = cp.requested_bsms.length();
-  if (cur_class_local_bsm_count > 0) {
-    int    noes =           cp.outputEntries.length();
-    entry** oes = (entry**) cp.outputEntries.base();
-    PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp);
-    // append the BootstrapMethods attribute (after the InnerClasses attr):
-    putref(cp.sym[cpool::s_BootstrapMethods]);
-    // make a note of the offset, for lazy patching
-    int sizeOffset = (int)wpoffset();
-    putu4(-99);  // attr size will be patched
-    putu2(cur_class_local_bsm_count);
-    int written_bsms = 0;
-    for (int i = 0 ; i < cur_class_local_bsm_count ; i++) {
-      entry* e = (entry*)cp.requested_bsms.get(i);
-      assert(e->outputIndex != REQUESTED_NONE);
-      // output index is the index within the array
-      e->outputIndex = i;
-      putref(e->refs[0]);  // bsm
-      putu2(e->nrefs-1);  // number of args after bsm
-      for (int j = 1; j < e->nrefs; j++) {
-        putref(e->refs[j]);
-      }
-      written_bsms += 1;
-    }
-    assert(written_bsms == cur_class_local_bsm_count);  // else insane
-    byte* sizewp = wp_at(sizeOffset);
-    putu4_at(sizewp, (int)(wp - (sizewp+4)));  // size of code attr
-    putu2_at(wp_at(naOffset), ++na);  // increment class attr count
-  }
-  return na;
-}
-
-void unpacker::write_classfile_tail() {
-
-  cur_classfile_tail.empty();
-  set_output(&cur_classfile_tail);
-
-  int i, num;
-
-  attr_definitions& ad = attr_defs[ATTR_CONTEXT_CLASS];
-
-  bool haveLongFlags = ad.haveLongFlags();
-  julong kflags = class_flags_hi.getLong(class_flags_lo, haveLongFlags);
-  julong indexMask = ad.flagIndexMask();
-
-  cur_class = class_this.getRef();
-  CHECK;
-  cur_super = class_super.getRef();
-  CHECK;
-
-  if (cur_super == cur_class)  cur_super = null;
-  // special representation for java/lang/Object
-
-  putu2((ushort)(kflags & ~indexMask));
-  putref(cur_class);
-  putref(cur_super);
-
-  putu2(num = class_interface_count.getInt());
-  for (i = 0; i < num; i++) {
-    putref(class_interface.getRef());
-    CHECK;
-  }
-
-  write_members(class_field_count.getInt(),  ATTR_CONTEXT_FIELD);
-  write_members(class_method_count.getInt(), ATTR_CONTEXT_METHOD);
-  CHECK;
-
-  cur_class_has_local_ics = false;  // may be set true by write_attrs
-
-  int naOffset = (int)wpoffset();   // note the attr count location
-  int na = write_attrs(ATTR_CONTEXT_CLASS, (kflags & indexMask));
-  CHECK;
-
-  na = write_bsms(naOffset, na);
-  CHECK;
-
-  // choose which inner classes (if any) pertain to k:
-  na = write_ics(naOffset, na);
-  CHECK;
-
-  close_output();
-  cp.computeOutputIndexes();
-
-  // rewrite CP references in the tail
-  int nextref = 0;
-  for (i = 0; i < (int)class_fixup_type.size(); i++) {
-    int    type = class_fixup_type.getByte(i);
-    byte*  fixp = wp_at(class_fixup_offset.get(i));
-    entry* e    = (entry*)class_fixup_ref.get(nextref++);
-    int    idx  = e->getOutputIndex();
-    switch (type) {
-    case 1:  putu1_at(fixp, idx);  break;
-    case 2:  putu2_at(fixp, idx);  break;
-    default: assert(false);  // should not reach here
-    }
-  }
-  CHECK;
-}
-
-void unpacker::write_classfile_head() {
-  cur_classfile_head.empty();
-  set_output(&cur_classfile_head);
-
-  putu4(JAVA_MAGIC);
-  putu2(cur_class_minver);
-  putu2(cur_class_majver);
-  putu2(cp.outputIndexLimit);
-
-  int checkIndex = 1;
-  int    noes =           cp.outputEntries.length();
-  entry** oes = (entry**) cp.outputEntries.base();
-  for (int i = 0; i < noes; i++) {
-    entry& e = *oes[i];
-    assert(e.getOutputIndex() == checkIndex++);
-    byte tag = e.tag;
-    assert(tag != CONSTANT_Signature);
-    putu1(tag);
-    switch (tag) {
-    case CONSTANT_Utf8:
-      putu2((int)e.value.b.len);
-      put_bytes(e.value.b);
-      break;
-    case CONSTANT_Integer:
-    case CONSTANT_Float:
-      putu4(e.value.i);
-      break;
-    case CONSTANT_Long:
-    case CONSTANT_Double:
-      putu8(e.value.l);
-      assert(checkIndex++);
-      break;
-    case CONSTANT_Class:
-    case CONSTANT_String:
-      // just write the ref
-      putu2(e.refs[0]->getOutputIndex());
-      break;
-    case CONSTANT_Fieldref:
-    case CONSTANT_Methodref:
-    case CONSTANT_InterfaceMethodref:
-    case CONSTANT_NameandType:
-    case CONSTANT_InvokeDynamic:
-      putu2(e.refs[0]->getOutputIndex());
-      putu2(e.refs[1]->getOutputIndex());
-      break;
-    case CONSTANT_MethodHandle:
-        putu1(e.value.i);
-        putu2(e.refs[0]->getOutputIndex());
-        break;
-    case CONSTANT_MethodType:
-      putu2(e.refs[0]->getOutputIndex());
-      break;
-    case CONSTANT_BootstrapMethod: // should not happen
-    default:
-      abort(ERROR_INTERNAL);
-    }
-  }
-
-#ifndef PRODUCT
-  total_cp_size[0] += cp.outputIndexLimit;
-  total_cp_size[1] += (int)cur_classfile_head.size();
-#endif
-  close_output();
-}
-
-unpacker::file* unpacker::get_next_file() {
-  CHECK_0;
-  free_temps();
-  if (files_remaining == 0) {
-    // Leave a clue that we're exhausted.
-    cur_file.name = null;
-    cur_file.size = null;
-    if (archive_size != 0) {
-      julong predicted_size = unsized_bytes_read + archive_size;
-      if (predicted_size != bytes_read)
-        abort("archive header had incorrect size");
-    }
-    return null;
-  }
-  files_remaining -= 1;
-  assert(files_written < file_count || classes_written < class_count);
-  cur_file.name = "";
-  cur_file.size = 0;
-  cur_file.modtime = default_file_modtime;
-  cur_file.options = default_file_options;
-  cur_file.data[0].set(null, 0);
-  cur_file.data[1].set(null, 0);
-  if (files_written < file_count) {
-    entry* e = file_name.getRef();
-    CHECK_0;
-    cur_file.name = e->utf8String();
-    bool haveLongSize = (testBit(archive_options, AO_HAVE_FILE_SIZE_HI));
-    cur_file.size = file_size_hi.getLong(file_size_lo, haveLongSize);
-    if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
-      cur_file.modtime += file_modtime.getInt();  //relative to archive modtime
-    if (testBit(archive_options, AO_HAVE_FILE_OPTIONS))
-      cur_file.options |= file_options.getInt() & ~suppress_file_options;
-  } else if (classes_written < class_count) {
-    // there is a class for a missing file record
-    cur_file.options |= FO_IS_CLASS_STUB;
-  }
-  if ((cur_file.options & FO_IS_CLASS_STUB) != 0) {
-    assert(classes_written < class_count);
-    classes_written += 1;
-    if (cur_file.size != 0) {
-      abort("class file size transmitted");
-      return null;
-    }
-    reset_cur_classfile();
-
-    // write the meat of the classfile:
-    write_classfile_tail();
-    cur_file.data[1] = cur_classfile_tail.b;
-    CHECK_0;
-
-    // write the CP of the classfile, second:
-    write_classfile_head();
-    cur_file.data[0] = cur_classfile_head.b;
-    CHECK_0;
-
-    cur_file.size += cur_file.data[0].len;
-    cur_file.size += cur_file.data[1].len;
-    if (cur_file.name[0] == '\0') {
-      bytes& prefix = cur_class->ref(0)->value.b;
-      const char* suffix = ".class";
-      int len = (int)(prefix.len + strlen(suffix));
-      bytes name; name.set(T_NEW(byte, add_size(len, 1)), len);
-      cur_file.name = name.strcat(prefix).strcat(suffix).strval();
-    }
-  } else {
-    // If there is buffered file data, produce a pointer to it.
-    if (cur_file.size != (size_t) cur_file.size) {
-      // Silly size specified.
-      abort("resource file too large");
-      return null;
-    }
-    size_t rpleft = input_remaining();
-    if (rpleft > 0) {
-      if (rpleft > cur_file.size)
-        rpleft = (size_t) cur_file.size;
-      cur_file.data[0].set(rp, rpleft);
-      rp += rpleft;
-    }
-    if (rpleft < cur_file.size) {
-      // Caller must read the rest.
-      size_t fleft = (size_t)cur_file.size - rpleft;
-      bytes_read += fleft;  // Credit it to the overall archive size.
-    }
-  }
-  CHECK_0;
-  bytes_written += cur_file.size;
-  files_written += 1;
-  return &cur_file;
-}
-
-// Write a file to jarout.
-void unpacker::write_file_to_jar(unpacker::file* f) {
-  size_t htsize = f->data[0].len + f->data[1].len;
-  julong fsize = f->size;
-#ifndef PRODUCT
-  if (nowrite NOT_PRODUCT(|| skipfiles-- > 0)) {
-    PRINTCR((2,"would write %d bytes to %s", (int) fsize, f->name));
-    return;
-  }
-#endif
-  if (htsize == fsize) {
-    jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
-                        f->data[0], f->data[1]);
-  } else {
-    assert(input_remaining() == 0);
-    bytes part1, part2;
-    part1.len = f->data[0].len;
-    part1.set(T_NEW(byte, part1.len), part1.len);
-    part1.copyFrom(f->data[0]);
-    assert(f->data[1].len == 0);
-    part2.set(null, 0);
-    size_t fleft = (size_t) fsize - part1.len;
-    assert(bytes_read > fleft);  // part2 already credited by get_next_file
-    bytes_read -= fleft;
-    if (fleft > 0) {
-      // Must read some more.
-      if (live_input) {
-        // Stop using the input buffer.  Make a new one:
-        if (free_input)  input.free();
-        input.init(fleft > (1<<12) ? fleft : (1<<12));
-        free_input = true;
-        live_input = false;
-      } else {
-        // Make it large enough.
-        assert(free_input);  // must be reallocable
-        input.ensureSize(fleft);
-      }
-      rplimit = rp = input.base();
-      CHECK;
-      input.setLimit(rp + fleft);
-      if (!ensure_input(fleft))
-        abort("EOF reading resource file");
-      part2.ptr = input_scan();
-      part2.len = input_remaining();
-      rplimit = rp = input.base();
-    }
-    jarout->addJarEntry(f->name, f->deflate_hint(), f->modtime,
-                        part1, part2);
-  }
-  if (verbose >= 3) {
-    fprintf(errstrm, "Wrote "
-                     LONG_LONG_FORMAT " bytes to: %s\n", fsize, f->name);
-  }
-}
-
-// Redirect the stdio to the specified file in the unpack.log.file option
-void unpacker::redirect_stdio() {
-  if (log_file == null) {
-    log_file = LOGFILE_STDOUT;
-  }
-  if (log_file == errstrm_name)
-    // Nothing more to be done.
-    return;
-  errstrm_name = log_file;
-  if (strcmp(log_file, LOGFILE_STDERR) == 0) {
-    errstrm = stderr;
-    return;
-  } else if (strcmp(log_file, LOGFILE_STDOUT) == 0) {
-    errstrm = stdout;
-    return;
-  } else if (log_file[0] != '\0' && (errstrm = fopen(log_file,"a+")) != NULL) {
-    return;
-  } else {
-    fprintf(stderr, "Can not open log file %s\n", log_file);
-    // Last resort
-    // (Do not use stdout, since it might be jarout->jarfp.)
-    errstrm = stderr;
-    log_file = errstrm_name = LOGFILE_STDERR;
-  }
-}
-
-#ifndef PRODUCT
-int unpacker::printcr_if_verbose(int level, const char* fmt ...) {
-  if (verbose < level)  return 0;
-  va_list vl;
-  va_start(vl, fmt);
-  char fmtbuf[300];
-  strcpy(fmtbuf+100, fmt);
-  strcat(fmtbuf+100, "\n");
-  char* fmt2 = fmtbuf+100;
-  while (level-- > 0)  *--fmt2 = ' ';
-  vfprintf(errstrm, fmt2, vl);
-  return 1;  // for ?: usage
-}
-#endif
-
-void unpacker::abort(const char* message) {
-  if (message == null)  message = "error unpacking archive";
-#ifdef UNPACK_JNI
-  if (message[0] == '@') {  // secret convention for sprintf
-     bytes saved;
-     saved.saveFrom(message+1);
-     mallocs.add(message = saved.strval());
-   }
-  abort_message = message;
-  return;
-#else
-  if (message[0] == '@')  ++message;
-  fprintf(errstrm, "%s\n", message);
-#ifndef PRODUCT
-  fflush(errstrm);
-  ::abort();
-#else
-  exit(-1);
-#endif
-#endif // JNI
-}
--- a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,510 +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.
- */
-// Global Structures
-struct jar;
-struct gunzip;
-struct band;
-struct cpool;
-struct entry;
-struct cpindex;
-struct inner_class;
-struct value_stream;
-
-struct cpindex {
-  uint    len;
-  entry*  base1;   // base of primary index
-  entry** base2;   // base of secondary index
-  byte    ixTag;   // type of entries (!= CONSTANT_None), plus 64 if sub-index
-  enum { SUB_TAG = 64 };
-
-  entry* get(uint i);
-
-  void init(int len_, entry* base1_, int ixTag_) {
-    len = len_;
-    base1 = base1_;
-    base2 = null;
-    ixTag = ixTag_;
-  }
-  void init(int len_, entry** base2_, int ixTag_) {
-    len = len_;
-    base1 = null;
-    base2 = base2_;
-    ixTag = ixTag_;
-  }
-};
-
-struct cpool {
-  uint  nentries;
-  entry* entries;
-  entry* first_extra_entry;
-  uint maxentries;      // total allocated size of entries
-
-  // Position and size of each homogeneous subrange:
-  int     tag_count[CONSTANT_Limit];
-  int     tag_base[CONSTANT_Limit];
-  cpindex tag_index[CONSTANT_Limit];
-  ptrlist tag_extras[CONSTANT_Limit];
-
-  int     tag_group_count[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
-  cpindex tag_group_index[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
-
-  cpindex* member_indexes;   // indexed by 2*CONSTANT_Class.inord
-  cpindex* getFieldIndex(entry* classRef);
-  cpindex* getMethodIndex(entry* classRef);
-
-  inner_class** ic_index;
-  inner_class** ic_child_index;
-  inner_class* getIC(entry* inner);
-  inner_class* getFirstChildIC(entry* outer);
-  inner_class* getNextChildIC(inner_class* child);
-
-  int outputIndexLimit;  // index limit after renumbering
-  ptrlist outputEntries; // list of entry* needing output idx assigned
-  ptrlist requested_bsms; // which bsms need output?
-
-  entry** hashTab;
-  uint    hashTabLength;
-  entry*& hashTabRef(byte tag, bytes& b);
-  entry*  ensureUtf8(bytes& b);
-  entry*  ensureClass(bytes& b);
-
-  // Well-known Utf8 symbols.
-  enum {
-    #define SNAME(n,s) s_##s,
-    ALL_ATTR_DO(SNAME)
-    #undef SNAME
-    s_lt_init_gt,  // <init>
-    s_LIMIT
-  };
-  entry* sym[s_LIMIT];
-
-  // read counts from hdr, allocate main arrays
-  void init(unpacker* u, int counts[CONSTANT_Limit]);
-
-  // pointer to outer unpacker, for error checks etc.
-  unpacker* u;
-
-  int getCount(byte tag) {
-    if ((uint)tag >= CONSTANT_GroupFirst) {
-      assert((uint)tag < CONSTANT_GroupLimit);
-      return tag_group_count[(uint)tag - CONSTANT_GroupFirst];
-    } else {
-      assert((uint)tag < CONSTANT_Limit);
-      return tag_count[(uint)tag];
-    }
-  }
-  cpindex* getIndex(byte tag) {
-    if ((uint)tag >= CONSTANT_GroupFirst) {
-      assert((uint)tag < CONSTANT_GroupLimit);
-      return &tag_group_index[(uint)tag - CONSTANT_GroupFirst];
-    } else {
-      assert((uint)tag < CONSTANT_Limit);
-      return &tag_index[(uint)tag];
-    }
-  }
-
-  cpindex* getKQIndex();  // uses cur_descr
-
-  void expandSignatures();
-  void initGroupIndexes();
-  void initMemberIndexes();
-  int  initLoadableValues(entry** loadable_entries);
-
-  void computeOutputOrder();
-  void computeOutputIndexes();
-  void resetOutputIndexes();
-
-  // error handling
-  inline void abort(const char* msg);
-  inline bool aborting();
-};
-
-/*
- * The unpacker provides the entry points to the unpack engine,
- * as well as maintains the state of the engine.
- */
-struct unpacker {
-  // One element of the resulting JAR.
-  struct file {
-    const char* name;
-    julong      size;
-    int         modtime;
-    int         options;
-    bytes       data[2];
-    // Note:  If Sum(data[*].len) < size,
-    // remaining bytes must be read directly from the input stream.
-    bool deflate_hint() { return ((options & FO_DEFLATE_HINT) != 0); }
-  };
-
-  // back pointer to NativeUnpacker obj and Java environment
-  void* jniobj;
-  void* jnienv;
-
-  // global pointer to self, if not running under JNI (not multi-thread safe)
-  static unpacker* non_mt_current;
-
-  // if running Unix-style, here are the inputs and outputs
-  FILE* infileptr;  // buffered
-  int   infileno;   // unbuffered
-  bytes inbytes;    // direct
-  gunzip* gzin;     // gunzip filter, if any
-  jar*  jarout;     // output JAR file
-  uint  gzcrc;      // CRC gathered from gzip content
-
-#ifndef PRODUCT
-  int   nowrite;
-  int   skipfiles;
-  int   verbose_bands;
-#endif
-
-  // pointer to self, for U_NEW macro
-  unpacker* u;
-
-  // private abort message string, allocated to PATH_MAX*2
-  const char* abort_message;
-  ptrlist mallocs;      // list of guys to free when we are all done
-  ptrlist tmallocs;     // list of guys to free on next client request
-  fillbytes smallbuf;   // supplies small alloc requests
-  fillbytes tsmallbuf;  // supplies temporary small alloc requests
-
-  // option management members
-  int   verbose;  // verbose level, 0 means no output
-  bool  strip_compile;
-  bool  strip_debug;
-  bool  strip_jcov;
-  bool  remove_packfile;
-  int   deflate_hint_or_zero;  // ==0 means not set, otherwise -1 or 1
-  int   modification_time_or_zero;
-
-  FILE*       errstrm;
-  const char* errstrm_name;
-
-  const char* log_file;
-
-  // input stream
-  fillbytes input;       // the whole block (size is predicted, has slop too)
-  bool      live_input;  // is the data in this block live?
-  bool      free_input;  // must the input buffer be freed?
-  byte*     rp;          // read pointer (< rplimit <= input.limit())
-  byte*     rplimit;     // how much of the input block has been read?
-  julong    bytes_read;
-  int       unsized_bytes_read;
-
-  // callback to read at least one byte, up to available input
-  typedef jlong (*read_input_fn_t)(unpacker* self, void* buf, jlong minlen, jlong maxlen);
-  read_input_fn_t read_input_fn;
-
-  // archive header fields
-  int      magic, minver, majver;
-  size_t   archive_size;
-  int      archive_next_count, archive_options, archive_modtime;
-  int      band_headers_size;
-  int      file_count, attr_definition_count, ic_count, class_count;
-  int      default_class_minver, default_class_majver;
-  int      default_file_options, suppress_file_options;  // not header fields
-  int      default_archive_modtime, default_file_modtime;  // not header fields
-  int      code_count;  // not a header field
-  int      files_remaining;  // not a header field
-
-  // engine state
-  band*        all_bands;   // indexed by band_number
-  byte*        meta_rp;     // read-pointer into (copy of) band_headers
-  cpool        cp;          // all constant pool information
-  inner_class* ics;         // InnerClasses
-
-  // output stream
-  bytes    output;      // output block (either classfile head or tail)
-  byte*    wp;          // write pointer (< wplimit == output.limit())
-  byte*    wpbase;      // write pointer starting address (<= wp)
-  byte*    wplimit;     // how much of the output block has been written?
-
-  // output state
-  file      cur_file;
-  entry*    cur_class;  // CONSTANT_Class entry
-  entry*    cur_super;  // CONSTANT_Class entry or null
-  entry*    cur_descr;  // CONSTANT_NameandType entry
-  int       cur_descr_flags;  // flags corresponding to cur_descr
-  int       cur_class_minver, cur_class_majver;
-  bool      cur_class_has_local_ics;
-  int       cur_class_local_bsm_count;
-  fillbytes cur_classfile_head;
-  fillbytes cur_classfile_tail;
-  int       files_written;   // also tells which file we're working on
-  int       classes_written; // also tells which class we're working on
-  julong    bytes_written;
-  intlist   bcimap;
-  fillbytes class_fixup_type;
-  intlist   class_fixup_offset;
-  ptrlist   class_fixup_ref;
-  fillbytes code_fixup_type;    // which format of branch operand?
-  intlist   code_fixup_offset;  // location of operand needing fixup
-  intlist   code_fixup_source;  // encoded ID of branch insn
-  ptrlist   requested_ics;      // which ics need output?
-
-  // stats pertaining to multiple segments (updated on reset)
-  julong    bytes_read_before_reset;
-  julong    bytes_written_before_reset;
-  int       files_written_before_reset;
-  int       classes_written_before_reset;
-  int       segments_read_before_reset;
-
-  // attribute state
-  struct layout_definition {
-    uint          idx;        // index (0..31...) which identifies this layout
-    const char*   name;       // name of layout
-    entry*        nameEntry;
-    const char*   layout;     // string of layout (not yet parsed)
-    band**        elems;      // array of top-level layout elems (or callables)
-
-    bool hasCallables()   { return layout[0] == '['; }
-    band** bands()        { assert(elems != null); return elems; }
-  };
-  struct attr_definitions {
-    unpacker* u;  // pointer to self, for U_NEW macro
-    int     xxx_flags_hi_bn;// locator for flags, count, indexes, calls bands
-    int     attrc;          // ATTR_CONTEXT_CLASS, etc.
-    uint    flag_limit;     // 32 or 63, depending on archive_options bit
-    julong  predef;         // mask of built-in definitions
-    julong  redef;          // mask of local flag definitions or redefinitions
-    ptrlist layouts;        // local (compressor-defined) defs, in index order
-    int     flag_count[X_ATTR_LIMIT_FLAGS_HI];
-    intlist overflow_count;
-    ptrlist strip_names;    // what attribute names are being stripped?
-    ptrlist band_stack;     // Temp., used during layout parsing.
-    ptrlist calls_to_link;  //  (ditto)
-    int     bands_made;     //  (ditto)
-
-    void free() {
-      layouts.free();
-      overflow_count.free();
-      strip_names.free();
-      band_stack.free();
-      calls_to_link.free();
-    }
-
-    // Locate the five fixed bands.
-    band& xxx_flags_hi();
-    band& xxx_flags_lo();
-    band& xxx_attr_count();
-    band& xxx_attr_indexes();
-    band& xxx_attr_calls();
-    band& fixed_band(int e_class_xxx);
-
-    // Register a new layout, and make bands for it.
-    layout_definition* defineLayout(int idx, const char* name, const char* layout);
-    layout_definition* defineLayout(int idx, entry* nameEntry, const char* layout);
-    band** buildBands(layout_definition* lo);
-
-    // Parse a layout string or part of one, recursively if necessary.
-    const char* parseLayout(const char* lp,    band** &res, int curCble);
-    const char* parseNumeral(const char* lp,   int    &res);
-    const char* parseIntLayout(const char* lp, band*  &res, byte le_kind,
-                               bool can_be_signed = false);
-    band** popBody(int band_stack_base);  // pops a body off band_stack
-
-    // Read data into the bands of the idx-th layout.
-    void readBandData(int idx);  // parse layout, make bands, read data
-    void readBandData(band** body, uint count);  // recursive helper
-
-    layout_definition* getLayout(uint idx) {
-      if (idx >= (uint)layouts.length())  return null;
-      return (layout_definition*) layouts.get(idx);
-    }
-
-    void setHaveLongFlags(bool z) {
-      assert(flag_limit == 0);  // not set up yet
-      flag_limit = (z? X_ATTR_LIMIT_FLAGS_HI: X_ATTR_LIMIT_NO_FLAGS_HI);
-    }
-    bool haveLongFlags() {
-     assert(flag_limit == X_ATTR_LIMIT_NO_FLAGS_HI ||
-            flag_limit == X_ATTR_LIMIT_FLAGS_HI);
-      return flag_limit == X_ATTR_LIMIT_FLAGS_HI;
-    }
-
-    // Return flag_count if idx is predef and not redef, else zero.
-    int predefCount(uint idx);
-
-    bool isRedefined(uint idx) {
-      if (idx >= flag_limit) return false;
-      return (bool)((redef >> idx) & 1);
-    }
-    bool isPredefined(uint idx) {
-      if (idx >= flag_limit) return false;
-      return (bool)(((predef & ~redef) >> idx) & 1);
-    }
-    julong flagIndexMask() {
-      return (predef | redef);
-    }
-    bool isIndex(uint idx) {
-      assert(flag_limit != 0);  // must be set up already
-      if (idx < flag_limit)
-        return (bool)(((predef | redef) >> idx) & 1);
-      else
-        return (idx - flag_limit < (uint)overflow_count.length());
-    }
-    int& getCount(uint idx) {
-      assert(isIndex(idx));
-      if (idx < flag_limit)
-        return flag_count[idx];
-      else
-        return overflow_count.get(idx - flag_limit);
-    }
-    bool aborting()             { return u->aborting(); }
-    void abort(const char* msg) { u->abort(msg); }
-  };
-
-  attr_definitions attr_defs[ATTR_CONTEXT_LIMIT];
-
-  // Initialization
-  void         init(read_input_fn_t input_fn = null);
-  // Resets to a known sane state
-  void         reset();
-  // Deallocates all storage.
-  void         free();
-  // Deallocates temporary storage (volatile after next client call).
-  void         free_temps() { tsmallbuf.init(); tmallocs.freeAll(); }
-
-  // Option management methods
-  bool         set_option(const char* option, const char* value);
-  const char*  get_option(const char* option);
-
-  void         dump_options();
-
-  // Fetching input.
-  bool   ensure_input(jlong more);
-  byte*  input_scan()               { return rp; }
-  size_t input_remaining()          { return rplimit - rp; }
-  size_t input_consumed()           { return rp - input.base(); }
-
-  // Entry points to the unpack engine
-  static int   run(int argc, char **argv);   // Unix-style entry point.
-  void         check_options();
-  void         start(void* packptr = null, size_t len = 0);
-  void         redirect_stdio();
-  void         write_file_to_jar(file* f);
-  void         finish();
-
-  // Public post unpack methods
-  int          get_files_remaining()    { return files_remaining; }
-  int          get_segments_remaining() { return archive_next_count; }
-  file*        get_next_file();  // returns null on last file
-
-  // General purpose methods
-  void*        alloc(size_t size) { return alloc_heap(size, true); }
-  void*        temp_alloc(size_t size) { return alloc_heap(size, true, true); }
-  void*        alloc_heap(size_t size, bool smallOK = false, bool temp = false);
-  void         saveTo(bytes& b, const char* str) { saveTo(b, (byte*)str, strlen(str)); }
-  void         saveTo(bytes& b, bytes& data) { saveTo(b, data.ptr, data.len); }
-  void         saveTo(bytes& b, byte* ptr, size_t len); //{ b.ptr = U_NEW...}
-  const char*  saveStr(const char* str) { bytes buf; saveTo(buf, str); return buf.strval(); }
-  const char*  saveIntStr(int num) { char buf[30]; sprintf(buf, "%d", num); return saveStr(buf); }
-#ifndef PRODUCT
-  int printcr_if_verbose(int level, const char* fmt,...);
-#endif
-  const char*  get_abort_message();
-  void         abort(const char* s = null);
-  bool         aborting() { return abort_message != null; }
-  static unpacker* current();  // find current instance
-  void checkLegacy(const char* name);
-  // Output management
-  void set_output(fillbytes* which) {
-    assert(wp == null);
-    which->ensureSize(1 << 12);  // covers the average classfile
-    wpbase  = which->base();
-    wp      = which->limit();
-    wplimit = which->end();
-  }
-  fillbytes* close_output(fillbytes* which = null);  // inverse of set_output
-
-  // These take an implicit parameter of wp/wplimit, and resize as necessary:
-  byte*  put_space(size_t len);  // allocates space at wp, returns pointer
-  size_t put_empty(size_t s)    { byte* p = put_space(s); return p - wpbase; }
-  void   ensure_put_space(size_t len);
-  void   put_bytes(bytes& b)    { b.writeTo(put_space(b.len)); }
-  void   putu1(int n)           { putu1_at(put_space(1), n); }
-  void   putu1_fast(int n)      { putu1_at(wp++,         n); }
-  void   putu2(int n);       // { putu2_at(put_space(2), n); }
-  void   putu4(int n);       // { putu4_at(put_space(4), n); }
-  void   putu8(jlong n);     // { putu8_at(put_space(8), n); }
-  void   putref(entry* e);   // { putu2_at(put_space(2), putref_index(e, 2)); }
-  void   putu1ref(entry* e); // { putu1_at(put_space(1), putref_index(e, 1)); }
-  int    putref_index(entry* e, int size);  // size in [1..2]
-  void   put_label(int curIP, int size);    // size in {2,4}
-  void   putlayout(band** body);
-  void   put_stackmap_type();
-
-  size_t wpoffset() { return (size_t)(wp - wpbase); }  // (unvariant across overflow)
-  byte*  wp_at(size_t offset) { return wpbase + offset; }
-  uint to_bci(uint bii);
-  void get_code_header(int& max_stack,
-                       int& max_na_locals,
-                       int& handler_count,
-                       int& cflags);
-  band* ref_band_for_self_op(int bc, bool& isAloadVar, int& origBCVar);
-  band* ref_band_for_op(int bc);
-
-  // Definitions of standard classfile int formats:
-  static void putu1_at(byte* wp, int n) { assert(n == (n & 0xFF)); wp[0] = n; }
-  static void putu2_at(byte* wp, int n);
-  static void putu4_at(byte* wp, int n);
-  static void putu8_at(byte* wp, jlong n);
-
-  // Private stuff
-  void reset_cur_classfile();
-  void write_classfile_tail();
-  void write_classfile_head();
-  void write_code();
-  void write_bc_ops();
-  void write_members(int num, int attrc);  // attrc=ATTR_CONTEXT_FIELD/METHOD
-  int  write_attrs(int attrc, julong indexBits);
-  int  write_ics(int naOffset, int na);
-  int  write_bsms(int naOffset, int na);
-
-  // The readers
-  void read_bands();
-  void read_file_header();
-  void read_cp();
-  void read_cp_counts(value_stream& hdr);
-  void read_attr_defs();
-  void read_ics();
-  void read_attrs(int attrc, int obj_count);
-  void read_classes();
-  void read_code_headers();
-  void read_bcs();
-  void read_bc_ops();
-  void read_files();
-  void read_Utf8_values(entry* cpMap, int len);
-  void read_single_words(band& cp_band, entry* cpMap, int len);
-  void read_double_words(band& cp_bands, entry* cpMap, int len);
-  void read_single_refs(band& cp_band, byte refTag, entry* cpMap, int len);
-  void read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag, entry* cpMap, int len);
-  void read_signature_values(entry* cpMap, int len);
-  void read_method_handle(entry* cpMap, int len);
-  void read_method_type(entry* cpMap, int len);
-  void read_bootstrap_methods(entry* cpMap, int len);
-};
-
-inline void cpool::abort(const char* msg) { u->abort(msg); }
-inline bool cpool::aborting()             { return u->aborting(); }
--- a/jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2001, 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 <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-
-#include <sys/stat.h>
-
-#ifdef _MSC_VER
-#include <direct.h>
-#include <io.h>
-#include <process.h>
-#else
-#include <unistd.h>
-#endif
-
-#include "constants.h"
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-
-#include "unpack.h"
-
-void* must_malloc(size_t size) {
-  size_t msize = size;
-  #ifdef USE_MTRACE
-  if (msize >= 0 && msize < sizeof(int))
-    msize = sizeof(int);  // see 0xbaadf00d below
-  #endif
-  void* ptr = (msize > PSIZE_MAX || msize <= 0) ? null : malloc(msize);
-  if (ptr != null) {
-    memset(ptr, 0, size);
-  } else {
-    unpack_abort(ERROR_ENOMEM);
-  }
-  mtrace('m', ptr, size);
-  return ptr;
-}
-
-void mkdirs(int oklen, char* path) {
-
-  if (strlen(path) <= (size_t)oklen)  return;
-  char dir[PATH_MAX];
-
-  strcpy(dir, path);
-  char* slash = strrchr(dir, '/');
-  if (slash == 0)  return;
-  *slash = 0;
-  mkdirs(oklen, dir);
-  MKDIR(dir);
-}
-
-
-#ifndef PRODUCT
-void breakpoint() { }  // hook for debugger
-int assert_failed(const char* p) {
-  char message[1<<12];
-  sprintf(message, "@assert failed: %s\n", p);
-  fprintf(stdout, 1+message);
-  breakpoint();
-  unpack_abort(message);
-  return 0;
-}
-#endif
-
-void unpack_abort(const char* msg, unpacker* u) {
-  if (msg == null)  msg = "corrupt pack file or internal error";
-  if (u == null)
-    u = unpacker::current();
-  if (u == null) {
-    fprintf(stderr, "Error: unpacker: %s\n", msg);
-    ::abort();
-    return;
-  }
-  u->abort(msg);
-}
-
-bool unpack_aborting(unpacker* u) {
-  if (u == null)
-    u = unpacker::current();
-  if (u == null) {
-    fprintf(stderr, "Error: unpacker: no current instance\n");
-    ::abort();
-    return true;
-  }
-  return u->aborting();
-}
-
-#ifdef USE_MTRACE
-// Use this occasionally for detecting storage leaks in unpack.
-void mtrace(char c, void* ptr, size_t size) {
-  if (c == 'f')  *(int*)ptr = 0xbaadf00d;
-  static FILE* mtfp;
-  if (mtfp == (FILE*)-1)  return;
-  if (mtfp == null) {
-    if (getenv("USE_MTRACE") == null) {
-      mtfp = (FILE*)-1;
-      return;
-    }
-    char fname[1024];
-    sprintf(fname, "mtr%d.txt", getpid());
-    mtfp = fopen(fname, "w");
-    if (mtfp == null)
-      mtfp = stdout;
-  }
-  fprintf(mtfp, "%c %p %p\n", c, ptr, (void*)size);
-}
-
-/* # Script for processing memory traces.
-   # It should report only a limited number (2) of "suspended" blocks,
-   # even if a large number of archive segments are processed.
-   # It should report no "leaked" blocks at all.
-   nawk < mtr*.txt '
-   function checkleaks(what) {
-     nd = 0
-     for (ptr in allocated) {
-       if (allocated[ptr] == 1) {
-         print NR ": " what " " ptr
-         #allocated[ptr] = 0  # stop the dangle
-         nd++
-       }
-     }
-     if (nd > 0)  print NR ": count " what " " nd
-   }
-
-   /^[mfr]/ {
-       ptr = $2
-       a1 = ($1 == "m")? 1: 0
-       a0 = 0+allocated[ptr]
-       allocated[ptr] = a1
-       if (a0 + a1 != 1) {
-         if (a0 == 0 && a1 == 0)
-           print NR ": double free " ptr
-         else if (a0 == 1 && a1 == 1)
-           print NR ": double malloc " ptr
-         else
-           print NR ": oddity " $0
-       }
-       next
-     }
-
-   /^s/ {
-     checkleaks("suspended")
-     next
-   }
-
-   {
-     print NR ": unrecognized " $0
-   }
-   END {
-     checkleaks("leaked")
-   }
-'
-*/
-#endif // USE_MTRACE
--- a/jdk/src/jdk.runtime/share/native/common-unpack/utils.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-//Definitions of our util functions
-
-void* must_malloc(size_t size);
-#ifndef USE_MTRACE
-#define mtrace(c, ptr, size)
-#else
-void mtrace(char c, void* ptr, size_t size);
-#endif
-
-// overflow management
-#define OVERFLOW ((uint)-1)
-#define PSIZE_MAX (OVERFLOW/2)  /* normal size limit */
-
-inline size_t scale_size(size_t size, size_t scale) {
-  return (size > PSIZE_MAX / scale) ? OVERFLOW : size * scale;
-}
-
-inline size_t add_size(size_t size1, size_t size2) {
-  return ((size1 | size2 | (size1 + size2)) > PSIZE_MAX)
-    ? OVERFLOW
-    : size1 + size2;
-}
-
-inline size_t add_size(size_t size1, size_t size2, int size3) {
-  return add_size(add_size(size1, size2), size3);
-}
-
-// These may be expensive, because they have to go via Java TSD,
-// if the optional u argument is missing.
-struct unpacker;
-extern void unpack_abort(const char* msg, unpacker* u = null);
-extern bool unpack_aborting(unpacker* u = null);
-
-#ifndef PRODUCT
-inline bool endsWith(const char* str, const char* suf) {
-  size_t len1 = strlen(str);
-  size_t len2 = strlen(suf);
-  return (len1 > len2 && 0 == strcmp(str + (len1-len2), suf));
-}
-#endif
-
-void mkdirs(int oklen, char* path);
--- a/jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,668 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-/**
- * Note: Lifted from uncrunch.c from jdk sources
- */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-
-#include <stdlib.h>
-
-#ifndef _MSC_VER
-#include <strings.h>
-#endif
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-
-#include "constants.h"
-#include "unpack.h"
-
-#include "zip.h"
-
-#ifdef NO_ZLIB
-
-inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
-  return false;
-}
-inline uint jar::get_crc32(uint c, uchar *ptr, uint len) { return 0; }
-#define Z_NULL NULL
-
-#else // Have ZLIB
-
-#include <zlib.h>
-
-inline uint jar::get_crc32(uint c, uchar *ptr, uint len) { return crc32(c, ptr, len); }
-
-#endif // End of ZLIB
-
-#ifdef _BIG_ENDIAN
-#define SWAP_BYTES(a) \
-    ((((a) << 8) & 0xff00) | 0x00ff) & (((a) >> 8) | 0xff00)
-#else
-#define SWAP_BYTES(a)  (a)
-#endif
-
-#define GET_INT_LO(a) \
-    SWAP_BYTES(a & 0xFFFF)
-
-#define GET_INT_HI(a) \
-    SWAP_BYTES((a >> 16) & 0xFFFF)
-
-static const ushort jarmagic[2] = { SWAP_BYTES(0xCAFE), 0 };
-
-void jar::init(unpacker* u_) {
-  BYTES_OF(*this).clear();
-  u = u_;
-  u->jarout = this;
-}
-
-// Write data to the ZIP output stream.
-void jar::write_data(void* buff, int len) {
-  while (len > 0) {
-    int rc = (int)fwrite(buff, 1, len, jarfp);
-    if (rc <= 0) {
-      fprintf(u->errstrm, "Error: write on output file failed err=%d\n",errno);
-      exit(1); // Called only from the native standalone unpacker
-    }
-    output_file_offset += rc;
-    buff = ((char *)buff) + rc;
-    len -= rc;
-  }
-}
-
-void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
-                               int len, int clen, uLong crc) {
-  uint fname_length = (uint)strlen(fname);
-  ushort header[23];
-  if (modtime == 0)  modtime = default_modtime;
-  uLong dostime = get_dostime(modtime);
-
-  header[0] = (ushort)SWAP_BYTES(0x4B50);
-  header[1] = (ushort)SWAP_BYTES(0x0201);
-  header[2] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
-
-  // required version
-  header[3] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
-
-  // Flags - UTF-8 compression and separating crc and sizes
-  // into separate headers for deflated file
-  header[4] = ( store ) ? SWAP_BYTES(0x0800) : 0x0808;
-
-  // Compression method 8=deflate.
-  header[5] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
-
-  // Last modified date and time.
-  header[6] = (ushort)GET_INT_LO(dostime);
-  header[7] = (ushort)GET_INT_HI(dostime);
-
-  // CRC
-  header[8] = (ushort)GET_INT_LO(crc);
-  header[9] = (ushort)GET_INT_HI(crc);
-
-  // Compressed length:
-  header[10] = (ushort)GET_INT_LO(clen);
-  header[11] = (ushort)GET_INT_HI(clen);
-
-  // Uncompressed length.
-  header[12] = (ushort)GET_INT_LO(len);
-  header[13] = (ushort)GET_INT_HI(len);
-
-  // Filename length
-  header[14] = (ushort)SWAP_BYTES(fname_length);
-  // So called "extra field" length.
-  // If it's the first record we must add JAR magic sequence
-  header[15] = ( central_directory_count ) ? 0 : (ushort)SWAP_BYTES(4);
-  // So called "comment" length.
-  header[16] = 0;
-  // Disk number start
-  header[17] = 0;
-  // File flags => binary
-  header[18] = 0;
-  // More file flags
-  header[19] = 0;
-  header[20] = 0;
-  // Offset within ZIP file.
-  header[21] = (ushort)GET_INT_LO(output_file_offset);
-  header[22] = (ushort)GET_INT_HI(output_file_offset);
-
-  // Copy the whole thing into the central directory.
-  central_directory.append(header, sizeof(header));
-
-  // Copy the fname to the header.
-  central_directory.append(fname, fname_length);
-
-  // Add jar magic for the first record
-  if (central_directory_count == 0) {
-    central_directory.append((void *)jarmagic, sizeof(jarmagic));
-  }
-
-  central_directory_count++;
-}
-
-void jar::write_jar_header(const char* fname, bool store, int modtime,
-                           int len, int clen, uint crc) {
-  uint fname_length = (uint)strlen(fname);
-  ushort header[15];
-  if (modtime == 0)  modtime = default_modtime;
-  uLong dostime = get_dostime(modtime);
-
-  // ZIP LOC magic.
-  header[0] = (ushort)SWAP_BYTES(0x4B50);
-  header[1] = (ushort)SWAP_BYTES(0x0403);
-
-  // Version
-  header[2] = (ushort)SWAP_BYTES(( store ) ? 0x0A : 0x14);
-
-  // General purpose flags - same as in the Central Directory
-  header[3] = ( store ) ? SWAP_BYTES(0x0800) : 0x0808;
-
-  // Compression method = deflate
-  header[4] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
-
-  // Last modified date and time.
-  header[5] = (ushort)GET_INT_LO(dostime);
-  header[6] = (ushort)GET_INT_HI(dostime);
-
-  // CRC, 0 if deflated, will come separately in extra header
-  header[7] = ( store ) ? (ushort)GET_INT_LO(crc) : 0;
-  header[8] = ( store ) ? (ushort)GET_INT_HI(crc) : 0;
-
-  // Compressed length, 0 if deflated
-  header[9] = ( store ) ? (ushort)GET_INT_LO(clen) : 0;
-  header[10] = ( store ) ? (ushort)GET_INT_HI(clen) : 0;
-
-  // Uncompressed length, 0 if deflated
-  header[11] = ( store ) ? (ushort)GET_INT_LO(len) : 0;
-  header[12] = ( store ) ? (ushort)GET_INT_HI(len) : 0;
-
-  // Filename length
-  header[13] = (ushort)SWAP_BYTES(fname_length);
-  // So called "extra field" length.
-  header[14] = ( central_directory_count - 1 ) ? 0 : (ushort)SWAP_BYTES(4);
-
-  // Write the LOC header to the output file.
-  write_data(header, (int)sizeof(header));
-
-  // Copy the fname to the header.
-  write_data((char*)fname, (int)fname_length);
-
-  if (central_directory_count == 1) {
-    // Write JAR magic sequence
-    write_data((void *)jarmagic, (int)sizeof(jarmagic));
-  }
-}
-
-void jar::write_jar_extra(int len, int clen, uint crc) {
-  ushort header[8];
-  // Extra field signature
-  header[0] = (ushort)SWAP_BYTES(0x4B50);
-  header[1] = (ushort)SWAP_BYTES(0x0807);
-  // CRC
-  header[2] = (ushort)GET_INT_LO(crc);
-  header[3] = (ushort)GET_INT_HI(crc);
-  // Compressed length
-  header[4] = (ushort)GET_INT_LO(clen);
-  header[5] = (ushort)GET_INT_HI(clen);
-  // Uncompressed length
-  header[6] = (ushort)GET_INT_LO(len);
-  header[7] = (ushort)GET_INT_HI(len);
-
-  write_data(header, sizeof(header));
-}
-
-static const char marker_comment[] = ZIP_ARCHIVE_MARKER_COMMENT;
-
-void jar::write_central_directory() {
-  bytes mc; mc.set(marker_comment);
-
-  ushort header[11];
-  ushort header64[38];
-
-  // Create the End of Central Directory structure.
-  header[0] = (ushort)SWAP_BYTES(0x4B50);
-  header[1] = (ushort)SWAP_BYTES(0x0605);
-  // disk numbers
-  header[2] = 0;
-  header[3] = 0;
-  // Number of entries in central directory.
-  header[4] = ( central_directory_count >= 0xffff ) ? 0xffff : (ushort)SWAP_BYTES(central_directory_count);
-  header[5] = ( central_directory_count >= 0xffff ) ? 0xffff : (ushort)SWAP_BYTES(central_directory_count);
-  // Size of the central directory}
-  header[6] = (ushort)GET_INT_LO((int)central_directory.size());
-  header[7] = (ushort)GET_INT_HI((int)central_directory.size());
-  // Offset of central directory within disk.
-  header[8] = (ushort)GET_INT_LO(output_file_offset);
-  header[9] = (ushort)GET_INT_HI(output_file_offset);
-  // zipfile comment length;
-  header[10] = (ushort)SWAP_BYTES((int)mc.len);
-
-  // Write the central directory.
-  PRINTCR((2, "Central directory at %d\n", output_file_offset));
-  write_data(central_directory.b);
-
-  // If number of records exceeds the 0xFFFF we need to prepend extended
-  // Zip64 End of Central Directory record and its locator to the old
-  // style ECD record
-  if (central_directory_count > 0xFFFF) {
-    // Zip64 END signature
-    header64[0] = (ushort)SWAP_BYTES(0x4B50);
-    header64[1] = (ushort)0x0606;
-    // Size of header (long)
-    header64[2] = (ushort)SWAP_BYTES(44);;
-    header64[3] = 0;
-    header64[4] = 0;
-    header64[5] = 0;
-    // Version produced and required (short)
-    header64[6] = (ushort)SWAP_BYTES(45);
-    header64[7] = (ushort)SWAP_BYTES(45);
-    // Current disk number (int)
-    header64[8] = 0;
-    header64[9] = 0;
-    // Central directory start disk (int)
-    header64[10] = 0;
-    header64[11] = 0;
-    // Count of records on disk (long)
-    header64[12] = (ushort)GET_INT_LO(central_directory_count);
-    header64[13] = (ushort)GET_INT_HI(central_directory_count);
-    header64[14] = 0;
-    header64[15] = 0;
-    // Count of records totally (long)
-    header64[16] = (ushort)GET_INT_LO(central_directory_count);
-    header64[17] = (ushort)GET_INT_HI(central_directory_count);
-    header64[18] = 0;
-    header64[19] = 0;
-    // Length of the central directory (long)
-    header64[20] = header[6];
-    header64[21] = header[7];
-    header64[22] = 0;
-    header64[23] = 0;
-    // Offset of central directory (long)
-    header64[24] = header[8];
-    header64[25] = header[9];
-    header64[26] = 0;
-    header64[27] = 0;
-    // Zip64 end of central directory locator
-    // Locator signature
-    header64[28] = (ushort)SWAP_BYTES(0x4B50);
-    header64[29] = (ushort)SWAP_BYTES(0x0706);
-    // Start disk number (int)
-    header64[30] = 0;
-    header64[31] = 0;
-    // Offset of zip64 END record (long)
-    header64[32] = (ushort)GET_INT_LO(output_file_offset);
-    header64[33] = (ushort)GET_INT_HI(output_file_offset);
-    header64[34] = 0;
-    header64[35] = 0;
-    // Total number of disks (int)
-    header64[36] = (ushort)SWAP_BYTES(1);
-    header64[37] = 0;
-    write_data(header64, (int)sizeof(header64));
-  }
-
-  // Write the End of Central Directory structure.
-  PRINTCR((2, "end-of-directory at %d\n", output_file_offset));
-  write_data(header, (int)sizeof(header));
-
-  PRINTCR((2, "writing zip comment\n"));
-  // Write the comment.
-  write_data(mc);
-}
-
-// Public API
-
-// Open a Jar file and initialize.
-void jar::openJarFile(const char* fname) {
-  if (!jarfp) {
-    PRINTCR((1, "jar::openJarFile: opening %s\n",fname));
-    jarfp = fopen(fname, "wb");
-    if (!jarfp) {
-      fprintf(u->errstrm, "Error: Could not open jar file: %s\n",fname);
-      exit(3); // Called only from the native standalone unpacker
-    }
-  }
-}
-
-// Add a ZIP entry and copy the file data
-void jar::addJarEntry(const char* fname,
-                      bool deflate_hint, int modtime,
-                      bytes& head, bytes& tail) {
-  int len = (int)(head.len + tail.len);
-  int clen = 0;
-
-  uint crc = get_crc32(0,Z_NULL,0);
-  if (head.len != 0)
-    crc = get_crc32(crc, (uchar *)head.ptr, (uint)head.len);
-  if (tail.len != 0)
-    crc = get_crc32(crc, (uchar *)tail.ptr, (uint)tail.len);
-
-  bool deflate = (deflate_hint && len > 0);
-
-  if (deflate) {
-    if (deflate_bytes(head, tail) == false) {
-      PRINTCR((2, "Reverting to store fn=%s\t%d -> %d\n",
-              fname, len, deflated.size()));
-      deflate = false;
-    }
-  }
-  clen = (int)((deflate) ? deflated.size() : len);
-  add_to_jar_directory(fname, !deflate, modtime, len, clen, crc);
-  write_jar_header(    fname, !deflate, modtime, len, clen, crc);
-
-  if (deflate) {
-    write_data(deflated.b);
-    // Write deflated information in extra header
-    write_jar_extra(len, clen, crc);
-  } else {
-    write_data(head);
-    write_data(tail);
-  }
-}
-
-// Add a ZIP entry for a directory name no data
-void jar::addDirectoryToJarFile(const char* dir_name) {
-  bool store = true;
-  add_to_jar_directory((const char*)dir_name, store, default_modtime, 0, 0, 0);
-  write_jar_header(    (const char*)dir_name, store, default_modtime, 0, 0, 0);
-}
-
-// Write out the central directory and close the jar file.
-void jar::closeJarFile(bool central) {
-  if (jarfp) {
-    fflush(jarfp);
-    if (central) write_central_directory();
-    fflush(jarfp);
-    fclose(jarfp);
-    PRINTCR((2, "jar::closeJarFile:closed jar-file\n"));
-  }
-  reset();
-}
-
-/* Convert the date y/n/d and time h:m:s to a four byte DOS date and
- *  time (date in high two bytes, time in low two bytes allowing magnitude
- *  comparison).
- */
-inline
-uLong jar::dostime(int y, int n, int d, int h, int m, int s) {
-  return y < 1980 ? dostime(1980, 1, 1, 0, 0, 0) :
-    (((uLong)y - 1980) << 25) | ((uLong)n << 21) | ((uLong)d << 16) |
-    ((uLong)h << 11) | ((uLong)m << 5) | ((uLong)s >> 1);
-}
-
-#ifdef _REENTRANT // solaris
-extern "C" struct tm *gmtime_r(const time_t *, struct tm *);
-#else
-#define gmtime_r(t, s) gmtime(t)
-#endif
-/*
- * Return the Unix time in DOS format
- */
-uLong jar::get_dostime(int modtime) {
-  // see defines.h
-  if (modtime != 0 && modtime == modtime_cache)
-    return dostime_cache;
-  if (modtime != 0 && default_modtime == 0)
-    default_modtime = modtime;  // catch a reasonable default
-  time_t t = modtime;
-  struct tm sbuf;
-  (void)memset((void*)&sbuf,0, sizeof(sbuf));
-  struct tm* s = gmtime_r(&t, &sbuf);
-  if (s == NULL) {
-    fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n");
-    exit(-1);
-  }
-  modtime_cache = modtime;
-  dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
-                          s->tm_hour, s->tm_min, s->tm_sec);
-  //printf("modtime %d => %d\n", modtime_cache, dostime_cache);
-  return dostime_cache;
-}
-
-
-
-#ifndef NO_ZLIB
-
-/* Returns true on success, and will set the clen to the compressed
-   length, the caller should verify if true and clen less than the
-   input data
-*/
-bool jar::deflate_bytes(bytes& head, bytes& tail) {
-  int len = (int)(head.len + tail.len);
-
-  z_stream zs;
-  BYTES_OF(zs).clear();
-
-  // NOTE: the window size should always be -MAX_WBITS normally -15.
-  // unzip/zipup.c and java/Deflater.c
-
-  int error = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
-                           -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
-  if (error != Z_OK) {
-    switch (error) {
-    case Z_MEM_ERROR:
-      PRINTCR((2, "Error: deflate error : Out of memory \n"));
-      break;
-    case Z_STREAM_ERROR:
-      PRINTCR((2,"Error: deflate error : Invalid compression level \n"));
-      break;
-    case Z_VERSION_ERROR:
-      PRINTCR((2,"Error: deflate error : Invalid version\n"));
-      break;
-    default:
-      PRINTCR((2,"Error: Internal deflate error error = %d\n", error));
-    }
-    return false;
-  }
-
-  deflated.empty();
-  zs.next_out  = (uchar*) deflated.grow(add_size(len, (len/2)));
-  zs.avail_out = (int)deflated.size();
-
-  zs.next_in = (uchar*)head.ptr;
-  zs.avail_in = (int)head.len;
-
-  bytes* first = &head;
-  bytes* last  = &tail;
-  if (last->len == 0) {
-    first = null;
-    last = &head;
-  } else if (first->len == 0) {
-    first = null;
-  }
-
-  if (first != null && error == Z_OK) {
-    zs.next_in = (uchar*) first->ptr;
-    zs.avail_in = (int)first->len;
-    error = deflate(&zs, Z_NO_FLUSH);
-  }
-  if (error == Z_OK) {
-    zs.next_in = (uchar*) last->ptr;
-    zs.avail_in = (int)last->len;
-    error = deflate(&zs, Z_FINISH);
-  }
-  if (error == Z_STREAM_END) {
-    if ((int)zs.total_out > 0) {
-      // Even if compressed size is bigger than uncompressed, write it
-      PRINTCR((2, "deflate compressed data %d -> %d\n", len, zs.total_out));
-      deflated.b.len = zs.total_out;
-      deflateEnd(&zs);
-      return true;
-    }
-    PRINTCR((2, "deflate expanded data %d -> %d\n", len, zs.total_out));
-    deflateEnd(&zs);
-    return false;
-  }
-
-  deflateEnd(&zs);
-  PRINTCR((2, "Error: deflate error deflate did not finish error=%d\n",error));
-  return false;
-}
-
-// Callback for fetching data from a GZIP input stream
-static jlong read_input_via_gzip(unpacker* u,
-                                  void* buf, jlong minlen, jlong maxlen) {
-  assert(minlen <= maxlen);  // don't talk nonsense
-  jlong numread = 0;
-  char* bufptr = (char*) buf;
-  char* inbuf = u->gzin->inbuf;
-  size_t inbuflen = sizeof(u->gzin->inbuf);
-  unpacker::read_input_fn_t read_gzin_fn =
-    (unpacker::read_input_fn_t) u->gzin->read_input_fn;
-  z_stream& zs = *(z_stream*) u->gzin->zstream;
-  while (numread < minlen) {
-    int readlen = (1 << 16);  // pretty arbitrary
-    if (readlen > (maxlen - numread))
-      readlen = (int)(maxlen - numread);
-    zs.next_out = (uchar*) bufptr;
-    zs.avail_out = readlen;
-    if (zs.avail_in == 0) {
-      zs.avail_in = (int) read_gzin_fn(u, inbuf, 1, inbuflen);
-      zs.next_in = (uchar*) inbuf;
-    }
-    int error = inflate(&zs, Z_NO_FLUSH);
-    if (error != Z_OK && error != Z_STREAM_END) {
-      u->abort("error inflating input");
-      break;
-    }
-    int nr = readlen - zs.avail_out;
-    u->gzcrc = crc32(u->gzcrc, (const unsigned char *)bufptr, nr);
-    numread += nr;
-    bufptr += nr;
-    assert(numread <= maxlen);
-    if (error == Z_STREAM_END) {
-      enum { TRAILER_LEN = 8 };
-      // skip 8-byte trailer
-      if (zs.avail_in >= TRAILER_LEN) {
-        zs.avail_in -= TRAILER_LEN;
-      } else {
-        // Bug: 5023768,we read past the TRAILER_LEN to see if there is
-        // any extraneous data, as we don't support concatenated .gz
-        // files just yet.
-        int extra = (int) read_gzin_fn(u, inbuf, 1, inbuflen);
-        zs.avail_in += extra - TRAILER_LEN;
-      }
-      // %%% should check final CRC and length here
-      // %%% should check for concatenated *.gz files here
-      if (zs.avail_in > 0)
-        u->abort("garbage after end of deflated input stream");
-      // pop this filter off:
-      u->gzin->free();
-      break;
-    }
-  }
-
-  //fprintf(u->errstrm, "readInputFn(%d,%d) => %d (gunzip)\n",
-  //        (int)minlen, (int)maxlen, (int)numread);
-  return numread;
-}
-
-void gunzip::init(unpacker* u_) {
-  BYTES_OF(*this).clear();
-  u = u_;
-  assert(u->gzin == null);  // once only, please
-  read_input_fn = (void*)u->read_input_fn;
-  zstream = NEW(z_stream, 1);
-  u->gzin = this;
-  u->read_input_fn = read_input_via_gzip;
-  u->gzcrc = crc32(0L, Z_NULL, 0);
-}
-
-void gunzip::start(int magic) {
-  assert((magic & GZIP_MAGIC_MASK) == GZIP_MAGIC);
-  int gz_flg = (magic & 0xFF);  // keep "flg", discard other 3 bytes
-  enum {
-    FHCRC    = (1<<1),
-    FEXTRA   = (1<<2),
-    FNAME    = (1<<3),
-    FCOMMENT = (1<<4)
-  };
-  char gz_mtime[4];
-  char gz_xfl[1];
-  char gz_os[1];
-  char gz_extra_len[2];
-  char gz_hcrc[2];
-  char gz_ignore;
-  // do not save extra, name, comment
-  read_fixed_field(gz_mtime, sizeof(gz_mtime));
-  read_fixed_field(gz_xfl, sizeof(gz_xfl));
-  read_fixed_field(gz_os, sizeof(gz_os));
-  if (gz_flg & FEXTRA) {
-    read_fixed_field(gz_extra_len, sizeof(gz_extra_len));
-    int extra_len = gz_extra_len[0] & 0xFF;
-    extra_len += (gz_extra_len[1] & 0xFF) << 8;
-    for (; extra_len > 0; extra_len--) {
-      read_fixed_field(&gz_ignore, 1);
-    }
-  }
-  int null_terms = 0;
-  if (gz_flg & FNAME)     null_terms++;
-  if (gz_flg & FCOMMENT)  null_terms++;
-  for (; null_terms; null_terms--) {
-    for (;;) {
-      gz_ignore = 0;
-      read_fixed_field(&gz_ignore, 1);
-      if (gz_ignore == 0)  break;
-    }
-  }
-  if (gz_flg & FHCRC)
-    read_fixed_field(gz_hcrc, sizeof(gz_hcrc));
-
-  if (aborting())  return;
-
-  // now the input stream is ready to read into the inflater
-  int error = inflateInit2((z_stream*) zstream, -MAX_WBITS);
-  if (error != Z_OK) { abort("cannot create input"); return; }
-}
-
-void gunzip::free() {
-  assert(u->gzin == this);
-  u->gzin = null;
-  u->read_input_fn = (unpacker::read_input_fn_t) this->read_input_fn;
-  inflateEnd((z_stream*) zstream);
-  mtrace('f', zstream, 0);
-  ::free(zstream);
-  zstream = null;
-  mtrace('f', this, 0);
-  ::free(this);
-}
-
-void gunzip::read_fixed_field(char* buf, size_t buflen) {
-  if (aborting())  return;
-  jlong nr = ((unpacker::read_input_fn_t)read_input_fn)
-    (u, buf, buflen, buflen);
-  if ((size_t)nr != buflen)
-    u->abort("short stream header");
-}
-
-#else // NO_ZLIB
-
-void gunzip::free() {
-}
-
-#endif // NO_ZLIB
--- a/jdk/src/jdk.runtime/share/native/common-unpack/zip.h	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-#define ushort unsigned short
-#define uint   unsigned int
-#define uchar  unsigned char
-
-struct unpacker;
-
-struct jar {
-  // JAR file writer
-  FILE*       jarfp;
-  int         default_modtime;
-
-  // Used by unix2dostime:
-  int         modtime_cache;
-  uLong       dostime_cache;
-
-  // Private members
-  fillbytes   central_directory;
-  uint        central_directory_count;
-  uint        output_file_offset;
-  fillbytes   deflated;  // temporary buffer
-
-  // pointer to outer unpacker, for error checks etc.
-  unpacker* u;
-
-  // Public Methods
-  void openJarFile(const char* fname);
-  void addJarEntry(const char* fname,
-                   bool deflate_hint, int modtime,
-                   bytes& head, bytes& tail);
-  void addDirectoryToJarFile(const char* dir_name);
-  void closeJarFile(bool central);
-
-  void init(unpacker* u_);
-
-  void free() {
-    central_directory.free();
-    deflated.free();
-  }
-
-  void reset() {
-    free();
-    init(u);
-  }
-
-  // Private Methods
-  void write_data(void* ptr, int len);
-  void write_data(bytes& b) { write_data(b.ptr, (int)b.len); }
-  void add_to_jar_directory(const char* fname, bool store, int modtime,
-                            int len, int clen, uLong crc);
-  void write_jar_header(const char* fname, bool store, int modtime,
-                        int len, int clen, unsigned int crc);
-  void write_jar_extra(int len, int clen, unsigned int crc);
-  void write_central_directory();
-  uLong dostime(int y, int n, int d, int h, int m, int s);
-  uLong get_dostime(int modtime);
-
-  // The definitions of these depend on the NO_ZLIB option:
-  bool deflate_bytes(bytes& head, bytes& tail);
-  static uint get_crc32(uint c, unsigned char *ptr, uint len);
-
-  // error handling
-  void abort(const char* msg) { unpack_abort(msg, u); }
-  bool aborting()             { return unpack_aborting(u); }
-};
-
-struct gunzip {
-  // optional gzip input stream control block
-
-  // pointer to outer unpacker, for error checks etc.
-  unpacker* u;
-
-  void* read_input_fn;  // underlying byte stream
-  void* zstream;        // inflater state
-  char inbuf[1 << 14];   // input buffer
-
-  void init(unpacker* u_);  // pushes new value on u->read_input_fn
-
-  void free();
-
-  void start(int magic);
-
-  // private stuff
-  void read_fixed_field(char* buf, size_t buflen);
-
-  // error handling
-  void abort(const char* msg) { unpack_abort(msg, u); }
-  bool aborting()             { return unpack_aborting(u); }
-};
--- a/jdk/src/jdk.runtime/share/native/libunpack/jni.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +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.
- */
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-
-#include <limits.h>
-
-#include <com_sun_java_util_jar_pack_NativeUnpack.h>
-
-#include "jni_util.h"
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-#include "coding.h"
-#include "bands.h"
-#include "constants.h"
-#include "zip.h"
-#include "unpack.h"
-
-
-static jfieldID  unpackerPtrFID;
-static jmethodID currentInstMID;
-static jmethodID readInputMID;
-static jclass    NIclazz;
-static jmethodID getUnpackerPtrMID;
-
-static char* dbg = null;
-
-#define THROW_IOE(x) JNU_ThrowIOException(env,x)
-
-#define CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(CERVTI_exception, CERVTI_message) \
-    do { \
-        if ((env)->ExceptionOccurred()) { \
-            THROW_IOE(CERVTI_message); \
-            return; \
-        } \
-        if ((CERVTI_exception) == NULL) { \
-                THROW_IOE(CERVTI_message); \
-                return; \
-        } \
-    } while (JNI_FALSE)
-
-
-#define CHECK_EXCEPTION_RETURN_VALUE(CERL_exception, CERL_return_value) \
-    do { \
-        if ((env)->ExceptionOccurred()) { \
-            return CERL_return_value; \
-        } \
-        if ((CERL_exception) == NULL) { \
-            return CERL_return_value; \
-        } \
-    } while (JNI_FALSE)
-
-
-// If these useful macros aren't defined in jni_util.h then define them here
-#ifndef CHECK_NULL_RETURN
-#define CHECK_NULL_RETURN(x, y) \
-    do { \
-        if ((x) == NULL) return (y); \
-    } while (JNI_FALSE)
-#endif
-
-#ifndef CHECK_EXCEPTION_RETURN
-#define CHECK_EXCEPTION_RETURN(env, y) \
-    do { \
-        if ((*env)->ExceptionCheck(env)) return (y); \
-    } while (JNI_FALSE)
-#endif
-
-static jlong read_input_via_jni(unpacker* self,
-                                void* buf, jlong minlen, jlong maxlen);
-
-static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
-  unpacker* uPtr;
-  jlong p = env->CallLongMethod(pObj, getUnpackerPtrMID);
-  uPtr = (unpacker*)jlong2ptr(p);
-  if (uPtr == null) {
-    if (noCreate)  return null;
-    uPtr = new unpacker();
-    if (uPtr == null) {
-      THROW_IOE(ERROR_ENOMEM);
-      return null;
-    }
-    //fprintf(stderr, "get_unpacker(%p) uPtr=%p initializing\n", pObj, uPtr);
-    uPtr->init(read_input_via_jni);
-    uPtr->jniobj = (void*) env->NewGlobalRef(pObj);
-    env->SetLongField(pObj, unpackerPtrFID, ptr2jlong(uPtr));
-  }
-  uPtr->jnienv = env;  // keep refreshing this in case of MT access
-  return uPtr;
-}
-
-// This is the harder trick:  Pull the current state out of mid-air.
-static unpacker* get_unpacker() {
-  //fprintf(stderr, "get_unpacker()\n");
-  JavaVM* vm = null;
-  jsize nVM = 0;
-  jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM);
-  // other VM implements may differ, thus for correctness, we need these checks
-  if (retval != JNI_OK || nVM != 1)
-    return null;
-  void* envRaw = null;
-  vm->GetEnv(&envRaw, JNI_VERSION_1_1);
-  JNIEnv* env = (JNIEnv*) envRaw;
-  //fprintf(stderr, "get_unpacker() env=%p\n", env);
-  CHECK_NULL_RETURN(env, NULL);
-  jobject pObj = env->CallStaticObjectMethod(NIclazz, currentInstMID);
-  // We should check upon the known non-null variable because here we want to check
-  // only for pending exceptions. If pObj is null we'll deal with it later.
-  CHECK_EXCEPTION_RETURN_VALUE(env, NULL);
-  //fprintf(stderr, "get_unpacker0() pObj=%p\n", pObj);
-  if (pObj != null) {
-    // Got pObj and env; now do it the easy way.
-    return get_unpacker(env, pObj);
-  }
-  // this should really not happen, if it does something is seriously
-  // wrong throw an exception
-  THROW_IOE(ERROR_INTERNAL);
-  return null;
-}
-
-static void free_unpacker(JNIEnv *env, jobject pObj, unpacker* uPtr) {
-  if (uPtr != null) {
-    //fprintf(stderr, "free_unpacker(%p) uPtr=%p\n", pObj, uPtr);
-    env->DeleteGlobalRef((jobject) uPtr->jniobj);
-    uPtr->jniobj = null;
-    uPtr->free();
-    delete uPtr;
-    env->SetLongField(pObj, unpackerPtrFID, (jlong)null);
-   }
-}
-
-unpacker* unpacker::current() {
-  return get_unpacker();
-}
-
-// Callback for fetching data, Java style.  Calls NativeUnpack.readInputFn().
-static jlong read_input_via_jni(unpacker* self,
-                                void* buf, jlong minlen, jlong maxlen) {
-  JNIEnv* env = (JNIEnv*) self->jnienv;
-  jobject pbuf = env->NewDirectByteBuffer(buf, maxlen);
-  return env->CallLongMethod((jobject) self->jniobj, readInputMID,
-                             pbuf, minlen);
-}
-
-JNIEXPORT void JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz) {
-#ifndef PRODUCT
-  dbg = getenv("DEBUG_ATTACH");
-  while( dbg != null) { sleep(10); }
-#endif
-  NIclazz = (jclass) env->NewGlobalRef(clazz);
-
-  unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J");
-  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(unpackerPtrFID, ERROR_INIT);
-
-  currentInstMID = env->GetStaticMethodID(clazz, "currentInstance",
-                                          "()Ljava/lang/Object;");
-  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(currentInstMID, ERROR_INIT);
-
-  readInputMID = env->GetMethodID(clazz, "readInputFn",
-                                  "(Ljava/nio/ByteBuffer;J)J");
-  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(readInputMID, ERROR_INIT);
-
-  getUnpackerPtrMID = env->GetMethodID(clazz, "getUnpackerPtr", "()J");
-  CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(getUnpackerPtrMID, ERROR_INIT);
-}
-
-JNIEXPORT jlong JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_start(JNIEnv *env, jobject pObj,
-                                   jobject pBuf, jlong offset) {
-  // try to get the unpacker pointer the hard way first, we do this to ensure
-  // valid object pointers and env is intact, if not now is good time to bail.
-  unpacker* uPtr = get_unpacker();
-  //fprintf(stderr, "start(%p) uPtr=%p initializing\n", pObj, uPtr);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, -1);
-  // redirect our io to the default log file or whatever.
-  uPtr->redirect_stdio();
-
-  void*  buf    = null;
-  size_t buflen = 0;
-  if (pBuf != null) {
-    buf    = env->GetDirectBufferAddress(pBuf);
-    buflen = (size_t)env->GetDirectBufferCapacity(pBuf);
-    if (buflen == 0)  buf = null;
-    if (buf == null) { THROW_IOE(ERROR_INTERNAL); return 0; }
-    if ((size_t)offset >= buflen)
-      { buf = null; buflen = 0; }
-    else
-      { buf = (char*)buf + (size_t)offset; buflen -= (size_t)offset; }
-  }
-  // before we start off we make sure there is no other error by the time we
-  // get here
-  if (uPtr->aborting()) {
-    THROW_IOE(uPtr->get_abort_message());
-    return 0;
-  }
-  uPtr->start(buf, buflen);
-  if (uPtr->aborting()) {
-    THROW_IOE(uPtr->get_abort_message());
-    return 0;
-  }
-
-  return ((jlong)
-          uPtr->get_segments_remaining() << 32)
-    + uPtr->get_files_remaining();
-}
-
-JNIEXPORT jboolean JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_getNextFile(JNIEnv *env, jobject pObj,
-                                         jobjectArray pParts) {
-
-  unpacker* uPtr = get_unpacker(env, pObj);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
-  unpacker::file* filep = uPtr->get_next_file();
-
-  if (uPtr->aborting()) {
-    THROW_IOE(uPtr->get_abort_message());
-    return false;
-  }
-
-  CHECK_NULL_RETURN(filep, false);
-  assert(filep == &uPtr->cur_file);
-
-  int pidx = 0, iidx = 0;
-  jintArray pIntParts = (jintArray) env->GetObjectArrayElement(pParts, pidx++);
-  CHECK_EXCEPTION_RETURN_VALUE(pIntParts, false);
-  jint*     intParts  = env->GetIntArrayElements(pIntParts, null);
-  intParts[iidx++] = (jint)( (julong)filep->size >> 32 );
-  intParts[iidx++] = (jint)( (julong)filep->size >>  0 );
-  intParts[iidx++] = filep->modtime;
-  intParts[iidx++] = filep->deflate_hint() ? 1 : 0;
-  env->ReleaseIntArrayElements(pIntParts, intParts, JNI_COMMIT);
-  jstring filename = env->NewStringUTF(filep->name);
-  CHECK_EXCEPTION_RETURN_VALUE(filename, false);
-  env->SetObjectArrayElement(pParts, pidx++, filename);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
-  jobject pDataBuf = null;
-  if (filep->data[0].len > 0) {
-    pDataBuf = env->NewDirectByteBuffer(filep->data[0].ptr,
-                                        filep->data[0].len);
-    CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
-  }
-  env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
-  pDataBuf = null;
-  if (filep->data[1].len > 0) {
-    pDataBuf = env->NewDirectByteBuffer(filep->data[1].ptr,
-                                        filep->data[1].len);
-    CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
-  }
-  env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
-
-  return true;
-}
-
-
-JNIEXPORT jobject JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject pObj) {
-  unpacker* uPtr = get_unpacker(env, pObj);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
-  unpacker::file* filep = &uPtr->cur_file;
-
-  if (uPtr->aborting()) {
-    THROW_IOE(uPtr->get_abort_message());
-    return false;
-  }
-
-  // We have fetched all the files.
-  // Now swallow up any remaining input.
-  if (uPtr->input_remaining() == 0) {
-    return null;
-  } else {
-    bytes remaining_bytes;
-    remaining_bytes.malloc(uPtr->input_remaining());
-    remaining_bytes.copyFrom(uPtr->input_scan(), uPtr->input_remaining());
-    return env->NewDirectByteBuffer(remaining_bytes.ptr, remaining_bytes.len);
-  }
-}
-
-JNIEXPORT jlong JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv *env, jobject pObj) {
-  unpacker* uPtr = get_unpacker(env, pObj, false);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
-  size_t consumed = uPtr->input_consumed();
-  free_unpacker(env, pObj, uPtr);
-  return consumed;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_setOption(JNIEnv *env, jobject pObj,
-                                       jstring pProp, jstring pValue) {
-  unpacker*   uPtr  = get_unpacker(env, pObj);
-  const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
-  CHECK_EXCEPTION_RETURN_VALUE(prop, false);
-  const char* value = env->GetStringUTFChars(pValue, JNI_FALSE);
-  CHECK_EXCEPTION_RETURN_VALUE(value, false);
-  jboolean   retval = uPtr->set_option(prop, value);
-  env->ReleaseStringUTFChars(pProp,  prop);
-  env->ReleaseStringUTFChars(pValue, value);
-  return retval;
-}
-
-JNIEXPORT jstring JNICALL
-Java_com_sun_java_util_jar_pack_NativeUnpack_getOption(JNIEnv *env, jobject pObj,
-                                       jstring pProp) {
-
-  unpacker*   uPtr  = get_unpacker(env, pObj);
-  CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
-  const char* prop  = env->GetStringUTFChars(pProp, JNI_FALSE);
-  CHECK_EXCEPTION_RETURN_VALUE(prop, NULL);
-  const char* value = uPtr->get_option(prop);
-  CHECK_EXCEPTION_RETURN_VALUE(value, NULL);
-  env->ReleaseStringUTFChars(pProp, prop);
-  return env->NewStringUTF(value);
-}
--- a/jdk/src/jdk.runtime/share/native/unpack200/main.cpp	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,470 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-#ifdef _ALLBSD_SOURCE
-#include <stdint.h>
-#define THRTYPE intptr_t
-#else
-#define THRTYPE int
-#endif
-
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#include <limits.h>
-#include <time.h>
-
-#if defined(unix) && !defined(PRODUCT)
-#include "pthread.h"
-#define THREAD_SELF ((THRTYPE)pthread_self())
-#endif
-
-#include "defines.h"
-#include "bytes.h"
-#include "utils.h"
-#include "coding.h"
-#include "bands.h"
-
-#include "constants.h"
-
-#include "zip.h"
-
-#include "unpack.h"
-
-
-int main(int argc, char **argv) {
-    return unpacker::run(argc, argv);
-}
-
-// Dealing with big-endian arch
-#ifdef _BIG_ENDIAN
-#define SWAP_INT(a) (((a>>24)&0xff) | ((a<<8)&0xff0000) | ((a>>8)&0xff00) | ((a<<24)&0xff000000))
-#else
-#define SWAP_INT(a) (a)
-#endif
-
-// Single-threaded, implementation, not reentrant.
-// Includes a weak error check against MT access.
-#ifndef THREAD_SELF
-#define THREAD_SELF ((THRTYPE) 0)
-#endif
-NOT_PRODUCT(static THRTYPE uThread = -1;)
-
-unpacker* unpacker::non_mt_current = null;
-unpacker* unpacker::current() {
-  //assert(uThread == THREAD_SELF);
-  return non_mt_current;
-}
-static void set_current_unpacker(unpacker* u) {
-  unpacker::non_mt_current = u;
-  assert(((uThread = (u == null) ? (THRTYPE) -1 : THREAD_SELF),
-          true));
-}
-
-// Callback for fetching data, Unix style.
-static jlong read_input_via_stdio(unpacker* u,
-                                  void* buf, jlong minlen, jlong maxlen) {
-  assert(minlen <= maxlen);  // don't talk nonsense
-  jlong numread = 0;
-  char* bufptr = (char*) buf;
-  while (numread < minlen) {
-    // read available input, up to buf.length or maxlen
-    int readlen = (1<<16);
-    if (readlen > (maxlen - numread))
-      readlen = (int)(maxlen - numread);
-    int nr = 0;
-    if (u->infileptr != null) {
-      nr = (int)fread(bufptr, 1, readlen, u->infileptr);
-    } else {
-#ifndef WIN32
-      // we prefer unbuffered inputs
-      nr = (int)read(u->infileno, bufptr, readlen);
-#else
-      nr = (int)fread(bufptr, 1, readlen, stdin);
-#endif
-    }
-    if (nr <= 0) {
-      if (errno != EINTR)
-        break;
-      nr = 0;
-    }
-    numread += nr;
-    bufptr += nr;
-    assert(numread <= maxlen);
-  }
-  //fprintf(u->errstrm, "readInputFn(%d,%d) => %d\n",
-  //        (int)minlen, (int)maxlen, (int)numread);
-  return numread;
-}
-
-enum { EOF_MAGIC = 0, BAD_MAGIC = -1 };
-static int read_magic(unpacker* u, char peek[], int peeklen) {
-  assert(peeklen == 4);  // magic numbers are always 4 bytes
-  jlong nr = (u->read_input_fn)(u, peek, peeklen, peeklen);
-  if (nr != peeklen) {
-    return (nr == 0) ? EOF_MAGIC : BAD_MAGIC;
-  }
-  int magic = 0;
-  for (int i = 0; i < peeklen; i++) {
-    magic <<= 8;
-    magic += peek[i] & 0xFF;
-  }
-  return magic;
-}
-
-static void setup_gzin(unpacker* u) {
-  gunzip* gzin = NEW(gunzip, 1);
-  gzin->init(u);
-}
-
-static const char* nbasename(const char* progname) {
-  const char* slash = strrchr(progname, '/');
-  if (slash != null)  progname = ++slash;
-  return progname;
-}
-
-static const char* usage_lines[] = {
-  "Usage:  %s [-opt... | --option=value]... x.pack[.gz] y.jar\n",
-    "\n",
-    "Unpacking Options\n",
-    "  -H{h}, --deflate-hint={h}     override transmitted deflate hint: true, false, or keep (default)\n",
-    "  -r, --remove-pack-file        remove input file after unpacking\n",
-    "  -v, --verbose                 increase program verbosity\n",
-    "  -q, --quiet                   set verbosity to lowest level\n",
-    "  -l{F}, --log-file={F}         output to the given log file, or '-' for standard output (default)\n",
-    "  -?, -h, --help                print this message\n",
-    "  -V, --version                 print program version\n",
-    "  -J{X}                         Java VM argument (ignored)\n",
-    null
-};
-
-static void usage(unpacker* u, const char* progname, bool full = false) {
-  // WinMain does not set argv[0] to the progrname
-  progname = (progname != null) ? nbasename(progname) : "unpack200";
-  for (int i = 0; usage_lines[i] != null; i++) {
-    fprintf(u->errstrm, usage_lines[i], progname);
-    if (!full) {
-      fprintf(u->errstrm,
-              "(For more information, run %s --help .)\n", progname);
-      break;
-    }
-  }
-}
-
-// argument parsing
-static char** init_args(int argc, char** argv, int &envargc) {
-  const char* env = getenv("UNPACK200_FLAGS");
-  ptrlist envargs;
-  envargs.init();
-  if (env != null) {
-    char* buf = (char*) strdup(env);
-    const char* delim = "\n\t ";
-    for (char* p = strtok(buf, delim); p != null; p = strtok(null, delim)) {
-      envargs.add(p);
-    }
-  }
-  // allocate extra margin at both head and tail
-  char** argp = NEW(char*, envargs.length()+argc+1);
-  char** argp0 = argp;
-  int i;
-  for (i = 0; i < envargs.length(); i++) {
-    *argp++ = (char*) envargs.get(i);
-  }
-  for (i = 1; i < argc; i++) {
-    // note: skip argv[0] (program name)
-    *argp++ = (char*) strdup(argv[i]);  // make a scratch copy
-  }
-  *argp = null; // sentinel
-  envargc = envargs.length();  // report this count to next_arg
-  envargs.free();
-  return argp0;
-}
-
-static int strpcmp(const char* str, const char* pfx) {
-  return strncmp(str, pfx, strlen(pfx));
-}
-
-static const char flag_opts[] = "vqrVh?";
-static const char string_opts[] = "HlJ";
-
-static int next_arg(char** &argp) {
-  char* arg = *argp;
-  if (arg == null || arg[0] != '-') { // end of option list
-    return 0;
-  }
-  //printf("opt: %s\n", arg);
-  char ach = arg[1];
-  if (ach == '\0') {
-    // ++argp;  // do not pop this arg
-    return 0;  // bare "-" is stdin/stdout
-  } else if (arg[1] == '-') {  // --foo option
-    static const char* keys[] = {
-      "Hdeflate-hint=",
-      "vverbose",
-      "qquiet",
-      "rremove-pack-file",
-      "llog-file=",
-      "Vversion",
-      "hhelp",
-      null };
-    if (arg[2] == '\0') {  // end of option list
-      ++argp;  // pop the "--"
-      return 0;
-    }
-    for (int i = 0; keys[i] != null; i++) {
-      const char* key = keys[i];
-      char kch = *key++;
-      if (strchr(key, '=') == null) {
-        if (!strcmp(arg+2, key)) {
-          ++argp;  // pop option arg
-          return kch;
-        }
-      } else {
-        if (!strpcmp(arg+2, key)) {
-          *argp += 2 + strlen(key);  // remove "--"+key from arg
-          return kch;
-        }
-      }
-    }
-  } else if (strchr(flag_opts, ach) != null) {  // plain option
-    if (arg[2] == '\0') {
-      ++argp;
-    } else {
-      // in-place edit of "-vxyz" to "-xyz"
-      arg += 1;  // skip original '-'
-      arg[0] = '-';
-      *argp = arg;
-    }
-    //printf("  key => %c\n", ach);
-    return ach;
-  } else if (strchr(string_opts, ach) != null) {  // argument-bearing option
-    if (arg[2] == '\0') {
-      if (argp[1] == null)  return -1;  // no next arg
-      ++argp;  // leave the argument in place
-    } else {
-      // in-place edit of "-Hxyz" to "xyz"
-      arg += 2;  // skip original '-H'
-      *argp = arg;
-    }
-    //printf("  key => %c\n", ach);
-    return ach;
-  }
-  return -1;  // bad argument
-}
-
-static const char sccsver[] = "1.30, 07/05/05";
-
-// Usage:  unpackage input.pack output.jar
-int unpacker::run(int argc, char **argv) {
-  unpacker u;
-  u.init(read_input_via_stdio);
-  set_current_unpacker(&u);
-
-  jar jarout;
-  jarout.init(&u);
-
-  int envargc = 0;
-  char** argbuf = init_args(argc, argv, envargc);
-  char** arg0 = argbuf+envargc;
-  char** argp = argbuf;
-
-  int verbose = 0;
-  char* logfile = null;
-
-  for (;;) {
-    const char* arg = (*argp == null)? "": u.saveStr(*argp);
-    bool isenvarg = (argp < arg0);
-    int ach = next_arg(argp);
-    bool hasoptarg = (ach != 0 && strchr(string_opts, ach) != null);
-    if (ach == 0 && argp >= arg0)  break;
-    if (isenvarg && argp == arg0 && hasoptarg)  ach = 0;  // don't pull from cmdline
-    switch (ach) {
-    case 'H':  u.set_option(UNPACK_DEFLATE_HINT,*argp++); break;
-    case 'v':  ++verbose; break;
-    case 'q':  verbose = 0; break;
-    case 'r':  u.set_option(UNPACK_REMOVE_PACKFILE,"1"); break;
-    case 'l':  logfile = *argp++; break;
-    case 'J':  argp += 1; break;  // skip ignored -Jxxx parameter
-
-    case 'V':
-      fprintf(u.errstrm, VERSION_STRING, nbasename(argv[0]), sccsver);
-      exit(0);
-
-    case 'h':
-    case '?':
-      usage(&u, argv[0], true);
-      exit(1);
-
-    default:
-      const char* inenv = isenvarg? " in ${UNPACK200_FLAGS}": "";
-      if (hasoptarg)
-        fprintf(u.errstrm, "Missing option string%s: %s\n", inenv, arg);
-      else
-        fprintf(u.errstrm, "Unrecognized argument%s: %s\n", inenv, arg);
-      usage(&u, argv[0]);
-      exit(2);
-    }
-  }
-
-  if (verbose != 0) {
-    u.set_option(DEBUG_VERBOSE, u.saveIntStr(verbose));
-  }
-  if (logfile != null) {
-    u.set_option(UNPACK_LOG_FILE, logfile);
-  }
-
-  u.redirect_stdio();
-
-  const char* source_file      = *argp++;
-  const char* destination_file = *argp++;
-
-  if (source_file == null || destination_file == null || *argp != null) {
-    usage(&u, argv[0]);
-    exit(2);
-  }
-
-  if (verbose != 0) {
-    fprintf(u.errstrm,
-            "Unpacking from %s to %s\n", source_file, destination_file);
-  }
-  bool& remove_source = u.remove_packfile;
-
-  if (strcmp(source_file, "-") == 0) {
-    remove_source = false;
-    u.infileno = fileno(stdin);
-  } else {
-    u.infileptr = fopen(source_file, "rb");
-    if (u.infileptr == null) {
-       fprintf(u.errstrm,
-               "Error: Could not open input file: %s\n", source_file);
-       exit(3); // Called only from the native standalone unpacker
-    }
-  }
-
-  if (strcmp(destination_file, "-") == 0) {
-    jarout.jarfp = stdout;
-    if (u.errstrm == stdout) // do not mix output
-      u.set_option(UNPACK_LOG_FILE, LOGFILE_STDERR);
-  } else {
-    jarout.openJarFile(destination_file);
-    assert(jarout.jarfp != null);
-  }
-
-  if (verbose != 0)
-    u.dump_options();
-
-  char peek[4];
-  int magic;
-
-  // check for GZIP input
-  magic = read_magic(&u, peek, (int)sizeof(peek));
-  if ((magic & GZIP_MAGIC_MASK) == GZIP_MAGIC) {
-    // Oops; must slap an input filter on this data.
-    setup_gzin(&u);
-    u.gzin->start(magic);
-    if (!u.aborting()) {
-      u.start();
-    }
-  } else {
-    u.gzcrc = 0;
-    u.start(peek, sizeof(peek));
-  }
-
-  // Note:  The checks to u.aborting() are necessary to gracefully
-  // terminate processing when the first segment throws an error.
-
-  for (;;) {
-    if (u.aborting())  break;
-
-    // Each trip through this loop unpacks one segment
-    // and then resets the unpacker.
-    for (unpacker::file* filep; (filep = u.get_next_file()) != null; ) {
-      if (u.aborting())  break;
-      u.write_file_to_jar(filep);
-    }
-    if (u.aborting())  break;
-
-    // Peek ahead for more data.
-    magic = read_magic(&u, peek, (int)sizeof(peek));
-    if (magic != (int)JAVA_PACKAGE_MAGIC) {
-      if (magic != EOF_MAGIC)
-        u.abort("garbage after end of pack archive");
-      break;   // all done
-    }
-
-    // Release all storage from parsing the old segment.
-    u.reset();
-
-    // Restart, beginning with the peek-ahead.
-    u.start(peek, sizeof(peek));
-  }
-
-
-
-  int status = 0;
-  if (u.aborting()) {
-    fprintf(u.errstrm, "Error: %s\n", u.get_abort_message());
-    status = 1;
-  }
-
-  if (!u.aborting() && u.infileptr != null) {
-    if (u.gzcrc != 0) {
-      // Read the CRC information from the gzip container
-      fseek(u.infileptr, -8, SEEK_END);
-      uint filecrc;
-      fread(&filecrc, sizeof(filecrc), 1, u.infileptr);
-      if (u.gzcrc != SWAP_INT(filecrc)) { // CRC error
-        if (strcmp(destination_file, "-") != 0) {
-          // Output is not stdout, remove it, it's broken
-          if (u.jarout != null)
-            u.jarout->closeJarFile(false);
-          remove(destination_file);
-        }
-        // Print out the error and exit with return code != 0
-        u.abort("CRC error, invalid compressed data.");
-      }
-    }
-    fclose(u.infileptr);
-    u.infileptr = null;
-  }
-
-  if (!u.aborting() && remove_source)
-    remove(source_file);
-
-  if (verbose != 0) {
-    fprintf(u.errstrm, "unpacker completed with status=%d\n", status);
-  }
-
-  u.finish();
-
-  u.free();  // tidy up malloc blocks
-  set_current_unpacker(null);  // clean up global pointer
-
-  return status;
-}
--- a/jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest	Thu Mar 12 13:35:03 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
-  <assemblyIdentity version="IMVERSION"
-     processorArchitecture="X86"
-     name="unpack200.exe"
-     type="win32"/> 
-
-  <description>Java(TM) SE Runtime Environment unpack200 Process.</description> 
-  <!-- Identify the application security requirements. -->
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel
-          level="asInvoker"
-          uiAccess="false"/>
-        </requestedPrivileges>
-       </security>
-  </trustInfo>
-</assembly>
--- a/jdk/test/TEST.ROOT	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/TEST.ROOT	Wed Jul 05 20:24:03 2017 +0200
@@ -5,7 +5,7 @@
 keys=2d dnd i18n
 
 # Tests that must run in othervm mode
-othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces
+othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation
 
 # Tests that cannot run concurrently
 exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,186 @@
+/*
+ * 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
+ * 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.io.PrintStream;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+
+public class Dynamic {
+
+    static final String ALGORITHM = "AES";
+    static final String[] MODE = {
+        "ECb", "CbC", "CTR", "PCBC", "OFB", "OFB150", "cFB", "CFB7",
+        "cFB8", "cFB16", "cFB24", "cFB32", "Cfb40", "cfB48", "cfB56",
+        "cfB64", "cfB72", "cfB80", "cfB88", "cfB96", "cfb104", "cfB112",
+        "cfB120", "cfB128", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40",
+        "OFB48", "OFB56", "OFB64", "OFB72", "OFB80", "OFB88", "OFB96",
+        "OFB104", "OFB112", "OFB120", "OFB128", "GCM"
+    };
+    static final String[] PADDING = {
+        "NoPadding", "PKCS5Padding", "ISO10126Padding"
+    };
+    static final String SUNJCE = "SunJCE";
+
+    Cipher ci = null;
+    byte[] iv = null;
+    AlgorithmParameterSpec aps = null;
+    SecretKey key = null;
+    int keyStrength;
+    static int DefaultSize = 128;
+
+    public void run(String[] argv) throws Exception {
+        if (!runAllTest(argv, System.out)) {
+            throw new Exception("Test Failed");
+        }
+    }
+
+    protected boolean runAllTest(String argv[], PrintStream out) {
+        boolean result = true;
+        StringBuilder failedList = new StringBuilder();
+        int failedCnt = 0;
+        int testCount = 0;
+        int padKinds; // how many kinds of padding mode such as PKCS5padding and
+        // NoPadding.
+
+        try {
+            for (int i = 0; i < 3; i++) {
+                keyStrength = DefaultSize + i * 64; // obtain the key size 128,
+                // 192, 256
+
+                for (int j = 0; j < MODE.length; j++) {
+                    if (MODE[j].equalsIgnoreCase("ECB")
+                            || MODE[j].equalsIgnoreCase("PCBC")
+                            || MODE[j].equalsIgnoreCase("CBC")) {
+                        padKinds = PADDING.length;
+                    } else {
+                        padKinds = 1;
+                    }
+
+                    for (int k = 0; k < padKinds; k++) {
+                        testCount++;
+                        try {
+                            if (!runTest(ALGORITHM, MODE[j], PADDING[k])) {
+                                result = false;
+                                failedCnt++;
+                                failedList.append(ALGORITHM + "/" + MODE[j]
+                                        + "/" + PADDING[k] + " ");
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            result = false;
+                            failedCnt++;
+                            failedList.append(ALGORITHM + "/" + MODE[j] + "/"
+                                    + PADDING[k] + " ");
+                        }
+
+                    }
+                }
+            }
+
+            if (result) {
+                out.println("STATUS:Passed. Test " + testCount
+                        + " cases, All Passed");
+                return true;
+            }
+            out.println("STATUS:Failed. " + failedCnt + " Failed: "
+                    + failedList);
+            return false;
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            out.println("STATUS:Failed. Unexpected Exception: " + ex);
+            return false;
+        }
+    }
+
+    protected boolean runTest(String algo, String mo, String pad)
+            throws Exception {
+        boolean result = true;
+        try {
+            byte[] plainText = new byte[160000];
+            new Random().nextBytes(plainText);
+
+            String transformation = algo + "/" + mo + "/" + pad;
+            ci = Cipher.getInstance(transformation, SUNJCE);
+            KeyGenerator kg = KeyGenerator.getInstance(algo, SUNJCE);
+            if (keyStrength > Cipher.getMaxAllowedKeyLength(transformation)) {
+                // skip if this key length is larger than what's
+                // configured in the jce jurisdiction policy files
+                System.out.println(keyStrength
+                        + " is larger than what's configured "
+                        + "in the jce jurisdiction policy files");
+                return result;
+            }
+            kg.init(keyStrength);
+            key = kg.generateKey();
+
+            if (!mo.equalsIgnoreCase("GCM")) {
+                ci.init(Cipher.ENCRYPT_MODE, key, aps);
+            } else {
+                ci.init(Cipher.ENCRYPT_MODE, key);
+            }
+            byte[] cipherText = new byte[ci.getOutputSize(plainText.length)];
+            int offset = ci.update(plainText, 0, plainText.length, cipherText,
+                    0);
+            ci.doFinal(cipherText, offset);
+
+            if (!mo.equalsIgnoreCase("ECB")) {
+                iv = ci.getIV();
+                aps = new IvParameterSpec(iv);
+            } else {
+                aps = null;
+            }
+
+            if (!mo.equalsIgnoreCase("GCM")) {
+                ci.init(Cipher.DECRYPT_MODE, key, aps);
+            } else {
+                ci.init(Cipher.DECRYPT_MODE, key, ci.getParameters());
+            }
+            byte[] recoveredText = new byte[ci.getOutputSize(cipherText.length)];
+            int len = ci.doFinal(cipherText, 0, cipherText.length,
+                    recoveredText);
+
+            byte[] tmp = new byte[len];
+            for (int i = 0; i < len; i++) {
+                tmp[i] = recoveredText[i];
+            }
+
+            result = Arrays.equals(plainText, tmp);
+        } catch (NoSuchAlgorithmException nsaEx) {
+            nsaEx.printStackTrace();
+            // CFB7 and OFB150 are negative test,SunJCE not support this
+            // algorithm
+            result = mo.equalsIgnoreCase("CFB7")
+                    || mo.equalsIgnoreCase("OFB150");
+
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * 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 8044193
+ * @summary Test AES ciphers with different modes and padding schemes with
+ *  default provider
+ */
+
+public class TestAESWithDefaultProvider extends Dynamic {
+    public static void main(String argv[]) throws Exception {
+        new TestAESWithDefaultProvider().run(argv);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,39 @@
+/* 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
+ * 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.Security;
+
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ *  remove then add provider.
+ * @run main/othervm/policy=testAES.policy TestAESWithProviderChange
+ */
+
+public class TestAESWithProviderChange extends Dynamic {
+    public static void main(String argv[]) throws Exception {
+        Security.removeProvider(SUNJCE);
+        Security.addProvider(new com.sun.crypto.provider.SunJCE());
+        new TestAESWithProviderChange().run(argv);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * 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
+ * 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.*;
+import java.security.Provider;
+
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ *  remove default provider then add it back.
+ * @run main/othervm/policy=testAES.policy TestAESWithRemoveAddProvider
+ */
+
+public class TestAESWithRemoveAddProvider extends Dynamic {
+    public static void main(String argv[]) throws Exception {
+        Provider pJCE = Security.getProvider(SUNJCE);
+        Security.removeProvider(SUNJCE);
+        Security.addProvider(pJCE);
+        new TestAESWithRemoveAddProvider().run(argv);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,6 @@
+grant 
+{
+    permission java.security.SecurityPermission "removeProvider.SunJCE";
+    permission java.security.SecurityPermission "insertProvider.SunJCE";
+    permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+};
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Wed Jul 05 20:24:03 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
  *      5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
  *      6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- *      4947220 7018606 7034570 4244896 5049299 8003488 8054494
+ *      4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
  * @summary Basic tests for Process and Environment Variable code
  * @run main/othervm/timeout=300 Basic
  * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
@@ -941,6 +941,14 @@
                () -> pb.redirectOutput(Redirect.from(ifile)),
                () -> pb.redirectError(Redirect.from(ifile)));
 
+        THROWS(NullPointerException.class,
+                () -> pb.redirectInput((File)null),
+                () -> pb.redirectOutput((File)null),
+                () -> pb.redirectError((File)null),
+                () -> pb.redirectInput((Redirect)null),
+                () -> pb.redirectOutput((Redirect)null),
+                () -> pb.redirectError((Redirect)null));
+
         THROWS(IOException.class,
                // Input file does not exist
                () -> pb.start());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,75 @@
+/*
+ * 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 8046246
+ * @summary Tests and benchmarks the JVMTI RedefineClasses when a
+ *          single class (and its parent) contains many methods.
+ *
+ * @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent
+ * @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true'
+ * @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp
+ */
+import java.lang.instrument.*;
+
+public class ManyMethodsBenchmarkAgent
+{
+    public  static boolean fail = false;
+    public  static boolean completed = false;
+    private static  Instrumentation instrumentation;
+
+    public static void
+    premain(    String agentArgs,
+                Instrumentation instrumentation) {
+        System.out.println("ManyMethodsBenchmarkAgent started");
+        ManyMethodsBenchmarkAgent.instrumentation = instrumentation;
+        System.out.println("ManyMethodsBenchmarkAgent finished");
+    }
+
+    static void instr() {
+        System.out.println("ManyMethodsBenchmarkAgent.instr started");
+
+        Class[] allClasses = instrumentation.getAllLoadedClasses();
+
+        for (int i = 0; i < allClasses.length; i++) {
+            Class klass = allClasses[i];
+            String name = klass.getName();
+            if (!name.equals("Base")) {
+                continue;
+            }
+            System.err.println("Instrumenting the class: " + klass);
+
+            try {
+                instrumentation.retransformClasses(klass);
+            } catch (Throwable e) {
+                System.err.println("Error: bad return from retransform: " + klass);
+                System.err.println("  ERROR: " + e);
+                fail = true;
+            }
+        }
+        completed = true;
+        System.out.println("ManyMethodsBenchmarkAgent.instr finished");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2015 Google Inc.  All Rights Reserved.
+ * 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.io.File;
+import java.io.FileWriter;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+/**
+ * A manual benchmark of the JVMTI RedefineClasses when a
+ * single class (and its parent) contains many methods.
+ */
+public class ManyMethodsBenchmarkApp {
+     // Limit is 64k but we can not put such many as the CP limit is 32k.
+     // In practice, it means a real limit is much lower (less than 22000).
+    static final int METHOD_COUNT = 20000;
+
+    static Class<?> loadClassInNewClassLoader(String className) throws Exception {
+        URL[] urls = { new File(".").toURI().toURL() };
+        URLClassLoader ucl = new URLClassLoader(urls, null);
+        Class<?> klazz = Class.forName(className, true, ucl);
+        return klazz;
+    }
+
+    static void benchmarkClassOperations(String className) throws Exception {
+        Class<?> klazz = loadClassInNewClassLoader(className);
+
+        Method[] methods = klazz.getDeclaredMethods();
+        if (methods.length != METHOD_COUNT) {
+            throw new AssertionError("unexpected method count: " + methods.length +
+                                     " expected: " + METHOD_COUNT);
+        }
+
+        methods = klazz.getMethods();
+        // returned methods includes those inherited from Object
+        int objectMethodSlop = 100;
+        if (methods.length <= METHOD_COUNT ||
+            methods.length >= METHOD_COUNT + objectMethodSlop) {
+            throw new AssertionError("unexpected method count: " + methods.length);
+        }
+
+        // Invoke methods to make them appear in the constant pool cache
+        Object obj = klazz.newInstance();
+        Object[] args = new Object[0];
+        for (Method m: methods) {
+            try {
+                Class<?>[] types = m.getParameterTypes();
+                String     name  = m.getName();
+             // System.out.println("method: " + name + "; argno: " + types.length);
+                if (types.length == 0 && name.length() == 2 && name.startsWith("f")) {
+                    m.invoke(obj, args);
+                }
+            } catch (InvocationTargetException ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("test started: ManyMethodsBenchmarkApp");
+
+        // Create source files with many methods
+        File base = new File("Base.java");
+        try (FileWriter fw = new FileWriter(base)) {
+            fw.write("public class Base {\n");
+            final int L = 10;
+            // Each of the first L methods makes calls to its own chunk of METHOD_COUNT/L methods
+            for (int k = 0; k < L; k++) {
+                fw.write("    public void f" + k + "() {\n");
+                int shift = (k == 0) ? L : 0;
+                for (int i = (k * (METHOD_COUNT/L)) + shift; i < (k + 1) * METHOD_COUNT/L; i++) {
+                    fw.write("        f" + i + "();\n");
+                }
+                fw.write("    }\n");
+            }
+
+            // The rest of (METHOD_COUNT - L) methods have empty body
+            for (int i = L; i < METHOD_COUNT; i++) {
+                fw.write("    public static void f" + i + "() {}\n");
+            }
+            fw.write("}\n");
+        }
+
+        // Compile the generated source files.
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        List<File> files = Arrays.asList(new File[] { base });
+        try (StandardJavaFileManager fileManager =
+             compiler.getStandardFileManager(null, null, null)) {
+            compiler.getTask(null, fileManager, null, null, null,
+                fileManager.getJavaFileObjectsFromFiles(files))
+                .call();
+        }
+
+        benchmarkClassOperations("Base");
+
+        ManyMethodsBenchmarkAgent.instr();
+
+        // Cleanup
+        base.delete();
+        new File("Base.class").delete();
+        if (!ManyMethodsBenchmarkAgent.completed) {
+            throw new Exception("ERROR: ManyMethodsBenchmarkAgent did not complete.");
+        }
+
+        if (ManyMethodsBenchmarkAgent.fail) {
+            throw new Exception("ERROR: ManyMethodsBenchmarkAgent failed.");
+        } else {
+            System.out.println("ManyMethodsBenchmarkAgent succeeded.");
+        }
+        System.out.println("test finished: ManyMethodsBenchmarkApp");
+    }
+}
--- a/jdk/test/java/math/BigDecimal/StringConstructor.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/math/BigDecimal/StringConstructor.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2005, 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
@@ -23,19 +23,20 @@
 
 /*
  * @test
- * @bug 4103117 4331084 4488017 4490929 6255285 6268365
- * @summary Tests the BigDecimal string constructor.
+ * @library ..
+ * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460
+ * @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed).
  */
 
 import java.math.*;
-import java.util.Random;
 
 public class StringConstructor {
 
-    private static int seed = new Random().nextInt();
-    private static Random rnd = new Random(seed);
+    private static RandomSeed rndSeed = new RandomSeed(false);
 
     public static void main(String[] args) throws Exception {
+        System.out.println("Random number generator seed = " + rndSeed.getSeed());
+
         constructWithError("");
         constructWithError("+");
         constructWithError("-");
@@ -71,19 +72,18 @@
 
         // Roundtrip tests
         for (int i=0; i<100; i++) {
-            int size = rnd.nextInt(100) + 1;
-            BigInteger bi = new BigInteger(size, rnd);
-            if (rnd.nextBoolean())
+            int size = rndSeed.getRandom().nextInt(100) + 1;
+            BigInteger bi = new BigInteger(size, rndSeed.getRandom());
+            if (rndSeed.getRandom().nextBoolean())
                 bi = bi.negate();
             int decimalLength = bi.toString().length();
-            int scale = rnd.nextInt(decimalLength);
+            int scale = rndSeed.getRandom().nextInt(decimalLength);
             BigDecimal bd = new BigDecimal(bi, scale);
             String bdString = bd.toString();
             // System.err.println("bi" + bi.toString() + "\tscale " + scale);
             // System.err.println("bd string: " + bdString);
             BigDecimal bdDoppel = new BigDecimal(bdString);
             if (!bd.equals(bdDoppel)) {
-                System.err.println("Random number seed = " + seed);
                 System.err.println("bd string: scale: " + bd.scale() +
                                    "\t" + bdString);
                 System.err.println("bd doppel: scale: " + bdDoppel.scale() +
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, 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
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465
- * @summary tests methods in BigInteger
+ * @library ..
+ * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460
+ * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed)
  * @run main/timeout=400 BigIntegerTest
  * @author madbot
  */
@@ -35,7 +36,6 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.math.BigInteger;
-import java.util.Random;
 
 /**
  * This is a simple test class created to ensure that the results
@@ -86,7 +86,8 @@
 
     static final int SIZE = 1000; // numbers per batch
 
-    static Random rnd = new Random();
+    private static RandomSeed rndSeed = new RandomSeed(false);
+
     static boolean failure = false;
 
     public static void constructor() {
@@ -97,7 +98,7 @@
         int arrayLength = 23;
         int halfLength = arrayLength/2;
         byte[] array = new byte[arrayLength];
-        rnd.nextBytes(array);
+        rndSeed.getRandom().nextBytes(array);
 
         int[][] offLen = new int[][] { // offset, length, num exceptions
             {-1, arrayLength, 1},                         // negative offset
@@ -161,7 +162,7 @@
         }
 
         byte[] magNonZeroLength = new byte[42];
-        rnd.nextBytes(magNonZeroLength);
+        rndSeed.getRandom().nextBytes(magNonZeroLength);
         for (int signum = -1; signum <= 1; signum++) {
             BigInteger bi = new BigInteger(signum, magNonZeroLength, 0, 0);
             if (bi.compareTo(BigInteger.ZERO) != 0) {
@@ -174,13 +175,13 @@
 
         for (int i = 0; i < SIZE; i++) {
             // create reference value via a different code path from those tested
-            BigInteger reference = new BigInteger(2 + rnd.nextInt(336), 4, rnd);
+            BigInteger reference = new BigInteger(2 + rndSeed.getRandom().nextInt(336), 4, rndSeed.getRandom());
 
             byte[] refArray = reference.toByteArray();
             int refLen = refArray.length;
-            int factor = rnd.nextInt(5);
-            int objLen = refArray.length + factor*rnd.nextInt(refArray.length) + 1;
-            int offset = rnd.nextInt(objLen - refLen);
+            int factor = rndSeed.getRandom().nextInt(5);
+            int objLen = refArray.length + factor*rndSeed.getRandom().nextInt(refArray.length) + 1;
+            int offset = rndSeed.getRandom().nextInt(objLen - refLen);
             byte[] objArray = new byte[objLen];
             System.arraycopy(refArray, 0, objArray, offset, refLen);
 
@@ -191,7 +192,7 @@
                 failCount++;
             }
 
-            boolean isNegative = rnd.nextBoolean();
+            boolean isNegative = rndSeed.getRandom().nextBoolean();
             BigInteger signMag = new BigInteger(isNegative ? -1 : 1, objArray, offset, refLen);
             if (signMag.compareTo(isNegative ? reference.negate() : reference) != 0) {
                 System.err.println("Sign-magnitude BigInteger not equal for offset " +
@@ -208,7 +209,7 @@
 
         for (int i=0; i<SIZE; i++) {
             // Test identity x^power == x*x*x ... *x
-            int power = rnd.nextInt(6) + 2;
+            int power = rndSeed.getRandom().nextInt(6) + 2;
             BigInteger x = fetchNumber(order);
             BigInteger y = x.pow(power);
             BigInteger z = x;
@@ -309,12 +310,12 @@
         for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_KARATSUBA - 32 - 1);
             BigInteger u = base.add(x);
-            int a = 1 + rnd.nextInt(31);
+            int a = 1 + rndSeed.getRandom().nextInt(31);
             BigInteger w = u.shiftLeft(a);
 
             BigInteger y = fetchNumber(BITS_KARATSUBA - 32 - 1);
             BigInteger v = base.add(y);
-            int b = 1 + rnd.nextInt(32);
+            int b = 1 + rndSeed.getRandom().nextInt(32);
             BigInteger z = v.shiftLeft(b);
 
             BigInteger multiplyResult = u.multiply(v).shiftLeft(a + b);
@@ -363,7 +364,7 @@
         for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_KARATSUBA_SQUARE - 32 - 1);
             BigInteger u = base.add(x);
-            int a = 1 + rnd.nextInt(31);
+            int a = 1 + rndSeed.getRandom().nextInt(31);
             BigInteger w = u.shiftLeft(a);
 
             BigInteger squareResult = u.multiply(u).shiftLeft(2*a);
@@ -381,7 +382,7 @@
         for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_TOOM_COOK_SQUARE - 32 - 1);
             BigInteger u = base.add(x);
-            int a = 1 + rnd.nextInt(31);
+            int a = 1 + rndSeed.getRandom().nextInt(31);
             BigInteger w = u.shiftLeft(a);
 
             BigInteger squareResult = u.multiply(u).shiftLeft(2*a);
@@ -415,20 +416,20 @@
 
         BigInteger base = BigInteger.ONE.shiftLeft(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 33);
         for (int i=0; i<SIZE; i++) {
-            BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 34, rnd);
+            BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER + BITS_BURNIKEL_ZIEGLER_OFFSET - 34, rndSeed.getRandom());
             BigInteger v = base.add(addend);
 
-            BigInteger u = v.multiply(BigInteger.valueOf(2 + rnd.nextInt(Short.MAX_VALUE - 1)));
+            BigInteger u = v.multiply(BigInteger.valueOf(2 + rndSeed.getRandom().nextInt(Short.MAX_VALUE - 1)));
 
-            if(rnd.nextBoolean()) {
+            if(rndSeed.getRandom().nextBoolean()) {
                 u = u.negate();
             }
-            if(rnd.nextBoolean()) {
+            if(rndSeed.getRandom().nextBoolean()) {
                 v = v.negate();
             }
 
-            int a = BITS_BURNIKEL_ZIEGLER_OFFSET + rnd.nextInt(16);
-            int b = 1 + rnd.nextInt(16);
+            int a = BITS_BURNIKEL_ZIEGLER_OFFSET + rndSeed.getRandom().nextInt(16);
+            int b = 1 + rndSeed.getRandom().nextInt(16);
             BigInteger w = u.multiply(BigInteger.ONE.shiftLeft(a));
             BigInteger z = v.multiply(BigInteger.ONE.shiftLeft(b));
 
@@ -450,7 +451,7 @@
         int failCount = 0;
 
         for (int i=0; i<SIZE*10; i++) {
-            int x = rnd.nextInt();
+            int x = rndSeed.getRandom().nextInt();
             BigInteger bigX = BigInteger.valueOf((long)x);
             int bit = (x < 0 ? 0 : 1);
             int tmp = x, bitCount = 0;
@@ -471,7 +472,7 @@
         int failCount = 0;
 
         for (int i=0; i<SIZE*10; i++) {
-            int x = rnd.nextInt();
+            int x = rndSeed.getRandom().nextInt();
             BigInteger bigX = BigInteger.valueOf((long)x);
             int signBit = (x < 0 ? 0x80000000 : 0);
             int tmp = x, bitLength, j;
@@ -575,7 +576,7 @@
 
         for (int i=0; i<100; i++) {
             BigInteger x = fetchNumber(order);
-            int n = Math.abs(rnd.nextInt()%200);
+            int n = Math.abs(rndSeed.getRandom().nextInt()%200);
 
             if (!x.shiftLeft(n).equals
                 (x.multiply(BigInteger.valueOf(2L).pow(n))))
@@ -642,8 +643,8 @@
 
         // Generic string conversion.
         for (int i=0; i<100; i++) {
-            byte xBytes[] = new byte[Math.abs(rnd.nextInt())%100+1];
-            rnd.nextBytes(xBytes);
+            byte xBytes[] = new byte[Math.abs(rndSeed.getRandom().nextInt())%100+1];
+            rndSeed.getRandom().nextBytes(xBytes);
             BigInteger x = new BigInteger(xBytes);
 
             for (int radix=Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
@@ -667,7 +668,7 @@
 
             for (int bits = upper; bits >= lower; bits--) {
                 for (int i = 0; i < 50; i++) {
-                    BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rnd));
+                    BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rndSeed.getRandom()));
 
                     for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
                         String result = x.toString(radix);
@@ -764,9 +765,9 @@
         int failCount = 0;
 
         for (int i=0; i<10; i++) {
-            BigInteger m = new BigInteger(100, 5, rnd);
+            BigInteger m = new BigInteger(100, 5, rndSeed.getRandom());
             while(m.compareTo(BigInteger.ONE) != 1)
-                m = new BigInteger(100, 5, rnd);
+                m = new BigInteger(100, 5, rndSeed.getRandom());
             BigInteger exp = m.subtract(BigInteger.ONE);
             BigInteger base = fetchNumber(order).abs();
             while(base.compareTo(m) != -1)
@@ -826,7 +827,7 @@
 
         // Test consistency
         for(int i=0; i<10; i++) {
-            p1 = BigInteger.probablePrime(100, rnd);
+            p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
             if (!p1.isProbablePrime(100)) {
                 System.err.println("Consistency "+p1.toString(16));
                 failCount++;
@@ -867,7 +868,7 @@
         // Numbers of the form (6k+1)(12k+1)(18k+1) are Carmichael numbers if
         // each of the factors is prime
         int found = 0;
-        BigInteger f1 = new BigInteger(40, 100, rnd);
+        BigInteger f1 = new BigInteger(40, 100, rndSeed.getRandom());
         while (found < NUM_CARMICHAELS_TO_TEST) {
             BigInteger k = null;
             BigInteger f2, f3;
@@ -894,8 +895,8 @@
 
         // Test some composites that are products of 2 primes
         for (int i=0; i<50; i++) {
-            p1 = BigInteger.probablePrime(100, rnd);
-            p2 = BigInteger.probablePrime(100, rnd);
+            p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
+            p2 = BigInteger.probablePrime(100, rndSeed.getRandom());
             c1 = p1.multiply(p2);
             if (c1.isProbablePrime(100)) {
                 System.err.println("Composite failed "+c1.toString(16));
@@ -904,8 +905,8 @@
         }
 
         for (int i=0; i<4; i++) {
-            p1 = BigInteger.probablePrime(600, rnd);
-            p2 = BigInteger.probablePrime(600, rnd);
+            p1 = BigInteger.probablePrime(600, rndSeed.getRandom());
+            p2 = BigInteger.probablePrime(600, rndSeed.getRandom());
             c1 = p1.multiply(p2);
             if (c1.isProbablePrime(100)) {
                 System.err.println("Composite failed "+c1.toString(16));
@@ -960,7 +961,7 @@
         // Next, pick some large primes, use nextProbablePrime to find the
         // next one, and make sure there are no primes in between
         for (int i=0; i<100; i+=10) {
-            p1 = BigInteger.probablePrime(50 + i, rnd);
+            p1 = BigInteger.probablePrime(50 + i, rndSeed.getRandom());
             p2 = p1.add(ONE);
             p3 = p1.nextProbablePrime();
             while(p2.compareTo(p3) < 0) {
@@ -1025,7 +1026,7 @@
         }
 
         for(int i=0; i<10; i++) {
-            BigInteger b1 = fetchNumber(rnd.nextInt(100));
+            BigInteger b1 = fetchNumber(rndSeed.getRandom().nextInt(100));
             BigInteger b2 = null;
             File f = new File("serialtest");
             try (FileOutputStream fos = new FileOutputStream(f)) {
@@ -1059,6 +1060,7 @@
      *
      */
     public static void main(String[] args) throws Exception {
+        System.out.println("Random number generator seed = " + rndSeed.getSeed());
 
         // Some variables for sizing test numbers in bits
         int order1 = ORDER_MEDIUM;
@@ -1131,8 +1133,8 @@
      * If order is less than 2, order is changed to 2.
      */
     private static BigInteger fetchNumber(int order) {
-        boolean negative = rnd.nextBoolean();
-        int numType = rnd.nextInt(7);
+        boolean negative = rndSeed.getRandom().nextBoolean();
+        int numType = rndSeed.getRandom().nextInt(7);
         BigInteger result = null;
         if (order < 2) order = 2;
 
@@ -1156,14 +1158,14 @@
                 break;
 
             case 3: // One bit in number
-                result = BigInteger.ONE.shiftLeft(rnd.nextInt(order));
+                result = BigInteger.ONE.shiftLeft(rndSeed.getRandom().nextInt(order));
                 break;
 
             case 4: // Random bit density
                 byte[] val = new byte[(order+7)/8];
-                int iterations = rnd.nextInt(order);
+                int iterations = rndSeed.getRandom().nextInt(order);
                 for (int i=0; i<iterations; i++) {
-                    int bitIdx = rnd.nextInt(order);
+                    int bitIdx = rndSeed.getRandom().nextInt(order);
                     val[bitIdx/8] |= 1 << (bitIdx%8);
                 }
                 result = new BigInteger(1, val);
@@ -1171,9 +1173,9 @@
             case 5: // Runs of consecutive ones and zeros
                 result = ZERO;
                 int remaining = order;
-                int bit = rnd.nextInt(2);
+                int bit = rndSeed.getRandom().nextInt(2);
                 while (remaining > 0) {
-                    int runLength = Math.min(remaining, rnd.nextInt(order));
+                    int runLength = Math.min(remaining, rndSeed.getRandom().nextInt(order));
                     result = result.shiftLeft(runLength);
                     if (bit > 0)
                         result = result.add(ONE.shiftLeft(runLength).subtract(ONE));
@@ -1183,7 +1185,7 @@
                 break;
 
             default: // random bits
-                result = new BigInteger(order, rnd);
+                result = new BigInteger(order, rndSeed.getRandom());
         }
 
         if (negative)
--- a/jdk/test/java/math/BigInteger/ModPow65537.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/math/BigInteger/ModPow65537.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -23,13 +23,13 @@
 
 /*
  * @test
- * @bug 4891312
- * @summary verify that modPow() not broken by the special case for 65537
+ * @library ..
+ * @bug 4891312 8074460
+ * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
  * @author Andreas Sterbenz
  */
 
 import java.math.BigInteger;
-import java.util.*;
 
 import java.security.*;
 import java.security.spec.*;
@@ -78,7 +78,9 @@
     private static void testSigning(KeyPair kp) throws Exception {
         System.out.println(kp.getPublic());
         byte[] data = new byte[1024];
-        new Random().nextBytes(data);
+        RandomSeed rndSeed = new RandomSeed(false);
+        System.out.println("Random number generator seed = " + rndSeed.getSeed());
+        rndSeed.getRandom().nextBytes(data);
 
         Signature sig = Signature.getInstance("SHA1withRSA", "SunRsaSign");
         sig.initSign(kp.getPrivate());
--- a/jdk/test/java/math/BigInteger/PrimeTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,13 @@
 
 /*
  * @test
- * @bug 8026236
- * @summary test primality verification methods in BigInteger
+ * @library ..
+ * @bug 8026236 8074460
+ * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
  * @author bpb
  */
 import java.math.BigInteger;
 import java.util.BitSet;
-import java.util.HashSet;
 import java.util.List;
 import java.util.NavigableSet;
 import java.util.Set;
@@ -178,7 +178,9 @@
         }
 
         // Create a list of non-prime BigIntegers.
-        List<BigInteger> nonPrimeBigInts = (new SplittableRandom())
+        RandomSeed rndSeed = new RandomSeed(true);
+        System.out.println("Random number generator seed = " + rndSeed.getSeed());
+        List<BigInteger> nonPrimeBigInts = (rndSeed.getSplittableRandom())
                 .ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf)
                 .filter(b -> !b.isProbablePrime(certainty)).collect(toList());
 
--- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 1025, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +24,10 @@
 /*
  * @test
  * @ignore This test has huge memory requirements
+ * @library ..
  * @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
- * @bug 6910473 8021204 8021203 9005933
- * @summary Test range of BigInteger values
+ * @bug 6910473 8021204 8021203 9005933 8074460
+ * @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed)
  * @author Dmitry Nadezhin
  */
 import java.io.ByteArrayInputStream;
@@ -35,7 +36,6 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Arrays;
-import java.util.Random;
 import java.math.BigInteger;
 
 public class SymmetricRangeTests {
@@ -114,8 +114,9 @@
         System.out.println("Testing overflow in BitSieve.sieveSingle");
         int bitLength = (5 << 27) - 1;
         try {
-            Random rnd = new Random();
-            BigInteger actual = new BigInteger(bitLength, 0, rnd);
+            RandomSeed rndSeed = new RandomSeed(false);
+            System.out.println("Random number generator seed = " + rndSeed.getSeed());
+            BigInteger actual = new BigInteger(bitLength, 0, rndSeed.getRandom());
             throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());
         } catch (ArithmeticException e) {
             // expected
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/RandomSeed.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,81 @@
+/*
+ * 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.util.Random;
+import java.util.SplittableRandom;
+
+public class RandomSeed {
+    private long seed = 0L;
+    private Random rnd = null;
+    private SplittableRandom srnd = null;
+
+    public RandomSeed(boolean isSplittableRandom) {
+        init(isSplittableRandom);
+    }
+
+    private void init(boolean isSplittableRandom) {
+        // obtain seed from environment if supplied
+        boolean isSeedProvided = false;
+        try {
+            // note that Long.valueOf(null) also throws a NumberFormatException
+            // so if the property is undefined this will still work correctly
+            seed = Long.valueOf(System.getProperty("seed"));
+            isSeedProvided = true;
+        } catch (NumberFormatException e) {
+            // do nothing: isSeedProvided is already false
+        }
+
+        // if no seed from environment, create a fresh one
+        Random tmpRnd = null;
+        if (!isSeedProvided) {
+            tmpRnd = new Random();
+            seed = tmpRnd.nextLong();
+        }
+
+        // create the PRNG
+        if (isSplittableRandom) {
+            srnd = new SplittableRandom(seed);
+        } else {
+            rnd = tmpRnd != null ? tmpRnd : new Random();
+            rnd.setSeed(seed);
+        }
+    }
+
+    public Random getRandom() {
+        if (rnd == null) {
+            throw new IllegalStateException("Variable of type Random not initialized");
+        }
+        return rnd;
+    }
+
+    public SplittableRandom getSplittableRandom() {
+        if (srnd == null) {
+            throw new IllegalStateException("Variable of type SplittableRandom not initialized");
+        }
+        return srnd;
+    }
+
+    public long getSeed() {
+        return seed;
+    }
+}
--- a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java	Wed Jul 05 20:24:03 2017 +0200
@@ -152,144 +152,181 @@
     @DataProvider(name="parseSuccess")
     Object[][] data_parseSuccess() {
         return new Object[][] {
-                {"Z", 1, -1, ZoneId.of("Z")},
-                {"UTC", 3, -1, ZoneId.of("UTC")},
-                {"UT", 2, -1, ZoneId.of("UT")},
-                {"GMT", 3, -1, ZoneId.of("GMT")},
+                {"Z", 1, -1, ZoneId.of("Z"), true},
+                {"UTC", 3, -1, ZoneId.of("UTC"), false},
+                {"UT", 2, -1, ZoneId.of("UT"), false},
+                {"GMT", 3, -1, ZoneId.of("GMT"), false},
 
-                {"+00:00", 6, -1, ZoneOffset.UTC},
-                {"UTC+00:00", 9, -1, ZoneId.of("UTC")},
-                {"UT+00:00", 8, -1, ZoneId.of("UT")},
-                {"GMT+00:00", 9, -1, ZoneId.of("GMT")},
-                {"-00:00", 6, -1, ZoneOffset.UTC},
-                {"UTC-00:00", 9, -1, ZoneId.of("UTC")},
-                {"UT-00:00", 8, -1, ZoneId.of("UT")},
-                {"GMT-00:00", 9, -1, ZoneId.of("GMT")},
+                {"+00:00", 6, -1, ZoneOffset.UTC, true},
+                {"UTC+00:00", 9, -1, ZoneId.of("UTC"), false},
+                {"UT+00:00", 8, -1, ZoneId.of("UT"), false},
+                {"GMT+00:00", 9, -1, ZoneId.of("GMT"), false},
+                {"-00:00", 6, -1, ZoneOffset.UTC, true},
+                {"UTC-00:00", 9, -1, ZoneId.of("UTC"), false},
+                {"UT-00:00", 8, -1, ZoneId.of("UT"), false},
+                {"GMT-00:00", 9, -1, ZoneId.of("GMT"), false},
 
-                {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)},
-                {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")},
-                {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")},
-                {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")},
-                {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
-                {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")},
-                {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")},
-                {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")},
+                {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30), true},
+                {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30"), false},
+                {"UT+02:30", 8, -1, ZoneId.of("UT+02:30"), false},
+                {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30"), false},
+                {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30), true},
+                {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30"), false},
+                {"UT-02:30", 8, -1, ZoneId.of("UT-02:30"), false},
+                {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30"), false},
 
                 // fallback to UTC
-                {"UTC-01:WW", 3, -1, ZoneId.of("UTC")},
-                {"UT-02:WW", 2, -1, ZoneId.of("UT")},
-                {"GMT-03:WW", 3, -1, ZoneId.of("GMT")},
-                {"Z0", 1, -1, ZoneOffset.UTC},
-                {"UTC1", 3, -1, ZoneId.of("UTC")},
+                {"UTC-01:WW", 3, -1, ZoneId.of("UTC"), false},
+                {"UT-02:WW", 2, -1, ZoneId.of("UT"), false},
+                {"GMT-03:WW", 3, -1, ZoneId.of("GMT"), false},
+                {"Z0", 1, -1, ZoneOffset.UTC, true},
+                {"UTC1", 3, -1, ZoneId.of("UTC"), false},
 
                 // Z not parsed as zero
-                {"UTCZ", 3, -1, ZoneId.of("UTC")},
-                {"UTZ", 2, -1, ZoneId.of("UT")},
-                {"GMTZ", 3, -1, ZoneId.of("GMT")},
+                {"UTCZ", 3, -1, ZoneId.of("UTC"), false},
+                {"UTZ", 2, -1, ZoneId.of("UT"), false},
+                {"GMTZ", 3, -1, ZoneId.of("GMT"), false},
 
                 // 0 not parsed
-                {"UTC0", 3, -1, ZoneId.of("UTC")},
-                {"UT0", 2, -1, ZoneId.of("UT")},
+                {"UTC0", 3, -1, ZoneId.of("UTC"), false},
+                {"UT0", 2, -1, ZoneId.of("UT"), false},
 
                 // fail to parse
-                {"", 0, 0, null},
-                {"A", 0, 0, null},
-                {"UZ", 0, 0, null},
-                {"GMA", 0, 0, null},
-                {"0", 0, 0, null},
-                {"+", 0, 0, null},
-                {"-", 0, 0, null},
+                {"", 0, 0, null, false},
+                {"A", 0, 0, null, false},
+                {"UZ", 0, 0, null, false},
+                {"GMA", 0, 0, null, false},
+                {"0", 0, 0, null, false},
+                {"+", 0, 0, null, false},
+                {"-", 0, 0, null, false},
 
                 // zone IDs
-                {"Europe/London", 13, -1, ZoneId.of("Europe/London")},
-                {"America/New_York", 16, -1, ZoneId.of("America/New_York")},
-                {"America/Bogusville", 0, 0, null},
+                {"Europe/London", 13, -1, ZoneId.of("Europe/London"), false},
+                {"America/New_York", 16, -1, ZoneId.of("America/New_York"), false},
+                {"America/Bogusville", 0, 0, null, false},
         };
     }
 
     @Test(dataProvider="parseSuccess")
-    public void test_parseSuccess_plain(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+    public void test_ZoneId_parseSuccess_plain(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.appendZoneId();
+        test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneId_parseSuccess_prefix(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.appendZoneId();
+        pos.setIndex(3);
+        test("XXX" + text,
+             expectedIndex + 3,
+             expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+             expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneId_parseSuccess_suffix(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
         builder.appendZoneId();
+        test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneId_parseSuccess_caseSensitive(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.parseCaseSensitive().appendZoneId();
+
+        if (text.matches("[^A-Z]*[A-Z].*")) {  // if input has letters
+            String lcText = text.toLowerCase(Locale.ENGLISH);
+            TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+            assertEquals(pos.getErrorIndex() >= 0, true);
+            assertEquals(pos.getIndex(), 0);
+            assertEquals(parsed, null);
+        } else {
+            test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+        }
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneId_parseSuccess_caseInsensitive(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.parseCaseInsensitive().appendZoneId();
+        test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneOrOffsetId_parseSuccess_plain(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.appendZoneOrOffsetId();
+        test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneOrOffsetId_parseSuccess_prefix(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.appendZoneOrOffsetId();
+        pos.setIndex(3);
+        test("XXX" + text,
+             expectedIndex + 3,
+             expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+             expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneOrOffsetId_parseSuccess_suffix(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.appendZoneOrOffsetId();
+        test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneOrOffsetId_parseSuccess_caseSensitive(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.parseCaseSensitive().appendZoneOrOffsetId();
+        if (text.matches("[^A-Z]*[A-Z].*")) {  // if input has letters
+            String lcText = text.toLowerCase(Locale.ENGLISH);
+            TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+            assertEquals(pos.getErrorIndex() >= 0, true);
+            assertEquals(pos.getIndex(), 0);
+            assertEquals(parsed, null);
+        } else {
+            test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+        }
+    }
+
+    @Test(dataProvider="parseSuccess")
+    public void test_ZoneOrOffsetIdparseSuccess_caseInsensitive(
+        String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+    {
+        builder.parseCaseInsensitive().appendZoneOrOffsetId();
+        test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+    }
+
+    private void test(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected,
+                      boolean isZoneOffset) {
         TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
         assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
         assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
         if (expected != null) {
-            assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + text);
-            assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + text);
-            assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + text);
-        } else {
-            assertEquals(parsed, null);
-        }
-    }
-
-    @Test(dataProvider="parseSuccess")
-    public void test_parseSuccess_prefix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
-        builder.appendZoneId();
-        pos.setIndex(3);
-        String prefixText = "XXX" + text;
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(prefixText, pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0  ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText);
-        assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText);
-        if (expected != null) {
-            assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText);
-            assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + prefixText);
-            assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + prefixText);
-        } else {
-            assertEquals(parsed, null);
-        }
-    }
-
-    @Test(dataProvider="parseSuccess")
-    public void test_parseSuccess_suffix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
-        builder.appendZoneId();
-        String suffixText = text + "XXX";
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(suffixText, pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText);
-        assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText);
-        if (expected != null) {
-            assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText);
-            assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + suffixText);
-            assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + suffixText);
-        } else {
-            assertEquals(parsed, null);
-        }
-    }
-
-    @Test(dataProvider="parseSuccess")
-    public void test_parseSuccess_caseSensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
-        builder.parseCaseSensitive().appendZoneId();
-        String lcText = text.toLowerCase(Locale.ENGLISH);
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
-        if (text.matches("[^A-Z]*[A-Z].*")) {  // if input has letters
-            assertEquals(pos.getErrorIndex() >= 0, true);
-            assertEquals(pos.getIndex(), 0);
-            assertEquals(parsed, null);
-        } else {
-            // case sensitive made no difference
-            assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
-            assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
-            if (expected != null) {
-                assertEquals(parsed.query(TemporalQueries.zoneId()), expected);
-                assertEquals(parsed.query(TemporalQueries.offset()), null);
-                assertEquals(parsed.query(TemporalQueries.zone()), expected);
-            } else {
-                assertEquals(parsed, null);
-            }
-        }
-    }
-
-    @Test(dataProvider="parseSuccess")
-    public void test_parseSuccess_caseInsensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
-        builder.parseCaseInsensitive().appendZoneId();
-        String lcText = text.toLowerCase(Locale.ENGLISH);
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
-        assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
-        if (expected != null) {
-            ZoneId zid = parsed.query(TemporalQueries.zoneId());
-            assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + lcText);
-            assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + lcText);
-            assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + lcText);
+            assertEquals(parsed.query(TemporalQueries.zoneId()),
+                         expected,
+                         "Incorrect zoneId parsing: " + text);
+            assertEquals(parsed.query(TemporalQueries.offset()),
+                         isZoneOffset ? expected : null,
+                         "Incorrect offset parsing: " + text);
+            assertEquals(parsed.query(TemporalQueries.zone()),
+                         expected,
+                         "Incorrect zone parsing: " + text);
         } else {
             assertEquals(parsed, null);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,89 @@
+/*
+ * 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.lang.reflect.Constructor;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferencesFactory;
+
+/*
+ * @test
+ * @bug 8068373
+ * @summary Ensure writing a code point U+0000 null control character is detected.
+ */
+public class CodePointZeroPrefsTest
+{
+    public static void main(String[] args) throws Exception
+    {
+        int failures = 0;
+
+        // Deliberately reflect so you can reproduce it on any platform.
+        Constructor<? extends PreferencesFactory> constructor =
+            Class.forName("java.util.prefs.FileSystemPreferencesFactory").asSubclass(PreferencesFactory.class).getDeclaredConstructor();
+        constructor.setAccessible(true);
+        PreferencesFactory factory = constructor.newInstance();
+
+        Preferences node = factory.userRoot().node("com/acme/testing");
+
+        // legal key and value
+        try {
+            node.put("a", "1");
+        } catch (IllegalArgumentException iae) {
+            System.err.println("Unexpected IllegalArgumentException for legal key");
+            failures++;
+        }
+
+        // illegal key only
+        int numIAEs = 0;
+        try {
+            node.put("a\u0000b", "1");
+            System.err.println("IllegalArgumentException not thrown for illegal key");
+            failures++;
+        } catch (IllegalArgumentException iae) {
+            // do nothing
+        }
+
+        // illegal value only
+        numIAEs = 0;
+        try {
+            node.put("ab", "2\u00003");
+            System.err.println("IllegalArgumentException not thrown for illegal value");
+            failures++;
+        } catch (IllegalArgumentException iae) {
+            // do nothing
+        }
+
+        // illegal key and value
+        numIAEs = 0;
+        try {
+            node.put("a\u0000b", "2\u00003");
+            System.err.println("IllegalArgumentException not thrown for illegal entry");
+            failures++;
+        } catch (IllegalArgumentException iae) {
+            // do nothing
+        }
+
+        if (failures != 0) {
+            throw new RuntimeException("CodePointZeroPrefsTest failed with "
+                + failures + " errors!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/text/resources/Format/Bug8074791.java	Wed Jul 05 20:24:03 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * 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 8074791
+ * @summary Make sure that Finnish month names are correct in formatted text.
+ */
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import static java.text.DateFormat.*;
+import static java.util.Calendar.JANUARY;
+
+public class Bug8074791 {
+    private static Locale FINNISH = new Locale("fi");
+    private static String JAN_FORMAT = "tammikuuta";
+    private static String JAN_STANDALONE = "tammikuu";
+
+    public static void main(String[] arg) {
+        int errors = 0;
+
+        DateFormat df = DateFormat.getDateInstance(LONG, FINNISH);
+        Date jan20 = new GregorianCalendar(2015, JANUARY, 20).getTime();
+        String str = df.format(jan20).toString();
+        // Extract the month name (locale data dependent)
+        String month = str.replaceAll(".+\\s([a-z]+)\\s\\d+$", "$1");
+        if (!month.equals(JAN_FORMAT)) {
+            errors++;
+            System.err.println("wrong format month name: got '" + month
+                               + "', expected '" + JAN_FORMAT + "'");
+        }
+
+        SimpleDateFormat sdf = new SimpleDateFormat("LLLL", FINNISH); // stand-alone month name
+        month = sdf.format(jan20);
+        if (!month.equals(JAN_STANDALONE)) {
+            errors++;
+            System.err.println("wrong stand-alone month name: got '" + month
+                               + "', expected '" + JAN_STANDALONE + "'");
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException();
+        }
+    }
+}
--- a/jdk/test/sun/text/resources/LocaleData	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/sun/text/resources/LocaleData	Wed Jul 05 20:24:03 2017 +0200
@@ -8273,3 +8273,9 @@
 FormatData/zh/MonthNarrows/10=11
 FormatData/zh/MonthNarrows/11=12
 FormatData/zh/MonthNarrows/12=
+
+# bug #8074791
+FormatData/fi/DatePatterns/0=d. MMMM yyyy
+FormatData/fi/DatePatterns/1=d. MMMM yyyy
+FormatData/fi/DatePatterns/2=d.M.yyyy
+FormatData/fi/DatePatterns/3=d.M.yyyy
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
- *      8037343 8055222 8042126
+ *      8037343 8055222 8042126 8074791
  * @summary Verify locale data
  *
  */
--- a/jdk/test/tools/launcher/TestSpecialArgs.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/jdk/test/tools/launcher/TestSpecialArgs.java	Wed Jul 05 20:24:03 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7124089 7131021 8042469 8066185
+ * @bug 7124089 7131021 8042469 8066185 8074373
  * @summary Checks for Launcher special flags, such as MacOSX specific flags,
  *          and JVM NativeMemoryTracking flags.
  * @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
@@ -270,6 +270,16 @@
         tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
         checkTestResult(tr);
 
+        // should accept with no warnings
+        tr = doExec(javaCmd, "-cp", jarFile.getName(),
+                    "-XX:NativeMemoryTracking=summary", "Foo");
+        ensureNoWarnings(tr);
+
+        // should accept with no warnings
+        tr = doExec(javaCmd, "-classpath", jarFile.getName(),
+                    "-XX:NativeMemoryTracking=summary", "Foo");
+        ensureNoWarnings(tr);
+
         // make sure a missing class is handled correctly, because the class
         // resolution is performed by the JVM.
         tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
@@ -278,6 +288,14 @@
         }
     }
 
+    void ensureNoWarnings(TestResult tr) {
+        checkTestResult(tr);
+        if (tr.contains("warning: Native Memory Tracking")) {
+            System.err.println(tr.toString());
+            throw new RuntimeException("Test Fails");
+        }
+    }
+
     void checkTestResult(TestResult tr) {
         if (!tr.isOK()) {
             System.err.println(tr.toString());
--- a/make/CompileJavaModules.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
 
 ################################################################################
 
+java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
 java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
 java.base_CLEAN := intrinsic.properties
 
@@ -89,10 +90,12 @@
 
 ################################################################################
 
+java.datatransfer_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
 java.datatransfer_COPY := flavormap.properties
 
 ################################################################################
 
+java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-missing,-reference '-Xdoclint/package:java.*,javax.*' 
 java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
 java.desktop_CLEAN := iio-plugin.properties cursors.properties
 
@@ -239,15 +242,18 @@
 
 ################################################################################
 
+java.scripting_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.scripting_COPY := .js
 java.scripting_CLEAN := .properties
 
 ################################################################################
 
+java.sql_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 
 ################################################################################
 
+java.sql.rowset_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.sql.rowset_CLEAN_FILES := $(wildcard \
     $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/com/sun/rowset/*.properties \
     $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
@@ -261,6 +267,7 @@
 
 ################################################################################
 
+java.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.rmi_CLEAN_FILES := $(wildcard \
     $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/registry/resources/*.properties \
     $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/server/resources/*.properties)
@@ -309,14 +316,17 @@
 
 ################################################################################
 
+java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.naming_CLEAN := jndiprovider.properties
 
 ################################################################################
 
+java.security.saaj_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.security.saaj_CLEAN := .properties
 
 ################################################################################
 
+java.xml.crypto_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.xml.crypto_COPY := .dtd .xml
 java.xml.crypto_CLEAN := .properties
 
@@ -485,7 +495,7 @@
     $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
   endif
   $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
-  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)"
+  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)" $$($1_ADD_JAVAC_FLAGS)
 
   $$(eval $$(call SetupJavaCompilation,$1, \
       SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
--- a/make/Images.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/Images.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -38,7 +38,7 @@
 ############################################################################
 
 MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
-               jdk.security.auth jdk.security.jgss jdk.runtime
+               jdk.security.auth jdk.security.jgss jdk.pack200
 
 # providers
 PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
@@ -46,8 +46,8 @@
 
 # tools
 TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
-               jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
-               jdk.xml.bind jdk.xml.ws
+               jdk.hotspot.agent jdk.hprof.agent jdk.jartool jdk.jdi jdk.jdwp.agent \
+               jdk.policytool jdk.rmic jdk.xml.bind jdk.xml.ws
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   PROVIDER_MODULES += jdk.crypto.mscapi
@@ -488,6 +488,42 @@
 JDK_TARGETS += $(COPY_JRTFS_JAR)
 
 ################################################################################
+# Code coverage data files
+
+ifeq ($(GCOV_ENABLED), true)
+
+  GCOV_FIND_EXPR := -type f -name "*.gcno"
+
+  ifeq ($(JVM_VARIANT_CLIENT), true)
+    $(eval $(call SetupCopyFiles,COPY_HOTSPOT_CLIENT_GCOV_GCNO, \
+        SRC := $(HOTSPOT_OUTPUTDIR), \
+        DEST := $(SYMBOLS_IMAGE_DIR)/gcov/hotspot/client, \
+        FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR)/*compiler1/ $(GCOV_FIND_EXPR)), \
+        FLATTEN := true))
+
+    SYMBOLS_TARGETS += $(COPY_HOTSPOT_CLIENT_GCOV_GCNO)
+  endif
+
+  ifeq ($(JVM_VARIANT_SERVER), true)
+    $(eval $(call SetupCopyFiles,COPY_HOTSPOT_SERVER_GCOV_GCNO, \
+        SRC := $(HOTSPOT_OUTPUTDIR), \
+        DEST := $(SYMBOLS_IMAGE_DIR)/gcov/hotspot/server, \
+        FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR)/*compiler2/ $(GCOV_FIND_EXPR)), \
+        FLATTEN := true))
+
+    SYMBOLS_TARGETS += $(COPY_HOTSPOT_SERVER_GCOV_GCNO)
+  endif
+
+  $(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
+      SRC := $(SUPPORT_OUTPUTDIR)/native, \
+      DEST := $(SYMBOLS_IMAGE_DIR)/gcov/jdk, \
+      FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
+
+  SYMBOLS_TARGETS += $(COPY_JDK_GCOV_GCNO)
+
+endif
+
+################################################################################
 
 # Include custom post hook here to make it possible to augment the target lists
 # before actual target prerequisites are declared.
@@ -498,7 +534,8 @@
 $(JRE_TARGETS): $(TOOL_JRE_TARGETS)
 $(JDK_TARGETS): $(TOOL_JDK_TARGETS)
 
-jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)
+jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS) \
+    $(SYMBOLS_TARGETS)
 
 
 $(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
--- a/make/Jprt.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/Jprt.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -33,10 +33,16 @@
     override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
   endif
   ifdef JPRT_ARCHIVE_INSTALL_BUNDLE
-    override JPRT_ARCHIVE_INSTALL_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
+    override JPRT_ARCHIVE_INSTALL_BUNDLE := \
+        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
   endif
   ifdef JPRT_ARCHIVE_TEST_BUNDLE
-    override JPRT_ARCHIVE_TEST_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
+    override JPRT_ARCHIVE_TEST_BUNDLE := \
+        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
+  endif
+  ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE
+    override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \
+        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE))
   endif
 endif
 
@@ -51,6 +57,9 @@
 ifndef JPRT_ARCHIVE_TEST_BUNDLE
   JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
 endif
+ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
+  JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
+endif
 
 ifeq ($(SKIP_BOOT_CYCLE), false)
   jprt_bundle: bootcycle-images
@@ -59,6 +68,10 @@
 # This target must be called in the context of a SPEC file
 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE)
 
+ifeq ($(GCOV_ENABLED), true)
+  jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
+endif
+
 # This target must be called in the context of a SPEC file
 $(JPRT_ARCHIVE_BUNDLE): bundles
 	$(MKDIR) -p $(@D)
@@ -70,6 +83,11 @@
 	$(RM) $@
 	$(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@
 
+$(JPRT_ARCHIVE_SYMBOLS_BUNDLE): bundles
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip $@
+
 SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
 SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
 SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
@@ -80,11 +98,19 @@
 bundles: all
 	@$(call TargetEnter)
 	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
-	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
-	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
-	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
+	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r \
+	    $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
+	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r \
+	    $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
+	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \
+	    $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
 	if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
-	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
+	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \
+	      $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
+	fi
+	if [ -d $(SYMBOLS_IMAGE_DIR) ] ; then \
+	  $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r \
+	      $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip . ; \
 	fi
 	@$(call TargetExit)
 
--- a/make/Main.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/Main.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -531,7 +531,7 @@
 # file.
 
 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
-    images make-support test-make
+    images make-support test-make bundles
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native
 CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
--- a/make/common/IdlCompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/IdlCompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -88,15 +88,8 @@
 #   EXCLUDES
 #   OLDIMPLBASES
 #   DELETES
-define SetupIdlCompilation
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupIdlCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupIdlCompilationInner
-  $(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))
+SetupIdlCompilation = $(NamedParamsMacroTemplate)
+define SetupIdlCompilationBody
 
   # Find all existing java files and existing class files.
   $$(call MakeDir,$$($1_BIN))
--- a/make/common/JavaCompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/JavaCompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -59,16 +59,8 @@
 #   FLAGS:=Flags to be supplied to javac
 #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
 #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
-define SetupJavaCompiler
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilerInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupJavaCompilerInner
-  $(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))
-
+SetupJavaCompiler = $(NamedParamsMacroTemplate)
+define SetupJavaCompilerBody
   # The port file contains the tcp/ip on which the server listens
   # and the cookie necessary to talk to the server.
   $1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
@@ -84,10 +76,11 @@
 # 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:
+#   DEPENDENCIES:=List of dependencies for the jar target. If left empty,
+#       dependencies are calculated automatically from the source files found.
+#       For this to work, the source files must exist when the makefile is
+#       parsed.
 #   SRCS:=List of directories in where to find files to add to archive
 #   SUFFIXES:=File suffixes to include in jar
 #   INCLUDES:=List of directories/packages in SRCS that should be included
@@ -102,17 +95,8 @@
 #       added to the archive.
 #   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
 #   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
-define SetupArchive
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-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 $(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))
+SetupArchive = $(NamedParamsMacroTemplate)
+define SetupArchiveBody
 
   $1_JARMAIN:=$(strip $$($1_JARMAIN))
   $1_JARNAME:=$$(notdir $$($1_JAR))
@@ -171,29 +155,27 @@
   # When this macro is run in the same makefile as the java compilation, dependencies are
   # transfered in make variables. When the macro is run in a different makefile than the
   # java compilation, the dependencies need to be found in the filesystem.
-  ifneq (,$2)
-    $1_DEPS:=$2
-  else
+  ifeq ($$($1_DEPENDENCIES), )
     # Add all source roots to the find cache since we are likely going to run find
     # on these more than once. The cache will only be updated if necessary.
     $$(eval $$(call FillCacheFind, $$($1_FIND_LIST)))
-    $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
+    $1_DEPENDENCIES:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
         $$(call CacheFind,$$($1_SRCS)))
     ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
-      $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
+      $1_DEPENDENCIES:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPENDENCIES))
     endif
     ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
-      $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
+      $1_DEPENDENCIES:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPENDENCIES))
     endif
     # Look for EXTRA_FILES in all SRCS dirs and as absolute paths.
-    $1_DEPS+=$$(wildcard $$(foreach src, $$($1_SRCS), \
+    $1_DEPENDENCIES+=$$(wildcard $$(foreach src, $$($1_SRCS), \
         $$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))
     ifeq (,$$($1_SKIP_METAINF))
-      $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
+      $1_DEPENDENCIES+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
     endif
   endif
   # The dependency list should never be empty
-  ifeq ($$(strip $$($1_DEPS)), )
+  ifeq ($$(strip $$($1_DEPENDENCIES)), )
     $$(warning No dependencies found for $1)
   endif
 
@@ -288,7 +270,7 @@
   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$(dir $$($1_JAR))_the.$$($1_JARNAME).vardeps)
 
   # Here is the rule that creates/updates the jar file.
-  $$($1_JAR) : $$($1_DEPS) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
+  $$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
 	$(MKDIR) -p $$($1_BIN)
 	$$($1_GREP_INCLUDE_OUTPUT)
 	$$($1_GREP_EXCLUDE_OUTPUT)
@@ -429,15 +411,8 @@
 #   HEADERS:=path to directory where all generated c-headers are written.
 #   DEPENDS:=Extra dependecy
 #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
-define SetupJavaCompilation
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupJavaCompilationInner
-  $(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))
+SetupJavaCompilation = $(NamedParamsMacroTemplate)
+define SetupJavaCompilationBody
 
   # Verify arguments
   ifeq ($$($1_BIN),)
@@ -653,7 +628,8 @@
       $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
     endif
 
-    $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1), \
+    $$(eval $$(call SetupArchive,ARCHIVE_$1, \
+        DEPENDENCIES:=$$($1), \
         SRCS:=$$($1_BIN), \
         SUFFIXES:=$$($1_SUFFIXES), \
         EXCLUDE:=$$($1_EXCLUDES), \
--- a/make/common/MakeBase.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/MakeBase.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -374,28 +374,70 @@
 # Make sure logging is setup for everyone that includes MakeBase.gmk.
 $(eval $(call SetupLogging))
 
-# 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 $(strip $($i)),$(NEWLINE) $(strip [$i] $($i))))))
+################################################################################
+# Creates a sequence of increasing numbers (inclusive).
+# Param 1 - starting number
+# Param 2 - ending number
+sequence = \
+    $(wordlist $1, $2, $(strip \
+        $(eval SEQUENCE_COUNT :=) \
+        $(call _sequence-do,$(strip $2))))
+
+_sequence-do = \
+    $(if $(word $1, $(SEQUENCE_COUNT)),, \
+      $(eval SEQUENCE_COUNT += .) \
+      $(words $(SEQUENCE_COUNT)) \
+      $(call _sequence-do,$1))
+
+################################################################################
+
+MAX_PARAMS := 30
+PARAM_SEQUENCE := $(call sequence, 2, $(MAX_PARAMS))
+
+# Template for creating a macro taking named parameters. To use it, assign the
+# template to a variable with the name you want for your macro, using '='
+# assignment. Then define a macro body with the suffix "Body". The Body macro
+# should take 1 parameter which should be a unique string for that invocation
+# of the macro.
+# Ex:
+# SetupFoo = $(NamedParamsMacroTemplate)
+# define SetupFooBody
+#   # do something
+#   # access parameters as $$($1_BAR)
+# endef
+# Call it like this
+# $(eval $(call SetupFoo, BUILD_SOMETHING, \
+#     BAR := some parameter value, \
+# ))
+define NamedParamsMacroTemplate
+  $(if $($(MAX_PARAMS)),$(error Internal makefile error: \
+      Too many named arguments to macro, please update MAX_PARAMS in MakeBase.gmk))
+  # Iterate over 2 3 4... and evaluate the named parameters with $1_ as prefix
+  $(foreach i,$(PARAM_SEQUENCE), $(if $(strip $($i)),\
+    $(strip $1)_$(strip $($i)))$(NEWLINE))
+  # Debug print all named parameter names and values
+  $(if $(findstring $(LOG_LEVEL),debug trace), \
+    $(info $0 $(strip $1) $(foreach i,$(PARAM_SEQUENCE), \
+      $(if $(strip $($i)),$(NEWLINE) $(strip [$i] $(if $(filter $(LOG_LEVEL), trace), \
+        $($i), $(wordlist 1, 20, $($(i))) $(if $(word 21, $($(i))), ...)))))))
+
+  $(if $(DEBUG_$(strip $1)),
+    $(info -------- <<< Begin expansion of $(strip $1)) \
+    $(info $(call $(0)Body,$(strip $1))) \
+    $(info -------- >>> End expansion of $(strip $1)) \
+  )
+
+  $(call $(0)Body,$(strip $1))
 endef
 
-# Support macro for all SetupFoo macros.
-define EvalDebugWrapper
-  $(if $(DEBUG_$1),
-    $(info -------- <<< Begin expansion of $1)
-    $(info $2)
-    $(info -------- >>> End expansion of $1)
-  )
-
-  $2
-endef
-
+################################################################################
 # Make directory without forking mkdir if not needed
 MakeDir = \
     $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
       $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
 
+################################################################################
+
 ifeq ($(OPENJDK_TARGET_OS),solaris)
   # On Solaris, if the target is a symlink and exists, cp won't overwrite.
   # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
@@ -437,6 +479,7 @@
   endef
 endif
 
+################################################################################
 # Convenience functions for working around make's limitations with $(filter ).
 containing = \
     $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),$v)))
@@ -457,8 +500,9 @@
     $(and $(findstring $(strip $1),$(strip $2)),\
         $(findstring $(strip $2),$(strip $1)))
 
+################################################################################
+
 ifneq ($(DISABLE_CACHE_FIND), true)
-  ################################################################################
   # In Cygwin, finds are very costly, both because of expensive forks and because
   # of bad file system caching. Find is used extensively in $(shell) commands to
   # find source files. This makes rerunning make with no or few changes rather
@@ -544,16 +588,8 @@
 #   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
-  $(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, please update MakeBase.gmk))
+SetupCopyFiles = $(NamedParamsMacroTemplate)
+define SetupCopyFilesBody
 
   ifeq ($$($1_MACRO), )
     $1_MACRO := install-file
--- a/make/common/NativeCompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/NativeCompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -194,15 +194,9 @@
 #   CC the compiler to use, default is $(CC)
 #   LDEXE the linker to use for linking executables, default is $(LDEXE)
 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
-define SetupNativeCompilation
-  $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupNativeCompilationInner,$(strip $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)))
-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 $(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))
+#   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
+SetupNativeCompilation = $(NamedParamsMacroTemplate)
+define SetupNativeCompilationBody
 
   ifneq (,$$($1_BIN))
     $$(error BIN has been replaced with OBJECT_DIR)
@@ -398,6 +392,12 @@
     $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
   endif
 
+  # Pick up disabled warnings, if possible on this platform.
+  ifneq ($(DISABLE_WARNING_PREFIX),)
+    $1_EXTRA_CFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
+    $1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), $$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)))
+  endif
+
   ifeq ($$($1_DEBUG_SYMBOLS), true)
     ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
       ifdef OPENJDK
--- a/make/common/RMICompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/RMICompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -37,15 +37,8 @@
 #   RUN_IIOP:=Set to run rmic with -iiop
 #   RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
 #   KEEP_GENERATED:=Set to keep generated sources around
-define SetupRMICompilation
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupRMICompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupRMICompilationInner
-  $(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))
+SetupRMICompilation = $(NamedParamsMacroTemplate)
+define SetupRMICompilationBody
 
   $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
 
--- a/make/common/TestFilesCompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/TestFilesCompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -46,15 +46,8 @@
 #   TYPE Must be either PROGRAM or LIBRARY.
 #   SOURCE_DIRS A list of source directories to search
 #   OUTPUT_DIR Where to put the resulting files
-define SetupTestFilesCompilation
-  $(if $(27),$(error Internal makefile error: Too many arguments to SetupTestFilesCompilation, please update BuildJTRegNative.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupTestFilesCompilationInner,$(strip $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)))
-endef
-
-define SetupTestFilesCompilationInner
-  $(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,SetupTestFileCompilation($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 SetupTestFilesCompilation, please update BuildJTRegNative.gmk))
+SetupTestFilesCompilation = $(NamedParamsMacroTemplate)
+define SetupTestFilesCompilationBody
 
   # Check for duplicate base file names. That would have failed later anyhow, but
   # this gives a better error message.
@@ -68,13 +61,13 @@
   ifeq ($$($1_TYPE), LIBRARY)
     $1_PREFIX = lib
     $1_OUTPUT_SUBDIR := lib
-    $1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS)
-    $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
+    $1_CFLAGS := $(CFLAGS_TESTLIB) $(CFLAGS_WARNINGS_ARE_ERRORS)
+    $1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
   else ifeq ($$($1_TYPE), PROGRAM)
     $1_PREFIX = exe
     $1_OUTPUT_SUBDIR := bin
-    $1_CFLAGS := $(CFLAGS_JDKEXE) $(CFLAGS_WARNINGS_ARE_ERRORS)
-    $1_LDFLAGS := $(LDFLAGS_JDKEXE)
+    $1_CFLAGS := $(CFLAGS_TESTEXE) $(CFLAGS_WARNINGS_ARE_ERRORS)
+    $1_LDFLAGS := $(LDFLAGS_TESTEXE)
   else
     $$(error Unknown type: $$($1_TYPE))
   endif
--- a/make/common/TextFileProcessing.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/TextFileProcessing.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -77,15 +77,8 @@
 #   processed first, and replacements will be done on the included fragments as well.
 #   If neither is present, the files will just be copied without modifications.
 #
-define SetupTextFileProcessing
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupTextFileProcessingInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupTextFileProcessingInner
-  $(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,SetupTextFileProcessing($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 SetupTextFileProcessing, please update TextFileProcessing.gmk))
+SetupTextFileProcessing = $(NamedParamsMacroTemplate)
+define SetupTextFileProcessingBody
 
   ifneq ($$($1_SOURCE_FILES),)
     ifneq ($$($1_SOURCE_DIRS),)
--- a/make/common/ZipArchive.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/make/common/ZipArchive.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -45,15 +45,8 @@
 #   SUFFIXES
 #   EXTRA_DEPS
 #   ZIP_OPTIONS extra options to pass to zip
-define SetupZipArchive
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update ZipArchive.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupZipArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupZipArchiveInner
-  $(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,SetupZipArchive($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 SetupZipArchive, please update JavaCompilation.gmk))
+SetupZipArchive = $(NamedParamsMacroTemplate)
+define SetupZipArchiveBody
 
   # To avoid running find over too large sets of files, which causes make to crash
   # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
--- a/modules.xml	Thu Mar 12 13:35:03 2015 -0700
+++ b/modules.xml	Wed Jul 05 20:24:03 2017 +0200
@@ -254,10 +254,10 @@
       <to>java.sql</to>
       <to>jdk.charsets</to>
       <to>jdk.deploy.osx</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
       <to>jdk.jconsole</to>
       <to>jdk.jvmstat</to>
-      <to>jdk.runtime</to>
+      <to>jdk.pack200</to>
       <to>jdk.security.auth</to>
       <to>jdk.security.jgss</to>
     </export>
@@ -279,7 +279,7 @@
       <name>sun.net.www</name>
       <to>java.desktop</to>
       <to>jdk.compiler</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
     </export>
     <export>
       <name>sun.net.www.protocol.http</name>
@@ -353,14 +353,15 @@
       <name>sun.security.pkcs</name>
       <to>jdk.crypto.ec</to>
       <to>jdk.deploy.osx</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
     </export>
     <export>
       <name>sun.security.provider</name>
       <to>java.rmi</to>
       <to>java.security.jgss</to>
       <to>jdk.crypto.pkcs11</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
+      <to>jdk.policytool</to>
       <to>jdk.security.auth</to>
     </export>
     <export>
@@ -378,7 +379,7 @@
     </export>
     <export>
       <name>sun.security.tools</name>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
     </export>
     <export>
       <name>sun.security.util</name>
@@ -392,7 +393,8 @@
       <to>jdk.crypto.pkcs11</to>
       <to>jdk.crypto.ucrypto</to>
       <to>jdk.deploy.osx</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
+      <to>jdk.policytool</to>
       <to>jdk.security.auth</to>
     </export>
     <export>
@@ -401,7 +403,7 @@
       <to>jdk.crypto.ec</to>
       <to>jdk.crypto.pkcs11</to>
       <to>jdk.deploy.osx</to>
-      <to>jdk.dev</to>
+      <to>jdk.jartool</to>
       <to>jdk.security.auth</to>
     </export>
     <export>
@@ -1591,16 +1593,8 @@
   <module>
     <name>jdk.dev</name>
     <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>
-    <depend>jdk.xml.ws</depend>
-    <export>
-      <name>com.sun.jarsigner</name>
-    </export>
   </module>
   <module>
     <name>jdk.hotspot.agent</name>
@@ -1627,6 +1621,13 @@
     </export>
   </module>
   <module>
+    <name>jdk.jartool</name>
+    <depend>java.base</depend>
+    <export>
+      <name>com.sun.jarsigner</name>
+    </export>
+  </module>
+  <module>
     <name>jdk.javadoc</name>
     <depend>java.base</depend>
     <depend re-exports="true">java.compiler</depend>
@@ -1720,6 +1721,15 @@
     <depend>java.rmi</depend>
   </module>
   <module>
+    <name>jdk.pack200</name>
+    <depend>java.base</depend>
+  </module>
+  <module>
+    <name>jdk.policytool</name>
+    <depend>java.base</depend>
+    <depend>java.desktop</depend>
+  </module>
+  <module>
     <name>jdk.rmic</name>
     <depend>java.base</depend>
     <depend>java.corba</depend>
@@ -1727,10 +1737,6 @@
     <depend>jdk.javadoc</depend>
   </module>
   <module>
-    <name>jdk.runtime</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
     <name>jdk.scripting.nashorn</name>
     <depend>java.base</depend>
     <depend>java.logging</depend>
--- a/test/lib/sun/hotspot/code/BlobType.java	Thu Mar 12 13:35:03 2015 -0700
+++ b/test/lib/sun/hotspot/code/BlobType.java	Wed Jul 05 20:24:03 2017 +0200
@@ -32,15 +32,28 @@
 
 public enum BlobType {
     // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
-    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'", "NonProfiledCodeHeapSize"),
+    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'", "NonProfiledCodeHeapSize") {
+        @Override
+        public boolean allowTypeWhenOverflow(BlobType type) {
+            return super.allowTypeWhenOverflow(type)
+                    || type == BlobType.MethodProfiled;
+        }
+    },
     // Execution level 2 and 3 (profiled) nmethods
-    MethodProfiled(1, "CodeHeap 'profiled nmethods'", "ProfiledCodeHeapSize"),
+    MethodProfiled(1, "CodeHeap 'profiled nmethods'", "ProfiledCodeHeapSize") {
+        @Override
+        public boolean allowTypeWhenOverflow(BlobType type) {
+            return super.allowTypeWhenOverflow(type)
+                    || type == BlobType.MethodNonProfiled;
+        }
+    },
     // Non-nmethods like Buffers, Adapters and Runtime Stubs
     NonNMethod(2, "CodeHeap 'non-nmethods'", "NonNMethodCodeHeapSize") {
         @Override
         public boolean allowTypeWhenOverflow(BlobType type) {
             return super.allowTypeWhenOverflow(type)
-                    || type == BlobType.MethodNonProfiled;
+                    || type == BlobType.MethodNonProfiled
+                    || type == BlobType.MethodProfiled;
         }
     },
     // All types (No code cache segmentation)
--- a/test/make/TestJavaCompilation.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/test/make/TestJavaCompilation.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -67,7 +67,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR1, \
-    $(OUTPUT_DIR)/_jar1_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar1_created, \
     SRCS := $(JAR1_SRC_ROOT), \
     MANIFEST := $(JAR1_MANIFEST), \
     JAR := $(JAR1_FILE)))
@@ -143,7 +143,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR2, \
-    $(OUTPUT_DIR)/_jar2_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar2_created, \
     SRCS := $(JAR2_SRC_ROOT1) $(JAR2_SRC_ROOT2), \
     JAR := $(JAR2_FILE)))
 
@@ -196,7 +196,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR3, \
-    $(OUTPUT_DIR)/_jar3_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar3_created, \
     SRCS := $(JAR3_SRC_ROOT1) $(JAR3_SRC_ROOT2), \
     EXTRA_FILES := extra-file \
         dir2/file$$$$foo.dollar \
--- a/test/make/TestMakeBase.gmk	Thu Mar 12 13:35:03 2015 -0700
+++ b/test/make/TestMakeBase.gmk	Wed Jul 05 20:24:03 2017 +0200
@@ -182,5 +182,23 @@
 TEST_TARGETS += test-vardep
 
 ################################################################################
+# Test sequence
+
+ifneq ($(call sequence, 1, 1), 1)
+  $(error Sequence 1, 1 should be "1", but was $(call sequence, 1, 1))
+endif
+
+ifneq ($(call sequence, 2, 3), 2 3)
+  $(error Sequence 2, 3 should be "2 3", but was $(call sequence, 2, 3))
+endif
+
+ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9)
+  $(error Sequence 4, 9 should be "4 5 6 7 8 9", but was $(call sequence, 4, 9))
+endif
+
+ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15)
+  $(error Sequence 5, 15 should be "5 6 7 8 9 10 11 12 13 14 15", \
+      but was $(call sequence, 5, 15))
+endif
 
 all: $(TEST_TARGETS)