changeset 13428:77259f6707d6

Merge
author lana
date Thu, 07 Jan 2016 15:14:24 -0800
parents af75d7a0b5dc adfeb1434d90
children 5c4530bb9ae6
files src/java.base/share/classes/sun/misc/MessageUtils.java src/java.base/share/classes/sun/misc/VM.java src/java.base/share/classes/sun/misc/VMNotification.java src/java.base/share/native/libjava/MessageUtils.c src/java.base/unix/classes/sun/misc/OSEnvironment.java src/java.base/windows/classes/sun/misc/OSEnvironment.java test/java/lang/ProcessHandle/TEST.properties test/sun/misc/VM/GetNanoTimeAdjustment.java
diffstat 97 files changed, 1918 insertions(+), 1378 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/NioLibraries.gmk	Thu Jan 07 09:33:58 2016 -0800
+++ b/make/lib/NioLibraries.gmk	Thu Jan 07 15:14:24 2016 -0800
@@ -58,7 +58,10 @@
 ifeq ($(OPENJDK_TARGET_OS), aix)
   BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/make/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
   BUILD_LIBNIO_EXFILES += \
-      NativeThread.c
+      /NativeThread.c
+  # Notice: we really need the leading slash here because otherwise every
+  # FILE_NAME in EXCLUDE_FILES will actually match any file ending in FILE_NAME
+  # (e.g. 'NativeThread.c' will also exclude 'AixNativeThread.c').
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
--- a/make/mapfiles/libjava/mapfile-vers	Thu Jan 07 09:33:58 2016 -0800
+++ b/make/mapfiles/libjava/mapfile-vers	Thu Jan 07 15:14:24 2016 -0800
@@ -216,6 +216,7 @@
 		Java_java_lang_SecurityManager_getClassContext;
 		Java_java_lang_Shutdown_halt0;
 		Java_java_lang_String_intern;
+		Java_java_lang_StringCoding_err;
 		Java_java_lang_StringUTF16_isBigEndian;
 		Java_java_lang_System_identityHashCode;
 		Java_java_lang_System_initProperties;
@@ -243,8 +244,6 @@
 		Java_java_util_TimeZone_getSystemTimeZoneID;
 		Java_java_util_TimeZone_getSystemGMTOffsetID;
 		Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
-		Java_sun_misc_MessageUtils_toStderr;
-		Java_sun_misc_MessageUtils_toStdout;
 		Java_sun_misc_NativeSignalHandler_handle0;
 		Java_sun_misc_Signal_findSignal;
 		Java_sun_misc_Signal_handle0;
@@ -274,12 +273,12 @@
 		Java_sun_reflect_Reflection_getClassAccessFlags;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJvmVersionInfo;
-		Java_sun_misc_VM_latestUserDefinedLoader;
-                Java_sun_misc_VM_getuid;
-                Java_sun_misc_VM_geteuid;
-                Java_sun_misc_VM_getgid;
-                Java_sun_misc_VM_getegid;
-                Java_sun_misc_VM_initialize;
+		Java_jdk_internal_misc_VM_latestUserDefinedLoader;
+                Java_jdk_internal_misc_VM_getuid;
+                Java_jdk_internal_misc_VM_geteuid;
+                Java_jdk_internal_misc_VM_getgid;
+                Java_jdk_internal_misc_VM_getegid;
+                Java_jdk_internal_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
 
--- a/make/src/classes/build/tools/dtdbuilder/DTDParser.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/make/src/classes/build/tools/dtdbuilder/DTDParser.java	Thu Jan 07 15:14:24 2016 -0800
@@ -35,8 +35,6 @@
 import java.util.BitSet;
 import java.text.MessageFormat;
 
