changeset 12205:c806975e2e98

Merge
author prr
date Tue, 16 Jun 2015 10:52:39 -0700
parents 6904e8d9fb41 fa85568bd976
children 9be08dde19af 3312b1146555
files src/java.base/share/classes/sun/misc/ExtensionDependency.java src/java.base/share/classes/sun/misc/ExtensionInfo.java src/java.base/share/classes/sun/misc/ExtensionInstallationException.java src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java src/linux/doc/man/ja/native2ascii.1 src/linux/doc/man/native2ascii.1 src/solaris/doc/sun/man/man1/ja/native2ascii.1 src/solaris/doc/sun/man/man1/native2ascii.1 test/javax/net/ssl/DTLS/DTLSUnSupportedCiphersTest.java test/javax/net/ssl/DTLSv10/DTLSv10UnSupportedCiphersTest.java test/javax/net/ssl/TLSCommon/UnSupportedCiphersTest.java test/sun/tools/jmap/heapconfig/LingeredApp.java test/sun/tools/jmap/heapconfig/LingeredAppTest.java
diffstat 104 files changed, 5130 insertions(+), 2745 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Jun 08 11:31:09 2015 -0700
+++ b/.hgtags	Tue Jun 16 10:52:39 2015 -0700
@@ -310,3 +310,4 @@
 ed94f3e7ba6bbfec0772de6d24e39543e13f6d88 jdk9-b65
 4fbcca8ab812198c7fb747ea7b213b6e404f36e9 jdk9-b66
 1abd45df5480a04bff98fba1851d66a5230e67d4 jdk9-b67
+046fd17bb9a0cdf6681124866df9626d17b0516a jdk9-b68
--- a/make/lib/Lib-java.instrument.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-java.instrument.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -61,7 +61,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBINSTRUMENT_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(LIBINSTRUMENT_CFLAGS) $(CFLAGS_WARNINGS_ARE_ERRORS), \
+    CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
     CFLAGS_debug := -DJPLIS_LOGGING, \
     CFLAGS_release := -DNO_JPLIS_LOGGING, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \
--- a/make/lib/Lib-java.management.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-java.management.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -50,7 +50,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBMANAGEMENT_SRC), \
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_CFLAGS), \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.attach.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.attach.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(call FindSrcDirsForLib, jdk.attach, attach), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
+    CFLAGS := $(CFLAGS_JDKLIB) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
         $(LIBJAVA_HEADER_FLAGS) $(LIBATTACH_CFLAGS), \
     CFLAGS_windows := /Gy, \
--- a/make/lib/Lib-jdk.hprof.agent.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.hprof.agent.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 
 BUILD_LIBHPROF_CFLAGS := $(addprefix -I, $(BUILD_LIBHPROF_SRC)) \
     -I$(JDK_TOPDIR)/src/demo/share/jvmti/java_crw_demo
-    
+
 BUILD_LIBHPROF_LDFLAGS :=
 
 LIBHPROF_OPTIMIZATION := HIGHEST
@@ -46,7 +46,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBHPROF_SRC), \
     OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
+    CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBHPROF_CFLAGS), \
     CFLAGS_debug := -DHPROF_LOGGING, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \
@@ -75,7 +75,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVA_CRW_DEMO_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
+    CFLAGS := $(CFLAGS_JDKLIB) \
         $(addprefix -I, $(LIBJAVA_CRW_DEMO_SRC)), \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava_crw_demo/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/make/lib/Lib-jdk.jdi.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.jdi.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBDT_SHMEM_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \
+      CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
           $(LIBDT_SHMEM_CPPFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LDFLAGS_windows := -export:jdwpTransport_OnLoad, \
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBDT_SOCKET_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \
+    CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
         $(LIBDT_SOCKET_CPPFLAGS), \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libdt_socket/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -77,7 +77,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJDWP_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \
+    CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
         $(LIBJDWP_CPPFLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \
--- a/make/lib/Lib-jdk.management.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.management.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -59,7 +59,7 @@
     SRC := $(LIBMANAGEMENT_EXT_SRC), \
     LANG := C, \
     OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_EXT_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_EXT_CFLAGS), \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement_ext/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.sctp.gmk	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/lib/Lib-jdk.sctp.gmk	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,8 @@
 ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
 
   ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
-
-    # Suppress unused parameters required by exported JNI functions.
-    SCTP_WERROR := -Werror -Wno-error=unused-parameter
-    ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
-      SCTP_WERROR :=
-    endif
+    # DISABLED_WARNINGS_gcc := unused-parameter needed to
+    # suppress unused parameters required by exported JNI functions.
 
     $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \
         LIBRARY := sctp, \
@@ -49,7 +45,7 @@
             $(LIBJAVA_HEADER_FLAGS) \
             -I$(SUPPORT_OUTPUTDIR)/headers/jdk.sctp \
             -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
-        CFLAGS_linux := $(SCTP_WERROR), \
+        DISABLED_WARNINGS_gcc := unused-parameter, \
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsctp/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/mapfiles/libjava/mapfile-vers	Mon Jun 08 11:31:09 2015 -0700
+++ b/make/mapfiles/libjava/mapfile-vers	Tue Jun 16 10:52:39 2015 -0700
@@ -129,11 +129,11 @@
 		Java_java_lang_ClassLoader_defineClass0;
 		Java_java_lang_ClassLoader_defineClass1;
 		Java_java_lang_ClassLoader_defineClass2;
+		Java_java_lang_ClassLoader_findBuiltinLib;
 		Java_java_lang_ClassLoader_findLoadedClass0;
 		Java_java_lang_ClassLoader_00024NativeLibrary_find;
 		Java_java_lang_ClassLoader_00024NativeLibrary_load;
 		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
-		Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
 		Java_java_lang_ClassLoader_registerNatives;
 		Java_java_lang_Double_longBitsToDouble;
 		Java_java_lang_Double_doubleToRawLongBits;
--- a/src/java.base/share/classes/java/io/FilePermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/io/FilePermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,11 +27,9 @@
 
 import java.security.*;
 import java.util.Enumeration;
-import java.util.List;
-import java.util.ArrayList;
+import java.util.StringJoiner;
 import java.util.Vector;
-import java.util.Collections;
-import java.util.StringJoiner;
+import java.util.concurrent.ConcurrentHashMap;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -288,7 +286,6 @@
      * @param path the pathname of the file/directory.
      * @param mask the action mask to use.
      */
-
     // package private for use by the FilePermissionCollection add method
     FilePermission(String path, int mask) {
         super(path);
@@ -315,6 +312,7 @@
      *                  <code>null</code> and is implied by this object,
      *                  <code>false</code> otherwise.
      */
+    @Override
     public boolean implies(Permission p) {
         if (!(p instanceof FilePermission))
             return false;
@@ -387,6 +385,7 @@
      *          pathname and actions as this FilePermission object,
      *          <code>false</code> otherwise.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -407,6 +406,7 @@
      *
      * @return a hash code value for this object.
      */
+    @Override
     public int hashCode() {
         return 0;
     }
@@ -587,6 +587,7 @@
      *
      * @return the canonical string representation of the actions.
      */
+    @Override
     public String getActions() {
         if (actions == null)
             actions = getActions(this.mask);
@@ -625,6 +626,7 @@
      * @return a new PermissionCollection object suitable for storing
      * FilePermissions.
      */
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new FilePermissionCollection();
     }
@@ -689,13 +691,13 @@
     implements Serializable
 {
     // Not serialized; see serialization section at end of class
-    private transient List<Permission> perms;
+    private transient ConcurrentHashMap<String, Permission> perms;
 
     /**
      * Create an empty FilePermissionCollection object.
      */
     public FilePermissionCollection() {
-        perms = new ArrayList<>();
+        perms = new ConcurrentHashMap<>();
     }
 
     /**
@@ -710,6 +712,7 @@
      * @exception SecurityException - if this FilePermissionCollection object
      *                                has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof FilePermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -718,9 +721,31 @@
             throw new SecurityException(
                 "attempt to add a Permission to a readonly PermissionCollection");
 
-        synchronized (this) {
-            perms.add(permission);
-        }
+        FilePermission fp = (FilePermission)permission;
+
+        // Add permission to map if it is absent, or replace with new
+        // permission if applicable. NOTE: cannot use lambda for
+        // remappingFunction parameter until JDK-8076596 is fixed.
+        perms.merge(fp.getName(), fp,
+            new java.util.function.BiFunction<>() {
+                @Override
+                public Permission apply(Permission existingVal,
+                                        Permission newVal) {
+                    int oldMask = ((FilePermission)existingVal).getMask();
+                    int newMask = ((FilePermission)newVal).getMask();
+                    if (oldMask != newMask) {
+                        int effective = oldMask | newMask;
+                        if (effective == newMask) {
+                            return newVal;
+                        }
+                        if (effective != oldMask) {
+                            return new FilePermission(fp.getName(), effective);
+                        }
+                    }
+                    return existingVal;
+                }
+            }
+        );
     }
 
     /**
@@ -732,26 +757,25 @@
      * @return true if "permission" is a proper subset of a permission in
      * the set, false if not.
      */
+    @Override
     public boolean implies(Permission permission) {
         if (! (permission instanceof FilePermission))
             return false;
 
-        FilePermission fp = (FilePermission) permission;
+        FilePermission fperm = (FilePermission) permission;
 
-        int desired = fp.getMask();
+        int desired = fperm.getMask();
         int effective = 0;
         int needed = desired;
 
-        synchronized (this) {
-            int len = perms.size();
-            for (int i = 0; i < len; i++) {
-                FilePermission x = (FilePermission) perms.get(i);
-                if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(fp)) {
-                    effective |=  x.getMask();
-                    if ((effective & desired) == desired)
-                        return true;
-                    needed = (desired ^ effective);
+        for (Permission perm : perms.values()) {
+            FilePermission fp = (FilePermission)perm;
+            if (((needed & fp.getMask()) != 0) && fp.impliesIgnoreMask(fperm)) {
+                effective |= fp.getMask();
+                if ((effective & desired) == desired) {
+                    return true;
                 }
+                needed = (desired ^ effective);
             }
         }
         return false;
@@ -763,11 +787,9 @@
      *
      * @return an enumeration of all the FilePermission objects.
      */
+    @Override
     public Enumeration<Permission> elements() {
-        // Convert Iterator into Enumeration
-        synchronized (this) {
-            return Collections.enumeration(perms);
-        }
+        return perms.elements();
     }
 
     private static final long serialVersionUID = 2202956749081564585L;
@@ -795,10 +817,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<Permission> permissions = new Vector<>(perms.size());
-        synchronized (this) {
-            permissions.addAll(perms);
-        }
+        Vector<Permission> permissions = new Vector<>(perms.values());
 
         ObjectOutputStream.PutField pfields = out.putFields();
         pfields.put("permissions", permissions);
@@ -819,7 +838,9 @@
         // Get the one we want
         @SuppressWarnings("unchecked")
         Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
-        perms = new ArrayList<>(permissions.size());
-        perms.addAll(permissions);
+        perms = new ConcurrentHashMap<>(permissions.size());
+        for (Permission perm : permissions) {
+            perms.put(perm.getName(), perm);
+        }
     }
 }
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1702,7 +1702,6 @@
 
         native long find(String name);
         native void unload(String name, boolean isBuiltin);
-        static native String findBuiltinLib(String name);
 
         public NativeLibrary(Class<?> fromClass, String name, boolean isBuiltin) {
             this.name = name;
@@ -1861,9 +1860,11 @@
         throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
     }
 
+    static native String findBuiltinLib(String name);
+
     private static boolean loadLibrary0(Class<?> fromClass, final File file) {
         // Check to see if we're attempting to access a static library
-        String name = NativeLibrary.findBuiltinLib(file.getName());
+        String name = findBuiltinLib(file.getName());
         boolean isBuiltin = (name != null);
         if (!isBuiltin) {
             name = AccessController.doPrivileged(
--- a/src/java.base/share/classes/java/lang/invoke/CallSite.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/CallSite.java	Tue Jun 16 10:52:39 2015 -0700
@@ -27,8 +27,6 @@
 
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
-import java.lang.reflect.Field;
-import sun.misc.Cleaner;
 
 /**
  * A {@code CallSite} is a holder for a variable {@link MethodHandle},
@@ -138,47 +136,9 @@
 
     /**
      * {@code CallSite} dependency context.
-     * VM uses context class to store nmethod dependencies on the call site target.
-     * Can be in 2 states: (a) null; or (b) {@code Cleaner} instance pointing to some Class instance.
-     * Lazily initialized when CallSite instance is linked to some indy call site or VM needs
-     * it to store dependencies. As a corollary, "null" context means there are no dependencies
-     * registered yet. {@code Cleaner} is used in 2 roles:
-     *   (a) context class access for VM;
-     *   (b) stale context class cleanup.
-     * {@code Cleaner} holds the context class until cleanup action is finished (see {@code PhantomReference}).
-     * Though it's impossible to get the context class using {@code Reference.get()}, VM extracts it directly
-     * from {@code Reference.referent} field.
+     * JVM uses CallSite.context to store nmethod dependencies on the call site target.
      */
-    private volatile Cleaner context = null;
-
-    /**
-     * Default context.
-     * VM uses it to initialize non-linked CallSite context.
-     */
-    private static class DefaultContext {}
-    private static final Cleaner DEFAULT_CONTEXT = makeContext(DefaultContext.class, null);
-
-    private static Cleaner makeContext(Class<?> referent, final CallSite holder) {
-        return Cleaner.create(referent,
-                new Runnable() {
-                    @Override public void run() {
-                        MethodHandleNatives.invalidateDependentNMethods(holder);
-                    }
-                });
-    }
-
-    /** Initialize context class used for nmethod dependency tracking */
-    /*package-private*/
-    void initContext(Class<?> newContext) {
-        // If there are concurrent actions, exactly one succeeds.
-        if (context == null) {
-            UNSAFE.compareAndSwapObject(this, CONTEXT_OFFSET, /*expected=*/null, makeContext(newContext, this));
-            // No need to care about failed CAS attempt.
-            // Since initContext is called from indy call site linkage in newContext class, there's no risk
-            // that the context class becomes dead while corresponding context cleaner is alive (causing cleanup
-            // action in the wrong context).
-        }
-    }
+    private final MethodHandleNatives.CallSiteContext context = MethodHandleNatives.CallSiteContext.make(this);
 
     /**
      * Returns the type of this call site's target.
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue Jun 16 10:52:39 2015 -0700
@@ -30,6 +30,7 @@
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+import sun.misc.Cleaner;
 
 /**
  * The JVM interface for the method handles package is all here.
@@ -61,8 +62,27 @@
     static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
     static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
 
-    /** Invalidate CallSite context: clean up dependent nmethods and reset call site context to initial state (null). */
-    static native void invalidateDependentNMethods(CallSite site);
+    /** Represents a context to track nmethod dependencies on CallSite instance target. */
+    static class CallSiteContext implements Runnable {
+        //@Injected JVM_nmethodBucket* vmdependencies;
+
+        static CallSiteContext make(CallSite cs) {
+            final CallSiteContext newContext = new CallSiteContext();
+            // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
+            // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
+            // referenced from Cleaner class) until cleanup is performed.
+            Cleaner.create(cs, newContext);
+            return newContext;
+        }
+
+        @Override
+        public void run() {
+            MethodHandleNatives.clearCallSiteContext(this);
+        }
+    }
+
+    /** Invalidate all recorded nmethods. */
+    private static native void clearCallSiteContext(CallSiteContext context);
 
     private static native void registerNatives();
     static {
@@ -235,7 +255,6 @@
             return Invokers.linkToTargetMethod(type);
         } else {
             appendixResult[0] = callSite;
-            callSite.initContext(caller);
             return Invokers.linkToCallSiteMethod(type);
         }
     }
--- a/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
 
     /**
      * Returns the potentially annotated bounds of this type variable.
+     * Note that if no bound is explicitly declared, the bound is unannotated
+     * {@code Object}.
      *
      * @return the potentially annotated bounds of this type variable
      */
--- a/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,13 +36,18 @@
 
     /**
      * Returns the potentially annotated lower bounds of this wildcard type.
+     * Note that if no lower bound is explicitly declared, the lower bound is the
+     * type of null. In this case, a zero length array is returned.
      *
-     * @return the potentially annotated lower bounds of this wildcard type
+     * @return the potentially annotated lower bounds of this wildcard type or
+     * an empty array if no lower bound is explicitly declared.
      */
     AnnotatedType[] getAnnotatedLowerBounds();
 
     /**
      * Returns the potentially annotated upper bounds of this wildcard type.
+     * Note that if no upper bound is explicitly declared, the upper bound is
+     * unannotated {@code Object}
      *
      * @return the potentially annotated upper bounds of this wildcard type
      */
--- a/src/java.base/share/classes/java/lang/reflect/TypeVariable.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/TypeVariable.java	Tue Jun 16 10:52:39 2015 -0700
@@ -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
@@ -91,11 +91,11 @@
      * Returns an array of AnnotatedType objects that represent the use of
      * types to denote the upper bounds of the type parameter represented by
      * this TypeVariable. The order of the objects in the array corresponds to
-     * the order of the bounds in the declaration of the type parameter.
+     * the order of the bounds in the declaration of the type parameter. Note that
+     * if no upper bound is explicitly declared, the upper bound is unannotated
+     * {@code Object}.
      *
-     * Returns an array of length 0 if the type parameter declares no bounds.
-     *
-     * @return an array of objects representing the upper bounds of the type variable
+     * @return an array of objects representing the upper bound(s) of the type variable
      * @since 1.8
      */
      AnnotatedType[] getAnnotatedBounds();
--- a/src/java.base/share/classes/java/math/BigInteger.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/math/BigInteger.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1963,6 +1963,43 @@
      * int array z.  The contents of x are not changed.
      */
     private static final int[] squareToLen(int[] x, int len, int[] z) {
+         int zlen = len << 1;
+         if (z == null || z.length < zlen)
+             z = new int[zlen];
+
+         // Execute checks before calling intrinsified method.
+         implSquareToLenChecks(x, len, z, zlen);
+         return implSquareToLen(x, len, z, zlen);
+     }
+
+     /**
+      * Parameters validation.
+      */
+     private static void implSquareToLenChecks(int[] x, int len, int[] z, int zlen) throws RuntimeException {
+         if (len < 1) {
+             throw new IllegalArgumentException("invalid input length: " + len);
+         }
+         if (len > x.length) {
+             throw new IllegalArgumentException("input length out of bound: " +
+                                        len + " > " + x.length);
+         }
+         if (len * 2 > z.length) {
+             throw new IllegalArgumentException("input length out of bound: " +
+                                        (len * 2) + " > " + z.length);
+         }
+         if (zlen < 1) {
+             throw new IllegalArgumentException("invalid input length: " + zlen);
+         }
+         if (zlen > z.length) {
+             throw new IllegalArgumentException("input length out of bound: " +
+                                        len + " > " + z.length);
+         }
+     }
+
+     /**
+      * Java Runtime may use intrinsic for this method.
+      */
+     private static final int[] implSquareToLen(int[] x, int len, int[] z, int zlen) {
         /*
          * The algorithm used here is adapted from Colin Plumb's C library.
          * Technique: Consider the partial products in the multiplication
@@ -1997,9 +2034,6 @@
          * again.  The low bit is simply a copy of the low bit of the
          * input, so it doesn't need special care.
          */
-        int zlen = len << 1;
-        if (z == null || z.length < zlen)
-            z = new int[zlen];
 
         // Store the squares, right shifted one bit (i.e., divided by 2)
         int lastProductLowWord = 0;
@@ -2857,6 +2891,32 @@
      * Multiply an array by one word k and add to result, return the carry
      */
     static int mulAdd(int[] out, int[] in, int offset, int len, int k) {
+        implMulAddCheck(out, in, offset, len, k);
+        return implMulAdd(out, in, offset, len, k);
+    }
+
+    /**
+     * Parameters validation.
+     */
+    private static void implMulAddCheck(int[] out, int[] in, int offset, int len, int k) {
+        if (len > in.length) {
+            throw new IllegalArgumentException("input length is out of bound: " + len + " > " + in.length);
+        }
+        if (offset < 0) {
+            throw new IllegalArgumentException("input offset is invalid: " + offset);
+        }
+        if (offset > (out.length - 1)) {
+            throw new IllegalArgumentException("input offset is out of bound: " + offset + " > " + (out.length - 1));
+        }
+        if (len > (out.length - offset)) {
+            throw new IllegalArgumentException("input len is out of bound: " + len + " > " + (out.length - offset));
+        }
+    }
+
+    /**
+     * Java Runtime may use intrinsic for this method.
+     */
+    private static int implMulAdd(int[] out, int[] in, int offset, int len, int k) {
         long kLong = k & LONG_MASK;
         long carry = 0;
 
--- a/src/java.base/share/classes/java/net/SocketPermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/net/SocketPermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,24 +25,24 @@
 
 package java.net;
 
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.StringJoiner;
-import java.util.StringTokenizer;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.Serializable;
 import java.net.InetAddress;
+import java.security.AccessController;
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.PrivilegedAction;
-import java.security.AccessController;
 import java.security.Security;
-import java.io.Serializable;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.StringJoiner;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentSkipListMap;
 import sun.net.util.IPAddressUtil;
 import sun.net.RegisteredDomain;
 import sun.net.PortConfig;
@@ -832,6 +832,7 @@
      * @return true if the specified permission is implied by this object,
      * false if not.
      */
+    @Override
     public boolean implies(Permission p) {
         int i,j;
 
@@ -1010,6 +1011,7 @@
      *  SocketPermission object. However, port range will be ignored
      *  in the comparison if <i>obj</i> only contains the action, 'resolve'.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -1069,7 +1071,7 @@
      *
      * @return a hash code value for this object.
      */
-
+    @Override
     public int hashCode() {
         /*
          * If this SocketPermission was initialized with an IP address
@@ -1137,6 +1139,7 @@
      *
      * @return the canonical string representation of the actions.
      */
+    @Override
     public String getActions()
     {
         if (actions == null)
@@ -1156,7 +1159,7 @@
      *
      * @return a new PermissionCollection object suitable for storing SocketPermissions.
      */
-
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new SocketPermissionCollection();
     }
@@ -1320,15 +1323,16 @@
     implements Serializable
 {
     // Not serialized; see serialization section at end of class
-    private transient List<SocketPermission> perms;
+    // A ConcurrentSkipListMap is used to preserve order, so that most
+    // recently added permissions are checked first (see JDK-4301064).
+    private transient ConcurrentSkipListMap<String, SocketPermission> perms;
 
     /**
      * Create an empty SocketPermissions object.
      *
      */
-
     public SocketPermissionCollection() {
-        perms = new ArrayList<>();
+        perms = new ConcurrentSkipListMap<>(new SPCComparator());
     }
 
     /**
@@ -1343,6 +1347,7 @@
      * @exception SecurityException - if this SocketPermissionCollection object
      *                                has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof SocketPermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -1351,11 +1356,32 @@
             throw new SecurityException(
                 "attempt to add a Permission to a readonly PermissionCollection");
 
-        // optimization to ensure perms most likely to be tested
-        // show up early (4301064)
-        synchronized (this) {
-            perms.add(0, (SocketPermission)permission);
-        }
+        SocketPermission sp = (SocketPermission)permission;
+
+        // Add permission to map if it is absent, or replace with new
+        // permission if applicable. NOTE: cannot use lambda for
+        // remappingFunction parameter until JDK-8076596 is fixed.
+        perms.merge(sp.getName(), sp,
+            new java.util.function.BiFunction<>() {
+                @Override
+                public SocketPermission apply(SocketPermission existingVal,
+                                              SocketPermission newVal) {
+                    int oldMask = existingVal.getMask();
+                    int newMask = newVal.getMask();
+                    if (oldMask != newMask) {
+                        int effective = oldMask | newMask;
+                        if (effective == newMask) {
+                            return newVal;
+                        }
+                        if (effective != oldMask) {
+                            return new SocketPermission(sp.getName(),
+                                                        effective);
+                        }
+                    }
+                    return existingVal;
+                }
+            }
+        );
     }
 
     /**
@@ -1367,7 +1393,7 @@
      * @return true if "permission" is a proper subset of a permission in
      * the collection, false if not.
      */
-
+    @Override
     public boolean implies(Permission permission)
     {
         if (! (permission instanceof SocketPermission))
@@ -1379,18 +1405,15 @@
         int effective = 0;
         int needed = desired;
 
-        synchronized (this) {
-            int len = perms.size();
-            //System.out.println("implies "+np);
-            for (int i = 0; i < len; i++) {
-                SocketPermission x = perms.get(i);
-                //System.out.println("  trying "+x);
-                if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(np)) {
-                    effective |=  x.getMask();
-                    if ((effective & desired) == desired)
-                        return true;
-                    needed = (desired ^ effective);
+        //System.out.println("implies "+np);
+        for (SocketPermission x : perms.values()) {
+            //System.out.println("  trying "+x);
+            if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(np)) {
+                effective |=  x.getMask();
+                if ((effective & desired) == desired) {
+                    return true;
                 }
+                needed = (desired ^ effective);
             }
         }
         return false;
@@ -1402,13 +1425,10 @@
      *
      * @return an enumeration of all the SocketPermission objects.
      */
-
+    @Override
     @SuppressWarnings("unchecked")
     public Enumeration<Permission> elements() {
-        // Convert Iterator into Enumeration
-        synchronized (this) {
-            return Collections.enumeration((List<Permission>)(List)perms);
-        }
+        return (Enumeration)Collections.enumeration(perms.values());
     }
 
     private static final long serialVersionUID = 2787186408602843674L;
@@ -1441,11 +1461,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<SocketPermission> permissions = new Vector<>(perms.size());
-
-        synchronized (this) {
-            permissions.addAll(perms);
-        }
+        Vector<SocketPermission> permissions = new Vector<>(perms.values());
 
         ObjectOutputStream.PutField pfields = out.putFields();
         pfields.put("permissions", permissions);
@@ -1466,7 +1482,22 @@
         // Get the one we want
         @SuppressWarnings("unchecked")
         Vector<SocketPermission> permissions = (Vector<SocketPermission>)gfields.get("permissions", null);
-        perms = new ArrayList<>(permissions.size());
-        perms.addAll(permissions);
+        perms = new ConcurrentSkipListMap<>(new SPCComparator());
+        for (SocketPermission sp : permissions) {
+            perms.put(sp.getName(), sp);
+        }
+    }
+
+    /**
+     * A simple comparator that orders new non-equal entries at the beginning.
+     */
+    private static class SPCComparator implements Comparator<String> {
+        @Override
+        public int compare(String s1, String s2) {
+            if (s1.equals(s2)) {
+                return 0;
+            }
+            return -1;
+        }
     }
 }
--- a/src/java.base/share/classes/java/security/BasicPermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/security/BasicPermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -25,15 +25,13 @@
 
 package java.security;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
 import java.util.Enumeration;
-import java.util.Map;
-import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.Collections;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * The BasicPermission class extends the Permission class, and
@@ -165,6 +163,7 @@
      * @return true if the passed permission is equal to or
      * implied by this permission, false otherwise.
      */
+    @Override
     public boolean implies(Permission p) {
         if ((p == null) || (p.getClass() != getClass()))
             return false;
@@ -200,6 +199,7 @@
      * @return true if {@code obj}'s class is the same as this object's class
      *  and has the same name as this BasicPermission object, false otherwise.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -221,6 +221,7 @@
      *
      * @return a hash code value for this object.
      */
+    @Override
     public int hashCode() {
         return this.getName().hashCode();
     }
@@ -232,6 +233,7 @@
      *
      * @return the empty string "".
      */
+    @Override
     public String getActions() {
         return "";
     }
@@ -248,6 +250,7 @@
      * @return a new PermissionCollection object suitable for
      * storing BasicPermissions.
      */
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new BasicPermissionCollection(this.getClass());
     }
@@ -308,7 +311,7 @@
       * collection must be of the same type.
       * Not serialized; see serialization section at end of class.
       */
-    private transient Map<String, Permission> perms;
+    private transient ConcurrentHashMap<String, Permission> perms;
 
     /**
      * This is set to {@code true} if this BasicPermissionCollection
@@ -320,7 +323,7 @@
 
     /**
      * The class to which all BasicPermissions in this
-     * BasicPermissionCollection belongs.
+     * BasicPermissionCollection belong.
      *
      * @see #serialPersistentFields
      */
@@ -330,9 +333,8 @@
      * Create an empty BasicPermissionCollection object.
      *
      */
-
     public BasicPermissionCollection(Class<?> clazz) {
-        perms = new HashMap<>(11);
+        perms = new ConcurrentHashMap<>(11);
         all_allowed = false;
         permClass = clazz;
     }
@@ -352,6 +354,7 @@
      * @exception SecurityException - if this BasicPermissionCollection object
      *                                has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof BasicPermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -373,13 +376,12 @@
                                                 permission);
         }
 
-        synchronized (this) {
-            perms.put(bp.getCanonicalName(), permission);
-        }
+        String canonName = bp.getCanonicalName();
+        perms.put(canonName, permission);
 
         // No sync on all_allowed; staleness OK
         if (!all_allowed) {
-            if (bp.getCanonicalName().equals("*"))
+            if (canonName.equals("*"))
                 all_allowed = true;
         }
     }
@@ -393,6 +395,7 @@
      * @return true if "permission" is a proper subset of a permission in
      * the set, false if not.
      */
+    @Override
     public boolean implies(Permission permission) {
         if (! (permission instanceof BasicPermission))
             return false;
@@ -414,11 +417,7 @@
         String path = bp.getCanonicalName();
         //System.out.println("check "+path);
 
-        Permission x;
-
-        synchronized (this) {
-            x = perms.get(path);
-        }
+        Permission x = perms.get(path);
 
         if (x != null) {
             // we have a direct hit!
@@ -435,9 +434,7 @@
             path = path.substring(0, last+1) + "*";
             //System.out.println("check "+path);
 
-            synchronized (this) {
-                x = perms.get(path);
-            }
+            x = perms.get(path);
 
             if (x != null) {
                 return x.implies(permission);
@@ -456,11 +453,9 @@
      *
      * @return an enumeration of all the BasicPermission objects.
      */
+    @Override
     public Enumeration<Permission> elements() {
-        // Convert Iterator of Map values into an Enumeration
-        synchronized (this) {
-            return Collections.enumeration(perms.values());
-        }
+        return perms.elements();
     }
 
     // Need to maintain serialization interoperability with earlier releases,
@@ -503,9 +498,7 @@
         Hashtable<String, Permission> permissions =
                 new Hashtable<>(perms.size()*2);
 
-        synchronized (this) {
-            permissions.putAll(perms);
-        }
+        permissions.putAll(perms);
 
         // Write out serializable fields
         ObjectOutputStream.PutField pfields = out.putFields();
@@ -533,7 +526,7 @@
         @SuppressWarnings("unchecked")
         Hashtable<String, Permission> permissions =
                 (Hashtable<String, Permission>)gfields.get("permissions", null);
-        perms = new HashMap<>(permissions.size()*2);
+        perms = new ConcurrentHashMap<>(permissions.size()*2);
         perms.putAll(permissions);
 
         // Get all_allowed
--- a/src/java.base/share/classes/java/security/CodeSource.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/security/CodeSource.java	Tue Jun 16 10:52:39 2015 -0700
@@ -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
@@ -34,6 +34,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.security.cert.*;
+import sun.net.util.URLUtil;
 
 /**
  *
@@ -73,6 +74,15 @@
     private transient CertificateFactory factory = null;
 
     /**
+     * A String form of the URL for use as a key in HashMaps/Sets. The String
+     * form should be behave in the same manner as the URL when compared for
+     * equality in a HashMap/Set, except that no nameservice lookup is done
+     * on the hostname (only string comparison), and the fragment is not
+     * considered.
+     */
+    private transient String locationNoFragString;
+
+    /**
      * Constructs a CodeSource and associates it with the specified
      * location and set of certificates.
      *
@@ -83,6 +93,9 @@
      */
     public CodeSource(URL url, java.security.cert.Certificate certs[]) {
         this.location = url;
+        if (url != null) {
+            this.locationNoFragString = URLUtil.urlNoFragString(url);
+        }
 
         // Copy the supplied certs
         if (certs != null) {
@@ -102,6 +115,9 @@
      */
     public CodeSource(URL url, CodeSigner[] signers) {
         this.location = url;
+        if (url != null) {
+            this.locationNoFragString = URLUtil.urlNoFragString(url);
+        }
 
         // Copy the supplied signers
         if (signers != null) {
@@ -169,6 +185,13 @@
     }
 
     /**
+     * Returns a String form of the URL for use as a key in HashMaps/Sets.
+     */
+    String getLocationNoFragString() {
+        return locationNoFragString;
+    }
+
+    /**
      * Returns the certificates associated with this CodeSource.
      * <p>
      * If this CodeSource object was created using the
@@ -588,6 +611,10 @@
         } catch (IOException ioe) {
             // no signers present
         }
+
+        if (location != null) {
+            locationNoFragString = URLUtil.urlNoFragString(location);
+        }
     }
 
     /*
--- a/src/java.base/share/classes/java/security/Permissions.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/security/Permissions.java	Tue Jun 16 10:52:39 2015 -0700
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.Iterator;
 import java.util.Collections;
+import java.util.concurrent.ConcurrentHashMap;
 import java.io.Serializable;
 import java.io.ObjectStreamField;
 import java.io.ObjectOutputStream;
@@ -85,7 +86,7 @@
      * Key is permissions Class, value is PermissionCollection for that class.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map<Class<?>, PermissionCollection> permsMap;
+    private transient ConcurrentHashMap<Class<?>, PermissionCollection> permsMap;
 
     // optimization. keep track of whether unresolved permissions need to be
     // checked
@@ -99,7 +100,7 @@
      * Creates a new Permissions object containing no PermissionCollections.
      */
     public Permissions() {
-        permsMap = new HashMap<>(11);
+        permsMap = new ConcurrentHashMap<>(11);
         allPermission = null;
     }
 
@@ -120,18 +121,14 @@
      *
      * @see PermissionCollection#isReadOnly()
      */
-
+    @Override
     public void add(Permission permission) {
         if (isReadOnly())
             throw new SecurityException(
               "attempt to add a Permission to a readonly Permissions object");
 
-        PermissionCollection pc;
-
-        synchronized (this) {
-            pc = getPermissionCollection(permission, true);
-            pc.add(permission);
-        }
+        PermissionCollection pc = getPermissionCollection(permission, true);
+        pc.add(permission);
 
         // No sync; staleness -> optimizations delayed, which is OK
         if (permission instanceof AllPermission) {
@@ -169,21 +166,19 @@
      * PermissionCollection it
      * belongs to, false if not.
      */
-
+    @Override
     public boolean implies(Permission permission) {
         // No sync; staleness -> skip optimization, which is OK
         if (allPermission != null) {
             return true; // AllPermission has already been added
         } else {
-            synchronized (this) {
-                PermissionCollection pc = getPermissionCollection(permission,
-                    false);
-                if (pc != null) {
-                    return pc.implies(permission);
-                } else {
-                    // none found
-                    return false;
-                }
+            PermissionCollection pc = getPermissionCollection(permission,
+                false);
+            if (pc != null) {
+                return pc.implies(permission);
+            } else {
+                // none found
+                return false;
             }
         }
     }
@@ -194,14 +189,12 @@
      *
      * @return an enumeration of all the Permissions.
      */
-
+    @Override
     public Enumeration<Permission> elements() {
         // go through each Permissions in the hash table
         // and call their elements() function.
 
-        synchronized (this) {
-            return new PermissionsEnumerator(permsMap.values().iterator());
-        }
+        return new PermissionsEnumerator(permsMap.values().iterator());
     }
 
     /**
@@ -236,34 +229,39 @@
      * It should be set to true when invoked from add().
      */
     private PermissionCollection getPermissionCollection(Permission p,
-        boolean createEmpty) {
+                                                         boolean createEmpty) {
         Class<?> c = p.getClass();
 
-        PermissionCollection pc = permsMap.get(c);
+        if (!hasUnresolved && !createEmpty) {
+            return permsMap.get(c);
+        }
 
-        if (!hasUnresolved && !createEmpty) {
-            return pc;
-        } else if (pc == null) {
+        // Create and add permission collection to map if it is absent.
+        // NOTE: cannot use lambda for mappingFunction parameter until
+        // JDK-8076596 is fixed.
+        return permsMap.computeIfAbsent(c,
+            new java.util.function.Function<>() {
+                @Override
+                public PermissionCollection apply(Class<?> k) {
+                    // Check for unresolved permissions
+                    PermissionCollection pc =
+                        (hasUnresolved ? getUnresolvedPermissions(p) : null);
 
-            // Check for unresolved permissions
-            pc = (hasUnresolved ? getUnresolvedPermissions(p) : null);
+                    // if still null, create a new collection
+                    if (pc == null && createEmpty) {
 
-            // if still null, create a new collection
-            if (pc == null && createEmpty) {
+                        pc = p.newPermissionCollection();
 
-                pc = p.newPermissionCollection();
-
-                // still no PermissionCollection?
-                // We'll give them a PermissionsHash.
-                if (pc == null)
-                    pc = new PermissionsHash();
+                        // still no PermissionCollection?
+                        // We'll give them a PermissionsHash.
+                        if (pc == null) {
+                            pc = new PermissionsHash();
+                        }
+                    }
+                    return pc;
+                }
             }
-
-            if (pc != null) {
-                permsMap.put(c, pc);
-            }
-        }
-        return pc;
+        );
     }
 
     /**
@@ -277,8 +275,6 @@
      */
     private PermissionCollection getUnresolvedPermissions(Permission p)
     {
-        // Called from within synchronized method so permsMap doesn't need lock
-
         UnresolvedPermissionCollection uc =
         (UnresolvedPermissionCollection) permsMap.get(UnresolvedPermission.class);
 
@@ -362,9 +358,7 @@
         // Copy perms into a Hashtable
         Hashtable<Class<?>, PermissionCollection> perms =
             new Hashtable<>(permsMap.size()*2); // no sync; estimate
-        synchronized (this) {
-            perms.putAll(permsMap);
-        }
+        perms.putAll(permsMap);
 
         // Write out serializable fields
         ObjectOutputStream.PutField pfields = out.putFields();
@@ -394,7 +388,7 @@
         @SuppressWarnings("unchecked")
         Hashtable<Class<?>, PermissionCollection> perms =
             (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
-        permsMap = new HashMap<>(perms.size()*2);
+        permsMap = new ConcurrentHashMap<>(perms.size()*2);
         permsMap.putAll(perms);
 
         // Set hasUnresolved
@@ -481,14 +475,13 @@
      * Key and value are (same) permissions objects.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map<Permission, Permission> permsMap;
+    private transient ConcurrentHashMap<Permission, Permission> permsMap;
 
     /**
      * Create an empty PermissionsHash object.
      */
-
     PermissionsHash() {
-        permsMap = new HashMap<>(11);
+        permsMap = new ConcurrentHashMap<>(11);
     }
 
     /**
@@ -496,11 +489,9 @@
      *
      * @param permission the Permission object to add.
      */
-
+    @Override
     public void add(Permission permission) {
-        synchronized (this) {
-            permsMap.put(permission, permission);
-        }
+        permsMap.put(permission, permission);
     }
 
     /**
@@ -512,23 +503,21 @@
      * @return true if "permission" is a proper subset of a permission in
      * the set, false if not.
      */
-
+    @Override
     public boolean implies(Permission permission) {
         // attempt a fast lookup and implies. If that fails
         // then enumerate through all the permissions.
-        synchronized (this) {
-            Permission p = permsMap.get(permission);
+        Permission p = permsMap.get(permission);
 
-            // If permission is found, then p.equals(permission)
-            if (p == null) {
-                for (Permission p_ : permsMap.values()) {
-                    if (p_.implies(permission))
-                        return true;
-                }
-                return false;
-            } else {
-                return true;
+        // If permission is found, then p.equals(permission)
+        if (p == null) {
+            for (Permission p_ : permsMap.values()) {
+                if (p_.implies(permission))
+                    return true;
             }
+            return false;
+        } else {
+            return true;
         }
     }
 
@@ -537,12 +526,9 @@
      *
      * @return an enumeration of all the Permissions.
      */
-
+    @Override
     public Enumeration<Permission> elements() {
-        // Convert Iterator of Map values into an Enumeration
-        synchronized (this) {
-            return Collections.enumeration(permsMap.values());
-        }
+        return permsMap.elements();
     }
 
     private static final long serialVersionUID = -8491988220802933440L;
@@ -570,9 +556,7 @@
         // Copy perms into a Hashtable
         Hashtable<Permission, Permission> perms =
                 new Hashtable<>(permsMap.size()*2);
-        synchronized (this) {
-            perms.putAll(permsMap);
-        }
+        perms.putAll(permsMap);
 
         // Write out serializable fields
         ObjectOutputStream.PutField pfields = out.putFields();
@@ -597,7 +581,7 @@
         @SuppressWarnings("unchecked")
         Hashtable<Permission, Permission> perms =
                 (Hashtable<Permission, Permission>)gfields.get("perms", null);
-        permsMap = new HashMap<>(perms.size()*2);
+        permsMap = new ConcurrentHashMap<>(perms.size()*2);
         permsMap.putAll(perms);
     }
 }
--- a/src/java.base/share/classes/java/security/SecureClassLoader.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/security/SecureClassLoader.java	Tue Jun 16 10:52:39 2015 -0700
@@ -47,10 +47,16 @@
      */
     private final boolean initialized;
 
-    // HashMap that maps CodeSource to ProtectionDomain
-    // @GuardedBy("pdcache")
-    private final HashMap<CodeSource, ProtectionDomain> pdcache =
-                        new HashMap<>(11);
+    /*
+     * HashMap that maps the CodeSource URL (as a String) to ProtectionDomain.
+     * We use a String instead of a CodeSource/URL as the key to avoid
+     * potential expensive name service lookups. This does mean that URLs that
+     * are equivalent after nameservice lookup will be placed in separate
+     * ProtectionDomains; however during policy enforcement these URLs will be
+     * canonicalized and resolved resulting in a consistent set of granted
+     * permissions.
+     */
+    private final HashMap<String, ProtectionDomain> pdcache = new HashMap<>(11);
 
     private static final Debug debug = Debug.getInstance("scl");
 
@@ -196,16 +202,22 @@
      * Returned cached ProtectionDomain for the specified CodeSource.
      */
     private ProtectionDomain getProtectionDomain(CodeSource cs) {
-        if (cs == null)
+        if (cs == null) {
             return null;
+        }
 
         ProtectionDomain pd = null;
         synchronized (pdcache) {
-            pd = pdcache.get(cs);
+            // Use a String form of the URL as the key. It should behave in the
+            // same manner as the URL when compared for equality except that no
+            // nameservice lookup is done on the hostname (String comparison
+            // only), and the fragment is not considered.
+            String key = cs.getLocationNoFragString();
+            pd = pdcache.get(key);
             if (pd == null) {
                 PermissionCollection perms = getPermissions(cs);
                 pd = new ProtectionDomain(cs, perms, this, null);
-                pdcache.put(cs, pd);
+                pdcache.put(key, pd);
                 if (debug != null) {
                     debug.println(" getPermissions "+ pd);
                     debug.println("");
--- a/src/java.base/share/classes/java/security/UnresolvedPermissionCollection.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/security/UnresolvedPermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,13 @@
 
 package java.security;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
 import java.util.*;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * A UnresolvedPermissionCollection stores a collection
@@ -54,14 +56,14 @@
      * of the same type.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map<String, List<UnresolvedPermission>> perms;
+    private transient ConcurrentHashMap<String, List<UnresolvedPermission>> perms;
 
     /**
      * Create an empty UnresolvedPermissionCollection object.
      *
      */
     public UnresolvedPermissionCollection() {
-        perms = new HashMap<>(11);
+        perms = new ConcurrentHashMap<>(11);
     }
 
     /**
@@ -70,25 +72,32 @@
      *
      * @param permission the Permission object to add.
      */
-
-    public void add(Permission permission)
-    {
+    @Override
+    public void add(Permission permission) {
         if (! (permission instanceof UnresolvedPermission))
             throw new IllegalArgumentException("invalid permission: "+
                                                permission);
         UnresolvedPermission up = (UnresolvedPermission) permission;
 
-        List<UnresolvedPermission> v;
-        synchronized (this) {
-            v = perms.get(up.getName());
-            if (v == null) {
-                v = new ArrayList<>();
-                perms.put(up.getName(), v);
+        // Add permission to map. NOTE: cannot use lambda for
+        // remappingFunction parameter until JDK-8076596 is fixed.
+        perms.compute(up.getName(),
+            new java.util.function.BiFunction<>() {
+                @Override
+                public List<UnresolvedPermission> apply(String key,
+                                        List<UnresolvedPermission> oldValue) {
+                    if (oldValue == null) {
+                        List<UnresolvedPermission> v =
+                            new CopyOnWriteArrayList<>();
+                        v.add(up);
+                        return v;
+                    } else {
+                        oldValue.add(up);
+                        return oldValue;
+                    }
+                }
             }
-        }
-        synchronized (v) {
-            v.add(up);
-        }
+        );
     }
 
     /**
@@ -96,17 +105,15 @@
      * and return the List containing them.
      */
     List<UnresolvedPermission> getUnresolvedPermissions(Permission p) {
-        synchronized (this) {
-            return perms.get(p.getClass().getName());
-        }
+        return perms.get(p.getClass().getName());
     }
 
     /**
      * always returns false for unresolved permissions
      *
      */
-    public boolean implies(Permission permission)
-    {
+    @Override
+    public boolean implies(Permission permission) {
         return false;
     }
 
@@ -116,18 +123,14 @@
      *
      * @return an enumeration of all the UnresolvedPermission objects.
      */
-
+    @Override
     public Enumeration<Permission> elements() {
         List<Permission> results =
             new ArrayList<>(); // where results are stored
 
         // Get iterator of Map values (which are lists of permissions)
-        synchronized (this) {
-            for (List<UnresolvedPermission> l : perms.values()) {
-                synchronized (l) {
-                    results.addAll(l);
-                }
-            }
+        for (List<UnresolvedPermission> l : perms.values()) {
+            results.addAll(l);
         }
 
         return Collections.enumeration(results);
@@ -164,19 +167,14 @@
             new Hashtable<>(perms.size()*2);
 
         // Convert each entry (List) into a Vector
-        synchronized (this) {
-            Set<Map.Entry<String, List<UnresolvedPermission>>> set = perms.entrySet();
-            for (Map.Entry<String, List<UnresolvedPermission>> e : set) {
-                // Convert list into Vector
-                List<UnresolvedPermission> list = e.getValue();
-                Vector<UnresolvedPermission> vec = new Vector<>(list.size());
-                synchronized (list) {
-                    vec.addAll(list);
-                }
+        Set<Map.Entry<String, List<UnresolvedPermission>>> set = perms.entrySet();
+        for (Map.Entry<String, List<UnresolvedPermission>> e : set) {
+            // Convert list into Vector
+            List<UnresolvedPermission> list = e.getValue();
+            Vector<UnresolvedPermission> vec = new Vector<>(list);
 
-                // Add to Hashtable being serialized
-                permissions.put(e.getKey(), vec);
-            }
+            // Add to Hashtable being serialized
+            permissions.put(e.getKey(), vec);
         }
 
         // Write out serializable fields
@@ -203,15 +201,14 @@
         Hashtable<String, Vector<UnresolvedPermission>> permissions =
                 (Hashtable<String, Vector<UnresolvedPermission>>)
                 gfields.get("permissions", null);
-        perms = new HashMap<>(permissions.size()*2);
+        perms = new ConcurrentHashMap<>(permissions.size()*2);
 
         // Convert each entry (Vector) into a List
         Set<Map.Entry<String, Vector<UnresolvedPermission>>> set = permissions.entrySet();
         for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) {
             // Convert Vector into ArrayList
             Vector<UnresolvedPermission> vec = e.getValue();
-            List<UnresolvedPermission> list = new ArrayList<>(vec.size());
-            list.addAll(vec);
+            List<UnresolvedPermission> list = new CopyOnWriteArrayList<>(vec);
 
             // Add to Hashtable being serialized
             perms.put(e.getKey(), list);
--- a/src/java.base/share/classes/java/util/DualPivotQuicksort.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/util/DualPivotQuicksort.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,11 +61,6 @@
     private static final int MAX_RUN_COUNT = 67;
 
     /**
-     * The maximum length of run in merge sort.
-     */
-    private static final int MAX_RUN_LENGTH = 33;
-
-    /**
      * If the length of an array to be sorted is less than this
      * constant, Quicksort is used in preference to merge sort.
      */
@@ -121,20 +116,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     int t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -151,7 +150,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
@@ -569,20 +568,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     long t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -599,7 +602,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
@@ -1053,20 +1056,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     short t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -1083,7 +1090,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
@@ -1537,20 +1544,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     char t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -1567,7 +1578,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
@@ -2117,20 +2128,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     float t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -2147,7 +2162,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
@@ -2656,20 +2671,24 @@
 
         // Check if the array is nearly sorted
         for (int k = left; k < right; run[count] = k) {
+            // Equal items in the beginning of the sequence
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;  // Sequence finishes with equal items
             if (a[k] < a[k + 1]) { // ascending
                 while (++k <= right && a[k - 1] <= a[k]);
             } else if (a[k] > a[k + 1]) { // descending
                 while (++k <= right && a[k - 1] >= a[k]);
+                // Transform into an ascending sequence
                 for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
                     double t = a[lo]; a[lo] = a[hi]; a[hi] = t;
                 }
-            } else { // equal
-                for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) {
-                    if (--m == 0) {
-                        sort(a, left, right, true);
-                        return;
-                    }
-                }
+            }
+
+            // Merge a transformed descending sequence followed by an
+            // ascending sequence
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
             }
 
             /*
@@ -2686,7 +2705,7 @@
         // Implementation note: variable "right" is increased by 1.
         if (run[count] == right++) { // The last run contains one element
             run[++count] = right;
-        } else if (count == 1) { // The array is already sorted
+        } else if (count <= 1) { // The array is already sorted
             return;
         }
 
--- a/src/java.base/share/classes/java/util/PropertyPermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/util/PropertyPermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -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
@@ -25,18 +25,15 @@
 
 package java.util;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
 import java.io.Serializable;
-import java.io.IOException;
 import java.security.*;
-import java.util.Map;
-import java.util.HashMap;
 import java.util.Enumeration;
 import java.util.Hashtable;
-import java.util.Collections;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -162,6 +159,16 @@
     }
 
     /**
+     * Creates a PropertyPermission object with the specified name and
+     * a pre-calculated mask. Avoids the overhead of re-computing the mask.
+     * Called by PropertyPermissionCollection.
+     */
+    PropertyPermission(String name, int mask) {
+        super(name, getActions(mask));
+        this.mask = mask;
+    }
+
+    /**
      * Checks if this PropertyPermission object "implies" the specified
      * permission.
      * <P>
@@ -178,6 +185,7 @@
      * @return true if the specified permission is implied by this object,
      * false if not.
      */
+    @Override
     public boolean implies(Permission p) {
         if (!(p instanceof PropertyPermission))
             return false;
@@ -198,6 +206,7 @@
      * @return true if obj is a PropertyPermission, and has the same name and
      * actions as this PropertyPermission object.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -219,6 +228,7 @@
      *
      * @return a hash code value for this object.
      */
+    @Override
     public int hashCode() {
         return this.getName().hashCode();
     }
@@ -345,6 +355,7 @@
      *
      * @return the canonical string representation of the actions.
      */
+    @Override
     public String getActions() {
         if (actions == null)
             actions = getActions(this.mask);
@@ -369,6 +380,7 @@
      * @return a new PermissionCollection object suitable for storing
      * PropertyPermissions.
      */
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new PropertyPermissionCollection();
     }
@@ -425,7 +437,7 @@
      * Key is property name; value is PropertyPermission.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map<String, PropertyPermission> perms;
+    private transient ConcurrentHashMap<String, PropertyPermission> perms;
 
     /**
      * Boolean saying if "*" is in the collection.
@@ -439,7 +451,7 @@
      * Create an empty PropertyPermissionCollection object.
      */
     public PropertyPermissionCollection() {
-        perms = new HashMap<>(32);     // Capacity for default policy
+        perms = new ConcurrentHashMap<>(32);     // Capacity for default policy
         all_allowed = false;
     }
 
@@ -455,6 +467,7 @@
      * @exception SecurityException - if this PropertyPermissionCollection
      *                                object has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof PropertyPermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -466,21 +479,30 @@
         PropertyPermission pp = (PropertyPermission) permission;
         String propName = pp.getName();
 
-        synchronized (this) {
-            PropertyPermission existing = perms.get(propName);
+        // Add permission to map if it is absent, or replace with new
+        // permission if applicable. NOTE: cannot use lambda for
+        // remappingFunction parameter until JDK-8076596 is fixed.
+        perms.merge(propName, pp,
+            new java.util.function.BiFunction<>() {
+                @Override
+                public PropertyPermission apply(PropertyPermission existingVal,
+                                                PropertyPermission newVal) {
 
-            if (existing != null) {
-                int oldMask = existing.getMask();
-                int newMask = pp.getMask();
-                if (oldMask != newMask) {
-                    int effective = oldMask | newMask;
-                    String actions = PropertyPermission.getActions(effective);
-                    perms.put(propName, new PropertyPermission(propName, actions));
+                    int oldMask = existingVal.getMask();
+                    int newMask = newVal.getMask();
+                    if (oldMask != newMask) {
+                        int effective = oldMask | newMask;
+                        if (effective == newMask) {
+                            return newVal;
+                        }
+                        if (effective != oldMask) {
+                            return new PropertyPermission(propName, effective);
+                        }
+                    }
+                    return existingVal;
                 }
-            } else {
-                perms.put(propName, pp);
             }
-        }
+        );
 
         if (!all_allowed) {
             if (propName.equals("*"))
@@ -497,9 +519,10 @@
      * @return true if "permission" is a proper subset of a permission in
      * the set, false if not.
      */
+    @Override
     public boolean implies(Permission permission) {
         if (! (permission instanceof PropertyPermission))
-                return false;
+            return false;
 
         PropertyPermission pp = (PropertyPermission) permission;
         PropertyPermission x;
@@ -509,9 +532,7 @@
 
         // short circuit if the "*" Permission was added
         if (all_allowed) {
-            synchronized (this) {
-                x = perms.get("*");
-            }
+            x = perms.get("*");
             if (x != null) {
                 effective |= x.getMask();
                 if ((effective & desired) == desired)
@@ -526,9 +547,7 @@
         String name = pp.getName();
         //System.out.println("check "+name);
 
-        synchronized (this) {
-            x = perms.get(name);
-        }
+        x = perms.get(name);
 
         if (x != null) {
             // we have a direct hit!
@@ -546,9 +565,7 @@
 
             name = name.substring(0, last+1) + "*";
             //System.out.println("check "+name);
-            synchronized (this) {
-                x = perms.get(name);
-            }
+            x = perms.get(name);
 
             if (x != null) {
                 effective |= x.getMask();
@@ -569,16 +586,14 @@
      *
      * @return an enumeration of all the PropertyPermission objects.
      */
+    @Override
     @SuppressWarnings("unchecked")
     public Enumeration<Permission> elements() {
-        // Convert Iterator of Map values into an Enumeration
-        synchronized (this) {
-            /**
-             * Casting to rawtype since Enumeration<PropertyPermission>
-             * cannot be directly cast to Enumeration<Permission>
-             */
-            return (Enumeration)Collections.enumeration(perms.values());
-        }
+        /**
+         * Casting to rawtype since Enumeration<PropertyPermission>
+         * cannot be directly cast to Enumeration<Permission>
+         */
+        return (Enumeration)perms.elements();
     }
 
     private static final long serialVersionUID = 7015263904581634791L;
@@ -616,9 +631,7 @@
         // Copy perms into a Hashtable
         Hashtable<String, Permission> permissions =
             new Hashtable<>(perms.size()*2);
-        synchronized (this) {
-            permissions.putAll(perms);
-        }
+        permissions.putAll(perms);
 
         // Write out serializable fields
         ObjectOutputStream.PutField pfields = out.putFields();
@@ -646,7 +659,7 @@
         @SuppressWarnings("unchecked")
         Hashtable<String, PropertyPermission> permissions =
             (Hashtable<String, PropertyPermission>)gfields.get("permissions", null);
-        perms = new HashMap<>(permissions.size()*2);
+        perms = new ConcurrentHashMap<>(permissions.size()*2);
         perms.putAll(permissions);
     }
 }
--- a/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java	Tue Jun 16 10:52:39 2015 -0700
@@ -780,7 +780,9 @@
     }
 
     /**
-     * Version of firstOfMode used by Spliterator
+     * Version of firstOfMode used by Spliterator. Callers must
+     * recheck if the returned node's item field is null or
+     * self-linked before using.
      */
     final Node firstDataNode() {
         for (Node p = head; p != null;) {
@@ -953,11 +955,12 @@
                 Object[] a = new Object[n];
                 int i = 0;
                 do {
-                    if ((a[i] = p.item) != null)
+                    Object e = p.item;
+                    if (e != p && (a[i] = e) != null)
                         ++i;
                     if (p == (p = p.next))
                         p = q.firstDataNode();
-                } while (p != null && i < n);
+                } while (p != null && i < n && p.isData);
                 if ((current = p) == null)
                     exhausted = true;
                 if (i > 0) {
@@ -980,11 +983,11 @@
                 exhausted = true;
                 do {
                     Object e = p.item;
+                    if (e != null && e != p)
+                        action.accept((E)e);
                     if (p == (p = p.next))
                         p = q.firstDataNode();
-                    if (e != null)
-                        action.accept((E)e);
-                } while (p != null);
+                } while (p != null && p.isData);
             }
         }
 
@@ -997,10 +1000,11 @@
                 ((p = current) != null || (p = q.firstDataNode()) != null)) {
                 Object e;
                 do {
-                    e = p.item;
+                    if ((e = p.item) == p)
+                        e = null;
                     if (p == (p = p.next))
                         p = q.firstDataNode();
-                } while (e == null && p != null);
+                } while (e == null && p != null && p.isData);
                 if ((current = p) == null)
                     exhausted = true;
                 if (e != null) {
--- a/src/java.base/share/classes/sun/misc/ExtensionDependency.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,554 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import sun.net.www.ParseUtil;
-
-/**
- * This class checks dependent extensions a particular jar file may have
- * declared through its manifest attributes.
- * <p>
- * Jar file declared dependent extensions through the extension-list
- * attribute. The extension-list contains a list of keys used to
- * fetch the other attributes describing the required extension.
- * If key is the extension key declared in the extension-list
- * attribute, the following describing attribute can be found in
- * the manifest:
- * <ul>
- * <li>key-Extension-Name:  (Specification package name)</li>
- * <li>key-Specification-Version: (Specification-Version)</li>
- * <li>key-Implementation-Version: (Implementation-Version)</li>
- * <li>key-Implementation-Vendor-Id: (Imlementation-Vendor-Id)</li>
- * <li>key-Implementation-Version: (Implementation version)</li>
- * <li>key-Implementation-URL: (URL to download the requested extension)</li>
- * </ul>
- * <p>
- * This class also maintain versioning consistency of installed
- * extensions dependencies declared in jar file manifest.
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionDependency {
-
-    /* Callbak interfaces to delegate installation of missing extensions */
-    private static Vector<ExtensionInstallationProvider> providers;
-
-    /**
-     * Register an ExtensionInstallationProvider. The provider is responsible
-     * for handling the installation (upgrade) of any missing extensions.
-     *
-     * @param eip ExtensionInstallationProvider implementation
-     */
-    public synchronized static void addExtensionInstallationProvider
-        (ExtensionInstallationProvider eip)
-    {
-        if (providers == null) {
-            providers = new Vector<>();
-        }
-        providers.add(eip);
-    }
-
-    /**
-     * Unregister a previously installed installation provider
-     */
-    public synchronized static void removeExtensionInstallationProvider
-        (ExtensionInstallationProvider eip)
-    {
-        providers.remove(eip);
-    }
-
-    /**
-     * Checks the dependencies of the jar file on installed extension.
-     *
-     * @param jar containing the attributes declaring the dependencies
-     */
-    public static boolean checkExtensionsDependencies(JarFile jar)
-    {
-        if (providers == null) {
-            // no need to bother, nobody is registered to install missing
-            // extensions
-            return true;
-        }
-
-        try {
-            ExtensionDependency extDep = new ExtensionDependency();
-            return extDep.checkExtensions(jar);
-        } catch (ExtensionInstallationException e) {
-            debug(e.getMessage());
-        }
-        return false;
-    }
-
-    /*
-     * Check for all declared required extensions in the jar file
-     * manifest.
-     */
-    protected boolean checkExtensions(JarFile jar)
-        throws ExtensionInstallationException
-    {
-        Manifest man;
-        try {
-            man = jar.getManifest();
-        } catch (IOException e) {
-            return false;
-        }
-
-        if (man == null) {
-            // The applet does not define a manifest file, so
-            // we just assume all dependencies are satisfied.
-            return true;
-        }
-
-        boolean result = true;
-        Attributes attr = man.getMainAttributes();
-        if (attr != null) {
-            // Let's get the list of declared dependencies
-            String value = attr.getValue(Name.EXTENSION_LIST);
-            if (value != null) {
-                StringTokenizer st = new StringTokenizer(value);
-                // Iterate over all declared dependencies
-                while (st.hasMoreTokens()) {
-                    String extensionName = st.nextToken();
-                    debug("The file " + jar.getName() +
-                          " appears to depend on " + extensionName);
-                    // Sanity Check
-                    String extName = extensionName + "-" +
-                        Name.EXTENSION_NAME.toString();
-                    if (attr.getValue(extName) == null) {
-                        debug("The jar file " + jar.getName() +
-                              " appers to depend on "
-                              + extensionName + " but does not define the " +
-                              extName + " attribute in its manifest ");
-
-                    } else {
-                        if (!checkExtension(extensionName, attr)) {
-                            debug("Failed installing " + extensionName);
-                            result = false;
-                        }
-                    }
-                }
-            } else {
-                debug("No dependencies for " + jar.getName());
-            }
-        }
-        return result;
-    }
-
-
-    /*
-     * Check that a particular dependency on an extension is satisfied.
-     *
-     * @param extensionName is the key used for the attributes in the manifest
-     * @param attr is the attributes of the manifest file
-     *
-     * @return true if the dependency is satisfied by the installed extensions
-     */
-    protected synchronized boolean checkExtension(final String extensionName,
-                                     final Attributes attr)
-        throws ExtensionInstallationException
-    {
-        debug("Checking extension " + extensionName);
-        if (checkExtensionAgainstInstalled(extensionName, attr))
-            return true;
-
-        debug("Extension not currently installed ");
-        ExtensionInfo reqInfo = new ExtensionInfo(extensionName, attr);
-        return installExtension(reqInfo, null);
-    }
-
-    /*
-     * Check if a particular extension is part of the currently installed
-     * extensions.
-     *
-     * @param extensionName is the key for the attributes in the manifest
-     * @param attr is the attributes of the manifest
-     *
-     * @return true if the requested extension is already installed
-     */
-    boolean checkExtensionAgainstInstalled(String extensionName,
-                                           Attributes attr)
-        throws ExtensionInstallationException
-    {
-        File fExtension = checkExtensionExists(extensionName);
-
-        if (fExtension != null) {
-        // Extension already installed, just check against this one
-            try {
-                if (checkExtensionAgainst(extensionName, attr, fExtension))
-                    return true;
-            } catch (FileNotFoundException e) {
-                debugException(e);
-            } catch (IOException e) {
-                debugException(e);
-            }
-            return false;
-
-        } else {
-        // Not sure if extension is already installed, so check all the
-        // installed extension jar files to see if we get a match
-
-            File[] installedExts;
-
-            try {
-            // Get the list of installed extension jar files so we can
-            // compare the installed versus the requested extension
-                installedExts = getInstalledExtensions();
-            } catch(IOException e) {
-                debugException(e);
-                return false;
-            }
-
-            for (int i=0;i<installedExts.length;i++) {
-                try {
-                    if (checkExtensionAgainst(extensionName, attr, installedExts[i]))
-                        return true;
-                } catch (FileNotFoundException e) {
-                    debugException(e);
-                } catch (IOException e) {
-                    debugException(e);
-                    // let's continue with the next installed extension
-                }
-            }
-        }
-        return false;
-    }
-
-    /*
-     * Check if the requested extension described by the attributes
-     * in the manifest under the key extensionName is compatible with
-     * the jar file.
-     *
-     * @param extensionName key in the attribute list
-     * @param attr manifest file attributes
-     * @param file installed extension jar file to compare the requested
-     * extension against.
-     */
-    protected boolean checkExtensionAgainst(String extensionName,
-                                            Attributes attr,
-                                            final File file)
-        throws IOException,
-               FileNotFoundException,
-               ExtensionInstallationException
-    {
-
-        debug("Checking extension " + extensionName +
-              " against " + file.getName());
-
-        // Load the jar file ...
-        Manifest man;
-        try {
-            man = AccessController.doPrivileged(
-                new PrivilegedExceptionAction<Manifest>() {
-                    public Manifest run()
-                            throws IOException, FileNotFoundException {
-                         if (!file.exists())
-                             throw new FileNotFoundException(file.getName());
-                         JarFile jarFile =  new JarFile(file);
-                         return jarFile.getManifest();
-                     }
-                 });
-        } catch(PrivilegedActionException e) {
-            if (e.getException() instanceof FileNotFoundException)
-                throw (FileNotFoundException) e.getException();
-            throw (IOException) e.getException();
-        }
-
-        // Construct the extension information object
-        ExtensionInfo reqInfo = new ExtensionInfo(extensionName, attr);
-        debug("Requested Extension : " + reqInfo);
-
-        int isCompatible = ExtensionInfo.INCOMPATIBLE;
-        ExtensionInfo instInfo = null;
-
-        if (man != null) {
-            Attributes instAttr = man.getMainAttributes();
-            if (instAttr != null) {
-                instInfo = new ExtensionInfo(null, instAttr);
-                debug("Extension Installed " + instInfo);
-                isCompatible = instInfo.isCompatibleWith(reqInfo);
-                switch(isCompatible) {
-                case ExtensionInfo.COMPATIBLE:
-                    debug("Extensions are compatible");
-                    return true;
-
-                case ExtensionInfo.INCOMPATIBLE:
-                    debug("Extensions are incompatible");
-                    return false;
-
-                default:
-                    // everything else
-                    debug("Extensions require an upgrade or vendor switch");
-                    return installExtension(reqInfo, instInfo);
-
-                }
-            }
-        }
-        return false;
-    }
-
-    /*
-     * An required extension is missing, if an ExtensionInstallationProvider is
-     * registered, delegate the installation of that particular extension to it.
-     *
-     * @param reqInfo Missing extension information
-     * @param instInfo Older installed version information
-     *
-     * @return true if the installation is successful
-     */
-    protected boolean installExtension(ExtensionInfo reqInfo,
-                                       ExtensionInfo instInfo)
-        throws ExtensionInstallationException
-    {
-        Vector<ExtensionInstallationProvider> currentProviders;
-        synchronized(providers) {
-            @SuppressWarnings("unchecked")
-            Vector<ExtensionInstallationProvider> tmp =
-                (Vector<ExtensionInstallationProvider>) providers.clone();
-            currentProviders = tmp;
-        }
-        for (Enumeration<ExtensionInstallationProvider> e = currentProviders.elements();
-                e.hasMoreElements();) {
-            ExtensionInstallationProvider eip = e.nextElement();
-
-            if (eip!=null) {
-                // delegate the installation to the provider
-                if (eip.installExtension(reqInfo, instInfo)) {
-                    debug(reqInfo.name + " installation successful");
-                    Launcher.ExtClassLoader cl = (Launcher.ExtClassLoader)
-                        Launcher.getLauncher().getClassLoader().getParent();
-                    addNewExtensionsToClassLoader(cl);
-                    return true;
-                }
-            }
-        }
-        // We have tried all of our providers, noone could install this
-        // extension, we just return failure at this point
-        debug(reqInfo.name + " installation failed");
-        return false;
-    }
-
-    /**
-     * Checks if the extension, that is specified in the extension-list in
-     * the applet jar manifest, is already installed (i.e. exists in the
-     * extension directory).
-     *
-     * @param extensionName extension name in the extension-list
-     *
-     * @return the extension if it exists in the extension directory
-     */
-    private File checkExtensionExists(String extensionName) {
-        // Function added to fix bug 4504166
-        final String extName = extensionName;
-        final String[] fileExt = {".jar", ".zip"};
-
-        return AccessController.doPrivileged(
-            new PrivilegedAction<File>() {
-                public File run() {
-                    try {
-                        File fExtension;
-                        File[] dirs = getExtDirs();
-
-                        // Search the extension directories for the extension that is specified
-                        // in the attribute extension-list in the applet jar manifest
-                        for (int i=0;i<dirs.length;i++) {
-                            for (int j=0;j<fileExt.length;j++) {
-                                if (extName.toLowerCase().endsWith(fileExt[j])) {
-                                    fExtension = new File(dirs[i], extName);
-                                } else {
-                                    fExtension = new File(dirs[i], extName+fileExt[j]);
-                                }
-                                debug("checkExtensionExists:fileName " + fExtension.getName());
-                                if (fExtension.exists()) {
-                                    return fExtension;
-                                }
-                            }
-                        }
-                        return null;
-
-                    } catch(Exception e) {
-                         debugException(e);
-                         return null;
-                    }
-                }
-            });
-    }
-
-    /**
-     * @return the java.ext.dirs property as a list of directory
-     */
-    private static File[] getExtDirs() {
-        String s = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("java.ext.dirs"));
-
-        File[] dirs;
-        if (s != null) {
-            StringTokenizer st =
-                new StringTokenizer(s, File.pathSeparator);
-            int count = st.countTokens();
-            debug("getExtDirs count " + count);
-            dirs = new File[count];
-            for (int i = 0; i < count; i++) {
-                dirs[i] = new File(st.nextToken());
-                debug("getExtDirs dirs["+i+"] "+ dirs[i]);
-            }
-        } else {
-            dirs = new File[0];
-            debug("getExtDirs dirs " + dirs);
-        }
-        debug("getExtDirs dirs.length " + dirs.length);
-        return dirs;
-    }
-
-    /*
-     * Scan the directories and return all files installed in those
-     *
-     * @param dirs list of directories to scan
-     *
-     * @return the list of files installed in all the directories
-     */
-    private static File[] getExtFiles(File[] dirs) throws IOException {
-        Vector<File> urls = new Vector<File>();
-        for (int i = 0; i < dirs.length; i++) {
-            String[] files = dirs[i].list(new JarFilter());
-            if (files != null) {
-                debug("getExtFiles files.length " + files.length);
-                for (int j = 0; j < files.length; j++) {
-                    File f = new File(dirs[i], files[j]);
-                    urls.add(f);
-                    debug("getExtFiles f["+j+"] "+ f);
-                }
-            }
-        }
-        File[] ua = new File[urls.size()];
-        urls.copyInto(ua);
-        debug("getExtFiles ua.length " + ua.length);
-        return ua;
-    }
-
-    /*
-     * @return the list of installed extensions jar files
-     */
-    private File[] getInstalledExtensions() throws IOException {
-        return AccessController.doPrivileged(
-            new PrivilegedAction<File[]>() {
-                public File[] run() {
-                     try {
-                         return getExtFiles(getExtDirs());
-                     } catch(IOException e) {
-                         debug("Cannot get list of installed extensions");
-                         debugException(e);
-                        return new File[0];
-                     }
-                 }
-            });
-    }
-
-    /*
-     * Add the newly installed jar file to the extension class loader.
-     *
-     * @param cl the current installed extension class loader
-     *
-     * @return true if successful
-     */
-    private Boolean addNewExtensionsToClassLoader(Launcher.ExtClassLoader cl) {
-        try {
-            File[] installedExts = getInstalledExtensions();
-            for (int i=0;i<installedExts.length;i++) {
-                final File instFile = installedExts[i];
-                URL instURL = AccessController.doPrivileged(
-                    new PrivilegedAction<URL>() {
-                        public URL run() {
-                            try {
-                                return ParseUtil.fileToEncodedURL(instFile);
-                            } catch (MalformedURLException e) {
-                                debugException(e);
-                                return null;
-                            }
-                        }
-                    });
-                if (instURL != null) {
-                    URL[] urls = cl.getURLs();
-                    boolean found=false;
-                    for (int j = 0; j<urls.length; j++) {
-                        debug("URL["+j+"] is " + urls[j] + " looking for "+
-                                           instURL);
-                        if (urls[j].toString().compareToIgnoreCase(
-                                    instURL.toString())==0) {
-                            found=true;
-                            debug("Found !");
-                        }
-                    }
-                    if (!found) {
-                        debug("Not Found ! adding to the classloader " +
-                              instURL);
-                        cl.addExtURL(instURL);
-                    }
-                }
-            }
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-            // let's continue with the next installed extension
-        }
-        return Boolean.TRUE;
-    }
-
-    // True to display all debug and trace messages
-    static final boolean DEBUG = false;
-
-    private static void debug(String s) {
-        if (DEBUG) {
-            System.err.println(s);
-        }
-    }
-
-    private void debugException(Throwable e) {
-        if (DEBUG) {
-            e.printStackTrace();
-        }
-    }
-
-}
--- a/src/java.base/share/classes/sun/misc/ExtensionInfo.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +0,0 @@
-/*
- * Copyright (c) 1999, 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;
-
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.text.MessageFormat;
-import java.lang.Character.*;
-
-
-/**
- * This class holds all necessary information to install or
- * upgrade a extension on the user's disk
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionInfo {
-
-    /**
-     * public static values returned by the isCompatible method
-     */
-    public static final int COMPATIBLE = 0;
-    public static final int REQUIRE_SPECIFICATION_UPGRADE = 1;
-    public static final int REQUIRE_IMPLEMENTATION_UPGRADE = 2;
-    public static final int REQUIRE_VENDOR_SWITCH = 3;
-    public static final int INCOMPATIBLE = 4;
-
-    /**
-     * attributes fully describer an extension. The underlying described
-     * extension may be installed and requested.
-     */
-    public String title;
-    public String name;
-    public String specVersion;
-    public String specVendor;
-    public String implementationVersion;
-    public String vendor;
-    public String vendorId;
-    public String url;
-
-    // For I18N support
-    private static final ResourceBundle rb =
-        ResourceBundle.getBundle("sun.misc.resources.Messages");
-
-
-    /**
-     * Create a new uninitialized extension information object
-     */
-    public ExtensionInfo() {
-    }
-
-    /**
-     * Create and initialize an extension information object.
-     * The initialization uses the attributes passed as being
-     * the content of a manifest file to load the extension
-     * information from.
-     * Since manifest file may contain information on several
-     * extension they may depend on, the extension key parameter
-     * is prepanded to the attribute name to make the key used
-     * to retrieve the attribute from the manifest file
-     *
-     * @param extensionKey unique extension key in the manifest
-     * @param attr Attributes of a manifest file
-     */
-    public ExtensionInfo(String extensionKey, Attributes attr)
-        throws NullPointerException
-    {
-        String s;
-        if (extensionKey!=null) {
-            s = extensionKey + "-";
-        } else {
-            s ="";
-        }
-
-        String attrKey = s + Name.EXTENSION_NAME.toString();
-        name = attr.getValue(attrKey);
-        if (name != null)
-            name = name.trim();
-
-        attrKey = s + Name.SPECIFICATION_TITLE.toString();
-        title = attr.getValue(attrKey);
-        if (title != null)
-            title = title.trim();
-
-        attrKey = s + Name.SPECIFICATION_VERSION.toString();
-        specVersion = attr.getValue(attrKey);
-        if (specVersion != null)
-            specVersion = specVersion.trim();
-
-        attrKey = s + Name.SPECIFICATION_VENDOR.toString();
-        specVendor = attr.getValue(attrKey);
-        if (specVendor != null)
-            specVendor = specVendor.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VERSION.toString();
-        implementationVersion = attr.getValue(attrKey);
-        if (implementationVersion != null)
-            implementationVersion = implementationVersion.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VENDOR.toString();
-        vendor = attr.getValue(attrKey);
-        if (vendor != null)
-            vendor = vendor.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VENDOR_ID.toString();
-        vendorId = attr.getValue(attrKey);
-        if (vendorId != null)
-            vendorId = vendorId.trim();
-
-        attrKey =s + Name.IMPLEMENTATION_URL.toString();
-        url = attr.getValue(attrKey);
-        if (url != null)
-            url = url.trim();
-    }
-
-    /**
-     * @return true if the extension described by this extension information
-     * is compatible with the extension described by the extension
-     * information passed as a parameter
-     *
-     * @param ei the requested extension information to compare to
-     */
-    public int isCompatibleWith(ExtensionInfo ei) {
-
-        if (name == null || ei.name == null)
-            return INCOMPATIBLE;
-        if (name.compareTo(ei.name)==0) {
-            // is this true, if not spec version is specified, we consider
-            // the value as being "any".
-            if (specVersion == null || ei.specVersion == null)
-                return COMPATIBLE;
-
-            int version = compareExtensionVersion(specVersion, ei.specVersion);
-            if (version<0) {
-                // this extension specification is "older"
-                if (vendorId != null && ei.vendorId !=null) {
-                    if (vendorId.compareTo(ei.vendorId)!=0) {
-                        return REQUIRE_VENDOR_SWITCH;
-                    }
-                }
-                return REQUIRE_SPECIFICATION_UPGRADE;
-            } else {
-                // the extension spec is compatible, let's look at the
-                // implementation attributes
-                if (vendorId != null && ei.vendorId != null) {
-                    // They care who provides the extension
-                    if (vendorId.compareTo(ei.vendorId)!=0) {
-                        // They want to use another vendor implementation
-                        return REQUIRE_VENDOR_SWITCH;
-                    } else {
-                        // Vendor matches, let's see the implementation version
-                        if (implementationVersion != null && ei.implementationVersion != null) {
-                            // they care about the implementation version
-                            version = compareExtensionVersion(implementationVersion, ei.implementationVersion);
-                            if (version<0) {
-                                // This extension is an older implementation
-                                return REQUIRE_IMPLEMENTATION_UPGRADE;
-                            }
-                        }
-                    }
-                }
-                // All othe cases, we consider the extensions to be compatible
-                return COMPATIBLE;
-            }
-        }
-        return INCOMPATIBLE;
-    }
-
-    /**
-     * helper method to print sensible information on the undelying described
-     * extension
-     */
-    public String toString() {
-        return "Extension : title(" + title + "), name(" + name + "), spec vendor(" +
-            specVendor + "), spec version(" + specVersion + "), impl vendor(" +
-            vendor + "), impl vendor id(" + vendorId + "), impl version(" +
-            implementationVersion + "), impl url(" + url + ")";
-    }
-
-    /*
-     * helper method to compare two versions.
-     * version are in the x.y.z.t pattern.
-     *
-     * @param source version to compare to
-     * @param target version used to compare against
-     * @return <pre>{@code
-     *   < 0 if source < version
-     *   > 0 if source > version
-     *   = 0 if source = version}</pre>
-     */
-    private int compareExtensionVersion(String source, String target)
-        throws NumberFormatException
-    {
-        source = source.toLowerCase();
-        target = target.toLowerCase();
-
-        return strictCompareExtensionVersion(source, target);
-    }
-
-
-    /*
-     * helper method to compare two versions.
-     * version are in the x.y.z.t pattern.
-     *
-     * @param source version to compare to
-     * @param target version used to compare against
-     * @return <pre>{@code
-     *   < 0 if source < version
-     *   > 0 if source > version
-     *   = 0 if source = version}</pre>
-     */
-    private int strictCompareExtensionVersion(String source, String target)
-        throws NumberFormatException
-    {
-        if (source.equals(target))
-            return 0;
-
-        StringTokenizer stk = new StringTokenizer(source, ".,");
-        StringTokenizer ttk = new StringTokenizer(target, ".,");
-
-        // Compare number
-        int n = 0, m = 0, result = 0;
-
-        // Convert token into meaning number for comparision
-        if (stk.hasMoreTokens())
-            n = convertToken(stk.nextToken().toString());
-
-        // Convert token into meaning number for comparision
-        if (ttk.hasMoreTokens())
-            m = convertToken(ttk.nextToken().toString());
-
-        if (n > m)
-            return 1;
-        else if (m > n)
-            return -1;
-        else
-        {
-            // Look for index of "." in the string
-            int sIdx = source.indexOf('.');
-            int tIdx = target.indexOf('.');
-
-            if (sIdx == -1)
-                sIdx = source.length() - 1;
-
-            if (tIdx == -1)
-                tIdx = target.length() - 1;
-
-            return strictCompareExtensionVersion(source.substring(sIdx + 1),
-                                                 target.substring(tIdx + 1));
-        }
-    }
-
-    private int convertToken(String token)
-    {
-        if (token == null || token.equals(""))
-            return 0;
-
-        int charValue = 0;
-        int charVersion = 0;
-        int patchVersion = 0;
-        int strLength = token.length();
-        int endIndex = strLength;
-        char lastChar;
-
-        Object[] args = {name};
-        MessageFormat mf = new MessageFormat(rb.getString("optpkg.versionerror"));
-        String versionError = mf.format(args);
-
-        // Look for "-" for pre-release
-        int prIndex = token.indexOf('-');
-
-        // Look for "_" for patch release
-        int patchIndex = token.indexOf('_');
-
-        if (prIndex == -1 && patchIndex == -1)
-        {
-            // This is a FCS release
-            try {
-                return Integer.parseInt(token) * 100;
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-        }
-        else if (patchIndex != -1)
-        {
-            // This is a patch (update) release
-            int prversion;
-            try {
-                // Obtain the version
-                prversion = Integer.parseInt(token.substring(0, patchIndex));
-
-                // Check to see if the patch version is in the n.n.n_nnl format (special release)
-                lastChar = token.charAt(strLength-1);
-                if (Character.isLetter(lastChar)) {
-                    // letters a-z have values from 10-35
-                    charValue = Character.getNumericValue(lastChar);
-                    endIndex = strLength-1;
-
-                    // Obtain the patch version id
-                    patchVersion = Integer.parseInt(token.substring(patchIndex+1, endIndex));
-
-                    if (charValue >= Character.getNumericValue('a') && charValue <= Character.getNumericValue('z')) {
-                        // This is a special release
-                        charVersion = (patchVersion * 100) + charValue;
-                    } else {
-                        // character is not a a-z letter, ignore
-                        charVersion = 0;
-                        System.out.println(versionError);
-                    }
-                } else {
-                    // This is a regular update release. Obtain the patch version id
-                    patchVersion = Integer.parseInt(token.substring(patchIndex+1, endIndex));
-                }
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-            return prversion * 100 + (patchVersion + charVersion);
-        }
-        else
-        {
-            //This is a milestone release, either a early access, alpha, beta, or RC
-
-            // Obtain the version
-            int mrversion;
-            try {
-                mrversion = Integer.parseInt(token.substring(0, prIndex));
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-
-            // Obtain the patch version string, including the milestone + version
-            String prString = token.substring(prIndex + 1);
-
-            // Milestone version
-            String msVersion = "";
-            int delta = 0;
-
-            if (prString.indexOf("ea") != -1)
-            {
-                msVersion = prString.substring(2);
-                delta = 50;
-            }
-            else if (prString.indexOf("alpha") != -1)
-            {
-                msVersion = prString.substring(5);
-                delta = 40;
-            }
-            else if (prString.indexOf("beta") != -1)
-            {
-                msVersion = prString.substring(4);
-                delta = 30;
-            }
-            else if (prString.indexOf("rc") != -1)
-            {
-                msVersion = prString.substring(2);
-                delta = 20;
-            }
-
-            if (msVersion == null || msVersion.equals(""))
-            {
-                // No version after the milestone, assume 0
-                return mrversion * 100 - delta ;
-            }
-            else
-            {
-                // Convert the milestone version
-                try {
-                    return mrversion * 100 - delta + Integer.parseInt(msVersion);
-                } catch (NumberFormatException e) {
-                    System.out.println(versionError);
-                    return 0;
-                }
-            }
-        }
-    }
-}
--- a/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/*
- * Exception when installation of an extension has failed for
- * any reason
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionInstallationException extends Exception {
-
-    static final long serialVersionUID = 3139688306909345924L;
-
-    /*
-     * <p>
-     * Construct a new exception with an exception reason
-     * </p>
-     */
-    public ExtensionInstallationException(String s) {
-        super(s);
-    }
-}
--- a/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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;
-
-/**
- * This interface defines the contract a extension installation capable
- * provided to the extension installation dependency mechanism to
- * install new extensions on the user's disk
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public interface ExtensionInstallationProvider {
-
-    /*
-     * <p>
-     * Request the installation of an extension in the extension directory
-     * </p>
-     *
-     * @param requestExtInfo information on the extension that need to be
-     * installed
-     * @param installedExtInfo information on the current compatible installed
-     * extension. Can be null if no current installation has been found.
-     * @return true if the installation is successful, false if the
-     * installation could not be attempted.
-     * @exception ExtensionInstallationException if an installation was
-     * attempted but did not succeed.
-     */
-    boolean installExtension(ExtensionInfo requestExtInfo,
-                             ExtensionInfo installedExtInfo)
-        throws ExtensionInstallationException;
-}
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -277,8 +277,14 @@
 
         @Override
         public AnnotatedType[] getAnnotatedUpperBounds() {
-            if (!hasUpperBounds())
-                return new AnnotatedType[0];
+            if (!hasUpperBounds()) {
+                return new AnnotatedType[] { buildAnnotatedType(Object.class,
+                                                                LocationInfo.BASE_LOCATION,
+                                                                new TypeAnnotation[0],
+                                                                new TypeAnnotation[0],
+                                                                null)
+                                           };
+            }
             return getAnnotatedBounds(getWildcardType().getUpperBounds());
         }
 
--- a/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Tue Jun 16 10:52:39 2015 -0700
@@ -28,6 +28,7 @@
 import java.security.AlgorithmConstraints;
 import java.security.CryptoPrimitive;
 import java.security.PrivateKey;
+import java.security.Security;
 
 import java.util.Set;
 import java.util.HashSet;
@@ -415,10 +416,12 @@
                     "SHA1withRSA",          --p);
             supports(HashAlgorithm.SHA1,        SignatureAlgorithm.ECDSA,
                     "SHA1withECDSA",        --p);
+            if (Security.getProvider("SunMSCAPI") == null) {
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
                     "SHA224withRSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
                     "SHA224withECDSA",      --p);
+            }
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.RSA,
                     "SHA256withRSA",        --p);
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.ECDSA,
--- a/src/java.base/share/native/libjava/ClassLoader.c	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/share/native/libjava/ClassLoader.c	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -479,12 +479,12 @@
     return res;
 }
 /*
- * Class:     java_lang_ClassLoader_NativeLibrary
+ * Class:     java_lang_ClassLoader
  * Method:    findBuiltinLib
  * Signature: (Ljava/lang/String;)Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL
-Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib
+Java_java_lang_ClassLoader_findBuiltinLib
   (JNIEnv *env, jclass cls, jstring name)
 {
     const char *cname;
@@ -500,8 +500,6 @@
         JNU_ThrowInternalError(env, "NULL filename for native library");
         return NULL;
     }
-    // Can't call initIDs because it will recurse into NativeLibrary via
-    // FindClass to check context so set prochandle here as well.
     procHandle = getProcessHandle();
     cname = JNU_GetStringPlatformChars(env, name, 0);
     if (cname == NULL) {
--- a/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,12 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <sys/statvfs.h>
+#endif
 #include <string.h>
 #include <stdlib.h>
 #include <dlfcn.h>
@@ -46,8 +51,10 @@
 #define dirent64 dirent
 #define readdir64_r readdir_r
 #define stat64 stat
+#ifndef MACOSX
 #define statvfs64 statvfs
 #endif
+#endif
 
 /* -- Field IDs -- */
 
@@ -432,8 +439,32 @@
     jlong rv = 0L;
 
     WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
+#ifdef MACOSX
+        struct statfs fsstat;
+#else
         struct statvfs64 fsstat;
+#endif
         memset(&fsstat, 0, sizeof(fsstat));
+#ifdef MACOSX
+        if (statfs(path, &fsstat) == 0) {
+            switch(t) {
+                case java_io_FileSystem_SPACE_TOTAL:
+                    rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+                                   long_to_jlong(fsstat.f_blocks));
+                    break;
+                case java_io_FileSystem_SPACE_FREE:
+                    rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+                                   long_to_jlong(fsstat.f_bfree));
+                    break;
+                case java_io_FileSystem_SPACE_USABLE:
+                    rv = jlong_mul(long_to_jlong(fsstat.f_bsize),
+                                   long_to_jlong(fsstat.f_bavail));
+                    break;
+                default:
+                    assert(0);
+            }
+        }
+#else
         if (statvfs64(path, &fsstat) == 0) {
             switch(t) {
             case java_io_FileSystem_SPACE_TOTAL:
@@ -452,6 +483,7 @@
                 assert(0);
             }
         }
+#endif
     } END_PLATFORM_STRING(env, path);
     return rv;
 }
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Tue Jun 16 10:52:39 2015 -0700
@@ -35,7 +35,12 @@
 #include <dlfcn.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef MACOSX
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
 #include <sys/statvfs.h>
+#endif
 #include <sys/time.h>
 
 #ifdef __solaris__
@@ -50,7 +55,9 @@
 #include <string.h>
 
 #define stat64 stat
+#ifndef MACOSX
 #define statvfs64 statvfs
+#endif
 
 #define open64 open
 #define fstat64 fstat
@@ -901,11 +908,18 @@
     jlong pathAddress, jobject attrs)
 {
     int err;
+#ifdef MACOSX
+    struct statfs buf;
+#else
     struct statvfs64 buf;
+#endif
     const char* path = (const char*)jlong_to_ptr(pathAddress);
 
-
+#ifdef MACOSX
+    RESTARTABLE(statfs(path, &buf), err);
+#else
     RESTARTABLE(statvfs64(path, &buf), err);
+#endif
     if (err == -1) {
         throwUnixException(env, errno);
     } else {
@@ -921,7 +935,11 @@
             buf.f_bavail = 0;
         }
 #endif
+#ifdef MACOSX
+        (*env)->SetLongField(env, attrs, attrs_f_frsize, long_to_jlong(buf.f_bsize));
+#else
         (*env)->SetLongField(env, attrs, attrs_f_frsize, long_to_jlong(buf.f_frsize));
+#endif
         (*env)->SetLongField(env, attrs, attrs_f_blocks, long_to_jlong(buf.f_blocks));
         (*env)->SetLongField(env, attrs, attrs_f_bfree,  long_to_jlong(buf.f_bfree));
         (*env)->SetLongField(env, attrs, attrs_f_bavail, long_to_jlong(buf.f_bavail));
--- a/src/java.logging/share/classes/java/util/logging/LogManager.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.logging/share/classes/java/util/logging/LogManager.java	Tue Jun 16 10:52:39 2015 -0700
@@ -540,9 +540,10 @@
         return result;
     }
 
-    Logger demandSystemLogger(String name, String resourceBundleName) {
+    Logger demandSystemLogger(String name, String resourceBundleName, Class<?> caller) {
         // Add a system logger in the system context's namespace
-        final Logger sysLogger = getSystemContext().demandLogger(name, resourceBundleName);
+        final Logger sysLogger = getSystemContext()
+                .demandLogger(name, resourceBundleName, caller);
 
         // Add the system logger to the LogManager's namespace if not exist
         // so that there is only one single logger of the given name.
@@ -627,11 +628,11 @@
             return global;
         }
 
-        Logger demandLogger(String name, String resourceBundleName) {
+        Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
             // a LogManager subclass may have its own implementation to add and
             // get a Logger.  So delegate to the LogManager to do the work.
             final LogManager owner = getOwner();
-            return owner.demandLogger(name, resourceBundleName, null);
+            return owner.demandLogger(name, resourceBundleName, caller);
         }
 
 
@@ -869,7 +870,7 @@
                     owner.getProperty(pname + ".handlers") != null) {
                     // This pname has a level/handlers definition.
                     // Make sure it exists.
-                    demandLogger(pname, null);
+                    demandLogger(pname, null, null);
                 }
                 ix = ix2+1;
             }
@@ -912,11 +913,11 @@
         // one single logger of the given name.  System loggers are visible
         // to applications unless a logger of the same name has been added.
         @Override
-        Logger demandLogger(String name, String resourceBundleName) {
+        Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
             Logger result = findLogger(name);
             if (result == null) {
                 // only allocate the new system logger once
-                Logger newLogger = new Logger(name, resourceBundleName, null, getOwner(), true);
+                Logger newLogger = new Logger(name, resourceBundleName, caller, getOwner(), true);
                 do {
                     if (addLocalLogger(newLogger)) {
                         // We successfully added the new Logger that we
--- a/src/java.logging/share/classes/java/util/logging/Logger.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.logging/share/classes/java/util/logging/Logger.java	Tue Jun 16 10:52:39 2015 -0700
@@ -450,7 +450,7 @@
         SecurityManager sm = System.getSecurityManager();
         if (sm != null && !SystemLoggerHelper.disableCallerCheck) {
             if (caller.getClassLoader() == null) {
-                return manager.demandSystemLogger(name, resourceBundleName);
+                return manager.demandSystemLogger(name, resourceBundleName, caller);
             }
         }
         return manager.demandLogger(name, resourceBundleName, caller);
@@ -500,7 +500,23 @@
         // would throw an IllegalArgumentException in the second call
         // because the wrapper would result in an attempt to replace
         // the existing "resourceBundleForFoo" with null.
-        return demandLogger(name, null, Reflection.getCallerClass());
+        return Logger.getLogger(name, Reflection.getCallerClass());
+    }
+
+    /**
+     * Find or create a logger for a named subsystem on behalf
+     * of the given caller.
+     *
+     * This method is called by {@link #getLogger(java.lang.String)} after
+     * it has obtained a reference to its caller's class.
+     *
+     * @param   name            A name for the logger.
+     * @param   callerClass     The class that called {@link
+     *                          #getLogger(java.lang.String)}.
+     * @return a suitable Logger for {@code callerClass}.
+     */
+    private static Logger getLogger(String name, Class<?> callerClass) {
+        return demandLogger(name, null, callerClass);
     }
 
     /**
@@ -550,7 +566,30 @@
     // adding a new Logger object is handled by LogManager.addLogger().
     @CallerSensitive
     public static Logger getLogger(String name, String resourceBundleName) {
-        Class<?> callerClass = Reflection.getCallerClass();
+        return Logger.getLogger(name, resourceBundleName, Reflection.getCallerClass());
+    }
+
+    /**
+     * Find or create a logger for a named subsystem on behalf
+     * of the given caller.
+     *
+     * This method is called by {@link
+     * #getLogger(java.lang.String, java.lang.String)} after
+     * it has obtained a reference to its caller's class.
+     *
+     * @param   name            A name for the logger.
+     * @param   resourceBundleName  name of ResourceBundle to be used for localizing
+     *                          messages for this logger. May be {@code null}
+     *                          if none of the messages require localization.
+     * @param   callerClass     The class that called {@link
+     *                          #getLogger(java.lang.String, java.lang.String)}.
+     *                          This class will also be used for locating the
+     *                          resource bundle if {@code resourceBundleName} is
+     *                          not {@code null}.
+     * @return a suitable Logger for {@code callerClass}.
+     */
+    private static Logger getLogger(String name, String resourceBundleName,
+                                    Class<?> callerClass) {
         Logger result = demandLogger(name, resourceBundleName, callerClass);
 
         // MissingResourceException or IllegalArgumentException can be
@@ -573,8 +612,9 @@
         LogManager manager = LogManager.getLogManager();
 
         // all loggers in the system context will default to
-        // the system logger's resource bundle
-        Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME);
+        // the system logger's resource bundle - therefore the caller won't
+        // be needed and can be null.
+        Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME, null);
         return result;
     }
 
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/DelegationPermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/DelegationPermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,15 @@
 
 package javax.security.auth.kerberos;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
 import java.util.*;
-import java.security.Permission;
-import java.security.BasicPermission;
-import java.security.PermissionCollection;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * This class is used to restrict the usage of the Kerberos
@@ -137,6 +138,7 @@
      * @return true if the specified permission is implied by this object,
      * false if not.
      */
+    @Override
     public boolean implies(Permission p) {
         if (!(p instanceof DelegationPermission))
             return false;
@@ -159,6 +161,7 @@
      *  has the same subordinate and service principal as this.
      *  DelegationPermission object.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -175,11 +178,11 @@
      *
      * @return a hash code value for this object.
      */
+    @Override
     public int hashCode() {
         return getName().hashCode();
     }
 
-
     /**
      * Returns a PermissionCollection object for storing
      * DelegationPermission objects.
@@ -192,7 +195,7 @@
      * @return a new PermissionCollection object suitable for storing
      * DelegationPermissions.
      */
-
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new KrbDelegationPermissionCollection();
     }
@@ -263,13 +266,12 @@
     implements java.io.Serializable {
 
     // Not serialized; see serialization section at end of class.
-    private transient List<Permission> perms;
+    private transient ConcurrentHashMap<Permission, Boolean> perms;
 
     public KrbDelegationPermissionCollection() {
-        perms = new ArrayList<Permission>();
+        perms = new ConcurrentHashMap<>();
     }
 
-
     /**
      * Check and see if this collection of permissions implies the permissions
      * expressed in "permission".
@@ -279,18 +281,13 @@
      * @return true if "permission" is a proper subset of a permission in
      * the collection, false if not.
      */
+    @Override
     public boolean implies(Permission permission) {
         if (! (permission instanceof DelegationPermission))
-                return false;
+            return false;
 
-        synchronized (this) {
-            for (Permission x : perms) {
-                if (x.implies(permission))
-                    return true;
-            }
-        }
-        return false;
-
+        // if map contains key, then it automatically implies it
+        return perms.containsKey(permission);
     }
 
     /**
@@ -305,6 +302,7 @@
      * @exception SecurityException - if this PermissionCollection object
      *                                has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof DelegationPermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -312,9 +310,7 @@
         if (isReadOnly())
             throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
 
-        synchronized (this) {
-            perms.add(0, permission);
-        }
+        perms.put(permission, Boolean.TRUE);
     }
 
     /**
@@ -323,11 +319,9 @@
      *
      * @return an enumeration of all the DelegationPermission objects.
      */
+    @Override
     public Enumeration<Permission> elements() {
-        // Convert Iterator into Enumeration
-        synchronized (this) {
-            return Collections.enumeration(perms);
-        }
+        return perms.keys();
     }
 
     private static final long serialVersionUID = -3383936936589966948L;
@@ -354,11 +348,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<Permission> permissions = new Vector<>(perms.size());
-
-        synchronized (this) {
-            permissions.addAll(perms);
-        }
+        Vector<Permission> permissions = new Vector<>(perms.keySet());
 
         ObjectOutputStream.PutField pfields = out.putFields();
         pfields.put("permissions", permissions);
@@ -379,8 +369,10 @@
 
         // Get the one we want
         Vector<Permission> permissions =
-                (Vector<Permission>)gfields.get("permissions", null);
-        perms = new ArrayList<Permission>(permissions.size());
-        perms.addAll(permissions);
+            (Vector<Permission>)gfields.get("permissions", null);
+        perms = new ConcurrentHashMap<>(permissions.size());
+        for (Permission perm : permissions) {
+            perms.put(perm, Boolean.TRUE);
+        }
     }
 }
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java	Tue Jun 16 10:52:39 2015 -0700
@@ -25,13 +25,14 @@
 
 package javax.security.auth.kerberos;
 
-import java.util.*;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
 import java.security.Permission;
 import java.security.PermissionCollection;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * This class is used to protect Kerberos services and the
@@ -149,6 +150,15 @@
         init(servicePrincipal, getMask(action));
     }
 
+    /**
+     * Creates a ServicePermission object with the specified servicePrincipal
+     * and a pre-calculated mask. Avoids the overhead of re-computing the mask.
+     * Called by ServicePermissionCollection.
+     */
+    ServicePermission(String servicePrincipal, int mask) {
+        super(servicePrincipal);
+        init(servicePrincipal, mask);
+    }
 
     /**
      * Initialize the ServicePermission object.
@@ -175,6 +185,7 @@
      * @return true if the specified permission is implied by this object,
      * false if not.
      */
+    @Override
     public boolean implies(Permission p) {
         if (!(p instanceof ServicePermission))
             return false;
@@ -200,6 +211,7 @@
      *  same service principal, and actions as this
      * ServicePermission object.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this)
             return true;
@@ -219,7 +231,7 @@
      *
      * @return a hash code value for this object.
      */
-
+    @Override
     public int hashCode() {
         return (getName().hashCode() ^ mask);
     }
@@ -234,7 +246,7 @@
      * @param mask a specific integer action mask to translate into a string
      * @return the canonical string representation of the actions
      */
-    private static String getActions(int mask)
+    static String getActions(int mask)
     {
         StringBuilder sb = new StringBuilder();
         boolean comma = false;
@@ -259,6 +271,7 @@
      * Always returns present actions in the following order:
      * initiate, accept.
      */
+    @Override
     public String getActions() {
         if (actions == null)
             actions = getActions(this.mask);
@@ -279,6 +292,7 @@
      * @return a new PermissionCollection object suitable for storing
      * ServicePermissions.
      */
+    @Override
     public PermissionCollection newPermissionCollection() {
         return new KrbServicePermissionCollection();
     }
@@ -453,11 +467,12 @@
 final class KrbServicePermissionCollection extends PermissionCollection
     implements java.io.Serializable {
 
+    // Key is the service principal, value is the ServicePermission.
     // Not serialized; see serialization section at end of class
-    private transient List<Permission> perms;
+    private transient ConcurrentHashMap<String, Permission> perms;
 
     public KrbServicePermissionCollection() {
-        perms = new ArrayList<Permission>();
+        perms = new ConcurrentHashMap<>();
     }
 
     /**
@@ -469,32 +484,28 @@
      * @return true if "permission" is a proper subset of a permission in
      * the collection, false if not.
      */
+    @Override
     public boolean implies(Permission permission) {
         if (! (permission instanceof ServicePermission))
-                return false;
+            return false;
 
         ServicePermission np = (ServicePermission) permission;
         int desired = np.getMask();
-        int effective = 0;
-        int needed = desired;
 
-        synchronized (this) {
-            int len = perms.size();
+        // first, check for wildcard principal
+        ServicePermission x = (ServicePermission)perms.get("*");
+        if (x != null) {
+            if ((x.getMask() & desired) == desired) {
+                return true;
+            }
+        }
 
-            // need to deal with the case where the needed permission has
-            // more than one action and the collection has individual permissions
-            // that sum up to the needed.
-
-            for (int i = 0; i < len; i++) {
-                ServicePermission x = (ServicePermission) perms.get(i);
-
-                //System.out.println("  trying "+x);
-                if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(np)) {
-                    effective |=  x.getMask();
-                    if ((effective & desired) == desired)
-                        return true;
-                    needed = (desired ^ effective);
-                }
+        // otherwise, check for match on principal
+        x = (ServicePermission)perms.get(np.getName());
+        if (x != null) {
+            //System.out.println("  trying "+x);
+            if ((x.getMask() & desired) == desired) {
+                return true;
             }
         }
         return false;
@@ -512,6 +523,7 @@
      * @exception SecurityException - if this PermissionCollection object
      *                                has been marked readonly
      */
+    @Override
     public void add(Permission permission) {
         if (! (permission instanceof ServicePermission))
             throw new IllegalArgumentException("invalid permission: "+
@@ -519,9 +531,32 @@
         if (isReadOnly())
             throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
 
-        synchronized (this) {
-            perms.add(0, permission);
-        }
+        ServicePermission sp = (ServicePermission)permission;
+        String princName = sp.getName();
+
+        // Add permission to map if it is absent, or replace with new
+        // permission if applicable. NOTE: cannot use lambda for
+        // remappingFunction parameter until JDK-8076596 is fixed.
+        perms.merge(princName, sp,
+            new java.util.function.BiFunction<>() {
+                @Override
+                public Permission apply(Permission existingVal,
+                                        Permission newVal) {
+                    int oldMask = ((ServicePermission)existingVal).getMask();
+                    int newMask = ((ServicePermission)newVal).getMask();
+                    if (oldMask != newMask) {
+                        int effective = oldMask | newMask;
+                        if (effective == newMask) {
+                            return newVal;
+                        }
+                        if (effective != oldMask) {
+                            return new ServicePermission(princName, effective);
+                        }
+                    }
+                    return existingVal;
+                }
+            }
+        );
     }
 
     /**
@@ -530,12 +565,9 @@
      *
      * @return an enumeration of all the ServicePermission objects.
      */
-
+    @Override
     public Enumeration<Permission> elements() {
-        // Convert Iterator into Enumeration
-        synchronized (this) {
-            return Collections.enumeration(perms);
-        }
+        return perms.elements();
     }
 
     private static final long serialVersionUID = -4118834211490102011L;
@@ -563,11 +595,7 @@
         // Don't call out.defaultWriteObject()
 
         // Write out Vector
-        Vector<Permission> permissions = new Vector<>(perms.size());
-
-        synchronized (this) {
-            permissions.addAll(perms);
-        }
+        Vector<Permission> permissions = new Vector<>(perms.values());
 
         ObjectOutputStream.PutField pfields = out.putFields();
         pfields.put("permissions", permissions);
@@ -589,7 +617,9 @@
         // Get the one we want
         Vector<Permission> permissions =
                 (Vector<Permission>)gfields.get("permissions", null);
-        perms = new ArrayList<Permission>(permissions.size());
-        perms.addAll(permissions);
+        perms = new ConcurrentHashMap<>(permissions.size());
+        for (Permission perm : permissions) {
+            perms.put(perm.getName(), perm);
+        }
     }
 }
--- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/XalanXPathAPI.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/XalanXPathAPI.java	Tue Jun 16 10:52:39 2015 -0700
@@ -167,6 +167,13 @@
 
     private synchronized static void fixupFunctionTable() {
         installed = false;
+        if (new FunctionTable().functionAvailable("here")) {
+            if (log.isLoggable(java.util.logging.Level.FINE)) {
+                log.log(java.util.logging.Level.FINE, "Here function already registered");
+            }
+            installed = true;
+            return;
+        }
         if (log.isLoggable(java.util.logging.Level.FINE)) {
             log.log(java.util.logging.Level.FINE, "Registering Here function");
         }
--- a/src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.native2ascii.resources;
-
-import java.util.ListResourceBundle;
-
-public class MsgNative2ascii_ja extends ListResourceBundle {
-
-    public Object[][] getContents() {
-        Object[][] temp = new Object[][] {
-        {"err.bad.arg", "-encoding\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059"},
-        {"err.cannot.read",  "{0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
-        {"err.cannot.write", "{0}\u3092\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
-        {"usage", "\u4F7F\u7528\u65B9\u6CD5: native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
-        };
-
-        return temp;
-    }
-}
--- a/src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.native2ascii.resources;
-
-import java.util.ListResourceBundle;
-
-public class MsgNative2ascii_zh_CN extends ListResourceBundle {
-
-    public Object[][] getContents() {
-        Object[][] temp = new Object[][] {
-        {"err.bad.arg", "-encoding \u9700\u8981\u53C2\u6570"},
-        {"err.cannot.read",  "\u65E0\u6CD5\u8BFB\u53D6{0}\u3002"},
-        {"err.cannot.write", "\u65E0\u6CD5\u5199\u5165{0}\u3002"},
-        {"usage", "\u7528\u6CD5: native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
-        };
-
-        return temp;
-    }
-}
--- a/src/linux/doc/man/ja/native2ascii.1	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\" Title: native2ascii
-.\" Language: English
-.\" Date: 2013年11月21日
-.\" SectDesc: 国際化ツール
-.\" Software: JDK 8
-.\" Arch: 汎用
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute 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.
-.\"
-.pl 99999
-.TH "native2ascii" "1" "2013年11月21日" "JDK 8" "国際化ツール"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-native2ascii \- サポートされている任意の文字エンコーディングの文字を含むファイルを、ASCIIおよびUnicodeでエスケープされたファイルに変換して(またはその逆)、ローカライズ可能なアプリケーションを作成します。
-.SH "概要"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fInative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIinputfile\fR
-.RS 4
-ASCIIに変換するエンコードされたファイル。
-.RE
-.PP
-\fIoutputfile\fR
-.RS 4
-変換されたASCIIファイル。
-.RE
-.SH "説明"
-.PP
-\fInative2ascii\fRコマンドは、ASCIIキャラクタ・セットに含まれないすべての文字にUnicodeエスケープ(\fI\eu\fR\fIxxxx\fR)表記法を使用して、Java Runtime Environment (JRE)でサポートされているエンコードされたファイルを、ASCIIでエンコードされたファイルに変換します。このプロセスは、ISO\-8859\-1文字セットに含まれない文字が含まれているプロパティ・ファイルで必要です。このツールは、その逆の変換を実行することもできます。
-.PP
-\fIoutputfile\fR値を省略した場合、標準出力に出力されます。さらに、\fIinputfile\fR値を省略した場合、標準入力から入力されます。
-.SH "オプション"
-.PP
-\-reverse
-.RS 4
-逆の処理を行います。つまり、ISO\-8859\-1でUnicodeエスケープを使用してエンコードされたファイルを、JREでサポートされる文字エンコーディングのファイルに変換します。
-.RE
-.PP
-\-encoding \fIencoding_name\fR
-.RS 4
-変換処理で使用する文字エンコーディングの名前を指定します。このオプションが存在しない場合は、デフォルトの文字エンコーディング(\fIjava\&.nio\&.charset\&.Charset\&.defaultCharset\fRメソッドで定義された)が使用されます。\fIencoding_name\fR文字列は、JREでサポートされている文字エンコーディングの名前にする必要があります。http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.htmlにある
-「サポートされているエンコーディング」を参照してください
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Java仮想マシン(JVM)に\fIoption\fRを渡します。optionには、Javaアプリケーション起動ツールのリファレンス・ページに記載されているオプションを1つ指定します。たとえば、\fI\-J\-Xms48m\fRと指定すると、スタートアップ・メモリーは48MBに設定されます。java(1)を参照してください。
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/linux/doc/man/native2ascii.1	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'\" t
-.\"  Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\"     Arch: generic
-.\"     Software: JDK 8
-.\"     Date: 21 November 2013
-.\"     SectDesc: Internationalization Tools
-.\"     Title: native2ascii.1
-.\"
-.if n .pl 99999
-.TH native2ascii 1 "21 November 2013" "JDK 8" "Internationalization Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME    
-native2ascii \- Creates localizable applications by converting a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes or vice versa\&.
-.SH SYNOPSIS    
-.sp     
-.nf     
-
-\fBnative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi     
-.sp     
-.TP     
-\fIinputfile\fR
-The encoded file to be converted to ASCII\&.
-.TP     
-\fIoutputfile\fR
-The converted ASCII file\&.
-.SH DESCRIPTION    
-The \f3native2ascii\fR command converts encoded files supported by the Java Runtime Environment (JRE) to files encoded in ASCII, using Unicode escapes (\f3\eu\fR\fIxxxx\fR) notation for all characters that are not part of the ASCII character set\&. This process is required for properties files that contain characters not in ISO-8859-1 character sets\&. The tool can also perform the reverse conversion\&.
-.PP
-If the \f3outputfile\fR value is omitted, then standard output is used for output\&. If, in addition, the \f3inputfile\fR value is omitted, then standard input is used for input\&.
-.SH OPTIONS    
-.TP
--reverse
-.br
-Perform the reverse operation: Converts a file encoded in ISO-8859-1 with Unicode escapes to a file in any character encoding supported by the JRE\&.
-.TP
--encoding \fIencoding_name\fR
-.br
-Specifies the name of the character encoding to be used by the conversion procedure\&. If this option is not present, then the default character encoding (as determined by the \f3java\&.nio\&.charset\&.Charset\&.defaultCharset\fR method) is used\&. The \f3encoding_name\fR string must be the name of a character encoding that is supported by the JRE\&. See Supported Encodings at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.html
-.TP
--J\fIoption\fR
-.br
-Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java application launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/solaris/doc/sun/man/man1/ja/native2ascii.1	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\" Title: native2ascii
-.\" Language: English
-.\" Date: 2013年11月21日
-.\" SectDesc: 国際化ツール
-.\" Software: JDK 8
-.\" Arch: 汎用
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute 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.
-.\"
-.pl 99999
-.TH "native2ascii" "1" "2013年11月21日" "JDK 8" "国際化ツール"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-native2ascii \- サポートされている任意の文字エンコーディングの文字を含むファイルを、ASCIIおよびUnicodeでエスケープされたファイルに変換して(またはその逆)、ローカライズ可能なアプリケーションを作成します。
-.SH "概要"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fInative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIinputfile\fR
-.RS 4
-ASCIIに変換するエンコードされたファイル。
-.RE
-.PP
-\fIoutputfile\fR
-.RS 4
-変換されたASCIIファイル。
-.RE
-.SH "説明"
-.PP
-\fInative2ascii\fRコマンドは、ASCIIキャラクタ・セットに含まれないすべての文字にUnicodeエスケープ(\fI\eu\fR\fIxxxx\fR)表記法を使用して、Java Runtime Environment (JRE)でサポートされているエンコードされたファイルを、ASCIIでエンコードされたファイルに変換します。このプロセスは、ISO\-8859\-1文字セットに含まれない文字が含まれているプロパティ・ファイルで必要です。このツールは、その逆の変換を実行することもできます。
-.PP
-\fIoutputfile\fR値を省略した場合、標準出力に出力されます。さらに、\fIinputfile\fR値を省略した場合、標準入力から入力されます。
-.SH "オプション"
-.PP
-\-reverse
-.RS 4
-逆の処理を行います。つまり、ISO\-8859\-1でUnicodeエスケープを使用してエンコードされたファイルを、JREでサポートされる文字エンコーディングのファイルに変換します。
-.RE
-.PP
-\-encoding \fIencoding_name\fR
-.RS 4
-変換処理で使用する文字エンコーディングの名前を指定します。このオプションが存在しない場合は、デフォルトの文字エンコーディング(\fIjava\&.nio\&.charset\&.Charset\&.defaultCharset\fRメソッドで定義された)が使用されます。\fIencoding_name\fR文字列は、JREでサポートされている文字エンコーディングの名前にする必要があります。http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.htmlにある
-「サポートされているエンコーディング」を参照してください
-.RE
-.PP
-\-J\fIoption\fR
-.RS 4
-Java仮想マシン(JVM)に\fIoption\fRを渡します。optionには、Javaアプリケーション起動ツールのリファレンス・ページに記載されているオプションを1つ指定します。たとえば、\fI\-J\-Xms48m\fRと指定すると、スタートアップ・メモリーは48MBに設定されます。java(1)を参照してください。
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/solaris/doc/sun/man/man1/native2ascii.1	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'\" t
-.\"  Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-.\"
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\"     Arch: generic
-.\"     Software: JDK 8
-.\"     Date: 21 November 2013
-.\"     SectDesc: Internationalization Tools
-.\"     Title: native2ascii.1
-.\"
-.if n .pl 99999
-.TH native2ascii 1 "21 November 2013" "JDK 8" "Internationalization Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME    
-native2ascii \- Creates localizable applications by converting a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes or vice versa\&.
-.SH SYNOPSIS    
-.sp     
-.nf     
-
-\fBnative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi     
-.sp     
-.TP     
-\fIinputfile\fR
-The encoded file to be converted to ASCII\&.
-.TP     
-\fIoutputfile\fR
-The converted ASCII file\&.
-.SH DESCRIPTION    
-The \f3native2ascii\fR command converts encoded files supported by the Java Runtime Environment (JRE) to files encoded in ASCII, using Unicode escapes (\f3\eu\fR\fIxxxx\fR) notation for all characters that are not part of the ASCII character set\&. This process is required for properties files that contain characters not in ISO-8859-1 character sets\&. The tool can also perform the reverse conversion\&.
-.PP
-If the \f3outputfile\fR value is omitted, then standard output is used for output\&. If, in addition, the \f3inputfile\fR value is omitted, then standard input is used for input\&.
-.SH OPTIONS    
-.TP
--reverse
-.br
-Perform the reverse operation: Converts a file encoded in ISO-8859-1 with Unicode escapes to a file in any character encoding supported by the JRE\&.
-.TP
--encoding \fIencoding_name\fR
-.br
-Specifies the name of the character encoding to be used by the conversion procedure\&. If this option is not present, then the default character encoding (as determined by the \f3java\&.nio\&.charset\&.Charset\&.defaultCharset\fR method) is used\&. The \f3encoding_name\fR string must be the name of a character encoding that is supported by the JRE\&. See Supported Encodings at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.html
-.TP
--J\fIoption\fR
-.br
-Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java application launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
-.RE
-.br
-'pl 8.5i
-'bp
--- a/test/ProblemList.txt	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/ProblemList.txt	Tue Jun 16 10:52:39 2015 -0700
@@ -123,9 +123,6 @@
 # 8029891
 java/lang/ClassLoader/deadlock/GetResource.java                 generic-all
 
-# 8080428
-java/lang/invoke/8022701/MHIllegalAccess.java                   generic-all
-
 ############################################################################
 
 # jdk_instrument
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 7130985
+ * @summary Four helper classes missing in Sun JDK
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main CorbaExceptionsCompileTest
+ */
+
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.rmi.RemoteException;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+import jdk.testlibrary.FileUtils;
+import jdk.testlibrary.JDKToolLauncher;
+
+public class CorbaExceptionsCompileTest implements CorbaExceptionsTest {
+
+    public CorbaExceptionsCompileTest() {
+        super();
+    }
+
+    public void testExceptionInvalidName()
+        throws java.rmi.RemoteException, InvalidName {}
+
+    public void testExceptionBounds()
+        throws java.rmi.RemoteException, Bounds {}
+
+    public void testExceptionBadKind()
+        throws java.rmi.RemoteException, BadKind {}
+
+    public void testExceptionCorba_Bounds()
+        throws java.rmi.RemoteException, org.omg.CORBA.Bounds {}
+
+    public static void main(String[] args) throws Exception {
+        final File f = new File(
+            CorbaExceptionsCompileTest.class.getProtectionDomain()
+                .getCodeSource().getLocation().getPath());
+        System.out.println(f.getCanonicalPath());
+        ProcessBuilder pb = new ProcessBuilder("ls", "-l");
+        pb.directory(f);
+        Process p = pb.start();
+        p.waitFor();
+        if (p.exitValue() == 0) {
+            try (BufferedReader br = new BufferedReader(
+                    new InputStreamReader(p.getInputStream()))) {
+                StringBuilder builder = new StringBuilder();
+                String line = null;
+                while ( (line = br.readLine()) != null) {
+                    builder.append(line + "\n");
+                }
+                String result = builder.toString();
+                System.out.println(result);
+            }
+        }
+
+        Path outDir = Paths.get("CorbaExceptionsCompileTest-compiled");
+        outDir = Files.createDirectory(outDir).toAbsolutePath();
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("rmic");
+        launcher.addToolArg("-classpath").addToolArg(f.getCanonicalPath())
+            .addToolArg("-d").addToolArg(outDir.toString())
+            .addToolArg("-iiop").addToolArg("CorbaExceptionsCompileTest");
+
+        pb = new ProcessBuilder(launcher.getCommand());
+        pb.directory(f);
+        System.out.println("Working Directory: " + pb.directory());
+        System.out.println("CorbaExceptionsCompileTest.class exists: "
+            + new File(f, "CorbaExceptionsCompileTest.class").exists());
+
+        p = pb.start();
+        p.waitFor();
+        if (p.exitValue() != 0) {
+            try (BufferedReader br = new BufferedReader(
+                    new InputStreamReader(p.getInputStream()))) {
+                StringBuilder builder = new StringBuilder();
+                String line = null;
+                while ( (line = br.readLine()) != null) {
+                    builder.append(line + "\n");
+                }
+                String result = builder.toString();
+                System.out.println(result);
+                throw new RuntimeException(launcher.getCommand() +
+                    " -iiop CorbaExceptionsCompileTest failed with status: "
+                    + p.exitValue());
+            }
+        }
+
+        if (Files.exists(outDir))
+            FileUtils.deleteFileTreeWithRetry(outDir);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/corba/7130985/CorbaExceptionsTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * 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.rmi.Remote;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+public interface CorbaExceptionsTest extends Remote {
+     public void testExceptionInvalidName() throws java.rmi.RemoteException, InvalidName;
+     public void testExceptionBounds() throws java.rmi.RemoteException, Bounds;
+     public void testExceptionBadKind() throws java.rmi.RemoteException, BadKind;
+     public void testExceptionCorba_Bounds() throws java.rmi.RemoteException, org.omg.CORBA.Bounds;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/io/FilePermission/FilePermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for FilePermissionCollection subclass
+ */
+
+import java.io.FilePermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+
+public class FilePermissionCollection {
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        FilePermission perm = new FilePermission("/tmp/foo", "read");
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println
+            ("test 1: add throws IllegalArgExc for wrong perm type");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong perm type");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println("test 3: implies returns true for match on " +
+                           "name and action");
+        perms.add(new FilePermission("/tmp/foo", "read"));
+        if (!perms.implies(new FilePermission("/tmp/foo", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println("test 4: implies returns false for match on " +
+                           "name but not action");
+        if (perms.implies(new FilePermission("/tmp/foo", "write"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println("test 5: implies returns true for match on " +
+                           "name and subset of actions");
+        perms.add(new FilePermission("/tmp/bar", "read, write"));
+        if (!perms.implies(new FilePermission("/tmp/bar", "write"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 6
+        System.out.println("test 6: implies returns true for aggregate " +
+                           "match on name and action");
+        perms.add(new FilePermission("/tmp/baz", "read"));
+        perms.add(new FilePermission("/tmp/baz", "write"));
+        if (!perms.implies(new FilePermission("/tmp/baz", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+        if (!perms.implies(new FilePermission("/tmp/baz", "write,read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 7
+        System.out.println("test 7: implies returns true for wildcard " +
+                           "and match on action");
+        perms.add(new FilePermission("/usr/tmp/*", "read"));
+        if (!perms.implies(new FilePermission("/usr/tmp/foo", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println
+            ("test 8: implies returns false for non-match on wildcard");
+        if (perms.implies(new FilePermission("/usr/tmp/bar/foo", "read"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 9
+        System.out.println
+            ("test 9: implies returns true for deep wildcard match");
+        perms.add(new FilePermission("/usr/tmp/-", "read"));
+        if (!perms.implies(new FilePermission("/usr/tmp/bar/foo", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 10
+        System.out.println("test 10: implies returns true for relative match");
+        perms.add(new FilePermission(".", "read"));
+        if (!perms.implies(new FilePermission(System.getProperty("user.dir"),
+                                              "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 11
+        System.out.println("test 11: implies returns true for all " +
+                           "wildcard and match on action");
+        perms.add(new FilePermission("<<ALL FILES>>", "read"));
+        if (!perms.implies(new FilePermission("/tmp/foobar", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 12
+        System.out.println("test 12: implies returns false for wildcard " +
+                           "and non-match on action");
+        if (perms.implies(new FilePermission("/tmp/foobar", "write"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 13
+        System.out.println("test 13: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        // the two "/tmp/baz" entries were combined into one
+        if (numPerms != 7) {
+            System.err.println("Expected 7, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+}
--- a/test/java/lang/Runtime/exec/LotsOfOutput.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/java/lang/Runtime/exec/LotsOfOutput.java	Tue Jun 16 10:52:39 2015 -0700
@@ -48,20 +48,21 @@
         UnixCommands.ensureCommandsAvailable("cat");
 
         Process p = runtime.exec(UnixCommands.cat() + " /dev/zero");
-        long initMemory = usedMemory();
-        boolean growing = false;
+        long prev = usedMemory();
+        int growing = 0;
         for (int i = 1; i < 10; i++) {
             Thread.sleep(100);
             long used = usedMemory();
-            if (used != initMemory) {
-                System.out.printf("consuming memory: i: %d, initial: %d, used: %d, delta: %d%n",
-                        i, initMemory, used, used - initMemory);
+            if (used != prev) {
+                System.out.printf("consuming memory: i: %d, prev: %d, used: %d, delta: %d%n",
+                        i, prev, used, used - prev);
             }
-            if (used > initMemory + THRESHOLD)
-                growing = true;
+            if (used > prev + THRESHOLD)
+                growing += 1;
+            prev = used;
         }
-        if (growing)
-            throw new Exception("Process consumes memory.");
+        if (growing > 2)
+            throw new Exception("Process consumes memory: growing " + growing);
 
     }
 }
--- a/test/java/lang/annotation/TypeAnnotationReflection.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/java/lang/annotation/TypeAnnotationReflection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004698 8007073 8022343
+ * @bug 8004698 8007073 8022343 8054304 8058595
  * @summary Unit test for type annotations
  */
 
@@ -200,6 +200,17 @@
         check(annos.length == 1);
         check(annos[0].annotationType().equals(TypeAnno.class));
         check(((TypeAnno)annos[0]).value().equals("M Runnable"));
+
+        // Check that AnnotatedTypeVariable.getAnnotatedBounds() returns jlO for a naked
+        // type variable (i.e no bounds, no annotations)
+        Method m4 = TestClassTypeVarAndField.class.getDeclaredMethod("foo4", (Class<?>[])null);
+        AnnotatedType ret4 = m4.getAnnotatedReturnType();
+        AnnotatedType[] annotatedBounds4 = ((AnnotatedTypeVariable)ret4).getAnnotatedBounds();
+        check(annotatedBounds4.length == 1);
+
+        annos = annotatedBounds4[0].getAnnotations();
+        check(annos.length == 0);
+        check(annotatedBounds4[0].getType().equals(Object.class));
     }
 
     private static void testFields() throws Exception {
@@ -231,7 +242,7 @@
     private static void testClassTypeVar() throws Exception {
         TypeVariable[] typeVars = TestClassTypeVarAndField.class.getTypeParameters();
         Annotation[] annos;
-        check(typeVars.length == 2);
+        check(typeVars.length == 3);
 
         // First TypeVar
         AnnotatedType[] annotatedBounds = typeVars[0].getAnnotatedBounds();
@@ -262,6 +273,14 @@
         check(annos.length == 1);
         check(annos[0].annotationType().equals(TypeAnno2.class));
         check(((TypeAnno2)annos[0]).value().equals("EEBound"));
+
+        // third Typevar V declared without explicit bounds should see jlO as its bound.
+        annotatedBounds = typeVars[2].getAnnotatedBounds();
+        check(annotatedBounds.length == 1);
+
+        annos = annotatedBounds[0].getAnnotations();
+        check(annos.length == 0);
+        check(annotatedBounds[0].getType().equals(Object.class));
     }
 
     private static void testMethodTypeVar() throws Exception {
@@ -282,7 +301,7 @@
         // Second method
         m2 = TestClassTypeVarAndField.class.getDeclaredMethod("foo3", (Class<?>[])null);
         t = m2.getTypeParameters();
-        check(t.length == 1);
+        check(t.length == 2);
         annos = t[0].getAnnotations();
         check(annos.length == 1);
         check(annos[0].annotationType().equals(TypeAnno.class));
@@ -293,6 +312,14 @@
 
         annos = annotatedBounds2[0].getAnnotations();
         check(annos.length == 0);
+
+        // for the naked type variable L of foo3, we should see jlO as its bound.
+        annotatedBounds2 = t[1].getAnnotatedBounds();
+        check(annotatedBounds2.length == 1);
+        check(annotatedBounds2[0].getType().equals(Object.class));
+
+        annos = annotatedBounds2[0].getAnnotations();
+        check(annos.length == 0);
     }
 
     private static void testParameterizedType() {
@@ -357,9 +384,24 @@
         w = (AnnotatedWildcardType)((AnnotatedParameterizedType)f
             .getAnnotatedType()).getAnnotatedActualTypeArguments()[0];
         t = w.getAnnotatedUpperBounds();
-        check(t.length == 0);
+        check(t.length == 1);
+        check(t[0].getType().equals(Object.class));
+        annos = t[0].getAnnotations();
+        check(annos.length == 0);
         t = w.getAnnotatedLowerBounds();
         check(t.length == 1);
+
+        // for an unbounded wildcard, we should see jlO as its upperbound and null type as its lower bound.
+        f = TestWildcardType.class.getDeclaredField("f3");
+        w = (AnnotatedWildcardType)((AnnotatedParameterizedType)f
+            .getAnnotatedType()).getAnnotatedActualTypeArguments()[0];
+        t = w.getAnnotatedUpperBounds();
+        check(t.length == 1);
+        check(t[0].getType().equals(Object.class));
+        annos = t[0].getAnnotations();
+        check(annos.length == 0);
+        t = w.getAnnotatedLowerBounds();
+        check(t.length == 0);
     }
 
     private static void testParameterTypes() throws Exception {
@@ -515,6 +557,7 @@
     public <T> List<? super T> foo() { return null;}
     public Class<@TypeAnno("1") ? extends @TypeAnno("2") Annotation> f1;
     public Class<@TypeAnno("3") ? super @TypeAnno("4") Annotation> f2;
+    public Class<@TypeAnno("5") ?> f3;
 }
 
 abstract class TestParameterizedType implements @TypeAnno("M") Map<@TypeAnno("S")String, @TypeAnno("I") @TypeAnno2("I2")Integer> {
@@ -555,14 +598,15 @@
 
 abstract class TestClassTypeVarAndField <T extends @TypeAnno("Object1") Object
                                           & @TypeAnno("Runnable1") @TypeAnno2("Runnable2") Runnable,
-                                        @TypeAnno("EE")EE extends @TypeAnno2("EEBound") Runnable > {
+                                        @TypeAnno("EE")EE extends @TypeAnno2("EEBound") Runnable, V > {
     @TypeAnno("T1 field") @TypeAnno2("T2 field") T field1;
     T field2;
     @TypeAnno("Object field") Object field3;
 
     public @TypeAnno("t1") @TypeAnno2("t2") T foo(){ return null; }
     public <M extends @TypeAnno("M Runnable") Runnable> M foo2() {return null;}
-    public <@TypeAnno("K") K extends Cloneable> K foo3() {return null;}
+    public <@TypeAnno("K") K extends Cloneable, L> K foo3() {return null;}
+    public <L> L foo4() {return null;}
 }
 
 @Target(ElementType.TYPE_USE)
--- a/test/java/lang/invoke/8022701/InvokeSeveralWays.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/java/lang/invoke/8022701/InvokeSeveralWays.java	Tue Jun 16 10:52:39 2015 -0700
@@ -38,12 +38,19 @@
             failures++;
         } catch (InvocationTargetException e) {
             Throwable c = e.getCause();
-            if (expected.isInstance(c))
-               System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
-            else {
-               failures++;
-               System.out.println("FAIL: Unexpected wrapped exception " + c);
-               e.printStackTrace(System.out);
+            if (BootstrapMethodError.class.isInstance(c)) {
+                c = c.getCause();
+                if (expected.isInstance(c))
+                    System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
+                else {
+                    failures++;
+                    System.out.println("FAIL: Unexpected wrapped exception " + c);
+                    e.printStackTrace(System.out);
+                }
+            } else {
+                failures++;
+                System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + c);
+                e.printStackTrace(System.out);
             }
         } catch (Throwable e) {
             failures++;
@@ -74,14 +81,19 @@
             Invoker.invoke();
             System.out.println("FAIL: No exception throw, probably failed to load modified bytecodes for MethodSupplier");
             failures++;
+        } catch (BootstrapMethodError e) {
+            Throwable c = e.getCause();
+            if (expected.isInstance(c))
+                System.out.println("EXPECTED: " + expected.getName() + ", "+ c);
+            else {
+                failures++;
+                System.out.println("FAIL: Unexpected exception has been caught " + c);
+                e.printStackTrace(System.out);
+            }
         } catch (Throwable e) {
-            if (expected.isInstance(e))
-               System.out.println("EXPECTED: " + expected.getName() + ", "+ e);
-            else {
             failures++;
-            System.out.println("FAIL: Unexpected exception has been caught " + e);
+            System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + e);
             e.printStackTrace(System.out);
-            }
         }
         System.out.println();
         try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/SocketPermission/SocketPermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for PermissionCollection subclasses
+ */
+
+import java.net.SocketPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+
+public class SocketPermissionCollection {
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        SocketPermission perm = new SocketPermission("www.example.com",
+                                                     "connect");
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println
+            ("test 1: add throws IllegalArgExc for wrong perm type");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong perm type");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println
+            ("test 3: implies returns true for match on name and action");
+        perms.add(new SocketPermission("www.example.com", "connect"));
+        if (!perms.implies(new SocketPermission("www.example.com", "connect"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println
+            ("test 4: implies returns false for match on name but not action");
+        if (perms.implies(new SocketPermission("www.example.com", "accept"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println("test 5: implies returns true for match on " +
+                           "name and subset of actions");
+        perms.add(new SocketPermission("www.example.org", "accept, connect"));
+        if (!perms.implies(new SocketPermission("www.example.org", "connect"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 6
+        System.out.println("test 6: implies returns true for aggregate " +
+                           "match on name and action");
+        perms.add(new SocketPermission("www.example.us", "accept"));
+        perms.add(new SocketPermission("www.example.us", "connect"));
+        if (!perms.implies(new SocketPermission("www.example.us", "accept"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+        if (!perms.implies(new SocketPermission("www.example.us",
+                                                "connect,accept"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 7
+        System.out.println("test 7: implies returns true for wildcard " +
+                           "and match on action");
+        perms.add(new SocketPermission("*.example.edu", "resolve"));
+        if (!perms.implies(new SocketPermission("foo.example.edu", "resolve"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println("test 8: implies returns false for non-match " +
+                           "on wildcard");
+        if (perms.implies(new SocketPermission("foo.example.edu", "connect"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 9
+        System.out.println("test 9: implies returns true for matching " +
+                           "port range and action");
+        perms.add(new SocketPermission("204.160.241.0:1024-65535", "connect"));
+        if (!perms.implies(new SocketPermission("204.160.241.0:1025", "connect"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 13
+        System.out.println("test 13: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        // the two "/tmp/baz" entries were combined into one
+        if (numPerms != 5) {
+            System.err.println("Expected 5, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/BasicPermission/BasicPermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for BasicPermissionCollection subclass
+ */
+
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+
+public class BasicPermissionCollection {
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        TestPermission perm = new TestPermission("foo");
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println("test 1: add throws IllegalArgumentExc");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong class");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println("test 3: implies returns true for match on name");
+        perms.add(new TestPermission("foo"));
+        if (!perms.implies(new TestPermission("foo"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println("test 4: implies returns true for wildcard match");
+        perms.add(new TestPermission("bar.*"));
+        if (!perms.implies(new TestPermission("bar.foo"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println
+            ("test 5: implies returns false for invalid wildcard");
+        perms.add(new TestPermission("baz*"));
+        if (perms.implies(new TestPermission("baz.foo"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 6
+        System.out.println
+            ("test 6: implies returns true for deep wildcard match");
+        if (!perms.implies(new TestPermission("bar.foo.baz"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 7
+        System.out.println
+            ("test 7: implies returns true for all wildcard match");
+        perms.add(new TestPermission("*"));
+        if (!perms.implies(new TestPermission("yes"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println("test 8: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        if (numPerms != 4) {
+            System.err.println("Expected 4, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+
+    private static class TestPermission extends BasicPermission {
+        TestPermission(String name) {
+            super(name);
+        }
+    }
+}
--- a/test/java/security/PermissionCollection/Concurrent.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/java/security/PermissionCollection/Concurrent.java	Tue Jun 16 10:52:39 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,13 +104,11 @@
                     System.out.println(perm[perm.length-1] + " implies " + result);
                 }
 
-                synchronized (pc) {
-                    Enumeration en = pc.elements();
-                    while (en.hasMoreElements()) {
-                        Object obj = en.nextElement();
-                        if (debug) {
-                            System.out.println(obj);
-                        }
+                Enumeration en = pc.elements();
+                while (en.hasMoreElements()) {
+                    Object obj = en.nextElement();
+                    if (debug) {
+                        System.out.println(obj);
                     }
                 }
             }
@@ -151,13 +149,11 @@
                     }
                 }
 
-                synchronized (pc) {
-                    Enumeration en = pc.elements();
-                    while (en.hasMoreElements()) {
-                        Object obj = en.nextElement();
-                        if (debug) {
-                            System.out.println(obj);
-                        }
+                Enumeration en = pc.elements();
+                while (en.hasMoreElements()) {
+                    Object obj = en.nextElement();
+                    if (debug) {
+                        System.out.println(obj);
                     }
                 }
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/SecureClassLoader/DefineClass.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecureClassLoader;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.List;
+import java.util.PropertyPermission;
+
+/*
+ * @test
+ * @bug 6826789
+ * @summary Make sure equivalent ProtectionDomains are granted the same
+ *          permissions when the CodeSource URLs are different but resolve
+ *          to the same ip address after name service resolution.
+ * @run main/othervm/java.security.policy=DefineClass.policy DefineClass
+ */
+
+public class DefineClass {
+
+    // permissions that are expected to be granted by the policy file
+    private final static Permission[] GRANTED_PERMS = new Permission[] {
+        new PropertyPermission("user.home", "read"),
+        new PropertyPermission("user.name", "read")
+    };
+
+    // Base64 encoded bytes of a simple class: "public class Foo {}"
+    private final static String FOO_CLASS =
+        "yv66vgAAADQADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
+        "D0xpbmVOdW1iZXJUYWJsZQEAClNvdXJjZUZpbGUBAAhGb28uamF2YQwABAAF" +
+        "AQADRm9vAQAQamF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAQABAAQABQAB" +
+        "AAYAAAAdAAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAAAEAAQAIAAAAAgAJ";
+
+    // Base64 encoded bytes of a simple class: "public class Bar {}"
+    private final static String BAR_CLASS =
+        "yv66vgAAADQADQoAAwAKBwALBwAMAQAGPGluaXQ+AQADKClWAQAEQ29kZQEA" +
+        "D0xpbmVOdW1iZXJUYWJsZQEAClNvdXJjZUZpbGUBAAhCYXIuamF2YQwABAAF" +
+        "AQADQmFyAQAQamF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAQABAAQABQAB" +
+        "AAYAAAAdAAEAAQAAAAUqtwABsQAAAAEABwAAAAYAAQAAAAEAAQAIAAAAAgAJ";
+
+    public static void main(String[] args) throws Exception {
+
+        MySecureClassLoader scl = new MySecureClassLoader();
+        Policy p = Policy.getPolicy();
+        ArrayList<Permission> perms1 = getPermissions(scl, p,
+                                                      "http://localhost/",
+                                                      "Foo", FOO_CLASS);
+        checkPerms(perms1, GRANTED_PERMS);
+        ArrayList<Permission> perms2 = getPermissions(scl, p,
+                                                      "http://127.0.0.1/",
+                                                      "Bar", BAR_CLASS);
+        checkPerms(perms2, GRANTED_PERMS);
+        assert(perms1.equals(perms2));
+    }
+
+    // returns the permissions granted to the codebase URL
+    private static ArrayList<Permission> getPermissions(MySecureClassLoader scl,
+                                                        Policy p, String url,
+                                                        String className,
+                                                        String classBytes)
+                                                        throws IOException {
+        CodeSource cs = new CodeSource(new URL(url), (Certificate[])null);
+        Base64.Decoder bd = Base64.getDecoder();
+        byte[] bytes = bd.decode(classBytes);
+        Class<?> c = scl.defineMyClass(className, bytes, cs);
+        ProtectionDomain pd = c.getProtectionDomain();
+        return Collections.list(p.getPermissions(pd).elements());
+    }
+
+    private static void checkPerms(List<Permission> perms,
+                                   Permission... grantedPerms)
+        throws Exception
+    {
+        if (!perms.containsAll(Arrays.asList(grantedPerms))) {
+            throw new Exception("Granted permissions not correct");
+        }
+    }
+
+    // A SecureClassLoader that allows the test to define its own classes
+    private static class MySecureClassLoader extends SecureClassLoader {
+        Class<?> defineMyClass(String name, byte[] b, CodeSource cs) {
+            return super.defineClass(name, b, 0, b.length, cs);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/SecureClassLoader/DefineClass.policy	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,11 @@
+grant {
+    permission java.lang.RuntimePermission "createClassLoader";
+    permission java.lang.RuntimePermission "getProtectionDomain";
+    permission java.security.SecurityPermission "getPolicy";
+};
+grant codebase "http://localhost/" {
+    permission java.util.PropertyPermission "user.home", "read";
+};
+grant codebase "http://127.0.0.1/" {
+    permission java.util.PropertyPermission "user.name", "read";
+};
--- a/test/java/util/Arrays/ParallelPrefix.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/java/util/Arrays/ParallelPrefix.java	Tue Jun 16 10:52:39 2015 -0700
@@ -26,6 +26,7 @@
  * @summary unit test for Arrays.ParallelPrefix().
  * @author Tristan Yan
  * @run testng ParallelPrefix
+ * @key intermittent
  */
 
 import java.util.Arrays;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Arrays/SortingIntBenchmarkTestJMH.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,708 @@
+/*
+ * Copyright 2015 Goldman Sachs.
+ * 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 org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Thread)
+@BenchmarkMode(Mode.Throughput)
+@OutputTimeUnit(TimeUnit.SECONDS)
+public class SortingIntBenchmarkTestJMH {
+    private static final int QUICKSORT_THRESHOLD = 286;
+    private static final int MAX_RUN_COUNT = 67;
+    private static final int INSERTION_SORT_THRESHOLD = 47;
+    public static final int MAX_VALUE = 1_000_000;
+
+    @Param({"pairFlipZeroPairFlip", "pairFlipOneHundredPairFlip"
+            , "zeroHi", "hiZeroLow", "hiFlatLow", "identical",
+            "randomDups", "randomNoDups", "sortedReversedSorted", "pairFlip", "endLessThan"})
+
+    public String listType;
+
+    private int[] array;
+    private static final int LIST_SIZE = 10_000_000;
+    public static final int NUMBER_OF_ITERATIONS = 10;
+
+    @Setup
+    public void setUp() {
+        Random random = new Random(123456789012345L);
+        this.array = new int[LIST_SIZE];
+        int threeQuarters = (int) (LIST_SIZE * 0.75);
+        if ("zeroHi".equals(this.listType)) {
+            for (int i = 0; i < threeQuarters; i++) {
+                this.array[i] = 0;
+            }
+            int k = 1;
+            for (int i = threeQuarters; i < LIST_SIZE; i++) {
+                this.array[i] = k;
+                k++;
+            }
+        }
+        else if ("hiFlatLow".equals(this.listType)) {
+            int oneThird = LIST_SIZE / 3;
+            for (int i = 0; i < oneThird; i++) {
+                this.array[i] = i;
+            }
+            int twoThirds = oneThird * 2;
+            int constant = oneThird - 1;
+            for (int i = oneThird; i < twoThirds; i++) {
+                this.array[i] = constant;
+            }
+            for (int i = twoThirds; i < LIST_SIZE; i++) {
+                this.array[i] = constant - i + twoThirds;
+            }
+        }
+        else if ("hiZeroLow".equals(this.listType)) {
+            int oneThird = LIST_SIZE / 3;
+            for (int i = 0; i < oneThird; i++) {
+                this.array[i] = i;
+            }
+            int twoThirds = oneThird * 2;
+            for (int i = oneThird; i < twoThirds; i++) {
+                this.array[i] = 0;
+            }
+            for (int i = twoThirds; i < LIST_SIZE; i++) {
+                this.array[i] = oneThird - i + twoThirds;
+            }
+        }
+        else if ("identical".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = 0;
+            }
+        }
+        else if ("randomDups".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = random.nextInt(1000);
+            }
+        }
+        else if ("randomNoDups".equals(this.listType)) {
+            Set<Integer> set = new HashSet();
+            while (set.size() < LIST_SIZE + 1) {
+                set.add(random.nextInt());
+            }
+            List<Integer> list = new ArrayList<>(LIST_SIZE);
+            list.addAll(set);
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = list.get(i);
+            }
+        }
+        else if ("sortedReversedSorted".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE / 2; i++) {
+                this.array[i] = i;
+            }
+            int num = 0;
+            for (int i = LIST_SIZE / 2; i < LIST_SIZE; i++) {
+                this.array[i] = LIST_SIZE - num;
+                num++;
+            }
+        }
+        else if ("pairFlip".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = i;
+            }
+            for (int i = 0; i < LIST_SIZE; i += 2) {
+                int temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+        }
+        else if ("endLessThan".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE - 1; i++) {
+                this.array[i] = 3;
+            }
+            this.array[LIST_SIZE - 1] = 1;
+        }
+        else if ("pairFlipZeroPairFlip".equals(this.listType)) {
+            //pairflip
+            for (int i = 0; i < 64; i++) {
+                this.array[i] = i;
+            }
+            for (int i = 0; i < 64; i += 2) {
+                int temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+            //zero
+            for (int i = 64; i < this.array.length - 64; i++) {
+                this.array[i] = 0;
+            }
+            //pairflip
+            for (int i = this.array.length - 64; i < this.array.length; i++) {
+                this.array[i] = i;
+            }
+            for (int i = this.array.length - 64; i < this.array.length; i += 2) {
+                int temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+        }
+        else if ("pairFlipOneHundredPairFlip".equals(this.listType)) {
+            //10, 5
+            for (int i = 0; i < 64; i++) {
+                if (i % 2 == 0) {
+                    this.array[i] = 10;
+                }
+                else {
+                    this.array[i] = 5;
+                }
+            }
+
+            //100
+            for (int i = 64; i < this.array.length - 64; i++) {
+                this.array[i] = 100;
+            }
+
+            //10, 5
+            for (int i = this.array.length - 64; i < this.array.length; i++) {
+                if (i % 2 == 0) {
+                    this.array[i] = 10;
+                }
+                else {
+                    this.array[i] = 5;
+                }
+            }
+        }
+    }
+
+    @Warmup(iterations = 20)
+    @Measurement(iterations = 10)
+    @Benchmark
+    public void sortNewWay() {
+        for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
+            SortingIntTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
+        }
+    }
+
+    @Warmup(iterations = 20)
+    @Measurement(iterations = 10)
+    @Benchmark
+    public void sortCurrentWay() {
+        for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
+            Arrays.sort(this.array);
+        }
+    }
+
+    static void sort(int[] a, int left, int right,
+                     int[] work, int workBase, int workLen) {
+        // Use Quicksort on small arrays
+        if (right - left < QUICKSORT_THRESHOLD) {
+            SortingIntTestJMH.sort(a, left, right, true);
+            return;
+        }
+
+         /*
+         * Index run[i] is the start of i-th run
+         * (ascending or descending sequence).
+         */
+        int[] run = new int[MAX_RUN_COUNT + 1];
+        int count = 0;
+        run[0] = left;
+
+        // Check if the array is nearly sorted
+        for (int k = left; k < right; run[count] = k) {
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;
+            if (a[k] < a[k + 1]) { // ascending
+                while (++k <= right && a[k - 1] <= a[k]) ;
+            }
+            else if (a[k] > a[k + 1]) { // descending
+                while (++k <= right && a[k - 1] >= a[k]) ;
+                for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
+                    int t = a[lo];
+                    a[lo] = a[hi];
+                    a[hi] = t;
+                }
+            }
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
+            }
+            /*
+             * The array is not highly structured,
+             * use Quicksort instead of merge sort.
+             */
+            if (++count == MAX_RUN_COUNT) {
+                sort(a, left, right, true);
+                return;
+            }
+        }
+
+        // Check special cases
+        // Implementation note: variable "right" is increased by 1.
+        if (run[count] == right++) {
+            run[++count] = right;
+        }
+        if (count <= 1) { // The array is already sorted
+            return;
+        }
+
+        // Determine alternation base for merge
+        byte odd = 0;
+        for (int n = 1; (n <<= 1) < count; odd ^= 1) {
+        }
+
+        // Use or create temporary array b for merging
+        int[] b;                 // temp array; alternates with a
+        int ao, bo;                 // array offsets from 'left'
+        int blen = right - left; // space needed for b
+        if (work == null || workLen < blen || workBase + blen > work.length) {
+            work = new int[blen];
+            workBase = 0;
+        }
+        if (odd == 0) {
+            System.arraycopy(a, left, work, workBase, blen);
+            b = a;
+            bo = 0;
+            a = work;
+            ao = workBase - left;
+        }
+        else {
+            b = work;
+            ao = 0;
+            bo = workBase - left;
+        }
+
+        // Merging
+        for (int last; count > 1; count = last) {
+            for (int k = (last = 0) + 2; k <= count; k += 2) {
+                int hi = run[k], mi = run[k - 1];
+                for (int i = run[k - 2], p = i, q = mi; i < hi; ++i) {
+                    if (q >= hi || p < mi && a[p + ao] <= a[q + ao]) {
+                        b[i + bo] = a[p++ + ao];
+                    }
+                    else {
+                        b[i + bo] = a[q++ + ao];
+                    }
+                }
+                run[++last] = hi;
+            }
+            if ((count & 1) != 0) {
+                for (int i = right, lo = run[count - 1]; --i >= lo;
+                     b[i + bo] = a[i + ao]
+                        ) {
+                }
+                run[++last] = right;
+            }
+            int[] t = a;
+            a = b;
+            b = t;
+            int o = ao;
+            ao = bo;
+            bo = o;
+        }
+    }
+
+    private static void sort(int[] a, int left, int right, boolean leftmost) {
+        int length = right - left + 1;
+
+        // Use insertion sort on tiny arrays
+        if (length < INSERTION_SORT_THRESHOLD) {
+            if (leftmost) {
+                /*
+                 * Traditional (without sentinel) insertion sort,
+                 * optimized for server VM, is used in case of
+                 * the leftmost part.
+                 */
+                for (int i = left, j = i; i < right; j = ++i) {
+                    int ai = a[i + 1];
+                    while (ai < a[j]) {
+                        a[j + 1] = a[j];
+                        if (j-- == left) {
+                            break;
+                        }
+                    }
+                    a[j + 1] = ai;
+                }
+            }
+            else {
+                /*
+                 * Skip the longest ascending sequence.
+                 */
+                do {
+                    if (left >= right) {
+                        return;
+                    }
+                }
+                while (a[++left] >= a[left - 1]);
+
+                /*
+                 * Every element from adjoining part plays the role
+                 * of sentinel, therefore this allows us to avoid the
+                 * left range check on each iteration. Moreover, we use
+                 * the more optimized algorithm, so called pair insertion
+                 * sort, which is faster (in the context of Quicksort)
+                 * than traditional implementation of insertion sort.
+                 */
+                for (int k = left; ++left <= right; k = ++left) {
+                    int a1 = a[k], a2 = a[left];
+
+                    if (a1 < a2) {
+                        a2 = a1;
+                        a1 = a[left];
+                    }
+                    while (a1 < a[--k]) {
+                        a[k + 2] = a[k];
+                    }
+                    a[++k + 1] = a1;
+
+                    while (a2 < a[--k]) {
+                        a[k + 1] = a[k];
+                    }
+                    a[k + 1] = a2;
+                }
+                int last = a[right];
+
+                while (last < a[--right]) {
+                    a[right + 1] = a[right];
+                }
+                a[right + 1] = last;
+            }
+            return;
+        }
+
+        // Inexpensive approximation of length / 7
+        int seventh = (length >> 3) + (length >> 6) + 1;
+
+        /*
+         * Sort five evenly spaced elements around (and including) the
+         * center element in the range. These elements will be used for
+         * pivot selection as described below. The choice for spacing
+         * these elements was empirically determined to work well on
+         * a wide variety of inputs.
+         */
+        int e3 = (left + right) >>> 1; // The midpoint
+        int e2 = e3 - seventh;
+        int e1 = e2 - seventh;
+        int e4 = e3 + seventh;
+        int e5 = e4 + seventh;
+
+        // Sort these elements using insertion sort
+        if (a[e2] < a[e1]) {
+            int t = a[e2];
+            a[e2] = a[e1];
+            a[e1] = t;
+        }
+
+        if (a[e3] < a[e2]) {
+            int t = a[e3];
+            a[e3] = a[e2];
+            a[e2] = t;
+            if (t < a[e1]) {
+                a[e2] = a[e1];
+                a[e1] = t;
+            }
+        }
+        if (a[e4] < a[e3]) {
+            int t = a[e4];
+            a[e4] = a[e3];
+            a[e3] = t;
+            if (t < a[e2]) {
+                a[e3] = a[e2];
+                a[e2] = t;
+                if (t < a[e1]) {
+                    a[e2] = a[e1];
+                    a[e1] = t;
+                }
+            }
+        }
+        if (a[e5] < a[e4]) {
+            int t = a[e5];
+            a[e5] = a[e4];
+            a[e4] = t;
+            if (t < a[e3]) {
+                a[e4] = a[e3];
+                a[e3] = t;
+                if (t < a[e2]) {
+                    a[e3] = a[e2];
+                    a[e2] = t;
+                    if (t < a[e1]) {
+                        a[e2] = a[e1];
+                        a[e1] = t;
+                    }
+                }
+            }
+        }
+
+        // Pointers
+        int less = left;  // The index of the first element of center part
+        int great = right; // The index before the first element of right part
+
+        if (a[e1] != a[e2] && a[e2] != a[e3] && a[e3] != a[e4] && a[e4] != a[e5]) {
+            /*
+             * Use the second and fourth of the five sorted elements as pivots.
+             * These values are inexpensive approximations of the first and
+             * second terciles of the array. Note that pivot1 <= pivot2.
+             */
+            int pivot1 = a[e2];
+            int pivot2 = a[e4];
+
+            /*
+             * The first and the last elements to be sorted are moved to the
+             * locations formerly occupied by the pivots. When partitioning
+             * is complete, the pivots are swapped back into their final
+             * positions, and excluded from subsequent sorting.
+             */
+            a[e2] = a[left];
+            a[e4] = a[right];
+
+            /*
+             * Skip elements, which are less or greater than pivot values.
+             */
+            while (a[++less] < pivot1) {
+            }
+            while (a[--great] > pivot2) {
+            }
+
+            /*
+             * Partitioning:
+             *
+             *   left part           center part                   right part
+             * +--------------------------------------------------------------+
+             * |  < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2  |
+             * +--------------------------------------------------------------+
+             *               ^                          ^       ^
+             *               |                          |       |
+             *              less                        k     great
+             *
+             * Invariants:
+             *
+             *              all in (left, less)   < pivot1
+             *    pivot1 <= all in [less, k)      <= pivot2
+             *              all in (great, right) > pivot2
+             *
+             * Pointer k is the first index of ?-part.
+             */
+            outer:
+            for (int k = less - 1; ++k <= great; ) {
+                int ak = a[k];
+                if (ak < pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
+                    /*
+                     * Here and below we use "a[i] = b; i++;" instead
+                     * of "a[i++] = b;" due to performance issue.
+                     */
+                    a[less] = ak;
+                    ++less;
+                }
+                else if (ak > pivot2) { // Move a[k] to right part
+                    while (a[great] > pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] < pivot1) { // a[great] <= pivot2
+                        a[k] = a[less];
+                        a[less] = a[great];
+                        ++less;
+                    }
+                    else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                    }
+                    /*
+                     * Here and below we use "a[i] = b; i--;" instead
+                     * of "a[i--] = b;" due to performance issue.
+                     */
+                    a[great] = ak;
+                    --great;
+                }
+            }
+
+            // Swap pivots into their final positions
+            a[left] = a[less - 1];
+            a[less - 1] = pivot1;
+            a[right] = a[great + 1];
+            a[great + 1] = pivot2;
+
+            // Sort left and right parts recursively, excluding known pivots
+            SortingIntTestJMH.sort(a, left, less - 2, leftmost);
+            SortingIntTestJMH.sort(a, great + 2, right, false);
+
+            /*
+             * If center part is too large (comprises > 4/7 of the array),
+             * swap internal pivot values to ends.
+             */
+            if (less < e1 && e5 < great) {
+                /*
+                 * Skip elements, which are equal to pivot values.
+                 */
+                while (a[less] == pivot1) {
+                    ++less;
+                }
+
+                while (a[great] == pivot2) {
+                    --great;
+                }
+
+                /*
+                 * Partitioning:
+                 *
+                 *   left part         center part                  right part
+                 * +----------------------------------------------------------+
+                 * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+                 * +----------------------------------------------------------+
+                 *              ^                        ^       ^
+                 *              |                        |       |
+                 *             less                      k     great
+                 *
+                 * Invariants:
+                 *
+                 *              all in (*,  less) == pivot1
+                 *     pivot1 < all in [less,  k)  < pivot2
+                 *              all in (great, *) == pivot2
+                 *
+                 * Pointer k is the first index of ?-part.
+                 */
+                outer:
+                for (int k = less - 1; ++k <= great; ) {
+                    int ak = a[k];
+                    if (ak == pivot1) { // Move a[k] to left part
+                        a[k] = a[less];
+                        a[less] = ak;
+                        ++less;
+                    }
+                    else if (ak == pivot2) { // Move a[k] to right part
+                        while (a[great] == pivot2) {
+                            if (great-- == k) {
+                                break outer;
+                            }
+                        }
+                        if (a[great] == pivot1) { // a[great] < pivot2
+                            a[k] = a[less];
+                            /*
+                             * Even though a[great] equals to pivot1, the
+                             * assignment a[less] = pivot1 may be incorrect,
+                             * if a[great] and pivot1 are floating-point zeros
+                             * of different signs. Therefore in float and
+                             * double sorting methods we have to use more
+                             * accurate assignment a[less] = a[great].
+                             */
+                            a[less] = pivot1;
+                            ++less;
+                        }
+                        else { // pivot1 < a[great] < pivot2
+                            a[k] = a[great];
+                        }
+                        a[great] = ak;
+                        --great;
+                    }
+                }
+            }
+
+            // Sort center part recursively
+            SortingIntTestJMH.sort(a, less, great, false);
+        }
+        else { // Partitioning with one pivot
+            /*
+             * Use the third of the five sorted elements as pivot.
+             * This value is inexpensive approximation of the median.
+             */
+            int pivot = a[e3];
+
+            /*
+             * Partitioning degenerates to the traditional 3-way
+             * (or "Dutch National Flag") schema:
+             *
+             *   left part    center part              right part
+             * +-------------------------------------------------+
+             * |  < pivot  |   == pivot   |     ?    |  > pivot  |
+             * +-------------------------------------------------+
+             *              ^              ^        ^
+             *              |              |        |
+             *             less            k      great
+             *
+             * Invariants:
+             *
+             *   all in (left, less)   < pivot
+             *   all in [less, k)     == pivot
+             *   all in (great, right) > pivot
+             *
+             * Pointer k is the first index of ?-part.
+             */
+            for (int k = less; k <= great; ++k) {
+                if (a[k] == pivot) {
+                    continue;
+                }
+                int ak = a[k];
+                if (ak < pivot) { // Move a[k] to left part
+                    a[k] = a[less];
+                    a[less] = ak;
+                    ++less;
+                }
+                else { // a[k] > pivot - Move a[k] to right part
+                    while (a[great] > pivot) {
+                        --great;
+                    }
+                    if (a[great] < pivot) { // a[great] <= pivot
+                        a[k] = a[less];
+                        a[less] = a[great];
+                        ++less;
+                    }
+                    else { // a[great] == pivot
+                        /*
+                         * Even though a[great] equals to pivot, the
+                         * assignment a[k] = pivot may be incorrect,
+                         * if a[great] and pivot are floating-point
+                         * zeros of different signs. Therefore in float
+                         * and double sorting methods we have to use
+                         * more accurate assignment a[k] = a[great].
+                         */
+                        a[k] = pivot;
+                    }
+                    a[great] = ak;
+                    --great;
+                }
+            }
+
+            /*
+             * Sort left and right parts recursively.
+             * All elements from center part are equal
+             * and, therefore, already sorted.
+             */
+            SortingIntTestJMH.sort(a, left, less - 1, leftmost);
+            SortingIntTestJMH.sort(a, great + 1, right, false);
+        }
+    }
+
+    private static void swap(int[] arr, int i, int j) {
+        int tmp = arr[i];
+        arr[i] = arr[j];
+        arr[j] = tmp;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Arrays/SortingLongBenchmarkTestJMH.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,725 @@
+/*
+ * Copyright 2015 Goldman Sachs.
+ * 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 org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Thread)
+@BenchmarkMode(Mode.Throughput)
+@OutputTimeUnit(TimeUnit.SECONDS)
+public class SortingLongBenchmarkTestJMH {
+    private static final int QUICKSORT_THRESHOLD = 286;
+    private static final int MAX_RUN_COUNT = 67;
+    private static final int INSERTION_SORT_THRESHOLD = 47;
+    public static final int MAX_VALUE = 1_000_000;
+
+    @Param({"pairFlipZeroPairFlip", "descendingAscending", "zeroHi", "hiZeroLow", "hiFlatLow", "identical",
+            "randomDups", "randomNoDups", "sortedReversedSorted", "pairFlip", "endLessThan"})
+    public String listType;
+
+    private long[] array;
+    private static final int LIST_SIZE = 10_000_000;
+    public static final int NUMBER_OF_ITERATIONS = 10;
+
+    @Setup
+    public void setUp() {
+        Random random = new Random(123456789012345L);
+        this.array = new long[LIST_SIZE];
+        int threeQuarters = (int) (LIST_SIZE * 0.75);
+        if ("zeroHi".equals(this.listType)) {
+            for (int i = 0; i < threeQuarters; i++) {
+                this.array[i] = 0;
+            }
+            int k = 1;
+            for (int i = threeQuarters; i < LIST_SIZE; i++) {
+                this.array[i] = k;
+                k++;
+            }
+        }
+        else if ("hiFlatLow".equals(this.listType)) {
+            int oneThird = LIST_SIZE / 3;
+            for (int i = 0; i < oneThird; i++) {
+                this.array[i] = i;
+            }
+            int twoThirds = oneThird * 2;
+            int constant = oneThird - 1;
+            for (int i = oneThird; i < twoThirds; i++) {
+                this.array[i] = constant;
+            }
+            for (int i = twoThirds; i < LIST_SIZE; i++) {
+                this.array[i] = constant - i + twoThirds;
+            }
+        }
+        else if ("hiZeroLow".equals(this.listType)) {
+            int oneThird = LIST_SIZE / 3;
+            for (int i = 0; i < oneThird; i++) {
+                this.array[i] = i;
+            }
+            int twoThirds = oneThird * 2;
+            for (int i = oneThird; i < twoThirds; i++) {
+                this.array[i] = 0;
+            }
+            for (int i = twoThirds; i < LIST_SIZE; i++) {
+                this.array[i] = oneThird - i + twoThirds;
+            }
+        }
+        else if ("identical".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = 0;
+            }
+        }
+        else if ("randomDups".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = random.nextInt(1000);
+            }
+        }
+        else if ("randomNoDups".equals(this.listType)) {
+            Set<Integer> set = new HashSet<>();
+            while (set.size() < LIST_SIZE + 1) {
+                set.add(random.nextInt());
+            }
+            List<Integer> list = new ArrayList<>(LIST_SIZE);
+            list.addAll(set);
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = list.get(i);
+            }
+        }
+        else if ("sortedReversedSorted".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE / 2; i++) {
+                this.array[i] = i;
+            }
+            int num = 0;
+            for (int i = LIST_SIZE / 2; i < LIST_SIZE; i++) {
+                this.array[i] = LIST_SIZE - num;
+                num++;
+            }
+        }
+        else if ("pairFlip".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE; i++) {
+                this.array[i] = i;
+            }
+            for (int i = 0; i < LIST_SIZE; i += 2) {
+                long temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+        }
+        else if ("endLessThan".equals(this.listType)) {
+            for (int i = 0; i < LIST_SIZE - 1; i++) {
+                this.array[i] = 3;
+            }
+            this.array[LIST_SIZE - 1] = 1;
+        }
+        else if ("pairFlipZeroPairFlip".equals(this.listType)) {
+            //pairflip
+            for (int i = 0; i < 64; i++) {
+                this.array[i] = i;
+            }
+            for (int i = 0; i < 64; i += 2) {
+                long temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+            //zero
+            for (int i = 64; i < this.array.length - 64; i++) {
+                this.array[i] = 0;
+            }
+            //pairflip
+            for (int i = this.array.length - 64; i < this.array.length; i++) {
+                this.array[i] = i;
+            }
+            for (int i = this.array.length - 64; i < this.array.length; i += 2) {
+                long temp = this.array[i];
+                this.array[i] = this.array[i + 1];
+                this.array[i + 1] = temp;
+            }
+        }
+        else if ("pairFlipOneHundredPairFlip".equals(this.listType)) {
+            //10, 5
+            for (int i = 0; i < 64; i++) {
+                if (i % 2 == 0) {
+                    this.array[i] = 10;
+                }
+                else {
+                    this.array[i] = 5;
+                }
+            }
+
+            //100
+            for (int i = 64; i < this.array.length - 64; i++) {
+                this.array[i] = 100;
+            }
+
+            //10, 5
+            for (int i = this.array.length - 64; i < this.array.length; i++) {
+                if (i % 2 == 0) {
+                    this.array[i] = 10;
+                }
+                else {
+                    this.array[i] = 5;
+                }
+            }
+        }
+    }
+
+    @Warmup(iterations = 20)
+    @Measurement(iterations = 10)
+    @Benchmark
+    public void sortNewWay() {
+        for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
+            SortingLongTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
+        }
+    }
+
+    @Warmup(iterations = 20)
+    @Measurement(iterations = 10)
+    @Benchmark
+    public void sortOldWay() {
+        for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
+            Arrays.sort(this.array);
+        }
+    }
+
+    /**
+     * Sorts the specified range of the array using the given
+     * workspace array slice if possible for merging
+     *
+     * @param a the array to be sorted
+     * @param left the index of the first element, inclusive, to be sorted
+     * @param right the index of the last element, inclusive, to be sorted
+     * @param work a workspace array (slice)
+     * @param workBase origin of usable space in work array
+     * @param workLen usable size of work array
+     */
+    static void sort(long[] a, int left, int right,
+                     long[] work, int workBase, int workLen) {
+// Use Quicksort on small arrays
+        if (right - left < QUICKSORT_THRESHOLD) {
+            SortingLongTestJMH.sort(a, left, right, true);
+            return;
+        }
+
+          /*
+         * Index run[i] is the start of i-th run
+         * (ascending or descending sequence).
+         */
+        int[] run = new int[MAX_RUN_COUNT + 1];
+        int count = 0;
+        run[0] = left;
+
+        // Check if the array is nearly sorted
+        for (int k = left; k < right; run[count] = k) {
+            while (k < right && a[k] == a[k + 1])
+                k++;
+            if (k == right) break;
+            if (a[k] < a[k + 1]) { // ascending
+                while (++k <= right && a[k - 1] <= a[k]) ;
+            }
+            else if (a[k] > a[k + 1]) { // descending
+                while (++k <= right && a[k - 1] >= a[k]) ;
+                for (int lo = run[count] - 1, hi = k; ++lo < --hi; ) {
+                    long t = a[lo];
+                    a[lo] = a[hi];
+                    a[hi] = t;
+                }
+            }
+            if (run[count] > left && a[run[count]] >= a[run[count] - 1]) {
+                count--;
+            }
+            /*
+             * The array is not highly structured,
+             * use Quicksort instead of merge sort.
+             */
+            if (++count == MAX_RUN_COUNT) {
+                sort(a, left, right, true);
+                return;
+            }
+        }
+
+        // Check special cases
+        // Implementation note: variable "right" is increased by 1.
+        if (run[count] == right++) {
+            run[++count] = right;
+        }
+        if (count <= 1) { // The array is already sorted
+            return;
+        }
+
+        // Determine alternation base for merge
+        byte odd = 0;
+        for (int n = 1; (n <<= 1) < count; odd ^= 1) {
+        }
+
+        // Use or create temporary array b for merging
+        long[] b;                  // temp array; alternates with a
+        int ao, bo;                 // array offsets from 'left'
+        int blen = right - left; // space needed for b
+        if (work == null || workLen < blen || workBase + blen > work.length) {
+            work = new long[blen];
+            workBase = 0;
+        }
+        if (odd == 0) {
+            System.arraycopy(a, left, work, workBase, blen);
+            b = a;
+            bo = 0;
+            a = work;
+            ao = workBase - left;
+        }
+        else {
+            b = work;
+            ao = 0;
+            bo = workBase - left;
+        }
+
+        // Merging
+        for (int last; count > 1; count = last) {
+            for (int k = (last = 0) + 2; k <= count; k += 2) {
+                int hi = run[k], mi = run[k - 1];
+                for (int i = run[k - 2], p = i, q = mi; i < hi; ++i) {
+                    if (q >= hi || p < mi && a[p + ao] <= a[q + ao]) {
+                        b[i + bo] = a[p++ + ao];
+                    }
+                    else {
+                        b[i + bo] = a[q++ + ao];
+                    }
+                }
+                run[++last] = hi;
+            }
+            if ((count & 1) != 0) {
+                for (int i = right, lo = run[count - 1]; --i >= lo;
+                     b[i + bo] = a[i + ao]
+                        ) {
+                }
+                run[++last] = right;
+            }
+            long[] t = a;
+            a = b;
+            b = t;
+            int o = ao;
+            ao = bo;
+            bo = o;
+        }
+    }
+
+    /**
+     * Sorts the specified range of the array by Dual-Pivot Quicksort.
+     *
+     * @param a the array to be sorted
+     * @param left the index of the first element, inclusive, to be sorted
+     * @param right the index of the last element, inclusive, to be sorted
+     * @param leftmost indicates if this part is the leftmost in the range
+     */
+    private static void sort(long[] a, int left, int right, boolean leftmost) {
+        int length = right - left + 1;
+
+        // Use insertion sort on tiny arrays
+        if (length < INSERTION_SORT_THRESHOLD) {
+            if (leftmost) {
+                /*
+                 * Traditional (without sentinel) insertion sort,
+                 * optimized for server VM, is used in case of
+                 * the leftmost part.
+                 */
+                for (int i = left, j = i; i < right; j = ++i) {
+                    long ai = a[i + 1];
+                    while (ai < a[j]) {
+                        a[j + 1] = a[j];
+                        if (j-- == left) {
+                            break;
+                        }
+                    }
+                    a[j + 1] = ai;
+                }
+            }
+            else {
+                /*
+                 * Skip the longest ascending sequence.
+                 */
+                do {
+                    if (left >= right) {
+                        return;
+                    }
+                }
+                while (a[++left] >= a[left - 1]);
+
+                /*
+                 * Every element from adjoining part plays the role
+                 * of sentinel, therefore this allows us to avoid the
+                 * left range check on each iteration. Moreover, we use
+                 * the more optimized algorithm, so called pair insertion
+                 * sort, which is faster (in the context of Quicksort)
+                 * than traditional implementation of insertion sort.
+                 */
+                for (int k = left; ++left <= right; k = ++left) {
+                    long a1 = a[k], a2 = a[left];
+
+                    if (a1 < a2) {
+                        a2 = a1;
+                        a1 = a[left];
+                    }
+                    while (a1 < a[--k]) {
+                        a[k + 2] = a[k];
+                    }
+                    a[++k + 1] = a1;
+
+                    while (a2 < a[--k]) {
+                        a[k + 1] = a[k];
+                    }
+                    a[k + 1] = a2;
+                }
+                long last = a[right];
+
+                while (last < a[--right]) {
+                    a[right + 1] = a[right];
+                }
+                a[right + 1] = last;
+            }
+            return;
+        }
+
+        // Inexpensive approximation of length / 7
+        int seventh = (length >> 3) + (length >> 6) + 1;
+
+        /*
+         * Sort five evenly spaced elements around (and including) the
+         * center element in the range. These elements will be used for
+         * pivot selection as described below. The choice for spacing
+         * these elements was empirically determined to work well on
+         * a wide variety of inputs.
+         */
+        int e3 = (left + right) >>> 1; // The midpoint
+        int e2 = e3 - seventh;
+        int e1 = e2 - seventh;
+        int e4 = e3 + seventh;
+        int e5 = e4 + seventh;
+
+        // Sort these elements using insertion sort
+        if (a[e2] < a[e1]) {
+            long t = a[e2];
+            a[e2] = a[e1];
+            a[e1] = t;
+        }
+
+        if (a[e3] < a[e2]) {
+            long t = a[e3];
+            a[e3] = a[e2];
+            a[e2] = t;
+            if (t < a[e1]) {
+                a[e2] = a[e1];
+                a[e1] = t;
+            }
+        }
+        if (a[e4] < a[e3]) {
+            long t = a[e4];
+            a[e4] = a[e3];
+            a[e3] = t;
+            if (t < a[e2]) {
+                a[e3] = a[e2];
+                a[e2] = t;
+                if (t < a[e1]) {
+                    a[e2] = a[e1];
+                    a[e1] = t;
+                }
+            }
+        }
+        if (a[e5] < a[e4]) {
+            long t = a[e5];
+            a[e5] = a[e4];
+            a[e4] = t;
+            if (t < a[e3]) {
+                a[e4] = a[e3];
+                a[e3] = t;
+                if (t < a[e2]) {
+                    a[e3] = a[e2];
+                    a[e2] = t;
+                    if (t < a[e1]) {
+                        a[e2] = a[e1];
+                        a[e1] = t;
+                    }
+                }
+            }
+        }
+
+        // Pointers
+        int less = left;  // The index of the first element of center part
+        int great = right; // The index before the first element of right part
+
+        if (a[e1] != a[e2] && a[e2] != a[e3] && a[e3] != a[e4] && a[e4] != a[e5]) {
+            /*
+             * Use the second and fourth of the five sorted elements as pivots.
+             * These values are inexpensive approximations of the first and
+             * second terciles of the array. Note that pivot1 <= pivot2.
+             */
+            long pivot1 = a[e2];
+            long pivot2 = a[e4];
+
+            /*
+             * The first and the last elements to be sorted are moved to the
+             * locations formerly occupied by the pivots. When partitioning
+             * is complete, the pivots are swapped back into their final
+             * positions, and excluded from subsequent sorting.
+             */
+            a[e2] = a[left];
+            a[e4] = a[right];
+
+            /*
+             * Skip elements, which are less or greater than pivot values.
+             */
+            while (a[++less] < pivot1) {
+            }
+            while (a[--great] > pivot2) {
+            }
+
+            /*
+             * Partitioning:
+             *
+             *   left part           center part                   right part
+             * +--------------------------------------------------------------+
+             * |  < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2  |
+             * +--------------------------------------------------------------+
+             *               ^                          ^       ^
+             *               |                          |       |
+             *              less                        k     great
+             *
+             * Invariants:
+             *
+             *              all in (left, less)   < pivot1
+             *    pivot1 <= all in [less, k)      <= pivot2
+             *              all in (great, right) > pivot2
+             *
+             * Pointer k is the first index of ?-part.
+             */
+            outer:
+            for (int k = less - 1; ++k <= great; ) {
+                long ak = a[k];
+                if (ak < pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
+                    /*
+                     * Here and below we use "a[i] = b; i++;" instead
+                     * of "a[i++] = b;" due to performance issue.
+                     */
+                    a[less] = ak;
+                    ++less;
+                }
+                else if (ak > pivot2) { // Move a[k] to right part
+                    while (a[great] > pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] < pivot1) { // a[great] <= pivot2
+                        a[k] = a[less];
+                        a[less] = a[great];
+                        ++less;
+                    }
+                    else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                    }
+                    /*
+                     * Here and below we use "a[i] = b; i--;" instead
+                     * of "a[i--] = b;" due to performance issue.
+                     */
+                    a[great] = ak;
+                    --great;
+                }
+            }
+
+            // Swap pivots into their final positions
+            a[left] = a[less - 1];
+            a[less - 1] = pivot1;
+            a[right] = a[great + 1];
+            a[great + 1] = pivot2;
+
+            // Sort left and right parts recursively, excluding known pivots
+            SortingLongTestJMH.sort(a, left, less - 2, leftmost);
+            SortingLongTestJMH.sort(a, great + 2, right, false);
+
+            /*
+             * If center part is too large (comprises > 4/7 of the array),
+             * swap internal pivot values to ends.
+             */
+            if (less < e1 && e5 < great) {
+                /*
+                 * Skip elements, which are equal to pivot values.
+                 */
+                while (a[less] == pivot1) {
+                    ++less;
+                }
+
+                while (a[great] == pivot2) {
+                    --great;
+                }
+
+                /*
+                 * Partitioning:
+                 *
+                 *   left part         center part                  right part
+                 * +----------------------------------------------------------+
+                 * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+                 * +----------------------------------------------------------+
+                 *              ^                        ^       ^
+                 *              |                        |       |
+                 *             less                      k     great
+                 *
+                 * Invariants:
+                 *
+                 *              all in (*,  less) == pivot1
+                 *     pivot1 < all in [less,  k)  < pivot2
+                 *              all in (great, *) == pivot2
+                 *
+                 * Pointer k is the first index of ?-part.
+                 */
+                outer:
+                for (int k = less - 1; ++k <= great; ) {
+                    long ak = a[k];
+                    if (ak == pivot1) { // Move a[k] to left part
+                        a[k] = a[less];
+                        a[less] = ak;
+                        ++less;
+                    }
+                    else if (ak == pivot2) { // Move a[k] to right part
+                        while (a[great] == pivot2) {
+                            if (great-- == k) {
+                                break outer;
+                            }
+                        }
+                        if (a[great] == pivot1) { // a[great] < pivot2
+                            a[k] = a[less];
+                            /*
+                             * Even though a[great] equals to pivot1, the
+                             * assignment a[less] = pivot1 may be incorrect,
+                             * if a[great] and pivot1 are floating-point zeros
+                             * of different signs. Therefore in float and
+                             * double sorting methods we have to use more
+                             * accurate assignment a[less] = a[great].
+                             */
+                            a[less] = pivot1;
+                            ++less;
+                        }
+                        else { // pivot1 < a[great] < pivot2
+                            a[k] = a[great];
+                        }
+                        a[great] = ak;
+                        --great;
+                    }
+                }
+            }
+
+            // Sort center part recursively
+            SortingLongTestJMH.sort(a, less, great, false);
+        }
+        else { // Partitioning with one pivot
+            /*
+             * Use the third of the five sorted elements as pivot.
+             * This value is inexpensive approximation of the median.
+             */
+            long pivot = a[e3];
+
+            /*
+             * Partitioning degenerates to the traditional 3-way
+             * (or "Dutch National Flag") schema:
+             *
+             *   left part    center part              right part
+             * +-------------------------------------------------+
+             * |  < pivot  |   == pivot   |     ?    |  > pivot  |
+             * +-------------------------------------------------+
+             *              ^              ^        ^
+             *              |              |        |
+             *             less            k      great
+             *
+             * Invariants:
+             *
+             *   all in (left, less)   < pivot
+             *   all in [less, k)     == pivot
+             *   all in (great, right) > pivot
+             *
+             * Pointer k is the first index of ?-part.
+             */
+            for (int k = less; k <= great; ++k) {
+                if (a[k] == pivot) {
+                    continue;
+                }
+                long ak = a[k];
+                if (ak < pivot) { // Move a[k] to left part
+                    a[k] = a[less];
+                    a[less] = ak;
+                    ++less;
+                }
+                else { // a[k] > pivot - Move a[k] to right part
+                    while (a[great] > pivot) {
+                        --great;
+                    }
+                    if (a[great] < pivot) { // a[great] <= pivot
+                        a[k] = a[less];
+                        a[less] = a[great];
+                        ++less;
+                    }
+                    else { // a[great] == pivot
+                        /*
+                         * Even though a[great] equals to pivot, the
+                         * assignment a[k] = pivot may be incorrect,
+                         * if a[great] and pivot are floating-point
+                         * zeros of different signs. Therefore in float
+                         * and double sorting methods we have to use
+                         * more accurate assignment a[k] = a[great].
+                         */
+                        a[k] = pivot;
+                    }
+                    a[great] = ak;
+                    --great;
+                }
+            }
+
+            /*
+             * Sort left and right parts recursively.
+             * All elements from center part are equal
+             * and, therefore, already sorted.
+             */
+            SortingLongTestJMH.sort(a, left, less - 1, leftmost);
+            SortingLongTestJMH.sort(a, great + 1, right, false);
+        }
+    }
+
+    private static void swap(long[] arr, int i, int j) {
+        long tmp = arr[i];
+        arr[i] = arr[j];
+        arr[j] = tmp;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Arrays/SortingNearlySortedPrimitive.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2015 Goldman Sachs.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @summary Tests the sorting of a large array of sorted primitive values,
+ *          predominently for cases where the array is nearly sorted. This tests
+ *          code that detects patterns in the array to determine if it is nearly
+ *          sorted and if so employs and optimizes merge sort rather than a
+ *          Dual-Pivot QuickSort.
+ *
+ * @run testng SortingNearlySortedPrimitive
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.function.Supplier;
+
+public class SortingNearlySortedPrimitive {
+    private static final int ARRAY_SIZE = 1_000_000;
+
+    @DataProvider(name = "arrays")
+    public Object[][] createData() {
+        return new Object[][]{
+                {"hiZeroLowTest", (Supplier<int[]>) this::hiZeroLowData},
+                {"endLessThanTest", (Supplier<int[]>) this::endLessThanData},
+                {"highFlatLowTest", (Supplier<int[]>) this::highFlatLowData},
+                {"identicalTest", (Supplier<int[]>) this::identicalData},
+                {"sortedReversedSortedTest", (Supplier<int[]>) this::sortedReversedSortedData},
+                {"pairFlipTest", (Supplier<int[]>) this::pairFlipData},
+                {"zeroHiTest", (Supplier<int[]>) this::zeroHiData},
+        };
+    }
+
+    @Test(dataProvider = "arrays")
+    public void runTests(String testName, Supplier<int[]> dataMethod) throws Exception {
+        int[] intSourceArray = dataMethod.get();
+
+        // Clone source array to ensure it is not modified
+        this.sortAndAssert(intSourceArray.clone());
+        this.sortAndAssert(floatCopyFromInt(intSourceArray));
+        this.sortAndAssert(doubleCopyFromInt(intSourceArray));
+        this.sortAndAssert(longCopyFromInt(intSourceArray));
+        this.sortAndAssert(shortCopyFromInt(intSourceArray));
+        this.sortAndAssert(charCopyFromInt(intSourceArray));
+    }
+
+    private float[] floatCopyFromInt(int[] src) {
+        float[] result = new float[src.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = src[i];
+        }
+        return result;
+    }
+
+    private double[] doubleCopyFromInt(int[] src) {
+        double[] result = new double[src.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = src[i];
+        }
+        return result;
+    }
+
+    private long[] longCopyFromInt(int[] src) {
+        long[] result = new long[src.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = src[i];
+        }
+        return result;
+    }
+
+    private short[] shortCopyFromInt(int[] src) {
+        short[] result = new short[src.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = (short) src[i];
+        }
+        return result;
+    }
+
+    private char[] charCopyFromInt(int[] src) {
+        char[] result = new char[src.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = (char) src[i];
+        }
+        return result;
+    }
+
+    private void sortAndAssert(int[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private void sortAndAssert(char[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private void sortAndAssert(short[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private void sortAndAssert(double[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private void sortAndAssert(float[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private void sortAndAssert(long[] array) {
+        Arrays.sort(array);
+        for (int i = 1; i < ARRAY_SIZE; i++) {
+            if (array[i] < array[i - 1]) {
+                throw new AssertionError("not sorted");
+            }
+        }
+        Assert.assertEquals(ARRAY_SIZE, array.length);
+    }
+
+    private int[] zeroHiData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        int threeQuarters = (int) (ARRAY_SIZE * 0.75);
+        for (int i = 0; i < threeQuarters; i++) {
+            array[i] = 0;
+        }
+        int k = 1;
+        for (int i = threeQuarters; i < ARRAY_SIZE; i++) {
+            array[i] = k;
+            k++;
+        }
+
+        return array;
+    }
+
+    private int[] hiZeroLowData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        int oneThird = ARRAY_SIZE / 3;
+        for (int i = 0; i < oneThird; i++) {
+            array[i] = i;
+        }
+        int twoThirds = oneThird * 2;
+        for (int i = oneThird; i < twoThirds; i++) {
+            array[i] = 0;
+        }
+        for (int i = twoThirds; i < ARRAY_SIZE; i++) {
+            array[i] = oneThird - i + twoThirds;
+        }
+        return array;
+    }
+
+    private int[] highFlatLowData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        int oneThird = ARRAY_SIZE / 3;
+        for (int i = 0; i < oneThird; i++) {
+            array[i] = i;
+        }
+        int twoThirds = oneThird * 2;
+        int constant = oneThird - 1;
+        for (int i = oneThird; i < twoThirds; i++) {
+            array[i] = constant;
+        }
+        for (int i = twoThirds; i < ARRAY_SIZE; i++) {
+            array[i] = constant - i + twoThirds;
+        }
+
+        return array;
+    }
+
+    private int[] identicalData() {
+        int[] array = new int[ARRAY_SIZE];
+        int listNumber = 24;
+
+        for (int i = 0; i < ARRAY_SIZE; i++) {
+            array[i] = listNumber;
+        }
+
+        return array;
+    }
+
+    private int[] endLessThanData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        for (int i = 0; i < ARRAY_SIZE - 1; i++) {
+            array[i] = 3;
+        }
+        array[ARRAY_SIZE - 1] = 1;
+
+        return array;
+    }
+
+    private int[] sortedReversedSortedData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        for (int i = 0; i < ARRAY_SIZE / 2; i++) {
+            array[i] = i;
+        }
+        int num = 0;
+        for (int i = ARRAY_SIZE / 2; i < ARRAY_SIZE; i++) {
+            array[i] = ARRAY_SIZE - num;
+            num++;
+        }
+
+        return array;
+    }
+
+    private int[] pairFlipData() {
+        int[] array = new int[ARRAY_SIZE];
+
+        for (int i = 0; i < ARRAY_SIZE; i++) {
+            array[i] = i;
+        }
+        for (int i = 0; i < ARRAY_SIZE; i += 2) {
+            int temp = array[i];
+            array[i] = array[i + 1];
+            array[i + 1] = temp;
+        }
+
+        return array;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/PropertyPermission/PropertyPermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for PropertyPermissionCollection subclass
+ */
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import java.util.PropertyPermission;
+
+public class PropertyPermissionCollection {
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        PropertyPermission perm = new PropertyPermission("user.home", "read");
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println
+            ("test 1: add throws IllegalArgExc for wrong perm type");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong perm type");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println
+            ("test 3: implies returns true for match on name and action");
+        perms.add(new PropertyPermission("user.home", "read"));
+        if (!perms.implies(new PropertyPermission("user.home", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println
+            ("test 4: implies returns false for match on name but not action");
+        if (perms.implies(new PropertyPermission("user.home", "write"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println("test 5: implies returns true for match " +
+                           "on name and subset of actions");
+        perms.add(new PropertyPermission("java.home", "read, write"));
+        if (!perms.implies(new PropertyPermission("java.home", "write"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 6
+        System.out.println("test 6: implies returns true for aggregate " +
+                           "match on name and action");
+        perms.add(new PropertyPermission("user.name", "read"));
+        perms.add(new PropertyPermission("user.name", "write"));
+        if (!perms.implies(new PropertyPermission("user.name", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+        if (!perms.implies(new PropertyPermission("user.name", "write,read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 7
+        System.out.println("test 7: implies returns true for wildcard " +
+                           "and match on action");
+        perms.add(new PropertyPermission("foo.*", "read"));
+        if (!perms.implies(new PropertyPermission("foo.bar", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println("test 8: implies returns true for deep " +
+                           "wildcard and match on action");
+        if (!perms.implies(new PropertyPermission("foo.bar.baz", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println
+            ("test 8: implies returns false for invalid wildcard");
+        perms.add(new PropertyPermission("baz*", "read"));
+        if (perms.implies(new PropertyPermission("baz.foo", "read"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 9
+        System.out.println("test 9: implies returns true for all " +
+                           "wildcard and match on action");
+        perms.add(new PropertyPermission("*", "read"));
+        if (!perms.implies(new PropertyPermission("java.version", "read"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 10
+        System.out.println("test 10: implies returns false for wildcard " +
+                           "and non-match on action");
+        if (perms.implies(new PropertyPermission("java.version", "write"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 11
+        System.out.println("test 11: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        // the 2 user.name permissions added were combined into one
+        if (numPerms != 6) {
+            System.err.println("Expected 6, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/concurrent/LinkedTransferQueue/SpliteratorTraverseAddRemoveTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @run testng SpliteratorTraverseAddRemoveTest
+ * @bug 8085978
+ * @summary repeatedly traverse the queue using the spliterator while
+ *          concurrently adding and removing an element to test that self-linked
+ *          nodes are never erroneously reported on traversal
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Queue;
+import java.util.Spliterator;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.LinkedTransferQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+
+@Test
+public class SpliteratorTraverseAddRemoveTest {
+
+    static Object[] of(String desc, Consumer<Queue<?>> c) {
+        return new Object[]{desc, c};
+    }
+
+    static void assertIsString(Object e) {
+        Assert.assertTrue(e instanceof String,
+                          String.format("Object instanceof %s (actual: instanceof %s)",
+                                        String.class.getName(),
+                                        e.getClass().getName()));
+    }
+
+    @DataProvider()
+    public static Object[][] spliteratorTraversers() {
+        return new Object[][]{
+                of("forEachRemaining", q -> {
+                    q.spliterator().forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString);
+                }),
+                of("tryAdvance", q -> {
+                    Spliterator<?> s = q.spliterator();
+                    while (s.tryAdvance(SpliteratorTraverseAddRemoveTest::assertIsString))
+                        ;
+                }),
+                of("trySplit then forEachRemaining", q -> {
+                    Spliterator<?> r = q.spliterator();
+
+                    List<Spliterator<?>> ss = new ArrayList<>();
+                    Spliterator<?> l;
+                    while ((l = r.trySplit()) != null) {
+                        ss.add(l);
+                    }
+                    ss.add(r);
+
+                    ss.forEach(s -> s.forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString));
+                }),
+        };
+    }
+
+    @Test(dataProvider = "spliteratorTraversers")
+    public void testQueue(String desc, Consumer<Queue<String>> c)
+            throws InterruptedException {
+        AtomicBoolean done = new AtomicBoolean(false);
+        Queue<String> msgs = new LinkedTransferQueue<>();
+
+        CompletableFuture<Void> traversalTask = CompletableFuture.runAsync(() -> {
+            while (!done.get()) {
+                // Traversal will fail if self-linked nodes of
+                // LinkedTransferQueue are erroneously reported
+                c.accept(msgs);
+            }
+        });
+        CompletableFuture<Void> addAndRemoveTask = CompletableFuture.runAsync(() -> {
+            while (!traversalTask.isDone()) {
+                msgs.add("msg");
+                msgs.remove("msg");
+            }
+        });
+
+        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
+        done.set(true);
+
+        addAndRemoveTask.join();
+        Assert.assertTrue(traversalTask.isDone());
+        traversalTask.join();
+    }
+}
--- a/test/javax/net/ssl/DTLS/DTLSUnSupportedCiphersTest.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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.
- */
-
-/*
- * @test
- * @bug 8043758
- * @summary Testing that try to enable unsupported ciphers
- *          causes IllegalArgumentException.
- * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
- * @run main/othervm -Dtest.security.protocol=DTLS DTLSUnSupportedCiphersTest
- */
-
-/**
- * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
- */
-public class DTLSUnSupportedCiphersTest {
-    public static void main(String[] args) {
-        UnSupportedCiphersTest.main(args);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/DTLS/DTLSUnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043758
+ * @summary Testing that try to enable unsupported ciphers
+ *          causes IllegalArgumentException.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=DTLS DTLSUnsupportedCiphersTest
+ */
+
+/**
+ * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class DTLSUnsupportedCiphersTest {
+    public static void main(String[] args) {
+        UnsupportedCiphersTest.main(args);
+    }
+}
--- a/test/javax/net/ssl/DTLSv10/DTLSv10UnSupportedCiphersTest.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.
- */
-
-/*
- * @test
- * @bug 8043758
- * @summary Testing that try to enable unsupported ciphers
- *          causes IllegalArgumentException.
- * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
- * @run main/othervm -Dtest.security.protocol=DTLSv1.0
- *      DTLSv10UnSupportedCiphersTest
- */
-
-/**
- * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
- */
-public class DTLSv10UnSupportedCiphersTest {
-    public static void main(String[] args) {
-        UnSupportedCiphersTest.main(args);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/DTLSv10/DTLSv10UnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043758
+ * @summary Testing that try to enable unsupported ciphers
+ *          causes IllegalArgumentException.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=DTLSv1.0
+ *      DTLSv10UnsupportedCiphersTest
+ */
+
+/**
+ * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class DTLSv10UnsupportedCiphersTest {
+    public static void main(String[] args) {
+        UnsupportedCiphersTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSDataExchangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS application data exchange using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSDataExchangeTest
+ */
+
+/**
+ * Testing TLS application data exchange using each of the supported cipher
+ * suites.
+ */
+public class TLSDataExchangeTest {
+    public static void main(String[] args) {
+        DataExchangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSEnginesClosureTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines closing using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSEnginesClosureTest
+ */
+
+/**
+ * Testing TLS engines closing using each of the supported cipher suites.
+ */
+public class TLSEnginesClosureTest {
+    public static void main(String[] args) {
+        EnginesClosureTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSHandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSHandshakeTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites.
+ */
+public class TLSHandshakeTest {
+    public static void main(String[] args) {
+        HandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSMFLNTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites with different maximum fragment length. Testing of
+ *          MFLN extension.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSMFLNTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites with
+ * different maximum fragment length. Testing of MFLN extension.
+ */
+public class TLSMFLNTest {
+    public static void main(String[] args) {
+        MFLNTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSNotEnabledRC4Test.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines do not enable RC4 ciphers by default.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS TLSNotEnabledRC4Test
+ */
+
+/**
+ * Testing DTLS engines do not enable RC4 ciphers by default.
+ */
+public class TLSNotEnabledRC4Test {
+    public static void main(String[] args) throws Exception {
+        NotEnabledRC4Test.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSRehandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSRehandshakeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher
+ * suites.
+ */
+public class TLSRehandshakeTest {
+    public static void main(String[] args) {
+        RehandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSRehandshakeWithCipherChangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines re-handshaking with cipher change. New cipher
+ *          is taken randomly from the supporetd ciphers list.
+ * @key randomness
+ * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS TLSRehandshakeWithCipherChangeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking with cipher change. New cipher is taken
+ * randomly from the supported ciphers list.
+ */
+public class TLSRehandshakeWithCipherChangeTest {
+    public static void main(String[] args) {
+        RehandshakeWithCipherChangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSRehandshakeWithDataExTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites with application data exchange before and after
+ *          re-handshake and closing of the engines.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=norm_sni TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLS -Dtest.mode=krb TLSRehandshakeWithDataExTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher suites
+ * with application data exchange before and after re-handshake and closing of
+ * the engines.
+ */
+public class TLSRehandshakeWithDataExTest {
+    public static void main(String[] args) {
+        RehandshakeWithDataExTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLS/TLSUnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing that try to enable unsupported ciphers
+ *          causes IllegalArgumentException.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLS TLSUnsupportedCiphersTest
+ */
+
+/**
+ * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class TLSUnsupportedCiphersTest {
+    public static void main(String[] args) {
+        UnsupportedCiphersTest.main(args);
+    }
+}
--- a/test/javax/net/ssl/TLSCommon/UnSupportedCiphersTest.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-
-/**
- * Testing that try to enable unsupported ciphers causes IllegalArgumentException.
- */
-public class UnSupportedCiphersTest extends SSLEngineTestCase {
-
-    public static void main(String[] s) {
-        UnSupportedCiphersTest test = new UnSupportedCiphersTest();
-        test.runTests(Ciphers.UNSUPPORTED_CIPHERS);
-    }
-
-    @Override
-    protected void testOneCipher(String cipher) {
-        unsupTest(cipher, true);
-        unsupTest(cipher, false);
-    }
-
-    private void unsupTest(String cipher, boolean clientTest) {
-        SSLContext context = getContext();
-        SSLEngine clientEngine = context.createSSLEngine();
-        clientEngine.setUseClientMode(true);
-        SSLEngine serverEngine = context.createSSLEngine();
-        serverEngine.setUseClientMode(false);
-        if (clientTest) {
-            clientEngine.setEnabledCipherSuites(new String[]{cipher});
-        } else {
-            serverEngine.setEnabledCipherSuites(new String[]{cipher});
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSCommon/UnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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 javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+
+/**
+ * Testing that try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class UnsupportedCiphersTest extends SSLEngineTestCase {
+
+    public static void main(String[] s) {
+        UnsupportedCiphersTest test = new UnsupportedCiphersTest();
+        test.runTests(Ciphers.UNSUPPORTED_CIPHERS);
+    }
+
+    @Override
+    protected void testOneCipher(String cipher) {
+        unsupTest(cipher, true);
+        unsupTest(cipher, false);
+    }
+
+    private void unsupTest(String cipher, boolean clientTest) {
+        SSLContext context = getContext();
+        SSLEngine clientEngine = context.createSSLEngine();
+        clientEngine.setUseClientMode(true);
+        SSLEngine serverEngine = context.createSSLEngine();
+        serverEngine.setUseClientMode(false);
+        if (clientTest) {
+            clientEngine.setEnabledCipherSuites(new String[]{cipher});
+        } else {
+            serverEngine.setEnabledCipherSuites(new String[]{cipher});
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSDataExchangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS application data exchange using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSDataExchangeTest
+ */
+
+/**
+ * Testing TLS application data exchange using each of the supported cipher
+ * suites.
+ */
+public class TLSDataExchangeTest {
+    public static void main(String[] args) {
+        DataExchangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSEnginesClosureTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines closing using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSEnginesClosureTest
+ */
+
+/**
+ * Testing TLS engines closing using each of the supported cipher suites.
+ */
+public class TLSEnginesClosureTest {
+    public static void main(String[] args) {
+        EnginesClosureTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSHandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSHandshakeTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites.
+ */
+public class TLSHandshakeTest {
+    public static void main(String[] args) {
+        HandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSMFLNTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites with different maximum fragment length. Testing of
+ *          MFLN extension.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSMFLNTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites with
+ * different maximum fragment length. Testing of MFLN extension.
+ */
+public class TLSMFLNTest {
+    public static void main(String[] args) {
+        MFLNTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSNotEnabledRC4Test.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines do not enable RC4 ciphers by default.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 TLSNotEnabledRC4Test
+ */
+
+/**
+ * Testing DTLS engines do not enable RC4 ciphers by default.
+ */
+public class TLSNotEnabledRC4Test {
+    public static void main(String[] args) throws Exception {
+        NotEnabledRC4Test.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSRehandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSRehandshakeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher
+ * suites.
+ */
+public class TLSRehandshakeTest {
+    public static void main(String[] args) {
+        RehandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSRehandshakeWithCipherChangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines re-handshaking with cipher change. New cipher
+ *          is taken randomly from the supporetd ciphers list.
+ * @key randomness
+ * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 TLSRehandshakeWithCipherChangeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking with cipher change. New cipher is taken
+ * randomly from the supported ciphers list.
+ */
+public class TLSRehandshakeWithCipherChangeTest {
+    public static void main(String[] args) {
+        RehandshakeWithCipherChangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSRehandshakeWithDataExTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites with application data exchange before and after
+ *          re-handshake and closing of the engines.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=norm_sni TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1 -Dtest.mode=krb TLSRehandshakeWithDataExTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher suites
+ * with application data exchange before and after re-handshake and closing of
+ * the engines.
+ */
+public class TLSRehandshakeWithDataExTest {
+    public static void main(String[] args) {
+        RehandshakeWithDataExTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv1/TLSUnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing that try to enable unsupported ciphers
+ *          causes IllegalArgumentException.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1 TLSUnsupportedCiphersTest
+ */
+
+/**
+ * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class TLSUnsupportedCiphersTest {
+    public static void main(String[] args) {
+        UnsupportedCiphersTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSDataExchangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS application data exchange using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSDataExchangeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSDataExchangeTest
+ */
+
+/**
+ * Testing TLS application data exchange using each of the supported cipher
+ * suites.
+ */
+public class TLSDataExchangeTest {
+    public static void main(String[] args) {
+        DataExchangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSEnginesClosureTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines closing using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSEnginesClosureTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSEnginesClosureTest
+ */
+
+/**
+ * Testing TLS engines closing using each of the supported cipher suites.
+ */
+public class TLSEnginesClosureTest {
+    public static void main(String[] args) {
+        EnginesClosureTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSHandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSHandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSHandshakeTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites.
+ */
+public class TLSHandshakeTest {
+    public static void main(String[] args) {
+        HandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSMFLNTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines handshake using each of the supported
+ *          cipher suites with different maximum fragment length. Testing of
+ *          MFLN extension.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSMFLNTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSMFLNTest
+ */
+
+/**
+ * Testing TLS engines handshake using each of the supported cipher suites with
+ * different maximum fragment length. Testing of MFLN extension.
+ */
+public class TLSMFLNTest {
+    public static void main(String[] args) {
+        MFLNTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSNotEnabledRC4Test.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines do not enable RC4 ciphers by default.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 TLSNotEnabledRC4Test
+ */
+
+/**
+ * Testing DTLS engines do not enable RC4 ciphers by default.
+ */
+public class TLSNotEnabledRC4Test {
+    public static void main(String[] args) throws Exception {
+        NotEnabledRC4Test.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSRehandshakeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSRehandshakeTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSRehandshakeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher
+ * suites.
+ */
+public class TLSRehandshakeTest {
+    public static void main(String[] args) {
+        RehandshakeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSRehandshakeWithCipherChangeTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8085979
+ * @summary Testing TLS engines re-handshaking with cipher change. New cipher
+ *          is taken randomly from the supporetd ciphers list.
+ * @key randomness
+ * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 TLSRehandshakeWithCipherChangeTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking with cipher change. New cipher is taken
+ * randomly from the supported ciphers list.
+ */
+public class TLSRehandshakeWithCipherChangeTest {
+    public static void main(String[] args) {
+        RehandshakeWithCipherChangeTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSRehandshakeWithDataExTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing TLS engines re-handshaking using each of the supported
+ *          cipher suites with application data exchange before and after
+ *          re-handshake and closing of the engines.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=norm_sni TLSRehandshakeWithDataExTest
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 -Dtest.mode=krb TLSRehandshakeWithDataExTest
+ */
+
+/**
+ * Testing TLS engines re-handshaking using each of the supported cipher suites
+ * with application data exchange before and after re-handshake and closing of
+ * the engines.
+ */
+public class TLSRehandshakeWithDataExTest {
+    public static void main(String[] args) {
+        RehandshakeWithDataExTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/net/ssl/TLSv11/TLSUnsupportedCiphersTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8085979
+ * @summary Testing that try to enable unsupported ciphers
+ *          causes IllegalArgumentException.
+ * @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
+ * @run main/othervm -Dtest.security.protocol=TLSv1.1 TLSUnsupportedCiphersTest
+ */
+
+/**
+ * Testing that a try to enable unsupported ciphers causes IllegalArgumentException.
+ */
+public class TLSUnsupportedCiphersTest {
+    public static void main(String[] args) {
+        UnsupportedCiphersTest.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/security/auth/kerberos/DelegationPermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for DelegationPermissionCollection subclass
+ */
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import javax.security.auth.kerberos.DelegationPermission;
+
+public class DelegationPermissionCollection {
+
+    private static final String FOO = "\"host/foo.example.com@EXAMPLE.COM\"";
+    private static final String BAR = "\"host/bar.example.com@EXAMPLE.COM\"";
+    private static final String TGT = "\"krbtgt/EXAMPLE.COM@EXAMPLE.COM\"";
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        DelegationPermission perm = new DelegationPermission(FOO + " " + TGT);
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println
+            ("test 1: add throws IllegalArgException for wrong perm type");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong perm type");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println("test 3: implies returns true for match on name");
+        perms.add(new DelegationPermission(FOO + " " + TGT));
+        if (!perms.implies(new DelegationPermission(FOO + " " + TGT))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println
+            ("test 4: implies returns false for non-match on name");
+        if (perms.implies(new DelegationPermission(BAR + " " + TGT))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println("test 5: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        if (numPerms != 1) {
+            System.err.println("Expected 1, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/security/auth/kerberos/ServicePermissionCollection.java	Tue Jun 16 10:52:39 2015 -0700
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8056179
+ * @summary Unit test for ServicePermissionCollection subclass
+ */
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import javax.security.auth.kerberos.ServicePermission;
+
+public class ServicePermissionCollection {
+
+    private static final String FOO = "host/foo.example.com@EXAMPLE.COM";
+    private static final String BAR = "host/bar.example.com@EXAMPLE.COM";
+    private static final String BAZ = "host/baz.example.com@EXAMPLE.COM";
+
+    public static void main(String[] args) throws Exception {
+
+        int testFail = 0;
+
+        ServicePermission perm = new ServicePermission(FOO, "accept");
+        PermissionCollection perms = perm.newPermissionCollection();
+
+        // test 1
+        System.out.println
+            ("test 1: add throws IllegalArgExc for wrong permission type");
+        try {
+            perms.add(new SecurityPermission("createAccessControlContext"));
+            System.err.println("Expected IllegalArgumentException");
+            testFail++;
+        } catch (IllegalArgumentException iae) {}
+
+        // test 2
+        System.out.println("test 2: implies returns false for wrong perm type");
+        if (perms.implies(new SecurityPermission("getPolicy"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 3
+        System.out.println
+            ("test 3: implies returns true for match on name and action");
+        perms.add(new ServicePermission(FOO, "accept"));
+        if (!perms.implies(new ServicePermission(FOO, "accept"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 4
+        System.out.println
+            ("test 4: implies returns false for match on name but not action");
+        if (perms.implies(new ServicePermission(FOO, "initiate"))) {
+            System.err.println("Expected false, returned true");
+            testFail++;
+        }
+
+        // test 5
+        System.out.println("test 5: implies returns true for match on " +
+                           "name and subset of actions");
+        perms.add(new ServicePermission(BAR, "accept, initiate"));
+        if (!perms.implies(new ServicePermission(BAR, "accept"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 6
+        System.out.println("test 6: implies returns false for aggregate " +
+                           "match on name and action");
+        perms.add(new ServicePermission(BAZ, "accept"));
+        perms.add(new ServicePermission(BAZ, "initiate"));
+        if (!perms.implies(new ServicePermission(BAZ, "initiate"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+        if (!perms.implies(new ServicePermission(BAZ, "initiate, accept"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 7
+        System.out.println("test 7: implies returns true for wildcard " +
+                           "match on name and action");
+        perms.add(new ServicePermission("*", "initiate"));
+        if (!perms.implies(new ServicePermission("Duke", "initiate"))) {
+            System.err.println("Expected true, returned false");
+            testFail++;
+        }
+
+        // test 8
+        System.out.println("test 8: elements returns correct number of perms");
+        int numPerms = 0;
+        Enumeration<Permission> e = perms.elements();
+        while (e.hasMoreElements()) {
+            numPerms++;
+            System.out.println(e.nextElement());
+        }
+        // the 2 FOO permissions and the 2 BAZ permisssions
+        // are combined into one
+        if (numPerms != 4) {
+            System.err.println("Expected 4, got " + numPerms);
+            testFail++;
+        }
+
+        if (testFail > 0) {
+            throw new Exception(testFail + " test(s) failed");
+        }
+    }
+}
--- a/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Mon Jun 08 11:31:09 2015 -0700
+++ b/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Tue Jun 16 10:52:39 2015 -0700
@@ -21,25 +21,29 @@
  * questions.
  */
 
-/*
- * @test
- * @bug 8042397
- * @summary Unit test for jmap utility test heap configuration reader
- * @library /lib/testlibrary
- * @modules java.management
- * @build jdk.testlibrary.*
- * @build JMapHeapConfigTest LingeredApp TmtoolTestScenario
- * @run main JMapHeapConfigTest
- */
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import jdk.test.lib.apps.LingeredApp;
 import jdk.testlibrary.Utils;
 import jdk.testlibrary.Platform;
 
+/*
+ * @test
+ * @bug 8042397
+ * @summary Unit test for jmap utility test heap configuration reader
+ * @library /../../test/lib/share/classes
+ * @library /lib/testlibrary
+ * @modules java.management
+ * @build jdk.testlibrary.*
+ * @build jdk.test.lib.apps.*
+ * @build JMapHeapConfigTest TmtoolTestScenario
+ * @run main JMapHeapConfigTest
+ */
 public class JMapHeapConfigTest {
 
     static final String expectedJMapValues[] = {
--- a/test/sun/tools/jmap/heapconfig/LingeredApp.java	Mon Jun 08 11:31:09 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,431 +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.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.nio.file.attribute.FileTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * This is a framework to launch an app that could be synchronized with caller
- * to make further attach actions reliable across supported platforms
-
- * Caller example:
- *   SmartTestApp a = SmartTestApp.startApp(cmd);
- *     // do something
- *   a.stopApp();
- *
- *   or fine grained control
- *
- *   a = new SmartTestApp("MyLock.lck");
- *   a.createLock();
- *   a.runApp();
- *   a.waitAppReady();
- *     // do something
- *   a.deleteLock();
- *   a.waitAppTerminate();
- *
- *  Then you can work with app output and process object
- *
- *   output = a.getAppOutput();
- *   process = a.getProcess();
- *
- */
-public class LingeredApp {
-
-    private static final long spinDelay = 1000;
-
-    private final String lockFileName;
-    private long lockCreationTime;
-    private Process appProcess;
-    private final ArrayList<String> storedAppOutput;
-
-    /*
-     * Drain child process output, store it into string array
-     */
-    class InputGobbler extends Thread {
-
-        InputStream is;
-        List<String> astr;
-
-        InputGobbler(InputStream is, List<String> astr) {
-            this.is = is;
-            this.astr = astr;
-        }
-
-        public void run() {
-            try {
-                InputStreamReader isr = new InputStreamReader(is);
-                BufferedReader br = new BufferedReader(isr);
-                String line = null;
-                while ((line = br.readLine()) != null) {
-                    astr.add(line);
-                }
-            } catch (IOException ex) {
-                // pass
-            }
-        }
-    }
-
-    /**
-     * Create LingeredApp object on caller side. Lock file have be a valid filename
-     * at writable location
-     *
-     * @param lockFileName - the name of lock file
-     */
-    public LingeredApp(String lockFileName) {
-        this.lockFileName = lockFileName;
-        this.storedAppOutput = new ArrayList();
-    }
-
-    /**
-     *
-     * @return name of lock file
-     */
-    public String getLockFileName() {
-        return this.lockFileName;
-    }
-
-    /**
-     *
-     * @return name of testapp
-     */
-    public String getAppName() {
-        return this.getClass().getName();
-    }
-
-    /**
-     *
-     *  @return pid of java process running testapp
-     */
-    public long getPid() {
-        if (appProcess == null) {
-            throw new RuntimeException("Process is not alive");
-        }
-        return appProcess.getPid();
-    }
-
-    /**
-     *
-     * @return process object
-     */
-    public Process getProcess() {
-        return appProcess;
-    }
-
-    /**
-     *
-     * @return application output as string array. Empty array if application produced no output
-     */
-    List<String> getAppOutput() {
-        if (appProcess.isAlive()) {
-            throw new RuntimeException("Process is still alive. Can't get its output.");
-        }
-        return storedAppOutput;
-    }
-
-    /* Make sure all part of the app use the same method to get dates,
-     as different methods could produce different results
-     */
-    private static long epoch() {
-        return new Date().getTime();
-    }
-
-    private static long lastModified(String fileName) throws IOException {
-        Path path = Paths.get(fileName);
-        BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
-        return attr.lastModifiedTime().toMillis();
-    }
-
-    private static void setLastModified(String fileName, long newTime) throws IOException {
-        Path path = Paths.get(fileName);
-        FileTime fileTime = FileTime.fromMillis(newTime);
-        Files.setLastModifiedTime(path, fileTime);
-    }
-
-    /**
-     * create lock
-     *
-     * @throws IOException
-     */
-    public void createLock() throws IOException {
-        Path path = Paths.get(lockFileName);
-        // Files.deleteIfExists(path);
-        Files.createFile(path);
-        lockCreationTime = lastModified(lockFileName);
-    }
-
-    /**
-     * Delete lock
-     *
-     * @throws IOException
-     */
-    public void deleteLock() throws IOException {
-        try {
-            Path path = Paths.get(lockFileName);
-            Files.delete(path);
-        } catch (NoSuchFileException ex) {
-            // Lock already deleted. Ignore error
-        }
-    }
-
-    public void waitAppTerminate() {
-        while (true) {
-            try {
-                appProcess.waitFor();
-                break;
-            } catch (InterruptedException ex) {
-                // pass
-            }
-        }
-    }
-
-    /**
-     * The app touches the lock file when it's started
-     * wait while it happens. Caller have to delete lock on wait error.
-     *
-     * @param timeout
-     * @throws java.io.IOException
-     */
-    public void waitAppReady(long timeout) throws IOException {
-        long here = epoch();
-        while (true) {
-            long epoch = epoch();
-            if (epoch - here > (timeout * 1000)) {
-                throw new IOException("App waiting timeout");
-            }
-
-            // Live process should touch lock file every second
-            long lm = lastModified(lockFileName);
-            if (lm > lockCreationTime) {
-                break;
-            }
-
-            // Make sure process didn't already exit
-            if (!appProcess.isAlive()) {
-                throw new IOException("App exited unexpectedly with " + appProcess.exitValue());
-            }
-
-            try {
-                Thread.sleep(spinDelay);
-            } catch (InterruptedException ex) {
-                // pass
-            }
-        }
-    }
-
-    /**
-     * Run the app
-     *
-     * @param vmArguments
-     * @throws IOException
-     */
-    public void runApp(List<String> vmArguments)
-            throws IOException {
-
-        // We should always use testjava or throw an exception,
-        // so we can't use JDKToolFinder.getJDKTool("java");
-        // that falls back to compile java on error
-        String jdkPath = System.getProperty("test.jdk");
-        if (jdkPath == null) {
-            // we are not under jtreg, try env
-            Map<String, String> env = System.getenv();
-            jdkPath = env.get("TESTJAVA");
-        }
-
-        if (jdkPath == null) {
-            throw new RuntimeException("Can't determine jdk path neither test.jdk property no TESTJAVA env are set");
-        }
-
-        String osname = System.getProperty("os.name");
-        String javapath = jdkPath + ((osname.startsWith("window")) ? "/bin/java.exe" : "/bin/java");
-
-        List<String> cmd = new ArrayList();
-        cmd.add(javapath);
-
-
-        if (vmArguments == null) {
-            // Propagate test.vm.options to LingeredApp, filter out possible empty options
-            String testVmOpts[] = System.getProperty("test.vm.opts","").split("\\s+");
-            for (String s : testVmOpts) {
-                if (!s.equals("")) {
-                    cmd.add(s);
-                }
-            }
-        }
-        else{
-            // Lets user manage LingerApp options
-            cmd.addAll(vmArguments);
-        }
-
-        // Make sure we set correct classpath to run the app
-        cmd.add("-cp");
-        String classpath = System.getProperty("test.class.path");
-        cmd.add((classpath == null) ? "." : classpath);
-
-        cmd.add(this.getAppName());
-        cmd.add(lockFileName);
-
-        // Reporting
-        StringBuilder cmdLine = new StringBuilder();
-        for (String strCmd : cmd) {
-            cmdLine.append("'").append(strCmd).append("' ");
-        }
-
-        // A bit of verbosity
-        System.out.println("Command line: [" + cmdLine.toString() + "]");
-
-        ProcessBuilder pb = new ProcessBuilder(cmd);
-        // we don't expect any error output but make sure we are not stuck on pipe
-        // pb.redirectErrorStream(false);
-        pb.redirectError(ProcessBuilder.Redirect.INHERIT);
-
-        appProcess = pb.start();
-
-        // Create pipe reader for process, and read stdin and stderr to array of strings
-        InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput);
-        gb.start();
-    }
-
-    /**
-     *  High level interface for test writers
-     */
-    /**
-     * Factory method that creates SmartAppTest object with ready to use application
-     *