-import sun.misc.MessageUtils;
-
 /**
  * A parser for DTDs. This parser roughly corresponds to the
  * rules specified in "The SGML Handbook" by Charles F. Goldfarb.
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jan 07 15:14:24 2016 -0800
@@ -2135,7 +2135,7 @@
      * corresponding modifications to the above class.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/src/java.base/share/classes/java/lang/Class.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/Class.java	Thu Jan 07 15:14:24 2016 -0800
@@ -56,6 +56,7 @@
 import java.util.Objects;
 import java.util.StringJoiner;
 import jdk.internal.misc.Unsafe;
+import jdk.internal.misc.VM;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import sun.reflect.CallerSensitive;
 import sun.reflect.ConstantPool;
@@ -360,9 +361,9 @@
             // Reflective call to get caller class is only needed if a security manager
             // is present.  Avoid the overhead of making this call otherwise.
             caller = Reflection.getCallerClass();
-            if (sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (VM.isSystemDomainLoader(loader)) {
                 ClassLoader ccl = ClassLoader.getClassLoader(caller);
-                if (!sun.misc.VM.isSystemDomainLoader(ccl)) {
+                if (!VM.isSystemDomainLoader(ccl)) {
                     sm.checkPermission(
                         SecurityConstants.GET_CLASSLOADER_PERMISSION);
                 }
--- a/src/java.base/share/classes/java/lang/Integer.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/Integer.java	Thu Jan 07 15:14:24 2016 -0800
@@ -28,6 +28,7 @@
 import java.lang.annotation.Native;
 import java.util.Objects;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 import static java.lang.String.COMPACT_STRINGS;
 import static java.lang.String.LATIN1;
@@ -1018,7 +1019,7 @@
      * may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option.
      * During VM initialization, java.lang.Integer.IntegerCache.high property
      * may be set and saved in the private system properties in the
-     * sun.misc.VM class.
+     * jdk.internal.misc.VM class.
      */
 
     private static class IntegerCache {
@@ -1030,7 +1031,7 @@
             // high value may be configured by property
             int h = 127;
             String integerCacheHighPropValue =
-                sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
+                VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
             if (integerCacheHighPropValue != null) {
                 try {
                     int i = parseInt(integerCacheHighPropValue);
--- a/src/java.base/share/classes/java/lang/StackStreamFactory.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/StackStreamFactory.java	Thu Jan 07 15:14:24 2016 -0800
@@ -24,7 +24,7 @@
  */
 package java.lang;
 
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import java.io.PrintStream;
 import java.lang.StackWalker.Option;
--- a/src/java.base/share/classes/java/lang/StringCoding.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/StringCoding.java	Thu Jan 07 15:14:24 2016 -0800
@@ -39,7 +39,6 @@
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.Arrays;
 import jdk.internal.HotSpotIntrinsicCandidate;
-import sun.misc.MessageUtils;
 import sun.nio.cs.HistoricallyNamedCharset;
 import sun.nio.cs.ArrayDecoder;
 import sun.nio.cs.ArrayEncoder;
@@ -106,11 +105,11 @@
 
     private static void warnUnsupportedCharset(String csn) {
         if (warnUnsupportedCharset) {
-            // Use sun.misc.MessageUtils rather than the Logging API or
-            // System.err since this method may be called during VM
-            // initialization before either is available.
-            MessageUtils.err("WARNING: Default charset " + csn +
-                             " not supported, using ISO-8859-1 instead");
+            // Use err(String) rather than the Logging API or System.err
+            // since this method may be called during VM initialization
+            // before either is available.
+            err("WARNING: Default charset " + csn +
+                " not supported, using ISO-8859-1 instead\n");
             warnUnsupportedCharset = false;
         }
     }
@@ -341,10 +340,9 @@
         try {
             return decode("ISO-8859-1", ba, off, len);
         } catch (UnsupportedEncodingException x) {
-            // If this code is hit during VM initialization, MessageUtils is
+            // If this code is hit during VM initialization, err(String) is
             // the only way we will be able to get any kind of error message.
-            MessageUtils.err("ISO-8859-1 charset not available: "
-                             + x.toString());
+            err("ISO-8859-1 charset not available: " + x.toString() + "\n");
             // If we can not find ISO-8859-1 (a required encoding) then things
             // are seriously wrong with the installation.
             System.exit(1);
@@ -653,14 +651,20 @@
         try {
             return encode("ISO-8859-1", coder, val);
         } catch (UnsupportedEncodingException x) {
-            // If this code is hit during VM initialization, MessageUtils is
+            // If this code is hit during VM initialization, err(String) is
             // the only way we will be able to get any kind of error message.
-            MessageUtils.err("ISO-8859-1 charset not available: "
-                             + x.toString());
+            err("ISO-8859-1 charset not available: " + x.toString() + "\n");
             // If we can not find ISO-8859-1 (a required encoding) then things
             // are seriously wrong with the installation.
             System.exit(1);
             return null;
         }
     }
+
+    /**
+     *  Print a message directly to stderr, bypassing all character conversion
+     *  methods.
+     *  @param msg  message to print
+     */
+    private static native void err(String msg);
 }
--- a/src/java.base/share/classes/java/lang/System.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/System.java	Thu Jan 07 15:14:24 2016 -0800
@@ -46,6 +46,7 @@
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangAccess;;
 import jdk.internal.misc.SharedSecrets;;
+import jdk.internal.misc.VM;
 import jdk.internal.logger.LoggerFinderLoader;
 import jdk.internal.logger.LazyLoggers;
 import jdk.internal.logger.LocalizedLoggerWrapper;
@@ -1817,12 +1818,12 @@
         // removed from the system properties.
         //
         // See java.lang.Integer.IntegerCache and the
-        // sun.misc.VM.saveAndRemoveProperties method for example.
+        // VM.saveAndRemoveProperties method for example.
         //
         // Save a private copy of the system properties object that
         // can only be accessed by the internal implementation.  Remove
         // certain system properties that are not intended for public access.
-        sun.misc.VM.saveAndRemoveProperties(props);
+        VM.saveAndRemoveProperties(props);
 
 
         lineSeparator = props.getProperty("line.separator");
@@ -1846,7 +1847,7 @@
         // set for the class libraries. Currently this is no-op everywhere except
         // for Windows where the process-wide error mode is set before the java.io
         // classes are used.
-        sun.misc.VM.initializeOSEnvironment();
+        VM.initializeOSEnvironment();
 
         // The main thread is not added to its thread group in the same
         // way as other threads; we must do it ourselves here.
@@ -1857,10 +1858,10 @@
         setJavaLangAccess();
 
         // Subsystems that are invoked during initialization can invoke
-        // sun.misc.VM.isBooted() in order to avoid doing things that should
+        // VM.isBooted() in order to avoid doing things that should
         // wait until the application class loader has been set up.
         // IMPORTANT: Ensure that this remains the last initialization action!
-        sun.misc.VM.booted();
+        VM.booted();
     }
 
     private static void setJavaLangAccess() {
--- a/src/java.base/share/classes/java/lang/Thread.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/Thread.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1869,7 +1869,7 @@
      */
     public State getState() {
         // get current thread state
-        return sun.misc.VM.toThreadState(threadStatus);
+        return jdk.internal.misc.VM.toThreadState(threadStatus);
     }
 
     // Added in JSR-166
--- a/src/java.base/share/classes/java/lang/ThreadGroup.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/ThreadGroup.java	Thu Jan 07 15:14:24 2016 -0800
@@ -27,7 +27,7 @@
 
 import java.io.PrintStream;
 import java.util.Arrays;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * A thread group represents a set of threads. In addition, a thread
--- a/src/java.base/share/classes/java/lang/Throwable.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/Throwable.java	Thu Jan 07 15:14:24 2016 -0800
@@ -24,7 +24,7 @@
  */
 
 package java.lang;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import  java.io.*;
 import  java.util.*;
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1836,7 +1836,7 @@
                 return false;
             }
             ClassLoader loader = defc.getClassLoader();
-            if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
                 ClassLoader sysl = ClassLoader.getSystemClassLoader();
                 boolean found = false;
                 while (sysl != null) {
--- a/src/java.base/share/classes/java/lang/ref/Finalizer.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/ref/Finalizer.java	Thu Jan 07 15:14:24 2016 -0800
@@ -29,7 +29,7 @@
 import java.security.AccessController;
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
                                                           same package as the Reference
--- a/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Thu Jan 07 15:14:24 2016 -0800
@@ -26,6 +26,7 @@
 package java.lang.ref;
 
 import java.util.function.Consumer;
+import jdk.internal.misc.VM;
 
 /**
  * Reference queues, to which registered reference objects are appended by the
@@ -73,7 +74,7 @@
             // Volatiles ensure ordering.
             r.queue = ENQUEUED;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(1);
+                VM.addFinalRefCount(1);
             }
             lock.notifyAll();
             return true;
@@ -93,7 +94,7 @@
             r.next = r;
             queueLength--;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(-1);
+                VM.addFinalRefCount(-1);
             }
             return r;
         }
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java	Thu Jan 07 15:14:24 2016 -0800
@@ -34,7 +34,7 @@
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.BiFunction;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
--- a/src/java.base/share/classes/java/net/URI.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/net/URI.java	Thu Jan 07 15:14:24 2016 -0800
@@ -2059,7 +2059,7 @@
 
         // 5.2 (2): Reference to current document (lone fragment)
         if ((child.scheme == null) && (child.authority == null)
-            && child.path.equals("") && (child.fragment != null)
+            && child.path.isEmpty() && (child.fragment != null)
             && (child.query == null)) {
             if ((base.fragment != null)
                 && child.fragment.equals(base.fragment)) {
@@ -2647,13 +2647,6 @@
     private static final long L_SCHEME = L_ALPHA | L_DIGIT | lowMask("+-.");
     private static final long H_SCHEME = H_ALPHA | H_DIGIT | highMask("+-.");
 
-    // uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
-    //                 "&" | "=" | "+" | "$" | ","
-    private static final long L_URIC_NO_SLASH
-        = L_UNRESERVED | L_ESCAPED | lowMask(";?:@&=+$,");
-    private static final long H_URIC_NO_SLASH
-        = H_UNRESERVED | H_ESCAPED | highMask(";?:@&=+$,");
-
     // scope_id = alpha | digit | "_" | "."
     private static final long L_SCOPE_ID
         = L_ALPHANUM | lowMask("_.");
@@ -2884,23 +2877,10 @@
 
         // -- Simple access to the input string --
 
-        // Return a substring of the input string
-        //
-        private String substring(int start, int end) {
-            return input.substring(start, end);
-        }
-
-        // Return the char at position p,
-        // assuming that p < input.length()
-        //
-        private char charAt(int p) {
-            return input.charAt(p);
-        }
-
         // Tells whether start < end and, if so, whether charAt(start) == c
         //
         private boolean at(int start, int end, char c) {
-            return (start < end) && (charAt(start) == c);
+            return (start < end) && (input.charAt(start) == c);
         }
 
         // Tells whether start + s.length() < end and, if so,
@@ -2913,7 +2893,7 @@
                 return false;
             int i = 0;
             while (i < sn) {
-                if (charAt(p++) != s.charAt(i)) {
+                if (input.charAt(p++) != s.charAt(i)) {
                     break;
                 }
                 i++;
@@ -2953,7 +2933,7 @@
         // start position.
         //
         private int scan(int start, int end, char c) {
-            if ((start < end) && (charAt(start) == c))
+            if ((start < end) && (input.charAt(start) == c))
                 return start + 1;
             return start;
         }
@@ -2968,7 +2948,7 @@
         private int scan(int start, int end, String err, String stop) {
             int p = start;
             while (p < end) {
-                char c = charAt(p);
+                char c = input.charAt(p);
                 if (err.indexOf(c) >= 0)
                     return -1;
                 if (stop.indexOf(c) >= 0)
@@ -2978,6 +2958,23 @@
             return p;
         }
 
+        // Scan forward from the given start position.  Stop at the first char
+        // in the stop string (in which case the index of the preceding char is
+        // returned), or the end of the input string (in which case the length
+        // of the input string is returned).  May return the start position if
+        // nothing matches.
+        //
+        private int scan(int start, int end, String stop) {
+            int p = start;
+            while (p < end) {
+                char c = input.charAt(p);
+                if (stop.indexOf(c) >= 0)
+                    break;
+                p++;
+            }
+            return p;
+        }
+
         // Scan a potential escape sequence, starting at the given position,
         // with the given first char (i.e., charAt(start) == c).
         //
@@ -2992,8 +2989,8 @@
             if (c == '%') {
                 // Process escape pair
                 if ((p + 3 <= n)
-                    && match(charAt(p + 1), L_HEX, H_HEX)
-                    && match(charAt(p + 2), L_HEX, H_HEX)) {
+                    && match(input.charAt(p + 1), L_HEX, H_HEX)
+                    && match(input.charAt(p + 2), L_HEX, H_HEX)) {
                     return p + 3;
                 }
                 fail("Malformed escape pair", p);
@@ -3013,7 +3010,7 @@
         {
             int p = start;
             while (p < n) {
-                char c = charAt(p);
+                char c = input.charAt(p);
                 if (match(c, lowMask, highMask)) {
                     p++;
                     continue;
@@ -3067,13 +3064,13 @@
                     failExpecting("scheme name", 0);
                 checkChar(0, L_ALPHA, H_ALPHA, "scheme name");
                 checkChars(1, p, L_SCHEME, H_SCHEME, "scheme name");
-                scheme = substring(0, p);
+                scheme = input.substring(0, p);
                 p++;                    // Skip ':'
                 ssp = p;
                 if (at(p, n, '/')) {
                     p = parseHierarchical(p, n);
                 } else {
-                    int q = scan(p, n, "", "#");
+                    int q = scan(p, n, "#");
                     if (q <= p)
                         failExpecting("scheme-specific part", p);
                     checkChars(p, q, L_URIC, H_URIC, "opaque part");
@@ -3083,10 +3080,10 @@
                 ssp = 0;
                 p = parseHierarchical(0, n);
             }
-            schemeSpecificPart = substring(ssp, p);
+            schemeSpecificPart = input.substring(ssp, p);
             if (at(p, n, '#')) {
                 checkChars(p + 1, n, L_URIC, H_URIC, "fragment");
-                fragment = substring(p + 1, n);
+                fragment = input.substring(p + 1, n);
                 p = n;
             }
             if (p < n)
@@ -3113,7 +3110,7 @@
             int p = start;
             if (at(p, n, '/') && at(p + 1, n, '/')) {
                 p += 2;
-                int q = scan(p, n, "", "/?#");
+                int q = scan(p, n, "/?#");
                 if (q > p) {
                     p = parseAuthority(p, q);
                 } else if (q < n) {
@@ -3122,15 +3119,15 @@
                 } else
                     failExpecting("authority", p);
             }
-            int q = scan(p, n, "", "?#"); // DEVIATION: May be empty
+            int q = scan(p, n, "?#"); // DEVIATION: May be empty
             checkChars(p, q, L_PATH, H_PATH, "path");
-            path = substring(p, q);
+            path = input.substring(p, q);
             p = q;
             if (at(p, n, '?')) {
                 p++;
-                q = scan(p, n, "", "#");
+                q = scan(p, n, "#");
                 checkChars(p, q, L_URIC, H_URIC, "query");
-                query = substring(p, q);
+                query = input.substring(p, q);
                 p = q;
             }
             return p;
@@ -3154,7 +3151,7 @@
             boolean serverChars;
             boolean regChars;
 
-            if (scan(p, n, "", "]") > p) {
+            if (scan(p, n, "]") > p) {
                 // contains a literal IPv6 address, therefore % is allowed
                 serverChars = (scan(p, n, L_SERVER_PERCENT, H_SERVER_PERCENT) == n);
             } else {
@@ -3164,7 +3161,7 @@
 
             if (regChars && !serverChars) {
                 // Must be a registry-based authority
-                authority = substring(p, n);
+                authority = input.substring(p, n);
                 return n;
             }
 
@@ -3176,7 +3173,7 @@
                     q = parseServer(p, n);
                     if (q < n)
                         failExpecting("end of authority", q);
-                    authority = substring(p, n);
+                    authority = input.substring(p, n);
                 } catch (URISyntaxException x) {
                     // Undo results of failed parse
                     userInfo = null;
@@ -3198,7 +3195,7 @@
             if (q < n) {
                 if (regChars) {
                     // Registry-based authority
-                    authority = substring(p, n);
+                    authority = input.substring(p, n);
                 } else if (ex != null) {
                     // Re-throw exception; it was probably due to
                     // a malformed IPv6 address
@@ -3224,7 +3221,7 @@
             q = scan(p, n, "/?#", "@");
             if ((q >= p) && at(q, n, '@')) {
                 checkChars(p, q, L_USERINFO, H_USERINFO, "user info");
-                userInfo = substring(p, q);
+                userInfo = input.substring(p, q);
                 p = q + 1;              // Skip '@'
             }
 
@@ -3235,7 +3232,7 @@
                 q = scan(p, n, "/?#", "]");
                 if ((q > p) && at(q, n, ']')) {
                     // look for a "%" scope id
-                    int r = scan (p, q, "", "%");
+                    int r = scan (p, q, "%");
                     if (r > p) {
                         parseIPv6Reference(p, r);
                         if (r+1 == q) {
@@ -3246,7 +3243,7 @@
                     } else {
                         parseIPv6Reference(p, q);
                     }
-                    host = substring(p-1, q+1);
+                    host = input.substring(p-1, q+1);
                     p = q + 1;
                 } else {
                     failExpecting("closing bracket for IPv6 address", q);
@@ -3261,7 +3258,7 @@
             // port
             if (at(p, n, ':')) {
                 p++;
-                q = scan(p, n, "", "/");
+                q = scan(p, n, "/");
                 if (q > p) {
                     checkChars(p, q, L_DIGIT, H_DIGIT, "port number");
                     try {
@@ -3361,13 +3358,13 @@
                 // IPv4 address is followed by something - check that
                 // it's a ":" as this is the only valid character to
                 // follow an address.
-                if (charAt(p) != ':') {
+                if (input.charAt(p) != ':') {
                     p = -1;
                 }
             }
 
             if (p > start)
-                host = substring(start, p);
+                host = input.substring(start, p);
 
             return p;
         }
@@ -3393,7 +3390,7 @@
                     p = q;
                     q = scan(p, n, L_ALPHANUM | L_DASH, H_ALPHANUM | H_DASH);
                     if (q > p) {
-                        if (charAt(q - 1) == '-')
+                        if (input.charAt(q - 1) == '-')
                             fail("Illegal character in hostname", q - 1);
                         p = q;
                     }
@@ -3412,11 +3409,11 @@
 
             // for a fully qualified hostname check that the rightmost
             // label starts with an alpha character.
-            if (l > start && !match(charAt(l), L_ALPHA, H_ALPHA)) {
+            if (l > start && !match(input.charAt(l), L_ALPHA, H_ALPHA)) {
                 fail("Illegal character in hostname", l);
             }
 
-            host = substring(start, p);
+            host = input.substring(start, p);
             return p;
         }
 
--- a/src/java.base/share/classes/java/net/URL.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/net/URL.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1242,7 +1242,7 @@
     private static ThreadLocal<Object> gate = new ThreadLocal<>();
 
     private static URLStreamHandler lookupViaProviders(final String protocol) {
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return null;
 
         if (gate.get() != null)
--- a/src/java.base/share/classes/java/net/URLConnection.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/net/URLConnection.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1567,6 +1567,11 @@
             }
         }
 
+        if ((c1 == 0x49 && c2 == 0x49 && c3 == 0x2a && c4 == 0x00)
+            || (c1 == 0x4d && c2 == 0x4d && c3 == 0x00 && c4 == 0x2a)) {
+            return "image/tiff";
+        }
+
         if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 &&
             c5 == 0xA1 && c6 == 0xB1 && c7 == 0x1A && c8 == 0xE1) {
 
--- a/src/java.base/share/classes/java/nio/Bits.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/nio/Bits.java	Thu Jan 07 15:14:24 2016 -0800
@@ -31,7 +31,7 @@
 import jdk.internal.misc.JavaLangRefAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * Access to bits, native and otherwise.
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Thu Jan 07 15:14:24 2016 -0800
@@ -30,7 +30,7 @@
 import java.io.FileDescriptor;
 import sun.misc.Cleaner;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.nio.ch.DirectBuffer;
 
 
--- a/src/java.base/share/classes/java/nio/charset/Charset.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java	Thu Jan 07 15:14:24 2016 -0800
@@ -43,6 +43,7 @@
 import java.util.ServiceConfigurationError;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import jdk.internal.misc.VM;
 import sun.misc.ASCIICaseInsensitiveComparator;
 import sun.nio.cs.StandardCharsets;
 import sun.nio.cs.ThreadLocalCoders;
@@ -281,7 +282,7 @@
     static boolean atBugLevel(String bl) {              // package-private
         String level = bugLevel;
         if (level == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!VM.isBooted())
                 return false;
             bugLevel = level = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.cs.bugLevel", ""));
@@ -394,7 +395,7 @@
         // that loader to be prematurely initialized with incomplete
         // information.
         //
-        if (!sun.misc.VM.isBooted())
+        if (!VM.isBooted())
             return null;
 
         if (gate.get() != null)
@@ -445,7 +446,7 @@
     }
 
     private static Charset lookupExtendedCharset(String charsetName) {
-        if (!sun.misc.VM.isBooted())  // see lookupViaProviders()
+        if (!VM.isBooted())  // see lookupViaProviders()
             return null;
         CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
         for (CharsetProvider cp : ecps) {
--- a/src/java.base/share/classes/java/time/Clock.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/time/Clock.java	Thu Jan 07 15:14:24 2016 -0800
@@ -69,7 +69,7 @@
 import java.io.Serializable;
 import java.util.Objects;
 import java.util.TimeZone;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * A clock providing access to the current instant, date and time using a time-zone.
--- a/src/java.base/share/classes/java/time/Duration.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/time/Duration.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1194,6 +1194,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the whole seconds part of the length of the duration, positive or negative
+     * @since 9
      */
     public long toSeconds() {
         return seconds;
@@ -1243,6 +1244,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of days in the duration, may be negative
+     * @since 9
      */
     public long toDaysPart(){
         return seconds / SECONDS_PER_DAY;
@@ -1258,6 +1260,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of hours part in the duration, may be negative
+     * @since 9
      */
     public int toHoursPart(){
         return (int) (toHours() % 24);
@@ -1273,7 +1276,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of minutes parts in the duration, may be negative
-     * may be negative
+     * @since 9
      */
     public int toMinutesPart(){
         return (int) (toMinutes() % MINUTES_PER_HOUR);
@@ -1289,6 +1292,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of seconds parts in the duration, may be negative
+     * @since 9
      */
     public int toSecondsPart(){
         return (int) (seconds % SECONDS_PER_MINUTE);
@@ -1306,6 +1310,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the number of milliseconds part of the duration.
+     * @since 9
      */
     public int toMillisPart(){
         return nanos / 1000_000;
@@ -1322,6 +1327,7 @@
      * This instance is immutable and unaffected by this method call.
      *
      * @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
+     * @since 9
      */
     public int toNanosPart(){
         return nanos;
@@ -1385,7 +1391,7 @@
      * <p>
      * The format of the returned string will be {@code PTnHnMnS}, where n is
      * the relevant hours, minutes or seconds part of the duration.
-     * Any fractional seconds are placed after a decimal point i the seconds section.
+     * Any fractional seconds are placed after a decimal point in the seconds section.
      * If a section has a zero value, it is omitted.
      * The hours, minutes and seconds will all have the same sign.
      * <p>
@@ -1406,9 +1412,13 @@
         if (this == ZERO) {
             return "PT0S";
         }
-        long hours = seconds / SECONDS_PER_HOUR;
-        int minutes = (int) ((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
-        int secs = (int) (seconds % SECONDS_PER_MINUTE);
+        long effectiveTotalSecs = seconds;
+        if (seconds < 0 && nanos > 0) {
+            effectiveTotalSecs++;
+        }
+        long hours = effectiveTotalSecs / SECONDS_PER_HOUR;
+        int minutes = (int) ((effectiveTotalSecs % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
+        int secs = (int) (effectiveTotalSecs % SECONDS_PER_MINUTE);
         StringBuilder buf = new StringBuilder(24);
         buf.append("PT");
         if (hours != 0) {
@@ -1420,18 +1430,18 @@
         if (secs == 0 && nanos == 0 && buf.length() > 2) {
             return buf.toString();
         }
-        if (secs < 0 && nanos > 0) {
-            if (secs == -1) {
+        if (seconds < 0 && nanos > 0) {
+            if (secs == 0) {
                 buf.append("-0");
             } else {
-                buf.append(secs + 1);
+                buf.append(secs);
             }
         } else {
             buf.append(secs);
         }
         if (nanos > 0) {
             int pos = buf.length();
-            if (secs < 0) {
+            if (seconds < 0) {
                 buf.append(2 * NANOS_PER_SECOND - nanos);
             } else {
                 buf.append(nanos + NANOS_PER_SECOND);
--- a/src/java.base/share/classes/java/util/Calendar.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/util/Calendar.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2085,8 +2085,10 @@
 
         String calendarType = getCalendarType();
         int fieldValue = get(field);
-        // the standalone and narrow styles are supported only through CalendarDataProviders.
-        if (isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+        // the standalone/narrow styles and short era are supported only through
+        // CalendarNameProviders.
+        if (isStandaloneStyle(style) || isNarrowFormatStyle(style) ||
+            field == ERA && (style & SHORT) == SHORT) {
             String val = CalendarDataUtility.retrieveFieldValueName(calendarType,
                                                                     field, fieldValue,
                                                                     style, locale);
--- a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1037,14 +1037,16 @@
                 }
                 if (size < eras.length) {
                     int baseStyle = getBaseStyle(style);
-                    for (int i = size; i < eras.length; i++) {
-                        Era era = eras[i];
-                        if (baseStyle == ALL_STYLES || baseStyle == SHORT
-                                || baseStyle == NARROW_FORMAT) {
-                            names.put(era.getAbbreviation(), i);
-                        }
-                        if (baseStyle == ALL_STYLES || baseStyle == LONG) {
-                            names.put(era.getName(), i);
+                    for (int i = 0; i < eras.length; i++) {
+                        if (!names.values().contains(i)) {
+                            Era era = eras[i];
+                            if (baseStyle == ALL_STYLES || baseStyle == SHORT
+                                    || baseStyle == NARROW_FORMAT) {
+                                names.put(era.getAbbreviation(), i);
+                            }
+                            if (baseStyle == ALL_STYLES || baseStyle == LONG) {
+                                names.put(era.getName(), i);
+                            }
                         }
                     }
                 }
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1251,7 +1251,7 @@
                     idx = getEntryNext(idx);
                 }
                 /* If not addSlash, or slash is already there, we are done */
-                if (!addSlash  || name[name.length - 1] == '/') {
+                if (!addSlash  || name.length == 0 || name[name.length - 1] == '/') {
                      return -1;
                 }
                 /* Add slash and try once more */
--- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Thu Jan 07 15:14:24 2016 -0800
@@ -48,7 +48,7 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import sun.misc.InnocuousThread;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 import jdk.internal.logger.LazyLoggers.LazyLoggerAccessor;
 
--- a/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Thu Jan 07 15:14:24 2016 -0800
@@ -32,7 +32,7 @@
 import java.lang.System.Logger;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 
 /**
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Thu Jan 07 15:14:24 2016 -0800
@@ -30,7 +30,7 @@
 
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/misc/VM.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,433 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+import static java.lang.Thread.State.*;
+import java.util.Properties;
+
+public class VM {
+
+    /* The following methods used to be native methods that instruct
+     * the VM to selectively suspend certain threads in low-memory
+     * situations. They are inherently dangerous and not implementable
+     * on native threads. We removed them in JDK 1.2. The skeletons
+     * remain so that existing applications that use these methods
+     * will still work.
+     */
+    private static boolean suspended = false;
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean threadsSuspended() {
+        return suspended;
+    }
+
+    @SuppressWarnings("deprecation")
+    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
+        return g.allowThreadSuspension(b);
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean suspendThreads() {
+        suspended = true;
+        return true;
+    }
+
+    // Causes any suspended threadgroups to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendThreads() {
+        suspended = false;
+    }
+
+    // Causes threadgroups no longer marked suspendable to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendSomeThreads() {
+    }
+
+    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_GREEN = 1;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_YELLOW = 2;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_RED = 3;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int getState() {
+        return STATE_GREEN;
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static void registerVMNotification(VMNotification n) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange(int as_old, int as_new) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange_otherthread(int as_old, int as_new) { }
+
+    /*
+     * Not supported in 1.2 because these will have to be exported as
+     * JVM functions, and we are not sure we want do that. Leaving
+     * here so it can be easily resurrected -- just remove the //
+     * comments.
+     */
+
+    /**
+     * Resume Java profiling.  All profiling data is added to any
+     * earlier profiling, unless <code>resetJavaProfiler</code> is
+     * called in between.  If profiling was not started from the
+     * command line, <code>resumeJavaProfiler</code> will start it.
+     * <p>
+     *
+     * NOTE: Profiling must be enabled from the command line for a
+     * java.prof report to be automatically generated on exit; if not,
+     * writeJavaProfilerReport must be invoked to write a report.
+     *
+     * @see     resetJavaProfiler
+     * @see     writeJavaProfilerReport
+     */
+
+    // public native static void resumeJavaProfiler();
+
+    /**
+     * Suspend Java profiling.
+     */
+    // public native static void suspendJavaProfiler();
+
+    /**
+     * Initialize Java profiling.  Any accumulated profiling
+     * information is discarded.
+     */
+    // public native static void resetJavaProfiler();
+
+    /**
+     * Write the current profiling contents to the file "java.prof".
+     * If the file already exists, it will be overwritten.
+     */
+    // public native static void writeJavaProfilerReport();
+
+
+    private static volatile boolean booted = false;
+    private static final Object lock = new Object();
+
+    // Invoked by System.initializeSystemClass just before returning.
+    // Subsystems that are invoked during initialization can check this
+    // property in order to avoid doing things that should wait until the
+    // application class loader has been set up.
+    //
+    public static void booted() {
+        synchronized (lock) {
+            booted = true;
+            lock.notifyAll();
+        }
+    }
+
+    public static boolean isBooted() {
+        return booted;
+    }
+
+    // Waits until VM completes initialization
+    //
+    // This method is invoked by the Finalizer thread
+    public static void awaitBooted() throws InterruptedException {
+        synchronized (lock) {
+            while (!booted) {
+                lock.wait();
+            }
+        }
+    }
+
+    // A user-settable upper limit on the maximum amount of allocatable direct
+    // buffer memory.  This value may be changed during VM initialization if
+    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
+    //
+    // The initial value of this field is arbitrary; during JRE initialization
+    // it will be reset to the value specified on the command line, if any,
+    // otherwise to Runtime.getRuntime().maxMemory().
+    //
+    private static long directMemory = 64 * 1024 * 1024;
+
+    // Returns the maximum amount of allocatable direct buffer memory.
+    // The directMemory variable is initialized during system initialization
+    // in the saveAndRemoveProperties method.
+    //
+    public static long maxDirectMemory() {
+        return directMemory;
+    }
+
+    // User-controllable flag that determines if direct buffers should be page
+    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
+    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
+    private static boolean pageAlignDirectMemory;
+
+    // Returns {@code true} if the direct buffers should be page aligned. This
+    // variable is initialized by saveAndRemoveProperties.
+    public static boolean isDirectMemoryPageAligned() {
+        return pageAlignDirectMemory;
+    }
+
+    /**
+     * Returns true if the given class loader is in the system domain
+     * in which all permissions are granted.
+     */
+    public static boolean isSystemDomainLoader(ClassLoader loader) {
+        return loader == null;
+    }
+
+    /**
+     * Returns the system property of the specified key saved at
+     * system initialization time.  This method should only be used
+     * for the system properties that are not changed during runtime.
+     * It accesses a private copy of the system properties so
+     * that user's locking of the system properties object will not
+     * cause the library to deadlock.
+     *
+     * Note that the saved system properties do not include
+     * the ones set by sun.misc.Version.init().
+     *
+     */
+    public static String getSavedProperty(String key) {
+        if (savedProps.isEmpty())
+            throw new IllegalStateException("Should be non-empty if initialized");
+
+        return savedProps.getProperty(key);
+    }
+
+    // TODO: the Property Management needs to be refactored and
+    // the appropriate prop keys need to be accessible to the
+    // calling classes to avoid duplication of keys.
+    private static final Properties savedProps = new Properties();
+
+    // Save a private copy of the system properties and remove
+    // the system properties that are not intended for public access.
+    //
+    // This method can only be invoked during system initialization.
+    public static void saveAndRemoveProperties(Properties props) {
+        if (booted)
+            throw new IllegalStateException("System initialization has completed");
+
+        savedProps.putAll(props);
+
+        // Set the maximum amount of direct memory.  This value is controlled
+        // by the vm option -XX:MaxDirectMemorySize=<size>.
+        // The maximum amount of allocatable direct buffer memory (in bytes)
+        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
+        // The system property will be removed.
+        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
+        if (s != null) {
+            if (s.equals("-1")) {
+                // -XX:MaxDirectMemorySize not given, take default
+                directMemory = Runtime.getRuntime().maxMemory();
+            } else {
+                long l = Long.parseLong(s);
+                if (l > -1)
+                    directMemory = l;
+            }
+        }
+
+        // Check if direct buffers should be page aligned
+        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
+        if ("true".equals(s))
+            pageAlignDirectMemory = true;
+
+        // Remove other private system properties
+        // used by java.lang.Integer.IntegerCache
+        props.remove("java.lang.Integer.IntegerCache.high");
+
+        // used by sun.launcher.LauncherHelper
+        props.remove("sun.java.launcher.diag");
+    }
+
+    // Initialize any miscellenous operating system settings that need to be
+    // set for the class libraries.
+    //
+    public static void initializeOSEnvironment() {
+        if (!booted) {
+            OSEnvironment.initialize();
+        }
+    }
+
+    /* Current count of objects pending for finalization */
+    private static volatile int finalRefCount;
+
+    /* Peak count of objects pending for finalization */
+    private static volatile int peakFinalRefCount;
+
+    /*
+     * Gets the number of objects pending for finalization.
+     *
+     * @return the number of objects pending for finalization.
+     */
+    public static int getFinalRefCount() {
+        return finalRefCount;
+    }
+
+    /*
+     * Gets the peak number of objects pending for finalization.
+     *
+     * @return the peak number of objects pending for finalization.
+     */
+    public static int getPeakFinalRefCount() {
+        return peakFinalRefCount;
+    }
+
+    /*
+     * Add {@code n} to the objects pending for finalization count.
+     *
+     * @param n an integer value to be added to the objects pending
+     * for finalization count
+     */
+    public static void addFinalRefCount(int n) {
+        // The caller must hold lock to synchronize the update.
+
+        finalRefCount += n;
+        if (finalRefCount > peakFinalRefCount) {
+            peakFinalRefCount = finalRefCount;
+        }
+    }
+
+    /**
+     * Returns Thread.State for the given threadStatus
+     */
+    public static Thread.State toThreadState(int threadStatus) {
+        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
+            return RUNNABLE;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
+            return BLOCKED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
+            return WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
+            return TIMED_WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
+            return TERMINATED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
+            return NEW;
+        } else {
+            return RUNNABLE;
+        }
+    }
+
+    /* The threadStatus field is set by the VM at state transition
+     * in the hotspot implementation. Its value is set according to
+     * the JVM TI specification GetThreadState function.
+     */
+    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
+    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
+    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
+    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
+    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
+    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
+
+    /*
+     * Returns the first non-null class loader up the execution stack,
+     * or null if only code from the null class loader is on the stack.
+     */
+    public static native ClassLoader latestUserDefinedLoader();
+
+    /**
+     * Returns {@code true} if we are in a set UID program.
+     */
+    public static boolean isSetUID() {
+        long uid = getuid();
+        long euid = geteuid();
+        long gid = getgid();
+        long egid = getegid();
+        return uid != euid  || gid != egid;
+    }
+
+    /**
+     * Returns the real user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getuid();
+
+    /**
+     * Returns the effective user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long geteuid();
+
+    /**
+     * Returns the real group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getgid();
+
+    /**
+     * Returns the effective group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getegid();
+
+    /**
+     * Get a nanosecond time stamp adjustment in the form of a single long.
+     *
+     * This value can be used to create an instant using
+     * {@link java.time.Instant#ofEpochSecond(long, long)
+     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
+     *  getNanoTimeAdjustment(offsetInSeconds))}.
+     * <p>
+     * The value returned has the best resolution available to the JVM on
+     * the current system.
+     * This is usually down to microseconds - or tenth of microseconds -
+     * depending on the OS/Hardware and the JVM implementation.
+     *
+     * @param offsetInSeconds The offset in seconds from which the nanosecond
+     *        time stamp should be computed.
+     *
+     * @apiNote The offset should be recent enough - so that
+     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
+     *         current UTC time. If the offset is too far off, {@code -1} will be
+     *         returned. As such, {@code -1} must not be considered as a valid
+     *         nano time adjustment, but as an exception value indicating
+     *         that an offset closer to the current time should be used.
+     *
+     * @return A nanosecond time stamp adjustment in the form of a single long.
+     *     If the offset is too far off the current time, this method returns -1.
+     *     In that case, the caller should call this method again, passing a
+     *     more accurate offset.
+     */
+    public static native long getNanoTimeAdjustment(long offsetInSeconds);
+
+    static {
+        initialize();
+    }
+    private static native void initialize();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/misc/VMNotification.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+/** @deprecated */
+@Deprecated
+public interface VMNotification {
+
+    // when the vm switches allocation states, we get notified
+    // (possible semantics: if the state changes while in this
+    // notification, don't recursively notify).
+    // oldState and newState may be the same if we are just releasing
+    // suspended threads.
+    void newAllocState(int oldState, int newState,
+                       boolean threadsSuspended);
+}
--- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Thu Jan 07 15:14:24 2016 -0800
@@ -66,6 +66,7 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import jdk.internal.misc.VM;
 
 public enum LauncherHelper {
     INSTANCE;
@@ -86,9 +87,9 @@
     private static final String PROP_SETTINGS   = "Property settings:";
     private static final String LOCALE_SETTINGS = "Locale settings:";
 
-    // sync with java.c and sun.misc.VM
+    // sync with java.c and jdk.internal.misc.VM
     private static final String diagprop = "sun.java.launcher.diag";
-    static final boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null;
+    static final boolean trace = VM.getSavedProperty(diagprop) != null;
 
     private static final String defaultBundleName =
             "sun.launcher.resources.launcher";
--- a/src/java.base/share/classes/sun/misc/MessageUtils.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/**
- * MessageUtils: miscellaneous utilities for handling error and status
- * properties and messages.
- *
- * @author Herb Jellinek
- */
-
-public class MessageUtils {
-    // can instantiate it for to allow less verbose use - via instance
-    // instead of classname
-
-    public MessageUtils() { }
-
-    public static String subst(String patt, String arg) {
-        String args[] = { arg };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String arg1, String arg2) {
-        String args[] = { arg1, arg2 };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String arg1, String arg2,
-                               String arg3) {
-        String args[] = { arg1, arg2, arg3 };
-        return subst(patt, args);
-    }
-
-    public static String subst(String patt, String args[]) {
-        StringBuilder result = new StringBuilder();
-        int len = patt.length();
-        for (int i = 0; i >= 0 && i < len; i++) {
-            char ch = patt.charAt(i);
-            if (ch == '%') {
-                if (i != len) {
-                    int index = Character.digit(patt.charAt(i + 1), 10);
-                    if (index == -1) {
-                        result.append(patt.charAt(i + 1));
-                        i++;
-                    } else if (index < args.length) {
-                        result.append(args[index]);
-                        i++;
-                    }
-                }
-            } else {
-                result.append(ch);
-            }
-        }
-        return result.toString();
-    }
-
-    public static String substProp(String propName, String arg) {
-        return subst(System.getProperty(propName), arg);
-    }
-
-    public static String substProp(String propName, String arg1, String arg2) {
-        return subst(System.getProperty(propName), arg1, arg2);
-    }
-
-    public static String substProp(String propName, String arg1, String arg2,
-                                   String arg3) {
-        return subst(System.getProperty(propName), arg1, arg2, arg3);
-    }
-
-    /**
-     *  Print a message directly to stderr, bypassing all the
-     *  character conversion methods.
-     *  @param msg   message to print
-     */
-    public static native void toStderr(String msg);
-
-    /**
-     *  Print a message directly to stdout, bypassing all the
-     *  character conversion methods.
-     *  @param msg   message to print
-     */
-    public static native void toStdout(String msg);
-
-
-    // Short forms of the above
-
-    public static void err(String s) {
-        toStderr(s + "\n");
-    }
-
-    public static void out(String s) {
-        toStdout(s + "\n");
-    }
-
-    // Print a stack trace to stderr
-    //
-    public static void where() {
-        Throwable t = new Throwable();
-        StackTraceElement[] es = t.getStackTrace();
-        for (int i = 1; i < es.length; i++)
-            toStderr("\t" + es[i].toString() + "\n");
-    }
-
-}
--- a/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/misc/Unsafe.java	Thu Jan 07 15:14:24 2016 -0800
@@ -32,6 +32,7 @@
 import sun.reflect.Reflection;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 
 /**
--- a/src/java.base/share/classes/sun/misc/VM.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import static java.lang.Thread.State.*;
-import java.util.Properties;
-
-public class VM {
-
-    /* The following methods used to be native methods that instruct
-     * the VM to selectively suspend certain threads in low-memory
-     * situations. They are inherently dangerous and not implementable
-     * on native threads. We removed them in JDK 1.2. The skeletons
-     * remain so that existing applications that use these methods
-     * will still work.
-     */
-    private static boolean suspended = false;
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean threadsSuspended() {
-        return suspended;
-    }
-
-    @SuppressWarnings("deprecation")
-    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
-        return g.allowThreadSuspension(b);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean suspendThreads() {
-        suspended = true;
-        return true;
-    }
-
-    // Causes any suspended threadgroups to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendThreads() {
-        suspended = false;
-    }
-
-    // Causes threadgroups no longer marked suspendable to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendSomeThreads() {
-    }
-
-    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_GREEN = 1;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_YELLOW = 2;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_RED = 3;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int getState() {
-        return STATE_GREEN;
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void registerVMNotification(VMNotification n) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange(int as_old, int as_new) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange_otherthread(int as_old, int as_new) { }
-
-    /*
-     * Not supported in 1.2 because these will have to be exported as
-     * JVM functions, and we are not sure we want do that. Leaving
-     * here so it can be easily resurrected -- just remove the //
-     * comments.
-     */
-
-    /**
-     * Resume Java profiling.  All profiling data is added to any
-     * earlier profiling, unless <code>resetJavaProfiler</code> is
-     * called in between.  If profiling was not started from the
-     * command line, <code>resumeJavaProfiler</code> will start it.
-     * <p>
-     *
-     * NOTE: Profiling must be enabled from the command line for a
-     * java.prof report to be automatically generated on exit; if not,
-     * writeJavaProfilerReport must be invoked to write a report.
-     *
-     * @see     resetJavaProfiler
-     * @see     writeJavaProfilerReport
-     */
-
-    // public native static void resumeJavaProfiler();
-
-    /**
-     * Suspend Java profiling.
-     */
-    // public native static void suspendJavaProfiler();
-
-    /**
-     * Initialize Java profiling.  Any accumulated profiling
-     * information is discarded.
-     */
-    // public native static void resetJavaProfiler();
-
-    /**
-     * Write the current profiling contents to the file "java.prof".
-     * If the file already exists, it will be overwritten.
-     */
-    // public native static void writeJavaProfilerReport();
-
-
-    private static volatile boolean booted = false;
-    private static final Object lock = new Object();
-
-    // Invoked by System.initializeSystemClass just before returning.
-    // Subsystems that are invoked during initialization can check this
-    // property in order to avoid doing things that should wait until the
-    // application class loader has been set up.
-    //
-    public static void booted() {
-        synchronized (lock) {
-            booted = true;
-            lock.notifyAll();
-        }
-    }
-
-    public static boolean isBooted() {
-        return booted;
-    }
-
-    // Waits until VM completes initialization
-    //
-    // This method is invoked by the Finalizer thread
-    public static void awaitBooted() throws InterruptedException {
-        synchronized (lock) {
-            while (!booted) {
-                lock.wait();
-            }
-        }
-    }
-
-    // A user-settable upper limit on the maximum amount of allocatable direct
-    // buffer memory.  This value may be changed during VM initialization if
-    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
-    //
-    // The initial value of this field is arbitrary; during JRE initialization
-    // it will be reset to the value specified on the command line, if any,
-    // otherwise to Runtime.getRuntime().maxMemory().
-    //
-    private static long directMemory = 64 * 1024 * 1024;
-
-    // Returns the maximum amount of allocatable direct buffer memory.
-    // The directMemory variable is initialized during system initialization
-    // in the saveAndRemoveProperties method.
-    //
-    public static long maxDirectMemory() {
-        return directMemory;
-    }
-
-    // User-controllable flag that determines if direct buffers should be page
-    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
-    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
-    private static boolean pageAlignDirectMemory;
-
-    // Returns {@code true} if the direct buffers should be page aligned. This
-    // variable is initialized by saveAndRemoveProperties.
-    public static boolean isDirectMemoryPageAligned() {
-        return pageAlignDirectMemory;
-    }
-
-    /**
-     * Returns true if the given class loader is in the system domain
-     * in which all permissions are granted.
-     */
-    public static boolean isSystemDomainLoader(ClassLoader loader) {
-        return loader == null;
-    }
-
-    /**
-     * Returns the system property of the specified key saved at
-     * system initialization time.  This method should only be used
-     * for the system properties that are not changed during runtime.
-     * It accesses a private copy of the system properties so
-     * that user's locking of the system properties object will not
-     * cause the library to deadlock.
-     *
-     * Note that the saved system properties do not include
-     * the ones set by sun.misc.Version.init().
-     *
-     */
-    public static String getSavedProperty(String key) {
-        if (savedProps.isEmpty())
-            throw new IllegalStateException("Should be non-empty if initialized");
-
-        return savedProps.getProperty(key);
-    }
-
-    // TODO: the Property Management needs to be refactored and
-    // the appropriate prop keys need to be accessible to the
-    // calling classes to avoid duplication of keys.
-    private static final Properties savedProps = new Properties();
-
-    // Save a private copy of the system properties and remove
-    // the system properties that are not intended for public access.
-    //
-    // This method can only be invoked during system initialization.
-    public static void saveAndRemoveProperties(Properties props) {
-        if (booted)
-            throw new IllegalStateException("System initialization has completed");
-
-        savedProps.putAll(props);
-
-        // Set the maximum amount of direct memory.  This value is controlled
-        // by the vm option -XX:MaxDirectMemorySize=<size>.
-        // The maximum amount of allocatable direct buffer memory (in bytes)
-        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
-        // The system property will be removed.
-        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
-        if (s != null) {
-            if (s.equals("-1")) {
-                // -XX:MaxDirectMemorySize not given, take default
-                directMemory = Runtime.getRuntime().maxMemory();
-            } else {
-                long l = Long.parseLong(s);
-                if (l > -1)
-                    directMemory = l;
-            }
-        }
-
-        // Check if direct buffers should be page aligned
-        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
-        if ("true".equals(s))
-            pageAlignDirectMemory = true;
-
-        // Remove other private system properties
-        // used by java.lang.Integer.IntegerCache
-        props.remove("java.lang.Integer.IntegerCache.high");
-
-        // used by sun.launcher.LauncherHelper
-        props.remove("sun.java.launcher.diag");
-    }
-
-    // Initialize any miscellenous operating system settings that need to be
-    // set for the class libraries.
-    //
-    public static void initializeOSEnvironment() {
-        if (!booted) {
-            OSEnvironment.initialize();
-        }
-    }
-
-    /* Current count of objects pending for finalization */
-    private static volatile int finalRefCount;
-
-    /* Peak count of objects pending for finalization */
-    private static volatile int peakFinalRefCount;
-
-    /*
-     * Gets the number of objects pending for finalization.
-     *
-     * @return the number of objects pending for finalization.
-     */
-    public static int getFinalRefCount() {
-        return finalRefCount;
-    }
-
-    /*
-     * Gets the peak number of objects pending for finalization.
-     *
-     * @return the peak number of objects pending for finalization.
-     */
-    public static int getPeakFinalRefCount() {
-        return peakFinalRefCount;
-    }
-
-    /*
-     * Add {@code n} to the objects pending for finalization count.
-     *
-     * @param n an integer value to be added to the objects pending
-     * for finalization count
-     */
-    public static void addFinalRefCount(int n) {
-        // The caller must hold lock to synchronize the update.
-
-        finalRefCount += n;
-        if (finalRefCount > peakFinalRefCount) {
-            peakFinalRefCount = finalRefCount;
-        }
-    }
-
-    /**
-     * Returns Thread.State for the given threadStatus
-     */
-    public static Thread.State toThreadState(int threadStatus) {
-        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
-            return RUNNABLE;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
-            return BLOCKED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
-            return WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
-            return TIMED_WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
-            return TERMINATED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
-            return NEW;
-        } else {
-            return RUNNABLE;
-        }
-    }
-
-    /* The threadStatus field is set by the VM at state transition
-     * in the hotspot implementation. Its value is set according to
-     * the JVM TI specification GetThreadState function.
-     */
-    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
-    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
-    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
-    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
-    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
-    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
-
-    /*
-     * Returns the first non-null class loader up the execution stack,
-     * or null if only code from the null class loader is on the stack.
-     */
-    public static native ClassLoader latestUserDefinedLoader();
-
-    /**
-     * Returns {@code true} if we are in a set UID program.
-     */
-    public static boolean isSetUID() {
-        long uid = getuid();
-        long euid = geteuid();
-        long gid = getgid();
-        long egid = getegid();
-        return uid != euid  || gid != egid;
-    }
-
-    /**
-     * Returns the real user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getuid();
-
-    /**
-     * Returns the effective user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long geteuid();
-
-    /**
-     * Returns the real group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getgid();
-
-    /**
-     * Returns the effective group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getegid();
-
-    /**
-     * Get a nanosecond time stamp adjustment in the form of a single long.
-     *
-     * This value can be used to create an instant using
-     * {@link java.time.Instant#ofEpochSecond(long, long)
-     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
-     *  getNanoTimeAdjustment(offsetInSeconds))}.
-     * <p>
-     * The value returned has the best resolution available to the JVM on
-     * the current system.
-     * This is usually down to microseconds - or tenth of microseconds -
-     * depending on the OS/Hardware and the JVM implementation.
-     *
-     * @param offsetInSeconds The offset in seconds from which the nanosecond
-     *        time stamp should be computed.
-     *
-     * @apiNote The offset should be recent enough - so that
-     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
-     *         current UTC time. If the offset is too far off, {@code -1} will be
-     *         returned. As such, {@code -1} must not be considered as a valid
-     *         nano time adjustment, but as an exception value indicating
-     *         that an offset closer to the current time should be used.
-     *
-     * @return A nanosecond time stamp adjustment in the form of a single long.
-     *     If the offset is too far off the current time, this method returns -1.
-     *     In that case, the caller should call this method again, passing a
-     *     more accurate offset.
-     */
-    public static native long getNanoTimeAdjustment(long offsetInSeconds);
-
-    static {
-        initialize();
-    }
-    private static native void initialize();
-}
--- a/src/java.base/share/classes/sun/misc/VMNotification.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/** @deprecated */
-@Deprecated
-public interface VMNotification {
-
-    // when the vm switches allocation states, we get notified
-    // (possible semantics: if the state changes while in this
-    // notification, don't recursively notify).
-    // oldState and newState may be the same if we are just releasing
-    // suspended threads.
-    void newAllocState(int oldState, int newState,
-                       boolean threadsSuspended);
-}
--- a/src/java.base/share/classes/sun/nio/ch/Util.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/nio/ch/Util.java	Thu Jan 07 15:14:24 2016 -0800
@@ -389,7 +389,7 @@
 
     static boolean atBugLevel(String bl) {              // package-private
         if (bugLevel == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!jdk.internal.misc.VM.isBooted())
                 return false;
             String value = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.ch.bugLevel"));
--- a/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Thu Jan 07 15:14:24 2016 -0800
@@ -156,12 +156,12 @@
 
     private boolean initialized = false;
 
-    /*   provider the sun.nio.cs.map property fir sjis/ms932 mapping hack 
+    /*   provider the sun.nio.cs.map property fir sjis/ms932 mapping hack
      */
     private void init() {
         if (initialized)
             return;
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return;
         initialized = true;
 
--- a/src/java.base/share/classes/sun/reflect/Reflection.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/reflect/Reflection.java	Thu Jan 07 15:14:24 2016 -0800
@@ -29,6 +29,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 /** Common utility routines used by both java.lang and
     java.lang.reflect */
@@ -335,7 +336,7 @@
      */
     public static boolean isCallerSensitive(Method m) {
         final ClassLoader loader = m.getDeclaringClass().getClassLoader();
-        if (sun.misc.VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
+        if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
             return m.isAnnotationPresent(CallerSensitive.class);
         }
         return false;
--- a/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Jan 07 15:14:24 2016 -0800
@@ -417,14 +417,12 @@
             supports(HashAlgorithm.SHA1,        SignatureAlgorithm.ECDSA,
                     "SHA1withECDSA",        --p);
 
-            if (Security.getProvider("SunMSCAPI") == null) {
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.DSA,
                     "SHA224withDSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
                     "SHA224withRSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
                     "SHA224withECDSA",      --p);
-            }
 
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.DSA,
                     "SHA256withDSA",        --p);
--- a/src/java.base/share/native/libjava/MessageUtils.c	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1998, 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 <stdlib.h>
-#include <jni.h>
-#include <jni_util.h>
-#include <jlong.h>
-#include <stdio.h>
-#include <jvm.h>
-
-#include "sun_misc_MessageUtils.h"
-
-static void
-printToFile(JNIEnv *env, jstring s, FILE *file)
-{
-    char *sConverted;
-    int length = 0;
-    int i;
-    const jchar *sAsArray;
-
-    if (s == NULL) {
-      s = (*env)->NewStringUTF(env, "null");
-      if (s == NULL) return;
-    }
-
-    sAsArray = (*env)->GetStringChars(env, s, NULL);
-    if (!sAsArray)
-        return;
-    length = (*env)->GetStringLength(env, s);
-    if (length == 0) {
-        (*env)->ReleaseStringChars(env, s, sAsArray);
-        return;
-    }
-    sConverted = (char *) malloc(length + 1);
-    if (!sConverted) {
-        (*env)->ReleaseStringChars(env, s, sAsArray);
-        JNU_ThrowOutOfMemoryError(env, NULL);
-        return;
-    }
-
-    for(i = 0; i < length; i++) {
-        sConverted[i] = (0x7f & sAsArray[i]);
-    }
-    sConverted[length] = '\0';
-    jio_fprintf(file, "%s", sConverted);
-    (*env)->ReleaseStringChars(env, s, sAsArray);
-    free(sConverted);
-}
-
-JNIEXPORT void JNICALL
-Java_sun_misc_MessageUtils_toStderr(JNIEnv *env, jclass cls, jstring s)
-{
-    printToFile(env, s, stderr);
-}
-
-JNIEXPORT void JNICALL
-Java_sun_misc_MessageUtils_toStdout(JNIEnv *env, jclass cls, jstring s)
-{
-    printToFile(env, s, stdout);
-}
--- a/src/java.base/share/native/libjava/RandomAccessFile.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/native/libjava/RandomAccessFile.c	Thu Jan 07 15:14:24 2016 -0800
@@ -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
@@ -103,23 +103,19 @@
 
 JNIEXPORT jlong JNICALL
 Java_java_io_RandomAccessFile_length(JNIEnv *env, jobject this) {
+
     FD fd;
-    jlong cur = jlong_zero;
-    jlong end = jlong_zero;
+    jlong length = jlong_zero;
 
     fd = GET_FD(this, raf_fd);
     if (fd == -1) {
         JNU_ThrowIOException(env, "Stream Closed");
         return -1;
     }
-    if ((cur = IO_Lseek(fd, 0L, SEEK_CUR)) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
-    } else if ((end = IO_Lseek(fd, 0L, SEEK_END)) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
-    } else if (IO_Lseek(fd, cur, SEEK_SET) == -1) {
-        JNU_ThrowIOExceptionWithLastError(env, "Seek failed");
+    if ((length = IO_GetLength(fd)) == -1) {
+        JNU_ThrowIOExceptionWithLastError(env, "GetLength failed");
     }
-    return end;
+    return length;
 }
 
 JNIEXPORT void JNICALL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/native/libjava/StringCoding.c	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1998, 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 <stdlib.h>
+#include <jni.h>
+#include <jni_util.h>
+#include <stdio.h>
+#include <jvm.h>
+
+#include "java_lang_StringCoding.h"
+
+static void
+printToFile(JNIEnv *env, jstring s, FILE *file)
+{
+    char *sConverted;
+    int length = 0;
+    int i;
+    const jchar *sAsArray;
+
+    if (s == NULL) {
+        JNU_ThrowNullPointerException(env, NULL);
+        return;
+    }
+
+    sAsArray = (*env)->GetStringChars(env, s, NULL);
+    if (!sAsArray)
+        return;
+    length = (*env)->GetStringLength(env, s);
+    if (length == 0) {
+        (*env)->ReleaseStringChars(env, s, sAsArray);
+        return;
+    }
+    sConverted = (char *) malloc(length + 1);
+    if (!sConverted) {
+        (*env)->ReleaseStringChars(env, s, sAsArray);
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return;
+    }
+
+    for(i = 0; i < length; i++) {
+        sConverted[i] = (0x7f & sAsArray[i]);
+    }
+    sConverted[length] = '\0';
+    jio_fprintf(file, "%s", sConverted);
+    (*env)->ReleaseStringChars(env, s, sAsArray);
+    free(sConverted);
+}
+
+JNIEXPORT void JNICALL
+Java_java_lang_StringCoding_err(JNIEnv *env, jclass cls, jstring s)
+{
+    printToFile(env, s, stderr);
+}
--- a/src/java.base/share/native/libjava/VM.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/share/native/libjava/VM.c	Thu Jan 07 15:14:24 2016 -0800
@@ -28,7 +28,7 @@
 #include "jvm.h"
 #include "jdk_util.h"
 
-#include "sun_misc_VM.h"
+#include "jdk_internal_misc_VM.h"
 
 /* Only register the performance-critical methods */
 static JNINativeMethod methods[] = {
@@ -36,12 +36,12 @@
 };
 
 JNIEXPORT jobject JNICALL
-Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
+Java_jdk_internal_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
     return JVM_LatestUserDefinedLoader(env);
 }
 
 JNIEXPORT void JNICALL
-Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
+Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
     if (!JDK_InitJvmHandle()) {
         JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
         return;
@@ -50,8 +50,8 @@
     // Registers implementations of native methods described in methods[]
     // above.
     // In particular, registers JVM_GetNanoTimeAdjustment as the implementation
-    // of the native sun.misc.VM.getNanoTimeAdjustment - avoiding the cost of
-    // introducing a Java_sun_misc_VM_getNanoTimeAdjustment  wrapper
+    // of the native VM.getNanoTimeAdjustment - avoiding the cost of
+    // introducing a Java_jdk_internal_misc_VM_getNanoTimeAdjustment wrapper
     (*env)->RegisterNatives(env, cls,
                             methods, sizeof(methods)/sizeof(methods[0]));
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/unix/classes/jdk/internal/misc/OSEnvironment.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jdk.internal.misc;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     */
+    public static void initialize() {
+        // no-op on Solaris and Linux
+    }
+
+}
--- a/src/java.base/unix/classes/sun/misc/OSEnvironment.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.misc;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     */
-    public static void initialize() {
-        // no-op on Solaris and Linux
-    }
-
-}
--- a/src/java.base/unix/native/libjava/VM_md.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/unix/native/libjava/VM_md.c	Thu Jan 07 15:14:24 2016 -0800
@@ -28,25 +28,25 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
 
     return getuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
 
     return geteuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
 
     return getgid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
 
     return getegid();
 }
--- a/src/java.base/unix/native/libjava/io_util_md.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/unix/native/libjava/io_util_md.c	Thu Jan 07 15:14:24 2016 -0800
@@ -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
@@ -22,7 +22,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 #include "jni.h"
 #include "jni_util.h"
 #include "jvm.h"
@@ -219,3 +218,14 @@
     RESTARTABLE(ftruncate64(fd, length), result);
     return result;
 }
+
+jlong
+handleGetLength(FD fd)
+{
+    struct stat64 sb;
+    if (fstat64(fd, &sb) == 0) {
+        return sb.st_size;
+    } else {
+        return -1;
+    }
+}
--- a/src/java.base/unix/native/libjava/io_util_md.h	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/unix/native/libjava/io_util_md.h	Thu Jan 07 15:14:24 2016 -0800
@@ -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
@@ -39,7 +39,7 @@
 ssize_t handleRead(FD fd, void *buf, jint len);
 jint handleAvailable(FD fd, jlong *pbytes);
 jint handleSetLength(FD fd, jlong length);
-
+jlong handleGetLength(FD fd);
 FD handleOpen(const char *path, int oflag, int mode);
 
 /*
@@ -72,6 +72,7 @@
 #define IO_Append handleWrite
 #define IO_Available handleAvailable
 #define IO_SetLength handleSetLength
+#define IO_GetLength handleGetLength
 
 #ifdef _ALLBSD_SOURCE
 #define open64 open
--- a/src/java.base/unix/native/libnio/ch/NativeThread.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/unix/native/libnio/ch/NativeThread.c	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,10 @@
 #else
     ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
 #endif
+#ifdef MACOSX
+    if (ret != 0 && ret != ESRCH)
+#else
     if (ret != 0)
+#endif
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/windows/classes/jdk/internal/misc/OSEnvironment.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 jdk.internal.misc;
+
+import sun.io.Win32ErrorMode;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     * <p>
+     * At this time only the process-wide error mode needs to be set.
+     */
+    public static void initialize() {
+        Win32ErrorMode.initialize();
+    }
+
+}
--- a/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Thu Jan 07 15:14:24 2016 -0800
@@ -66,7 +66,7 @@
      * has completed.
      */
     public static void initialize() {
-        if (!sun.misc.VM.isBooted()) {
+        if (!jdk.internal.misc.VM.isBooted()) {
             String s = System.getProperty("sun.io.allowCriticalErrorMessageBox");
             if (s == null || s.equals(Boolean.FALSE.toString())) {
                 long mode = setErrorMode(0);
--- a/src/java.base/windows/classes/sun/misc/OSEnvironment.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.misc;
-
-import sun.io.Win32ErrorMode;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     * <p>
-     * At this time only the process-wide error mode needs to be set.
-     */
-    public static void initialize() {
-        Win32ErrorMode.initialize();
-    }
-
-}
--- a/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +38,10 @@
 import java.util.Calendar;
 import java.util.Collections;
 import java.util.Currency;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Locale;
+import java.util.Map;
 import java.util.ResourceBundle.Control;
 import java.util.Set;
 import java.util.TimeZone;
@@ -47,6 +49,7 @@
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.spi.CalendarDataProvider;
+import java.util.spi.CalendarNameProvider;
 import java.util.spi.CurrencyNameProvider;
 import java.util.spi.LocaleNameProvider;
 import sun.util.spi.CalendarProvider;
@@ -81,6 +84,9 @@
     private static final int DN_LOCALE_REGION   = 4;
     private static final int DN_LOCALE_VARIANT  = 5;
 
+    // Windows Calendar IDs
+    private static final int CAL_JAPAN  = 3;
+
     // Native Calendar ID to LDML calendar type map
     private static final String[] calIDToLDML = {
         "",
@@ -95,7 +101,8 @@
         "gregory_fr",
         "gregory_ar",
         "gregory_en",
-        "gregory_fr",
+        "gregory_fr", "", "", "", "", "", "", "", "", "", "",
+        "islamic-umalqura",
     };
 
     // Caches
@@ -362,6 +369,50 @@
         };
     }
 
+    public static CalendarNameProvider getCalendarNameProvider() {
+        return new CalendarNameProvider() {
+            @Override
+            public Locale[] getAvailableLocales() {
+                return getSupportedCalendarLocales();
+            }
+
+            @Override
+            public boolean isSupportedLocale(Locale locale) {
+                return isSupportedCalendarLocale(locale);
+            }
+
+            @Override
+            public String getDisplayName(String calendarType, int field,
+                int value, int style, Locale locale) {
+                String[] names = getCalendarDisplayStrings(removeExtensions(locale).toLanguageTag(),
+                            getCalendarIDFromLDMLType(calendarType), field, style);
+                if (names != null && value >= 0 && value < names.length) {
+                    return names[value];
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public Map<String, Integer> getDisplayNames(String calendarType,
+                int field, int style, Locale locale) {
+                Map<String, Integer> map = null;
+                String[] names = getCalendarDisplayStrings(removeExtensions(locale).toLanguageTag(),
+                            getCalendarIDFromLDMLType(calendarType), field, style);
+                if (names != null) {
+                    map = new HashMap<>();
+                    for (int value = 0; value < names.length; value++) {
+                        if (names[value] != null) {
+                            map.put(names[value], value);
+                        }
+                    }
+                    map = map.isEmpty() ? null : map;
+                }
+                return map;
+            }
+        };
+    }
+
     public static CalendarProvider getCalendarProvider() {
         return new CalendarProvider() {
             @Override
@@ -496,15 +547,7 @@
     }
 
     private static boolean isSupportedCalendarLocale(Locale locale) {
-        Locale base = locale;
-
-        if (base.hasExtensions() || base.getVariant() != "") {
-            // strip off extensions and variant.
-            base = new Locale.Builder()
-                            .setLocale(locale)
-                            .clearExtensions()
-                            .build();
-        }
+        Locale base = stripVariantAndExtensions(locale);
 
         if (!supportedLocaleSet.contains(base)) {
             return false;
@@ -569,11 +612,23 @@
     }
 
     private static boolean isJapaneseCalendar() {
-        return getCalendarID("ja-JP") == 3; // 3: CAL_JAPAN
+        return getCalendarID("ja-JP") == CAL_JAPAN;
+    }
+
+    private static Locale stripVariantAndExtensions(Locale locale) {
+        if (locale.hasExtensions() || locale.getVariant() != "") {
+            // strip off extensions and variant.
+            locale = new Locale.Builder()
+                            .setLocale(locale)
+                            .clearExtensions()
+                            .build();
+        }
+
+        return locale;
     }
 
     private static Locale getCalendarLocale(Locale locale) {
-        int calid = getCalendarID(locale.toLanguageTag());
+        int calid = getCalendarID(stripVariantAndExtensions(locale).toLanguageTag());
         if (calid > 0 && calid < calIDToLDML.length) {
             Locale.Builder lb = new Locale.Builder();
             String[] caltype = calIDToLDML[calid].split("_");
@@ -589,6 +644,15 @@
         return locale;
     }
 
+    private static int getCalendarIDFromLDMLType(String ldmlType) {
+        for (int i = 0; i < calIDToLDML.length; i++) {
+            if (calIDToLDML[i].startsWith(ldmlType)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
     private static Locale getNumberLocale(Locale src) {
         if (JRELocaleConstants.TH_TH.equals(src)) {
             if (isNativeDigit("th-TH")) {
@@ -639,6 +703,9 @@
     // For CalendarDataProvider
     private static native int getCalendarDataValue(String langTag, int type);
 
+    // For CalendarNameProvider
+    private static native String[] getCalendarDisplayStrings(String langTag, int calid, int field, int style);
+
     // For Locale/CurrencyNameProvider
     private static native String getDisplayString(String langTag, int key, String value);
 }
--- a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,22 +31,33 @@
 
 #define BUFLEN 256
 
+// java.util.Calendar constants
+#define CALENDAR_FIELD_ERA              0           // Calendar.ERA
+#define CALENDAR_FIELD_MONTH            2           // Calendar.MONTH
+#define CALENDAR_STYLE_SHORT_MASK       0x00000001  // Calendar.SHORT
+#define CALENDAR_STYLE_STANDALONE_MASK  0x00008000  // Calendar.STANDALONE
+
 // global variables
 typedef int (WINAPI *PGLIE)(const jchar *, LCTYPE, LPWSTR, int);
 typedef int (WINAPI *PGCIE)(const jchar *, CALID, LPCWSTR, CALTYPE, LPWSTR, int, LPDWORD);
+typedef int (WINAPI *PECIEE)(CALINFO_ENUMPROCEXEX, const jchar *, CALID, LPCWSTR, CALTYPE, LPARAM);
 PGLIE pGetLocaleInfoEx;
 PGCIE pGetCalendarInfoEx;
+PECIEE pEnumCalendarInfoExEx;
 BOOL initialized = FALSE;
 
 // prototypes
 int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen);
 int getCalendarInfoWrapper(const jchar *langtag, CALID id, LPCWSTR reserved, CALTYPE type, LPWSTR data, int buflen, LPDWORD val);
 jint getCalendarID(const jchar *langtag);
-void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jobjectArray jarray,
-                       CALTYPE* pCalTypes, int offset, int length);
+void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jint calid, jobjectArray jarray,
+                       CALTYPE* pCalTypes, int offset, int length, int style);
 WCHAR * getNumberPattern(const jchar * langtag, const jint numberStyle);
 void getNumberPart(const jchar * langtag, const jint numberStyle, WCHAR * number);
 void getFixPart(const jchar * langtag, const jint numberStyle, BOOL positive, BOOL prefix, WCHAR * ret);
+int enumCalendarInfoWrapper(const jchar * langtag, CALID calid, CALTYPE type, LPWSTR buf, int buflen);
+BOOL CALLBACK EnumCalendarInfoProc(LPWSTR lpCalInfoStr, CALID calid, LPWSTR lpReserved, LPARAM lParam);
+jobjectArray getErasImpl(JNIEnv *env, jstring jlangtag, jint calid, jint style, jobjectArray eras);
 
 // from java_props_md.c
 extern __declspec(dllexport) const char * getJavaIDFromLangID(LANGID langID);
@@ -83,6 +94,8 @@
     CAL_SABBREVMONTHNAME13,
 };
 
+#define MONTHTYPES (sizeof(monthsType) / sizeof(CALTYPE))
+
 CALTYPE wDaysType[] = {
     CAL_SDAYNAME7,
     CAL_SDAYNAME1,
@@ -155,6 +168,11 @@
     }
 };
 
+
+// Localized region name for unknown regions (Windows 10)
+#define UNKNOWN_REGION  L"Unknown Region ("
+#define UNKNOWN_REGION_SIZE wcslen(UNKNOWN_REGION)
+
 /*
  * Class:     sun_util_locale_provider_HostLocaleProviderAdapterImpl
  * Method:    initialize
@@ -169,11 +187,15 @@
         pGetCalendarInfoEx = (PGCIE)GetProcAddress(
             GetModuleHandle("kernel32.dll"),
             "GetCalendarInfoEx");
+        pEnumCalendarInfoExEx = (PECIEE)GetProcAddress(
+            GetModuleHandle("kernel32.dll"),
+            "EnumCalendarInfoExEx");
         initialized =TRUE;
     }
 
     return pGetLocaleInfoEx != NULL &&
-           pGetCalendarInfoEx != NULL;
+           pGetCalendarInfoEx != NULL &&
+           pEnumCalendarInfoExEx != NULL;
 }
 
 /*
@@ -300,23 +322,7 @@
  */
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getEras
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray eras) {
-    WCHAR ad[BUFLEN];
-    const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    jstring tmp_string;
-    CHECK_NULL_RETURN(langtag, eras);
-
-    getCalendarInfoWrapper(langtag, getCalendarID(langtag), NULL,
-                      CAL_SERASTRING, ad, BUFLEN, NULL);
-
-    // Windows does not provide B.C. era.
-    tmp_string = (*env)->NewString(env, ad, (jsize)wcslen(ad));
-    if (tmp_string != NULL) {
-        (*env)->SetObjectArrayElement(env, eras, 1, tmp_string);
-    }
-
-    (*env)->ReleaseStringChars(env, jlangtag, langtag);
-
-    return eras;
+    return getErasImpl(env, jlangtag, -1, 0, eras);
 }
 
 /*
@@ -326,8 +332,8 @@
  */
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonths
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray months) {
-    replaceCalendarArrayElems(env, jlangtag, months, monthsType,
-                      0, sizeof(monthsType)/sizeof(CALTYPE));
+    replaceCalendarArrayElems(env, jlangtag, -1, months, monthsType,
+                      0, MONTHTYPES, 0);
     return months;
 }
 
@@ -338,8 +344,8 @@
  */
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortMonths
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray smonths) {
-    replaceCalendarArrayElems(env, jlangtag, smonths, sMonthsType,
-                      0, sizeof(sMonthsType)/sizeof(CALTYPE));
+    replaceCalendarArrayElems(env, jlangtag, -1, smonths, sMonthsType,
+                      0, MONTHTYPES, 0);
     return smonths;
 }
 
@@ -350,8 +356,8 @@
  */
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getWeekdays
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray wdays) {
-    replaceCalendarArrayElems(env, jlangtag, wdays, wDaysType,
-                      1, sizeof(wDaysType)/sizeof(CALTYPE));
+    replaceCalendarArrayElems(env, jlangtag, -1, wdays, wDaysType,
+                      1, sizeof(wDaysType)/sizeof(CALTYPE), 0);
     return wdays;
 }
 
@@ -362,8 +368,8 @@
  */
 JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getShortWeekdays
   (JNIEnv *env, jclass cls, jstring jlangtag, jobjectArray swdays) {
-    replaceCalendarArrayElems(env, jlangtag, swdays, sWDaysType,
-                      1, sizeof(sWDaysType)/sizeof(CALTYPE));
+    replaceCalendarArrayElems(env, jlangtag, -1, swdays, sWDaysType,
+                      1, sizeof(sWDaysType)/sizeof(CALTYPE), 0);
     return swdays;
 }
 
@@ -676,6 +682,41 @@
 
 /*
  * Class:     sun_util_locale_provider_HostLocaleProviderAdapterImpl
+ * Method:    getCalendarDisplayStrings
+ * Signature: (Ljava/lang/String;III)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDisplayStrings
+  (JNIEnv *env, jclass cls, jstring jlangtag, jint calid, jint field, jint style) {
+    jobjectArray ret = NULL;
+    CALTYPE * pCalType = NULL;
+
+    switch (field) {
+    case CALENDAR_FIELD_ERA:
+        return getErasImpl(env, jlangtag, calid, style, NULL);
+
+    case CALENDAR_FIELD_MONTH:
+        ret = (*env)->NewObjectArray(env, MONTHTYPES,
+                (*env)->FindClass(env, "java/lang/String"), NULL);
+        if (ret != NULL) {
+            if (style & CALENDAR_STYLE_SHORT_MASK) {
+                pCalType = sMonthsType;
+            } else {
+                pCalType = monthsType;
+            }
+
+            replaceCalendarArrayElems(env, jlangtag, calid, ret, pCalType,
+                          0, MONTHTYPES, style);
+        }
+        return ret;
+
+    default:
+        // not supported
+        return NULL;
+    }
+}
+
+/*
+ * Class:     sun_util_locale_provider_HostLocaleProviderAdapterImpl
  * Method:    getDisplayString
  * Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
  */
@@ -714,10 +755,15 @@
     (*env)->ReleaseStringChars(env, jStr, pjChar);
 
     if (got) {
-        return (*env)->NewString(env, buf, (jsize)wcslen(buf));
-    } else {
-        return NULL;
+        // Hack: Windows 10 returns "Unknown Region (XX)" for localized XX region name.
+        // Take that as not known.
+        if (type != sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_REGION ||
+            wcsncmp(UNKNOWN_REGION, buf, UNKNOWN_REGION_SIZE) != 0) {
+            return (*env)->NewString(env, buf, (jsize)wcslen(buf));
+        }
     }
+
+    return NULL;
 }
 
 int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen) {
@@ -753,35 +799,62 @@
 }
 
 jint getCalendarID(const jchar *langtag) {
-    DWORD type;
+    DWORD type = -1;
     int got = getLocaleInfoWrapper(langtag,
         LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER,
         (LPWSTR)&type, sizeof(type));
 
     if (got) {
-        return type;
-    } else {
-        return 0;
+        switch (type) {
+            case CAL_GREGORIAN:
+            case CAL_GREGORIAN_US:
+            case CAL_JAPAN:
+            case CAL_TAIWAN:
+            case CAL_HIJRI:
+            case CAL_THAI:
+            case CAL_GREGORIAN_ME_FRENCH:
+            case CAL_GREGORIAN_ARABIC:
+            case CAL_GREGORIAN_XLIT_ENGLISH:
+            case CAL_GREGORIAN_XLIT_FRENCH:
+            case CAL_UMALQURA:
+                break;
+
+            default:
+                // non-supported calendars return -1
+                type = -1;
+                break;
+        }
     }
+
+    return type;
 }
 
-void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jobjectArray jarray, CALTYPE* pCalTypes, int offset, int length) {
+void replaceCalendarArrayElems(JNIEnv *env, jstring jlangtag, jint calid, jobjectArray jarray, CALTYPE* pCalTypes, int offset, int length, int style) {
     WCHAR name[BUFLEN];
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int calid;
     jstring tmp_string;
+    CALTYPE isGenitive;
 
     CHECK_NULL(langtag);
-    calid = getCalendarID(langtag);
+
+    if (calid < 0) {
+        calid = getCalendarID(langtag);
+    }
 
     if (calid != -1) {
         int i;
+
+        if (!(style & CALENDAR_STYLE_STANDALONE_MASK)) {
+            isGenitive = CAL_RETURN_GENITIVE_NAMES;
+        }
+
         for (i = 0; i < length; i++) {
-            getCalendarInfoWrapper(langtag, calid, NULL,
-                              pCalTypes[i], name, BUFLEN, NULL);
-            tmp_string = (*env)->NewString(env, name, (jsize)wcslen(name));
-            if (tmp_string != NULL) {
-                (*env)->SetObjectArrayElement(env, jarray, i + offset, tmp_string);
+            if (getCalendarInfoWrapper(langtag, calid, NULL,
+                              pCalTypes[i] | isGenitive, name, BUFLEN, NULL) != 0) {
+                tmp_string = (*env)->NewString(env, name, (jsize)wcslen(name));
+                if (tmp_string != NULL) {
+                    (*env)->SetObjectArrayElement(env, jarray, i + offset, tmp_string);
+                }
             }
         }
     }
@@ -924,3 +997,99 @@
 
     wcscpy(ret, fixes[!prefix][!positive][style][pattern]);
 }
+
+int enumCalendarInfoWrapper(const jchar *langtag, CALID calid, CALTYPE type, LPWSTR buf, int buflen) {
+    if (pEnumCalendarInfoExEx) {
+        if (wcscmp(L"und", (LPWSTR)langtag) == 0) {
+            // defaults to "en"
+            return pEnumCalendarInfoExEx(&EnumCalendarInfoProc, L"en",
+                calid, NULL, type, (LPARAM)buf);
+        } else {
+            return pEnumCalendarInfoExEx(&EnumCalendarInfoProc, langtag,
+                calid, NULL, type, (LPARAM)buf);
+        }
+    } else {
+        return 0;
+    }
+}
+
+BOOL CALLBACK EnumCalendarInfoProc(LPWSTR lpCalInfoStr, CALID calid, LPWSTR lpReserved, LPARAM lParam) {
+    wcscat_s((LPWSTR)lParam, BUFLEN, lpCalInfoStr);
+    wcscat_s((LPWSTR)lParam, BUFLEN, L",");
+    return TRUE;
+}
+
+jobjectArray getErasImpl(JNIEnv *env, jstring jlangtag, jint calid, jint style, jobjectArray eras) {
+    const jchar * langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
+    WCHAR buf[BUFLEN];
+    jobjectArray ret = eras;
+    CALTYPE type;
+
+    CHECK_NULL_RETURN(langtag, ret);
+
+    buf[0] = '\0';
+    if (style & CALENDAR_STYLE_SHORT_MASK) {
+        type = CAL_SABBREVERASTRING;
+    } else {
+        type = CAL_SERASTRING;
+    }
+
+    if (calid < 0) {
+        calid = getCalendarID(langtag);
+    }
+
+    if (calid != -1 && enumCalendarInfoWrapper(langtag, calid, type, buf, BUFLEN)) {
+        // format in buf: "era0,era1,era2," where era0 is the current one
+        int eraCount;
+        LPWSTR current;
+        jsize array_length;
+
+        for(eraCount = 0, current = buf; *current != '\0'; current++) {
+            if (*current == L',') {
+                eraCount ++;
+            }
+        }
+
+        if (eras != NULL) {
+            array_length = (*env)->GetArrayLength(env, eras);
+        } else {
+            // +1 for the "before" era, e.g., BC, which Windows does not return.
+            array_length = (jsize)eraCount + 1;
+            ret = (*env)->NewObjectArray(env, array_length,
+                (*env)->FindClass(env, "java/lang/String"), NULL);
+        }
+
+        if (ret != NULL) {
+            int eraIndex;
+            LPWSTR era;
+
+            for(eraIndex = 0, era = current = buf; eraIndex < eraCount; era = current, eraIndex++) {
+                while (*current != L',') {
+                    current++;
+                }
+                *current++ = '\0';
+
+                if (eraCount - eraIndex < array_length &&
+                    *era != '\0') {
+                    (*env)->SetObjectArrayElement(env, ret,
+                        (jsize)(eraCount - eraIndex),
+                        (*env)->NewString(env, era, (jsize)wcslen(era)));
+                }
+            }
+
+            // Hack for the Japanese Imperial Calendar to insert Gregorian era for
+            // "Before Meiji"
+            if (calid == CAL_JAPAN) {
+                buf[0] = '\0';
+                if (enumCalendarInfoWrapper(langtag, CAL_GREGORIAN, type, buf, BUFLEN)) {
+                    jsize len = (jsize)wcslen(buf);
+                    buf[--len] = '\0'; // remove the last ','
+                    (*env)->SetObjectArrayElement(env, ret, 0, (*env)->NewString(env, buf, len));
+                }
+            }
+        }
+    }
+
+    (*env)->ReleaseStringChars(env, jlangtag, langtag);
+    return ret;
+}
--- a/src/java.base/windows/native/libjava/VM_md.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/native/libjava/VM_md.c	Thu Jan 07 15:14:24 2016 -0800
@@ -27,28 +27,28 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
 
     /* -1 means function not available. */
     return -1;
--- a/src/java.base/windows/native/libjava/io_util_md.c	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/native/libjava/io_util_md.c	Thu Jan 07 15:14:24 2016 -0800
@@ -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
@@ -584,3 +584,14 @@
     }
     return long_to_jlong(pos.QuadPart);
 }
+
+jlong
+handleGetLength(FD fd) {
+    HANDLE h = (HANDLE) fd;
+    LARGE_INTEGER length;
+    if (GetFileSizeEx(h, &length) != 0) {
+        return long_to_jlong(length.QuadPart);
+    } else {
+        return -1;
+    }
+}
--- a/src/java.base/windows/native/libjava/io_util_md.h	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.base/windows/native/libjava/io_util_md.h	Thu Jan 07 15:14:24 2016 -0800
@@ -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
@@ -44,6 +44,7 @@
 int handleAvailable(FD fd, jlong *pbytes);
 int handleSync(FD fd);
 int handleSetLength(FD fd, jlong length);
+jlong handleGetLength(FD fd);
 JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
 jint handleWrite(FD fd, const void *buf, jint len);
 jint handleAppend(FD fd, const void *buf, jint len);
@@ -84,6 +85,7 @@
 #define IO_Lseek handleLseek
 #define IO_Available handleAvailable
 #define IO_SetLength handleSetLength
+#define IO_GetLength handleGetLength
 
 /*
  * Setting the handle field in Java_java_io_FileDescriptor_set for
--- a/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Thu Jan 07 15:14:24 2016 -0800
@@ -35,8 +35,6 @@
 import java.util.Enumeration;
 import java.net.URL;
 
-import sun.misc.MessageUtils;
-
 /**
  * A simple DTD-driven HTML parser. The parser reads an
  * HTML file from an InputStream and calls various methods
--- a/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Thu Jan 07 15:14:24 2016 -0800
@@ -44,7 +44,6 @@
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
 import sun.misc.ManagedLocalsThread;
-import sun.misc.MessageUtils;
 import sun.misc.PerformanceLogger;
 import sun.security.util.SecurityConstants;
 
@@ -118,8 +117,6 @@
      */
     Dimension currentAppletSize = new Dimension(10, 10);
 
-    MessageUtils mu = new MessageUtils();
-
     /**
      * The thread to use during applet loading
      */
--- a/src/java.logging/share/classes/java/util/logging/FileHandler.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.logging/share/classes/java/util/logging/FileHandler.java	Thu Jan 07 15:14:24 2016 -0800
@@ -639,7 +639,7 @@
                     continue;
                 } else if (ch2 == 'h') {
                     file = new File(System.getProperty("user.home"));
-                    if (sun.misc.VM.isSetUID()) {
+                    if (jdk.internal.misc.VM.isSetUID()) {
                         // Ok, we are in a set UID program.  For safety's sake
                         // we disallow attempts to open files relative to %h.
                         throw new IOException("can't use %h in set UID program");
--- a/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Thu Jan 07 15:14:24 2016 -0800
@@ -583,7 +583,7 @@
         ClassLoader loader =
             AccessController.doPrivileged(
                 (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
-        if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+        if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
             throw new IllegalArgumentException(mxbeanName +
                 " is not a platform MXBean");
         }
--- a/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Thu Jan 07 15:14:24 2016 -0800
@@ -473,7 +473,7 @@
     public static Thread.State toThreadState(int state) {
         // suspended and native bits may be set in state
         int threadStatus = state & ~JMM_THREAD_STATE_FLAG_MASK;
-        return sun.misc.VM.toThreadState(threadStatus);
+        return jdk.internal.misc.VM.toThreadState(threadStatus);
     }
 
     // These values are defined in jmm.h
--- a/src/java.management/share/classes/sun/management/MemoryImpl.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.management/share/classes/sun/management/MemoryImpl.java	Thu Jan 07 15:14:24 2016 -0800
@@ -59,7 +59,7 @@
     }
 
     public int getObjectPendingFinalizationCount() {
-        return sun.misc.VM.getFinalRefCount();
+        return jdk.internal.misc.VM.getFinalRefCount();
     }
 
     public void gc() {
--- a/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Thu Jan 07 15:14:24 2016 -0800
@@ -262,7 +262,7 @@
      * if only code from the null class loader is on the stack.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Thu Jan 07 15:14:24 2016 -0800
@@ -397,7 +397,7 @@
          */
 
         if (osname != null && !osname.startsWith("Windows")) {
-            long uid = sun.misc.VM.getuid();
+            long uid = jdk.internal.misc.VM.getuid();
             if (uid != -1) {
                 name = File.separator + "tmp" +
                         File.separator + stdCacheNameComponent + "_" + uid;
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Thu Jan 07 15:14:24 2016 -0800
@@ -60,7 +60,7 @@
  *
  *    service_euid
  *
- * in which euid is available as sun.misc.VM.geteuid().
+ * in which euid is available as jdk.internal.misc.VM.geteuid().
  *
  * The file has a header:
  *
@@ -107,7 +107,7 @@
     private static long uid;
     static {
         // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
-        uid = sun.misc.VM.geteuid();
+        uid = jdk.internal.misc.VM.geteuid();
     }
 
     public DflCache (String source) {
--- a/src/java.sql/share/classes/java/sql/Statement.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/java.sql/share/classes/java/sql/Statement.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1582,4 +1582,43 @@
         return len >= 1 && len <= 128
                 && Pattern.compile("[\\p{Alpha}][\\p{Alnum}_]*").matcher(identifier).matches();
     }
+
+    /**
+    * Returns a {@code String} representing a National Character Set Literal
+    * enclosed in single quotes and prefixed with a upper case letter N.
+    * Any occurrence of a single quote within the string will be replaced
+    * by two single quotes.
+    *
+    * <blockquote>
+    * <table border = 1 cellspacing=0 cellpadding=5 >
+    * <caption>Examples of the conversion:</caption>
+    * <tr>
+    * <th>Value</th>
+    * <th>Result</th>
+    * </tr>
+    * <tr> <td align='center'>Hello</td> <td align='center'>N'Hello'</td> </tr>
+    * <tr> <td align='center'>G'Day</td> <td align='center'>N'G''Day'</td> </tr>
+    * <tr> <td align='center'>'G''Day'</td>
+    * <td align='center'>N'''G''''Day'''</td> </tr>
+    * <tr> <td align='center'>I'''M</td> <td align='center'>N'I''''''M'</td>
+    * <tr> <td align='center'>N'Hello'</td> <td align='center'>N'N''Hello'''</td> </tr>
+    *
+    * </table>
+    * </blockquote>
+    * @implNote
+    * JDBC driver implementations may need to provide their own implementation
+    * of this method in order to meet the requirements of the underlying
+    * datasource. An implementation of enquoteNCharLiteral may accept a different
+    * set of characters than that accepted by the same drivers implementation of
+    * enquoteLiteral.
+    * @param val a character string
+    * @return the result of replacing every single quote character in the
+    * argument by two single quote characters where this entire result is
+    * then prefixed with 'N'.
+    * @throws NullPointerException if val is {@code null}
+    * @throws SQLException if a database access error occurs
+    */
+    default String enquoteNCharLiteral(String val)  throws SQLException {
+        return "N'" + val.replace("'", "''") +  "'";
+   }
 }
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template	Thu Jan 07 09:33:58 2016 -0800
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template	Thu Jan 07 15:14:24 2016 -0800
@@ -97,7 +97,7 @@
     protected void init() {
         if (initialized)
             return;
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return;
 
         String map = getProperty("sun.nio.cs.map");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/io/RandomAccessFile/FileLengthTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,137 @@
+/*
+ * 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 randomAccessFile that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4823133
+ * @summary optimize RandomAccessFile.length() and length() is thread safe now.
+ */
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+/**
+ *
+ * @author vyom.tewari@oracle.com
+ */
+public class FileLengthTest {
+
+    private static final int BUF_SIZE = 4096;
+    private static RandomAccessFile randomAccessFile;
+    private static Thread fileLengthCaller;
+    private static Thread fileContentReader;
+    private static StringBuilder fileContents;
+    private static volatile boolean isFailed = false;
+
+    /**
+     * this thread will call length() in loop
+     */
+    private static void startLengthThread() {
+        if (randomAccessFile == null) {
+            return;
+        }
+        fileLengthCaller = new Thread(() -> {
+            while (true) {
+                try {
+                    long length = randomAccessFile.length();
+                    if (length < 0) {
+                        return;
+                    }
+                } catch (IOException ex) {
+                    return;
+                }
+            }
+        });
+        fileLengthCaller.setName("RandomAccessFile-length-caller");
+        fileLengthCaller.setDaemon(true);
+        fileLengthCaller.start();
+    }
+
+    /**
+     * this thread will call read() and store the content in internal buffer.
+     */
+    private static void startReaderThread() {
+        if (randomAccessFile == null) {
+            return;
+        }
+        fileContentReader = new Thread(() -> {
+            StringBuilder sb = new StringBuilder(BUF_SIZE);
+            int i;
+            byte arr[] = new byte[8];
+            try {
+                while ((i = randomAccessFile.read(arr)) != -1) {
+                    sb.append(new String(arr, 0, i));
+                }
+                if (!sb.toString().equals(fileContents.toString())) {
+                    isFailed = true;
+                }
+            } catch (IOException ex) {
+            }
+        });
+        fileContentReader.setName("RandomAccessFile-content-reader");
+        fileContentReader.setDaemon(true);
+        fileContentReader.start();
+    }
+
+    public static void main(String args[]) {
+        byte arr[] = new byte[BUF_SIZE];
+        String testFile = "testfile.txt";
+        try {
+            createDummyFile(testFile);
+            File file = new File(testFile);
+            file.deleteOnExit();
+            randomAccessFile = new RandomAccessFile(file, "r");
+            int count = randomAccessFile.read(arr);
+            randomAccessFile.seek(0);
+            fileContents = new StringBuilder(BUF_SIZE);
+            fileContents.append(new String(arr, 0, count));
+            startLengthThread();
+            startReaderThread();
+            fileContentReader.join();
+        } catch (FileNotFoundException | InterruptedException ex) {
+        } catch (IOException ex) {
+        } finally {
+            try {
+                randomAccessFile.close();
+            } catch (IOException ex) {
+            }
+        }
+        if (isFailed) {
+            throw new RuntimeException("RandomAccessFile.length() changed the underlying file pointer.");
+        }
+    }
+
+    private static void createDummyFile(String fileName) throws FileNotFoundException, IOException {
+        try (FileOutputStream outputStream = new FileOutputStream(new File(fileName))) {
+            String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+            int count = 0;
+            while ((count + str.length()) < BUF_SIZE) {
+                outputStream.write(str.getBytes());
+                count += str.length();
+            }
+            outputStream.flush();
+        }
+    }
+}
--- a/test/java/lang/ProcessHandle/Basic.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/Basic.java	Thu Jan 07 15:14:24 2016 -0800
@@ -27,8 +27,8 @@
 import static org.testng.Assert.fail;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.Optional;
-import java.util.List;
 import java.util.stream.Collectors;
 
 import org.testng.TestNG;
@@ -36,6 +36,8 @@
 
 /*
  * @test
+ * @library /test/lib/share/classes
+ * @run testng InfoTest
  * @summary Basic tests for ProcessHandler
  * @author Roger Riggs
  */
--- a/test/java/lang/ProcessHandle/InfoTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/InfoTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -21,11 +21,10 @@
  * questions.
  */
 
+import java.io.BufferedReader;
 import java.io.File;
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
-import java.lang.ProcessBuilder;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -40,18 +39,18 @@
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
 
-import jdk.testlibrary.Platform;
-import jdk.testlibrary.Utils;
-
+import jdk.test.lib.Platform;
+import jdk.test.lib.Utils;
 import org.testng.Assert;
+import org.testng.TestNG;
 import org.testng.annotations.Test;
-import org.testng.TestNG;
 
 /*
  * @test
  * @bug 8077350 8081566 8081567 8098852 8136597
- * @build jdk.testlibrary.*
- * @library /lib/testlibrary
+ * @library /test/lib/share/classes
+ * @build jdk.test.lib.Platform jdk.test.lib.Utils
+ * @run testng InfoTest
  * @summary Functions of ProcessHandle.Info
  * @author Roger Riggs
  * @key intermittent
--- a/test/java/lang/ProcessHandle/OnExitTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/OnExitTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -22,7 +22,6 @@
  */
 
 import java.io.IOException;
-import java.lang.InterruptedException;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
@@ -31,7 +30,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import org.testng.annotations.Test;
 import org.testng.Assert;
@@ -39,7 +38,9 @@
 
 /*
  * @test
- * @build jdk.testlibrary.Utils
+ * @library /test/lib/share/classes
+ * @build jdk.test.lib.Platform jdk.test.lib.Utils
+ * @run testng OnExitTest
  * @summary Functions of Process.onExit and ProcessHandle.onExit
  * @author Roger Riggs
  */
--- a/test/java/lang/ProcessHandle/PermissionTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/PermissionTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -31,7 +31,6 @@
 import java.security.ProtectionDomain;
 import java.security.SecurityPermission;
 import java.util.Arrays;
-import java.util.Optional;
 import java.util.PropertyPermission;
 
 import org.testng.Assert;
@@ -39,6 +38,12 @@
 import org.testng.annotations.BeforeGroups;
 import org.testng.annotations.Test;
 
+/*
+ * @test
+ * @run testng/othervm PermissionTest
+ * @summary Test Permissions to access Info
+ */
+
 public class PermissionTest {
     /**
      * Backing up policy.
--- a/test/java/lang/ProcessHandle/ProcessUtil.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/ProcessUtil.java	Thu Jan 07 15:14:24 2016 -0800
@@ -23,18 +23,13 @@
 
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
-import java.lang.ProcessBuilder;
 import java.time.Duration;
 import java.util.List;
-import java.util.Objects;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import com.sun.management.OperatingSystemMXBean;
-
-import jdk.testlibrary.Platform;
-
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+import jdk.test.lib.Platform;
 
 /**
  * Useful utilities for testing Process and ProcessHandle.
--- a/test/java/lang/ProcessHandle/TEST.properties	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-# ProcessHandle tests use TestNG
-TestNG.dirs = .
-lib.dirs = /lib/testlibrary
-modules = jdk.management
--- a/test/java/lang/ProcessHandle/TreeTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/ProcessHandle/TreeTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -23,30 +23,31 @@
 
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.time.Duration;
 import java.time.Instant;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import java.util.concurrent.ExecutionException;
-import jdk.testlibrary.Utils;
+
+import jdk.test.lib.Utils;
 import org.testng.Assert;
 import org.testng.TestNG;
 import org.testng.annotations.Test;
 
 /*
  * @test
- * @library /lib/testlibrary
- * Test counting and JavaChild.spawning and counting of Processes.
- * @run testng/othervm InfoTest
+ * @library /test/lib/share/classes
+ * @build jdk.test.lib.Utils
+ * @run testng/othervm TreeTest
+ * @summary Test counting and JavaChild.spawning and counting of Processes.
  * @key intermittent
  * @author Roger Riggs
  */
--- a/test/java/lang/management/MemoryMXBean/Pending.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/lang/management/MemoryMXBean/Pending.java	Thu Jan 07 15:14:24 2016 -0800
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug     4530538
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.management
  * @summary Basic unit test of
  *          RuntimeMXBean.getObjectPendingFinalizationCount()
@@ -50,10 +50,10 @@
     private static void printFinalizerInstanceCount() {
         if (!trace) return;
 
-        int count = sun.misc.VM.getFinalRefCount();
+        int count = jdk.internal.misc.VM.getFinalRefCount();
         System.out.println(INDENT + "Finalizable object Count = " + count);
 
-        count = sun.misc.VM.getPeakFinalRefCount();
+        count = jdk.internal.misc.VM.getPeakFinalRefCount();
         System.out.println(INDENT + "Peak Finalizable object Count = " + count);
     }
 
--- a/test/java/net/SocketOption/OptionsTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/net/SocketOption/OptionsTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,8 +80,11 @@
     static NetworkInterface getNetworkInterface() {
         try {
             Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
-            if (nifs.hasMoreElements()) {
-                return (NetworkInterface)nifs.nextElement();
+            while (nifs.hasMoreElements()) {
+                NetworkInterface ni = (NetworkInterface)nifs.nextElement();
+                if (ni.supportsMulticast()) {
+                    return ni;
+                }
             }
         } catch (Exception e) {
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/TIFFContentGuesser.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8146041
+ * @summary java.net.URLConnection.guessContentTypeFromStream() does not
+ * recognize TIFF streams
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.net.URLConnection;
+
+public class TIFFContentGuesser {
+    private static final byte[] LITTLE_ENDIAN_MAGIC =
+        new byte[] {(byte)0x49, (byte)0x49, (byte)0x2a, (byte)0};
+    private static final byte[] BIG_ENDIAN_MAGIC =
+        new byte[] {(byte)0x4d, (byte)0x4d, (byte)0, (byte)0x2a};
+
+    private static final String TIFF_MIME_TYPE = "image/tiff";
+
+    public static void main(String[] args) throws Throwable {
+        int failures = 0;
+
+        InputStream stream = new ByteArrayInputStream(LITTLE_ENDIAN_MAGIC);
+        String contentType = URLConnection.guessContentTypeFromStream(stream);
+        if (contentType == null || !contentType.equals(TIFF_MIME_TYPE)) {
+            failures++;
+            System.err.println("Test failed for little endian magic");
+        }
+
+        stream = new ByteArrayInputStream(BIG_ENDIAN_MAGIC);
+        contentType = URLConnection.guessContentTypeFromStream(stream);
+        if (contentType == null || !contentType.equals(TIFF_MIME_TYPE)) {
+            failures++;
+            System.err.println("Test failed for big endian magic");
+        }
+
+        if (failures != 0) {
+            throw new RuntimeException
+                ("Test failed with " + failures +  " error(s)");
+        }
+    }
+}
+
--- a/test/java/net/ipv6tests/TcpTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/net/ipv6tests/TcpTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,8 +60,7 @@
         dprintln ("Local Addresses");
         dprintln (ia4addr.toString());
         dprintln (ia6addr.toString());
-        test1 (0);
-        test1 (5100);
+        test1();
         test2();
         test3();
         test4();
@@ -69,11 +68,9 @@
 
     /* basic TCP connectivity test using IPv6 only and IPv4/IPv6 together */
 
-    static void test1 (int port) throws Exception {
-        server = new ServerSocket (port);
-        if (port == 0) {
-            port = server.getLocalPort();
-        }
+    static void test1 () throws Exception {
+        server = new ServerSocket (0);
+        int port = server.getLocalPort();
         // try Ipv6 only
         c1 = new Socket ("::1", port);
         s1 = server.accept ();
@@ -107,9 +104,7 @@
     /** bind tests:
      *  1. bind to specific address IPv4 only (any port)
      *  2. bind to specific address IPv6 only (any port)
-     *  3. bind to specific address IPv4 only (specific port)
-     *  4. bind to specific address IPv4 only (specific port)
-     *  5. bind to any address IPv4 (test collision)
+     *  3. bind to any address IPv4 (test collision)
      */
 
     static void test2 () throws Exception {
@@ -147,39 +142,6 @@
         server.close ();
         c1.close ();
 
-        /* now try IPv6 specific port only */
-
-        server = new ServerSocket ();
-        sadr = new InetSocketAddress (ia6addr, 5200);
-        server.bind (sadr);
-        port = server.getLocalPort();
-        t_assert (port == 5200);
-
-        c1 = new Socket (ia6addr, port);
-        try {
-            c2 = new Socket (ia4addr, port);
-            throw new RuntimeException ("connect to IPv4 address should be refused");
-        } catch (IOException e) { }
-        server.close ();
-        c1.close ();
-
-        /* now try IPv4 specific port only */
-
-        server = new ServerSocket ();
-        sadr = new InetSocketAddress (ia4addr, 5200);
-        server.bind (sadr);
-        port = server.getLocalPort();
-        t_assert (port == 5200);
-
-        c1 = new Socket (ia4addr, port);
-
-        try {
-            c2 = new Socket (ia6addr, port);
-            throw new RuntimeException ("connect to IPv6 address should be refused");
-        } catch (IOException e) { }
-        server.accept().close();
-        c1.close ();
-        server.close();
         System.out.println ("Test2: OK");
     }
 
@@ -242,3 +204,4 @@
         System.out.println ("Test4: OK");
     }
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/channels/DatagramChannel/StressNativeSignal.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8050499
+ * @summary Attempt to provoke error 316 on OS X in NativeSignal.signal()
+ */
+
+import java.io.*;
+import java.net.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+
+public class StressNativeSignal {
+    private UDPThread udpThread;
+    private ServerSocketThread serverSocketThread;
+
+    StressNativeSignal() {
+        try {
+            serverSocketThread = new ServerSocketThread();
+            serverSocketThread.start();
+
+            udpThread = new UDPThread();
+            udpThread.start();
+        } catch (Exception z) {
+            z.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        StressNativeSignal test = new StressNativeSignal();
+        try {
+            Thread.sleep(3000);
+        } catch (Exception z) {
+            z.printStackTrace(System.err);
+        }
+
+        test.shutdown();
+    }
+
+    public void shutdown() {
+        udpThread.terminate();
+        try {
+            udpThread.join();
+        } catch (Exception z) {
+            z.printStackTrace(System.err);
+        }
+
+        serverSocketThread.terminate();
+        try {
+            serverSocketThread.join();
+        } catch (Exception z) {
+            z.printStackTrace(System.err);
+        }
+    }
+
+    public class ServerSocketThread extends Thread {
+        private volatile boolean shouldTerminate;
+        private ServerSocket socket;
+
+        public void run() {
+            try {
+                socket = new ServerSocket(1122);
+                Socket client = socket.accept();
+                BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
+                shouldTerminate = false;
+                while (!shouldTerminate) {
+                    String msg = reader.readLine();
+                }
+            } catch (Exception z) {
+                if (!shouldTerminate) {
+                    z.printStackTrace(System.err);
+                }
+            }
+        }
+
+        public void terminate() {
+            shouldTerminate = true;
+            try {
+                socket.close();
+            } catch (Exception z) {
+                z.printStackTrace(System.err);
+                // ignore
+            }
+        }
+    }
+
+    public class UDPThread extends Thread {
+        private DatagramChannel channel;
+        private volatile boolean shouldTerminate;
+
+        @Override
+        public void run() {
+            try {
+                channel = DatagramChannel.open();
+                channel.setOption(StandardSocketOptions.SO_RCVBUF, 6553600);
+                channel.bind(new InetSocketAddress(19870));
+            } catch (IOException z) {
+                z.printStackTrace(System.err);
+            }
+
+            ByteBuffer buf = ByteBuffer.allocate(6553600);
+            shouldTerminate = false;
+            while (!shouldTerminate) {
+                try {
+                    buf.rewind();
+                    channel.receive(buf);
+                } catch (IOException z) {
+                    if (!shouldTerminate) {
+                        z.printStackTrace(System.err);
+                    }
+                }
+            }
+        }
+
+        public void terminate() {
+            shouldTerminate = true;
+            try {
+                channel.close();
+            } catch (Exception z) {
+                z.printStackTrace(System.err);
+                // ignore
+            }
+        }
+    }
+
+}
--- a/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  */
 
 import java.io.File;
+import java.io.InputStream;
 import java.io.IOException;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
@@ -49,6 +50,17 @@
     public static void main(String[] args)
         throws InterruptedException, IOException {
 
+        // Use 'which' to verify that 'nc' is available and skip the test
+        // if it is not.
+        Process proc = Runtime.getRuntime().exec("which nc");
+        InputStream stdout = proc.getInputStream();
+        int b = stdout.read();
+        proc.destroy();
+        if (b == -1) {
+            System.err.println("Netcat command unavailable; skipping test.");
+            return;
+        }
+
         // Create a new sub-directory of the nominal test directory in which
         // 'nc' will create the socket file.
         String testSubDir = System.getProperty("test.dir", ".")
@@ -62,7 +74,6 @@
 
         // Create a process which executes the nc (netcat) utility to create
         // a socket file at the indicated location.
-        Process proc;
         FileSystem fs = FileSystems.getDefault();
         try (WatchService ws = fs.newWatchService()) {
             // Watch the test sub-directory to receive notification when an
--- a/test/java/sql/testng/test/sql/StatementTests.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/sql/testng/test/sql/StatementTests.java	Thu Jan 07 15:14:24 2016 -0800
@@ -65,7 +65,7 @@
      * enquoteLiteral is null
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void test01()  throws SQLException {
+    public void test01() throws SQLException {
         stmt.enquoteLiteral(null);
 
     }
@@ -110,7 +110,7 @@
     }
 
     /*
-     * Validate a NullPointerException is thrown is the string passed to
+     * Validate a NullPointerException is thrown if the string passed to
      * isSimpleIdentifier is null
      */
     @Test(expectedExceptions = NullPointerException.class)
@@ -120,6 +120,24 @@
     }
 
     /*
+     * Verify that enquoteLiteral creates a  valid literal and converts every
+     * single quote to two single quotes
+     */
+    @Test(dataProvider = "validEnquotedNCharLiteralValues")
+    public void test07(String s, String expected) throws SQLException {
+        assertEquals(stmt.enquoteNCharLiteral(s), expected);
+    }
+
+    /*
+     * Validate a NullPointerException is thrown if the string passed to
+     * enquoteNCharLiteral is null
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test08() throws SQLException {
+        stmt.enquoteNCharLiteral(null);
+    }
+
+    /*
      * DataProvider used to provide strings that will be used to validate
      * that enquoteLiteral converts a string to a literal and every instance of
      * a single quote will be converted into two single quotes in the literal.
@@ -169,8 +187,7 @@
             {"\"Hel\"lo\"", true},
             {"Hello" + '\0', false},
             {"", false},
-            {maxIdentifier + 'a', false},
-            };
+            {maxIdentifier + 'a', false},};
     }
 
     /*
@@ -194,4 +211,22 @@
             {"", false},};
     }
 
+    /*
+     * DataProvider used to provide strings that will be used to validate
+     * that enquoteNCharLiteral converts a string to a National Character
+     * literal and every instance of
+     * a single quote will be converted into two single quotes in the literal.
+     */
+    @DataProvider(name = "validEnquotedNCharLiteralValues")
+    protected Object[][] validEnquotedNCharLiteralValues() {
+        return new Object[][]{
+            {"Hello", "N'Hello'"},
+            {"G'Day", "N'G''Day'"},
+            {"'G''Day'", "N'''G''''Day'''"},
+            {"I'''M", "N'I''''''M'"},
+            {"N'Hello'", "N'N''Hello'''"},
+            {"The Dark Knight", "N'The Dark Knight'"}
+
+        };
+    }
 }
--- a/test/java/time/tck/java/time/TCKDuration.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/time/tck/java/time/TCKDuration.java	Thu Jan 07 15:14:24 2016 -0800
@@ -2893,6 +2893,9 @@
             {-1, 0, "PT-1S"},
             {-1, 1000, "PT-0.999999S"},
             {-1, 900000000, "PT-0.1S"},
+            {-60, 100_000_000, "PT-59.9S"},
+            {-59, -900_000_000, "PT-59.9S"},
+            {-60, -100_000_000, "PT-1M-0.1S"},
             {Long.MAX_VALUE, 0, "PT" + (Long.MAX_VALUE / 3600) + "H" +
                     ((Long.MAX_VALUE % 3600) / 60) + "M" + (Long.MAX_VALUE % 60) + "S"},
             {Long.MIN_VALUE, 0, "PT" + (Long.MIN_VALUE / 3600) + "H" +
--- a/test/java/util/Locale/LocaleProviders.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/util/Locale/LocaleProviders.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,7 +213,7 @@
     static void bug8013903Test() {
         if (System.getProperty("os.name").startsWith("Windows")) {
             Date sampleDate = new Date(0x10000000000L);
-            String fallbackResult = "Heisei 16.Nov.03 (Wed) AM 11:53:47";
+            String hostResult = "\u5e73\u6210 16.11.03 (Wed) AM 11:53:47";
             String jreResult = "\u5e73\u6210 16.11.03 (\u6c34) \u5348\u524d 11:53:47";
             Locale l = new Locale("ja", "JP", "JP");
             SimpleDateFormat sdf = new SimpleDateFormat("GGGG yyyy.MMM.dd '('E')' a hh:mm:ss", l);
@@ -227,11 +227,10 @@
                         result + "\", expected: \"" + jreResult);
                 }
             } else {
-                // should be FALLBACK, as Windows HOST does not return
-                // display names
-                if (!fallbackResult.equals(result)) {
+                // Windows display names. Subject to change if Windows changes its format.
+                if (!hostResult.equals(result)) {
                     throw new RuntimeException("Format failed. result: \"" +
-                        result + "\", expected: \"" + fallbackResult);
+                        result + "\", expected: \"" + hostResult);
                 }
             }
         }
--- a/test/java/util/Locale/LocaleProviders.sh	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/util/Locale/LocaleProviders.sh	Thu Jan 07 15:14:24 2016 -0800
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
 # 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 @@
 #
 # @test
 # @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
-#      8010666 8013086 8013233 8013903 8015960 8028771 8062006
+#      8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
 # @summary tests for "java.locale.providers" system property
 # @compile -XDignore.symbol.file LocaleProviders.java
 # @run shell/timeout=600 LocaleProviders.sh
--- a/test/java/util/zip/ZipFile/TestZipFile.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/java/util/zip/ZipFile/TestZipFile.java	Thu Jan 07 15:14:24 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8142508
+ * @bug 8142508 8146431
  * @summary Tests various ZipFile apis
  * @run main/manual TestZipFile
  */
@@ -216,6 +216,13 @@
     }
 
     static void doTest0(Zip zip, ZipFile zf) throws Throwable {
+        // (0) check zero-length entry name, no AIOOBE
+        try {
+            check(zf.getEntry("") == null);;
+        } catch (Throwable t) {
+            unexpected(t);
+        }
+
         List<ZipEntry> list = new ArrayList(zip.entries.keySet());
         // (1) check entry list, in expected order
         if (!check(Arrays.equals(
--- a/test/javax/management/ImplementationVersion/ImplVersionCommand.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/javax/management/ImplementationVersion/ImplVersionCommand.java	Thu Jan 07 15:14:24 2016 -0800
@@ -53,21 +53,13 @@
 
         // Check JMX implementation version vs. JVM implementation version
         //
-        if (Boolean.valueOf(args[1]).booleanValue()) {
-            if (!mbsdVersion.equals(args[0]))
-                throw new IllegalArgumentException(
-                  "JMX and Java Runtime implementation versions do not match!");
-            // Test OK!
-            //
-            System.out.println("JMX and Java Runtime implementation " +
-                               "versions match!");
-        } else {
-            // Test OK!
-            //
-            System.out.println("JMX and Java Runtime implementation " +
-                               "versions do not match because the test " +
-                               "is using an unbundled version of JMX!");
-        }
+        if (!mbsdVersion.equals(args[0]))
+            throw new IllegalArgumentException(
+              "JMX and Java Runtime implementation versions do not match!");
+        // Test OK!
+        //
+        System.out.println("JMX and Java Runtime implementation " +
+                           "versions match!");
         System.out.println("Bye! Bye!");
     }
 }
--- a/test/javax/management/ImplementationVersion/ImplVersionTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/javax/management/ImplementationVersion/ImplVersionTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
  * @test
  * @bug 4842196
  * @summary Test that there is no difference between the JMX version and the
- * JDK version when JMX is bundled into the Java platform and the application
- * is run with a security manager and the test codebase has the java permission
- * to read the "java.runtime.version" system property.
+ * JDK version when the application is run with a security manager and the
+ * test codebase has the java permission to read the "java.runtime.version"
+ * system property.
  * @author Luis-Miguel Alventosa
  * @modules java.management
  * @run clean ImplVersionTest ImplVersionCommand
@@ -36,8 +36,6 @@
  */
 
 import java.io.File;
-import java.security.CodeSource;
-import javax.management.MBeanServer;
 
 public class ImplVersionTest {
 
@@ -70,18 +68,13 @@
             System.out.println("testClasses = " + testClasses);
             // Get boot class path
             //
-            boolean checkVersion = true;
-            String bootClassPath = System.getProperty("sun.boot.class.path");
-            if (bootClassPath != null &&
-                bootClassPath.indexOf("jmxri.jar") != -1)
-                checkVersion = false;
             String command =
                 javaHome + File.separator + "bin" + File.separator + "java " +
                 " -classpath " + testClasses +
                 " -Djava.security.manager -Djava.security.policy==" + testSrc +
                 File.separator + "policy -Dtest.classes=" + testClasses +
                 " ImplVersionCommand " +
-                System.getProperty("java.runtime.version") + " " + checkVersion;
+                System.getProperty("java.runtime.version");
             System.out.println("ImplVersionCommand Exec Command = " +command);
             Process proc = Runtime.getRuntime().exec(command);
             new ImplVersionReader(proc, proc.getInputStream()).start();
--- a/test/javax/management/remote/mandatory/version/ImplVersionTest.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/javax/management/remote/mandatory/version/ImplVersionTest.java	Thu Jan 07 15:14:24 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +25,9 @@
  * @test
  * @bug 5046815
  * @summary Test that RMIServer.getVersion() reflects the JDK version when
- * JMX is bundled into the Java platform and the application is run with a
- * security manager and the test codebase has the java permission to read
- * the "java.runtime.version" system property.
+ * the Java platform and the application is run with a security manager and the
+ * test codebase has the java permission to read the "java.runtime.version"
+ * system property.
  * @author Luis-Miguel Alventosa, Joel Feraud
  * @modules java.management
  * @run clean ImplVersionTest ImplVersionCommand
@@ -36,8 +36,6 @@
  */
 
 import java.io.File;
-import java.security.CodeSource;
-import javax.management.MBeanServer;
 
 public class ImplVersionTest {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/internal/misc/VM/GetNanoTimeAdjustment.java	Thu Jan 07 15:14:24 2016 -0800
@@ -0,0 +1,250 @@
+/*
+ * 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.Objects;
+import jdk.internal.misc.VM;
+
+/**
+ * @test
+ * @bug 8068730
+ * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
+ * @modules java.base/jdk.internal.misc
+ * @run main GetNanoTimeAdjustment
+ * @author danielfuchs
+ */
+public class GetNanoTimeAdjustment {
+
+    static final int MILLIS_IN_SECOND = 1000;
+    static final int NANOS_IN_MILLI = 1000_000;
+    static final int NANOS_IN_MICRO = 1000;
+    static final int NANOS_IN_SECOND = 1000_000_000;
+
+    static final boolean verbose = true;
+
+    static final class TestAssertException extends RuntimeException {
+        TestAssertException(String msg) { super(msg); }
+    }
+
+    private static void assertEquals(long expected, long received, String msg) {
+        if (expected != received) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    private static void assertEquals(Object expected, Object received, String msg) {
+        if (!Objects.equals(expected, received)) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    static final long MAX_OFFSET = 0x0100000000L;
+    static final long MIN_OFFSET = -MAX_OFFSET;
+    static enum Answer {
+        YES,   // isOffLimit = YES:   we must get -1
+        NO,    // isOffLimit = NO:    we must not not get -1
+        MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
+    };
+    static long distance(long one, long two) {
+        return one > two ? Math.subtractExact(one, two)
+                : Math.subtractExact(two, one);
+    }
+
+
+    static Answer isOffLimits(long before, long after, long offset) {
+        long relativeDistanceBefore = distance(before, offset);
+        long relativeDistanceAfter  = distance(after, offset);
+        if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
+            return Answer.YES;
+        }
+        if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
+            if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
+                return Answer.MAYBE; // unlucky case where
+            }
+            return Answer.NO;
+        }
+        return Answer.MAYBE;
+    }
+
+    static void testWithOffset(String name, long offset) {
+        System.out.println("Testing with offset: " + name);
+        long beforeMillis = System.currentTimeMillis();
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        long afterMillis = System.currentTimeMillis();
+
+        if (offset >= beforeMillis/MILLIS_IN_SECOND
+                && offset <= afterMillis/MILLIS_IN_SECOND) {
+            if (adjustment == -1) {
+                // it's possible that we have fallen in the unlucky case
+                // where -1 was the genuine result. let's go backward a bit.
+                offset = offset - 10;
+                beforeMillis = System.currentTimeMillis();
+                adjustment = VM.getNanoTimeAdjustment(offset);
+                afterMillis = System.currentTimeMillis();
+                if (adjustment == -1) {
+                    throw new RuntimeException(name + ": VM says " + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+            }
+        }
+
+        Answer isOffLimit = isOffLimits(beforeMillis/MILLIS_IN_SECOND,
+                afterMillis/MILLIS_IN_SECOND, offset);
+        switch (isOffLimit) {
+            case YES:
+                if (adjustment != -1) {
+                    throw new RuntimeException(name
+                        + ": VM should have returned -1 for "
+                        + offset
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND + "]");
+                }
+                System.out.println("Got expected exception value: " + adjustment);
+                break;
+            case NO:
+                if (adjustment == -1) {
+                    throw new RuntimeException(name
+                            + "VM says "  + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+                break;
+            case MAYBE:
+                System.out.println("Adjustment: " + adjustment);
+                System.out.println("Can't assert for -1 with offset "
+                        + offset + "(" + name + ")"
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND
+                        + "]");
+                // not conclusive
+        }
+
+        if (isOffLimit == Answer.NO || adjustment != -1) {
+            System.out.println("Validating adjustment: " + adjustment);
+            long expectedMax = distance(offset, beforeMillis/MILLIS_IN_SECOND)
+                      * NANOS_IN_SECOND
+                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
+                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
+            long absoluteAdjustment = distance(0, adjustment);
+            if (absoluteAdjustment > expectedMax) {
+                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
+                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
+                long expSec = expectedMax / NANOS_IN_SECOND;
+                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long expNan = (expectedMax % NANOS_IN_MICRO);
+                System.err.println("Excessive adjustment: " + adjSec + "s, "
+                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
+                System.err.println("Epected max: " + expSec + "s, "
+                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
+
+                throw new RuntimeException(name
+                    + ": Excessive adjustment: " + adjustment
+                    + " when time in millis is in ["
+                    + beforeMillis + ", " + afterMillis
+                    + "] and offset in seconds is " + offset);
+            }
+        }
+
+    }
+
+    static void regular() {
+        System.out.println("*** Testing regular cases ***");
+        final long start = System.currentTimeMillis();
+        long offset = start/1000;
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        if (start != offset*1000) {
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment == -1) {
+            offset = System.currentTimeMillis()/1000 - 1024;
+            adjustment = VM.getNanoTimeAdjustment(offset);
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment > (start/1000 - offset + 20)*NANOS_IN_SECOND) {
+            throw new RuntimeException("Excessive adjustment: " + adjustment);
+        }
+        testWithOffset("System.currentTimeMillis()/1000",
+                System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - 1024",
+                System.currentTimeMillis()/1000 - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + 1024",
+                System.currentTimeMillis()/1000 + 1024);
+    }
+
+    static void testLimits() {
+        System.out.println("*** Testing limits ***");
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
+                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
+                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
+                System.currentTimeMillis()/1000 - MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
+                System.currentTimeMillis()/1000 + MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
+                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
+                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
+        testWithOffset("0", 0);
+        testWithOffset("-1", -1);
+        testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
+                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
+                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
+        testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
+        testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
+                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
+    }
+
+    public static void main(String[] args) throws Exception {
+        regular();
+        testLimits();
+    }
+
+}
--- a/test/sun/misc/VM/GetNanoTimeAdjustment.java	Thu Jan 07 09:33:58 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * 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.Objects;
-import sun.misc.VM;
-
-/**
- * @test
- * @bug 8068730
- * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
- * @modules java.base/sun.misc
- * @run main GetNanoTimeAdjustment
- * @author danielfuchs
- */
-public class GetNanoTimeAdjustment {
-
-    static final int MILLIS_IN_SECOND = 1000;
-    static final int NANOS_IN_MILLI = 1000_000;
-    static final int NANOS_IN_MICRO = 1000;
-    static final int NANOS_IN_SECOND = 1000_000_000;
-
-    static final boolean verbose = true;
-
-    static final class TestAssertException extends RuntimeException {
-        TestAssertException(String msg) { super(msg); }
-    }
-
-    private static void assertEquals(long expected, long received, String msg) {
-        if (expected != received) {
-            throw new TestAssertException("Unexpected result for " + msg
-                    + ".\n\texpected: " + expected
-                    +  "\n\tactual:   " + received);
-        } else if (verbose) {
-            System.out.println("Got expected " + msg + ": " + received);
-        }
-    }
-
-    private static void assertEquals(Object expected, Object received, String msg) {
-        if (!Objects.equals(expected, received)) {
-            throw new TestAssertException("Unexpected result for " + msg
-                    + ".\n\texpected: " + expected
-                    +  "\n\tactual:   " + received);
-        } else if (verbose) {
-            System.out.println("Got expected " + msg + ": " + received);
-        }
-    }
-
-    static final long MAX_OFFSET = 0x0100000000L;
-    static final long MIN_OFFSET = -MAX_OFFSET;
-    static enum Answer {
-        YES,   // isOffLimit = YES:   we must get -1
-        NO,    // isOffLimit = NO:    we must not not get -1
-        MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
-    };
-    static long distance(long one, long two) {
-        return one > two ? Math.subtractExact(one, two)
-                : Math.subtractExact(two, one);
-    }
-
-
-    static Answer isOffLimits(long before, long after, long offset) {
-        long relativeDistanceBefore = distance(before, offset);
-        long relativeDistanceAfter  = distance(after, offset);
-        if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
-            return Answer.YES;
-        }
-        if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
-            if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
-                return Answer.MAYBE; // unlucky case where
-            }
-            return Answer.NO;
-        }
-        return Answer.MAYBE;
-    }
-
-    static void testWithOffset(String name, long offset) {
-        System.out.println("Testing with offset: " + name);
-        long beforeMillis = System.currentTimeMillis();
-        long adjustment = VM.getNanoTimeAdjustment(offset);
-        long afterMillis = System.currentTimeMillis();
-
-        if (offset >= beforeMillis/MILLIS_IN_SECOND
-                && offset <= afterMillis/MILLIS_IN_SECOND) {
-            if (adjustment == -1) {
-                // it's possible that we have fallen in the unlucky case
-                // where -1 was the genuine result. let's go backward a bit.
-                offset = offset - 10;
-                beforeMillis = System.currentTimeMillis();
-                adjustment = VM.getNanoTimeAdjustment(offset);
-                afterMillis = System.currentTimeMillis();
-                if (adjustment == -1) {
-                    throw new RuntimeException(name + ": VM says " + offset
-                            + " secs is too far off, "
-                            + " when time in seconds is in ["
-                            + beforeMillis/MILLIS_IN_SECOND + ", "
-                            + afterMillis/MILLIS_IN_SECOND
-                            + "]");
-                }
-            }
-        }
-
-        Answer isOffLimit = isOffLimits(beforeMillis/MILLIS_IN_SECOND,
-                afterMillis/MILLIS_IN_SECOND, offset);
-        switch (isOffLimit) {
-            case YES:
-                if (adjustment != -1) {
-                    throw new RuntimeException(name
-                        + ": VM should have returned -1 for "
-                        + offset
-                        + " when time in seconds is in ["
-                        + beforeMillis/MILLIS_IN_SECOND + ", "
-                        + afterMillis/MILLIS_IN_SECOND + "]");
-                }
-                System.out.println("Got expected exception value: " + adjustment);
-                break;
-            case NO:
-                if (adjustment == -1) {
-                    throw new RuntimeException(name
-                            + "VM says "  + offset
-                            + " secs is too far off, "
-                            + " when time in seconds is in ["
-                            + beforeMillis/MILLIS_IN_SECOND + ", "
-                            + afterMillis/MILLIS_IN_SECOND
-                            + "]");
-                }
-                break;
-            case MAYBE:
-                System.out.println("Adjustment: " + adjustment);
-                System.out.println("Can't assert for -1 with offset "
-                        + offset + "(" + name + ")"
-                        + " when time in seconds is in ["
-                        + beforeMillis/MILLIS_IN_SECOND + ", "
-                        + afterMillis/MILLIS_IN_SECOND
-                        + "]");
-                // not conclusive
-        }
-
-        if (isOffLimit == Answer.NO || adjustment != -1) {
-            System.out.println("Validating adjustment: " + adjustment);
-            long expectedMax = distance(offset, beforeMillis/MILLIS_IN_SECOND)
-                      * NANOS_IN_SECOND
-                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
-                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
-            long absoluteAdjustment = distance(0, adjustment);
-            if (absoluteAdjustment > expectedMax) {
-                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
-                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
-                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
-                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
-                long expSec = expectedMax / NANOS_IN_SECOND;
-                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
-                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
-                long expNan = (expectedMax % NANOS_IN_MICRO);
-                System.err.println("Excessive adjustment: " + adjSec + "s, "
-                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
-                System.err.println("Epected max: " + expSec + "s, "
-                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
-
-                throw new RuntimeException(name
-                    + ": Excessive adjustment: " + adjustment
-                    + " when time in millis is in ["
-                    + beforeMillis + ", " + afterMillis
-                    + "] and offset in seconds is " + offset);
-            }
-        }
-
-    }
-
-    static void regular() {
-        System.out.println("*** Testing regular cases ***");
-        final long start = System.currentTimeMillis();
-        long offset = start/1000;
-        long adjustment = VM.getNanoTimeAdjustment(offset);
-        if (start != offset*1000) {
-            if (adjustment == -1) {
-                throw new RuntimeException("VM says " + offset
-                        + " secs is too far off, but time millis is "
-                        + System.currentTimeMillis());
-            }
-        }
-        if (adjustment == -1) {
-            offset = System.currentTimeMillis()/1000 - 1024;
-            adjustment = VM.getNanoTimeAdjustment(offset);
-            if (adjustment == -1) {
-                throw new RuntimeException("VM says " + offset
-                        + " secs is too far off, but time millis is "
-                        + System.currentTimeMillis());
-            }
-        }
-        if (adjustment > (start/1000 - offset + 20)*NANOS_IN_SECOND) {
-            throw new RuntimeException("Excessive adjustment: " + adjustment);
-        }
-        testWithOffset("System.currentTimeMillis()/1000",
-                System.currentTimeMillis()/1000);
-        testWithOffset("System.currentTimeMillis()/1000 - 1024",
-                System.currentTimeMillis()/1000 - 1024);
-        testWithOffset("System.currentTimeMillis()/1000 + 1024",
-                System.currentTimeMillis()/1000 + 1024);
-    }
-
-    static void testLimits() {
-        System.out.println("*** Testing limits ***");
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
-                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
-                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
-                System.currentTimeMillis()/1000 - MAX_OFFSET);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
-                System.currentTimeMillis()/1000 + MAX_OFFSET);
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
-                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
-                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
-        testWithOffset("0", 0);
-        testWithOffset("-1", -1);
-        testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
-                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
-        testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
-                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
-        testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
-        testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
-                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
-    }
-
-    public static void main(String[] args) throws Exception {
-        regular();
-        testLimits();
-    }
-
-}
--- a/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Thu Jan 07 15:14:24 2016 -0800
@@ -78,7 +78,7 @@
                 mode = -1;
             }
 
-            uid = sun.misc.VM.geteuid();
+            uid = jdk.internal.misc.VM.geteuid();
 
             KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
             for (int i=0; i<nu; i++) {
--- a/test/sun/security/krb5/auto/TEST.properties	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/sun/security/krb5/auto/TEST.properties	Thu Jan 07 15:14:24 2016 -0800
@@ -1,4 +1,5 @@
-modules java.base/sun.misc \
+modules java.base/jdk.internal.misc \
+        java.base/sun.misc \
         java.base/sun.net.spi.nameservice \
         java.base/sun.security.util \
         java.security.jgss/sun.security.jgss \
--- a/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Jan 07 09:33:58 2016 -0800
+++ b/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Jan 07 15:14:24 2016 -0800
@@ -107,7 +107,7 @@
         data = new byte[2048];
         // keypair generation is very slow, test only a few short keys
         int[] keyLengths = {512, 512, 1024};
-        BigInteger[] pubExps = {null, BigInteger.valueOf(3), null};
+        BigInteger[] pubExps = {null, RSAKeyGenParameterSpec.F4, null};
         KeyPair[] keyPairs = new KeyPair[3];
         RandomFactory.getRandom().nextBytes(data);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", provider);