changeset 12458:7f6ac78c4644

Merge
author ddehaven
date Wed, 15 Jul 2015 10:00:15 -0700
parents ebdeb89e5dfb 5b7c04474d88
children 6c39ec510816
files make/non-build-utils/sharing/README.txt make/non-build-utils/sharing/tests/GHello.java make/non-build-utils/sharing/tests/Hello.java make/non-build-utils/sharing/tests/JHello.java make/non-build-utils/src/build/tools/makeclasslist/MakeClasslist.java src/java.desktop/share/classes/sun/net/www/content/audio/aiff.java src/java.desktop/share/classes/sun/net/www/content/audio/basic.java src/java.desktop/share/classes/sun/net/www/content/audio/wav.java src/java.desktop/share/classes/sun/net/www/content/audio/x_aiff.java src/java.desktop/share/classes/sun/net/www/content/audio/x_wav.java src/java.desktop/share/classes/sun/net/www/content/image/gif.java src/java.desktop/share/classes/sun/net/www/content/image/jpeg.java src/java.desktop/share/classes/sun/net/www/content/image/png.java src/java.desktop/share/classes/sun/net/www/content/image/x_xbitmap.java src/java.desktop/share/classes/sun/net/www/content/image/x_xpixmap.java
diffstat 149 files changed, 5581 insertions(+), 1253 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jul 15 15:48:32 2015 +0300
+++ b/.hgtags	Wed Jul 15 10:00:15 2015 -0700
@@ -314,3 +314,4 @@
 551323004d0ce2f1d4b0e99552f7e0cdcebc6fca jdk9-b69
 a7f731125b7fb0e4b0186172f85a21e2d5139f7e jdk9-b70
 e47d3bfbc61accc3fbd372a674fdce2933b54f31 jdk9-b71
+f376824d4940f45719d91838f3f6249f873440db jdk9-b72
--- a/make/non-build-utils/sharing/README.txt	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-This directory contains tools and tests associated with creating the
-class list for class data sharing.
-
-The class list is produced by running the refWorkload startup3 benchmark with
-the -XX:+TraceClassLoadingPreorder option.  The -Xshare:off option must also be
-used so that bootclasspath classes are loaded from rt.jar.  The MakeClasslist
-program should be built into the jar file makeclasslist.jar and is run
-on one of the logs from each of the benchmarks in the following fashion:
-
-cd .../<resultsdir>/results.startup3
-$JAVA_HOME/bin/java -jar makeclasslist.jar results.Noop/results_1/log results.Framer/results_1/log results.XFramer/results_1/log results.JEdit/results_1/log results.LimeWire/results_1/log results.NetBeans50/results_1/log
-
-Presently, $JAVA_HOME must be the same path used to run the startup3 benchmark.
-
-The logs are deliberately concatenated in roughly smallest to largest order
-based on application size.  The resulting output is redirected into a file
-and results in one of classlist.solaris, classlist.linux, classlist.macosx,
-or classlist.windows.  These files are checked in to the workspace.  A
-necessary checksum (AddJsum.java) is added to the final classlist
-(installed in lib/ or jre/lib/) during the build process by the
-makefiles in make/java/redist.
-
-In a forthcoming JDK build we plan to manually add the dependent
-classes for the calendar manager Glow, which pulls in the Preferences
-classes and, on Unix platforms, the XML parsing classes.
-
-The properties file supplied to the refworkload is approximately the
-following:
-
-javahome=/usr/java/j2sdk1.8.0
-resultsdir=classlist-run
-iterations=1
-benchmarks=startup3
-globalvmoptions=-client -Xshare:off -XX:+TraceClassLoadingPreorder
--- a/make/non-build-utils/sharing/tests/GHello.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.Label;
-
-public class GHello extends Frame {
-
-    public static void main(String[] args) {
-        System.out.println("Hello");
-
-        new GHello().show();
-        if (args.length == 1 && args[0].equals("quit")) {
-            try {
-                Thread.currentThread().sleep(200);
-            } catch (InterruptedException e) {
-            }
-            System.exit(0);
-        }
-    }
-
-
-    GHello() {
-        Label label = new Label("Hello");
-        label.setFont(new Font("Monospaced", Font.PLAIN, 144));
-        add(label);
-        pack();
-    }
-}
--- a/make/non-build-utils/sharing/tests/Hello.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-public class Hello {
-    public static void main(String[] args) {
-        System.out.println("Hello, World!");
-    }
-}
--- a/make/non-build-utils/sharing/tests/JHello.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import java.awt.Font;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-
-public class JHello extends JFrame {
-
-    public static void main(String[] args) {
-        System.out.println("Hello");
-
-        new JHello().show();
-        if (args.length == 1 && args[0].equals("quit")) {
-            try {
-                Thread.currentThread().sleep(1000);
-            } catch (InterruptedException e) {
-            }
-            System.exit(0);
-        }
-    }
-
-
-    JHello() {
-        JLabel jlabel = new JLabel("Hello");
-        jlabel.setFont(new Font("Monospaced", Font.PLAIN, 144));
-        getContentPane().add(jlabel);
-        pack();
-    }
-}
--- a/make/non-build-utils/src/build/tools/makeclasslist/MakeClasslist.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package build.tools.makeclasslist;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-
-/** Reads a set of files containing the output of java
-    -XX:+TraceClassLoadingPreorder runs. Finds all classes that were
-    loaded from the bootstrap class path by comparing the prefix of
-    the load path to the current JRE's java.home system property.
-    Prints the names of these classes to stdout.
-*/
-
-public class MakeClasslist {
-  public static void main(String[] args) throws IOException {
-    List<String> classes = new ArrayList<>();
-    String origJavaHome = System.getProperty("java.home");
-    String javaHome     = origJavaHome.toLowerCase();
-    if (javaHome.endsWith("jre")) {
-      origJavaHome = origJavaHome.substring(0, origJavaHome.length() - 4);
-      javaHome     = javaHome.substring(0, javaHome.length() - 4);
-    }
-    for (int i = 0; i < args.length; i++) {
-      try {
-        File file = new File(args[i]);
-        BufferedReader reader = new BufferedReader(new FileReader(file));
-        String line = null;
-        while ((line = reader.readLine()) != null) {
-          StringTokenizer tok = new StringTokenizer(line, "[ \t\n\r\f");
-          if (tok.hasMoreTokens()) {
-            String t = tok.nextToken();
-            // Understand only "Loading" from -XX:+TraceClassLoadingPreorder.
-            // This ignores old "Loaded" from -verbose:class to force correct
-            // classlist generation on Mustang.
-            if (t.equals("Loading")) {
-              t = tok.nextToken();
-              t = t.replace('.', '/');
-
-              // Check to make sure it came from the boot class path
-              if (tok.hasMoreTokens()) {
-                String tmp = tok.nextToken();
-                if (tmp.equals("from")) {
-                  if (tok.hasMoreTokens()) {
-                    tmp = tok.nextToken().toLowerCase();
-                    // System.err.println("Loaded " + t + " from " + tmp);
-                    if (tmp.startsWith(javaHome)) {
-                      // OK, remember this class for later
-                      classes.add(t);
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      } catch (IOException e) {
-        System.err.println("Error reading file " + args[i]);
-        throw(e);
-      }
-    }
-
-    Set<String> seenClasses = new HashSet<>();
-
-    for (String str : classes) {
-      if (seenClasses.add(str)) {
-        System.out.println(str);
-      }
-    }
-
-    // Try to complete certain packages
-    // Note: not using this new code yet; need to consider whether the
-    // footprint increase is worth any startup gains
-    // Note also that the packages considered below for completion are
-    // (obviously) platform-specific
-    // JarFile rtJar = new JarFile(origJavaHome + File.separator +
-    //                             "jre" + File.separator +
-    //                             "lib" + File.separator +
-    //                             "rt.jar");
-    // completePackage(seenClasses, rtJar, "java/awt");
-    // completePackage(seenClasses, rtJar, "sun/awt");
-    // completePackage(seenClasses, rtJar, "sun/awt/X11");
-    // completePackage(seenClasses, rtJar, "java/awt/im/spi");
-    // completePackage(seenClasses, rtJar, "java/lang");
-  }
-
-  private static void completePackage(Set<String> seenClasses,
-                                      JarFile jar,
-                                      String packageName) {
-    int len = packageName.length();
-    Enumeration<JarEntry> entries = jar.entries();
-    while (entries.hasMoreElements()) {
-      JarEntry entry = entries.nextElement();
-      String name = entry.getName();
-      if (name.startsWith(packageName) &&
-          name.endsWith(".class") &&
-          name.lastIndexOf('/') == len) {
-        // Trim ".class" from end
-        name = name.substring(0, name.length() - 6);
-        if (seenClasses.add(name)) {
-          System.out.println(name);
-        }
-      }
-    }
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/non-build-utils/src/build/tools/makeclasslist/makeClasslist.js	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This tool is used to help create the class list for class data sharing.
+ *
+ * The classlist is produced internally by first running a select number of
+ * startup benchmarks with the -XX:DumpLoadedClassList=<file> option, then
+ * running this tool in the following fashion to produce a complete classlist:
+ *
+ * jjs -scripting makeClasslist.js -- list1 list2 list3 > classlist.platform
+ *
+ * The lists should be listed in roughly smallest to largest order based on
+ * application size.
+ *
+ * After generating the classlist it's necessary to add a checksum (using
+ * AddJsum.java) before checking it into the workspace as the corresponding
+ * platform-specific classlist, such as make/data/classlist/classlist.linux 
+ */
+"use strict";
+var classlist = [];
+var seenClasses = {};
+
+for (var a in $ARG) {
+  var arg = $ARG[a];
+
+  var classes = readFully(arg).replace(/[\r\n]+/g, "\n").split("\n");
+
+  for (var c in classes) {
+    var clazz = classes[c];
+    if (clazz !== "" && seenClasses[clazz] === undefined) {
+      seenClasses[clazz] = clazz;
+      classlist.push(clazz);
+    }
+  }
+}
+
+for (c in classlist) {
+  print(classlist[c]);
+}
--- a/src/java.base/share/classes/java/net/ContentHandler.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/net/ContentHandler.java	Wed Jul 15 10:00:15 2015 -0700
@@ -44,14 +44,14 @@
  * instance of a subclass of {@code ContentHandler}, and its
  * {@code getContent} method is called to create the object.
  * <p>
- * If no content handler could be found, URLConnection will
- * look for a content handler in a user-defineable set of places.
+ * If no content handler could be {@linkplain URLConnection#getContent() found},
+ * URLConnection will look for a content handler in a user-definable set of places.
  * Users can define a vertical-bar delimited set of class prefixes
- * to search through by defining the <i>java.content.handler.pkgs</i>
+ * to search through by defining the <i>{@value java.net.URLConnection#contentPathProp}</i>
  * property. The class name must be of the form:
  * <blockquote>
  *     <i>{package-prefix}.{major}.{minor}</i>
- *     <P>
+ *     <p>
  *     where <i>{major}.{minor}</i> is formed by taking the
  *     content-type string, replacing all slash characters with a
  *     {@code period} ('.'), and all other non-alphanumeric characters
@@ -82,6 +82,7 @@
  * @since   1.0
  */
 abstract public class ContentHandler {
+
     /**
      * Given a URL connect stream positioned at the beginning of the
      * representation of an object, this method reads that stream and
@@ -104,8 +105,8 @@
      * @param      urlc   a URL connection.
      * @param      classes      an array of types requested
      * @return     the object read by the {@code ContentHandler} that is
-     *                 the first match of the suggested types.
-     *                 null if none of the requested  are supported.
+     *                 the first match of the suggested types or
+     *                 {@code null} if none of the requested  are supported.
      * @exception  IOException  if an I/O error occurs while reading the object.
      * @since 1.3
      */
@@ -113,12 +114,11 @@
     public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
         Object obj = getContent(urlc);
 
-        for (int i = 0; i < classes.length; i++) {
-          if (classes[i].isInstance(obj)) {
+        for (Class<?> c : classes) {
+            if (c.isInstance(obj)) {
                 return obj;
-          }
+            }
         }
         return null;
     }
-
 }
--- a/src/java.base/share/classes/java/net/ContentHandlerFactory.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/net/ContentHandlerFactory.java	Wed Jul 15 10:00:15 2015 -0700
@@ -39,12 +39,13 @@
  * @since   1.0
  */
 public interface ContentHandlerFactory {
+
     /**
      * Creates a new {@code ContentHandler} to read an object from
      * a {@code URLStreamHandler}.
      *
      * @param   mimetype   the MIME type for which a content handler is desired.
-
+     *
      * @return  a new {@code ContentHandler} to read an object from a
      *          {@code URLStreamHandler}.
      * @see     java.net.ContentHandler
--- a/src/java.base/share/classes/java/net/URLConnection.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/net/URLConnection.java	Wed Jul 15 10:00:15 2015 -0700
@@ -28,8 +28,12 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.security.PrivilegedAction;
 import java.util.Hashtable;
 import java.util.Date;
+import java.util.Iterator;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
 import java.util.StringTokenizer;
 import java.util.Collections;
 import java.util.Map;
@@ -107,7 +111,7 @@
  *   <li>{@code getContentType}
  *   <li>{@code getDate}
  *   <li>{@code getExpiration}
- *   <li>{@code getLastModifed}
+ *   <li>{@code getLastModified}
  * </ul>
  * <p>
  * provide convenient access to these fields. The
@@ -695,16 +699,30 @@
      * This method first determines the content type of the object by
      * calling the {@code getContentType} method. If this is
      * the first time that the application has seen that specific content
-     * type, a content handler for that content type is created:
+     * type, a content handler for that content type is created.
+     * <p> This is done as follows:
      * <ol>
      * <li>If the application has set up a content handler factory instance
      *     using the {@code setContentHandlerFactory} method, the
      *     {@code createContentHandler} method of that instance is called
      *     with the content type as an argument; the result is a content
      *     handler for that content type.
-     * <li>If no content handler factory has yet been set up, or if the
-     *     factory's {@code createContentHandler} method returns
-     *     {@code null}, then this method tries to load a content handler
+     * <li>If no {@code ContentHandlerFactory} has yet been set up,
+     *     or if the factory's {@code createContentHandler} method
+     *     returns {@code null}, then the {@linkplain java.util.ServiceLoader
+     *     ServiceLoader} mechanism is used to locate {@linkplain
+     *     java.net.ContentHandlerFactory ContentHandlerFactory}
+     *     implementations using the system class
+     *     loader. The order that factories are located is implementation
+     *     specific, and an implementation is free to cache the located
+     *     factories. A {@linkplain java.util.ServiceConfigurationError
+     *     ServiceConfigurationError}, {@code Error} or {@code RuntimeException}
+     *     thrown from the {@code createContentHandler}, if encountered, will
+     *     be propagated to the calling thread. The {@code
+     *     createContentHandler} method of each factory, if instantiated, is
+     *     invoked, with the content type, until a factory returns non-null,
+     *     or all factories have been exhausted.
+     * <li>Failing that, this method tries to load a content handler
      *     class as defined by {@link java.net.ContentHandler ContentHandler}.
      *     If the class does not exist, or is not a subclass of {@code
      *     ContentHandler}, then an {@code UnknownServiceException} is thrown.
@@ -855,8 +873,7 @@
      * @see #getDoInput()
      */
     public void setDoInput(boolean doinput) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         doInput = doinput;
     }
 
@@ -885,8 +902,7 @@
      * @see #getDoOutput()
      */
     public void setDoOutput(boolean dooutput) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         doOutput = dooutput;
     }
 
@@ -911,8 +927,7 @@
      * @see     #getAllowUserInteraction()
      */
     public void setAllowUserInteraction(boolean allowuserinteraction) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         allowUserInteraction = allowuserinteraction;
     }
 
@@ -974,8 +989,7 @@
      * @see #getUseCaches()
      */
     public void setUseCaches(boolean usecaches) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         useCaches = usecaches;
     }
 
@@ -1000,8 +1014,7 @@
      * @see     #getIfModifiedSince()
      */
     public void setIfModifiedSince(long ifmodifiedsince) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         ifModifiedSince = ifmodifiedsince;
     }
 
@@ -1055,12 +1068,11 @@
      *                  (e.g., "{@code Accept}").
      * @param   value   the value associated with it.
      * @throws IllegalStateException if already connected
-     * @throws NullPointerException if key is <CODE>null</CODE>
+     * @throws NullPointerException if key is {@code null}
      * @see #getRequestProperty(java.lang.String)
      */
     public void setRequestProperty(String key, String value) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         if (key == null)
             throw new NullPointerException ("key is null");
 
@@ -1084,8 +1096,7 @@
      * @since 1.4
      */
     public void addRequestProperty(String key, String value) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
         if (key == null)
             throw new NullPointerException ("key is null");
 
@@ -1107,8 +1118,7 @@
      * @see #setRequestProperty(java.lang.String, java.lang.String)
      */
     public String getRequestProperty(String key) {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
 
         if (requests == null)
             return null;
@@ -1129,8 +1139,7 @@
      * @since 1.4
      */
     public Map<String,List<String>> getRequestProperties() {
-        if (connected)
-            throw new IllegalStateException("Already connected");
+        checkConnected();
 
         if (requests == null)
             return Collections.emptyMap();
@@ -1183,7 +1192,7 @@
     /**
      * The ContentHandler factory.
      */
-    static ContentHandlerFactory factory;
+    private static volatile ContentHandlerFactory factory;
 
     /**
      * Sets the {@code ContentHandlerFactory} of an
@@ -1216,37 +1225,45 @@
         factory = fac;
     }
 
-    private static Hashtable<String, ContentHandler> handlers = new Hashtable<>();
+    private static final Hashtable<String, ContentHandler> handlers = new Hashtable<>();
 
     /**
      * Gets the Content Handler appropriate for this connection.
      */
-    synchronized ContentHandler getContentHandler()
-        throws UnknownServiceException
-    {
+    private ContentHandler getContentHandler() throws UnknownServiceException {
         String contentType = stripOffParameters(getContentType());
-        ContentHandler handler = null;
-        if (contentType == null)
+        if (contentType == null) {
             throw new UnknownServiceException("no content-type");
-        try {
-            handler = handlers.get(contentType);
+        }
+
+        ContentHandler handler = handlers.get(contentType);
+        if (handler != null)
+            return handler;
+
+        if (factory != null) {
+            handler = factory.createContentHandler(contentType);
             if (handler != null)
                 return handler;
-        } catch(Exception e) {
         }
 
-        if (factory != null)
-            handler = factory.createContentHandler(contentType);
-        if (handler == null) {
-            try {
-                handler = lookupContentHandlerClassFor(contentType);
-            } catch(Exception e) {
-                e.printStackTrace();
-                handler = UnknownContentHandler.INSTANCE;
-            }
-            handlers.put(contentType, handler);
+        handler = lookupContentHandlerViaProvider(contentType);
+
+        if (handler != null) {
+            ContentHandler h = handlers.putIfAbsent(contentType, handler);
+            return h != null ? h : handler;
         }
-        return handler;
+
+        try {
+            handler = lookupContentHandlerClassFor(contentType);
+        } catch (Exception e) {
+            e.printStackTrace();
+            handler = UnknownContentHandler.INSTANCE;
+        }
+
+        assert handler != null;
+
+        ContentHandler h = handlers.putIfAbsent(contentType, handler);
+        return h != null ? h : handler;
     }
 
     /*
@@ -1270,10 +1287,10 @@
     private static final String contentPathProp = "java.content.handler.pkgs";
 
     /**
-     * Looks for a content handler in a user-defineable set of places.
-     * By default it looks in sun.net.www.content, but users can define a
-     * vertical-bar delimited set of class prefixes to search through in
-     * addition by defining the java.content.handler.pkgs property.
+     * Looks for a content handler in a user-definable set of places.
+     * By default it looks in {@value #contentClassPrefix}, but users can define
+     * a vertical-bar delimited set of class prefixes to search through in
+     * addition by defining the {@value #contentPathProp} property.
      * The class name must be of the form:
      * <pre>
      *     {package-prefix}.{major}.{minor}
@@ -1281,11 +1298,10 @@
      *     YoyoDyne.experimental.text.plain
      * </pre>
      */
-    private ContentHandler lookupContentHandlerClassFor(String contentType)
-        throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+    private ContentHandler lookupContentHandlerClassFor(String contentType) {
         String contentHandlerClassName = typeToPackageName(contentType);
 
-        String contentHandlerPkgPrefixes =getContentHandlerPkgPrefixes();
+        String contentHandlerPkgPrefixes = getContentHandlerPkgPrefixes();
 
         StringTokenizer packagePrefixIter =
             new StringTokenizer(contentHandlerPkgPrefixes, "|");
@@ -1305,17 +1321,46 @@
                     }
                 }
                 if (cls != null) {
-                    ContentHandler handler =
-                        (ContentHandler)cls.newInstance();
-                    return handler;
+                    return (ContentHandler) cls.newInstance();
                 }
-            } catch(Exception e) {
-            }
+            } catch(Exception ignored) { }
         }
 
         return UnknownContentHandler.INSTANCE;
     }
 
+    private ContentHandler lookupContentHandlerViaProvider(String contentType) {
+        return AccessController.doPrivileged(
+                new PrivilegedAction<>() {
+                    @Override
+                    public ContentHandler run() {
+                        ClassLoader cl = ClassLoader.getSystemClassLoader();
+                        ServiceLoader<ContentHandlerFactory> sl =
+                                ServiceLoader.load(ContentHandlerFactory.class, cl);
+
+                        Iterator<ContentHandlerFactory> iterator = sl.iterator();
+
+                        ContentHandler handler = null;
+                        while (iterator.hasNext()) {
+                            ContentHandlerFactory f;
+                            try {
+                                f = iterator.next();
+                            } catch (ServiceConfigurationError e) {
+                                if (e.getCause() instanceof SecurityException) {
+                                    continue;
+                                }
+                                throw e;
+                            }
+                            handler = f.createContentHandler(contentType);
+                            if (handler != null) {
+                                break;
+                            }
+                        }
+                        return handler;
+                    }
+                });
+    }
+
     /**
      * Utility function to map a MIME content type into an equivalent
      * pair of class name components.  For example: "text/html" would
@@ -1345,8 +1390,8 @@
      * Returns a vertical bar separated list of package prefixes for potential
      * content handlers.  Tries to get the java.content.handler.pkgs property
      * to use as a set of package prefixes to search.  Whether or not
-     * that property has been defined, the sun.net.www.content is always
-     * the last one on the returned package list.
+     * that property has been defined, the {@value #contentClassPrefix}
+     * is always the last one on the returned package list.
      */
     private String getContentHandlerPkgPrefixes() {
         String packagePrefixList = AccessController.doPrivileged(
@@ -1764,9 +1809,12 @@
         return skipped;
     }
 
+    private void checkConnected() {
+        if (connected)
+            throw new IllegalStateException("Already connected");
+    }
 }
 
-
 class UnknownContentHandler extends ContentHandler {
     static final ContentHandler INSTANCE = new UnknownContentHandler();
 
--- a/src/java.base/share/classes/java/security/AccessControlContext.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/AccessControlContext.java	Wed Jul 15 10:00:15 2015 -0700
@@ -76,7 +76,7 @@
 
 public final class AccessControlContext {
 
-    private ProtectionDomain context[];
+    private ProtectionDomain[] context;
     // isPrivileged and isAuthorized are referenced by the VM - do not remove
     // or change their names
     private boolean isPrivileged;
@@ -89,13 +89,13 @@
     private DomainCombiner combiner = null;
 
     // limited privilege scope
-    private Permission permissions[];
+    private Permission[] permissions;
     private AccessControlContext parent;
     private boolean isWrapped;
 
     // is constrained by limited privilege scope?
     private boolean isLimited;
-    private ProtectionDomain limitedContext[];
+    private ProtectionDomain[] limitedContext;
 
     private static boolean debugInit = false;
     private static Debug debug = null;
@@ -123,7 +123,7 @@
      * changes to the array will not affect this AccessControlContext.
      * @throws NullPointerException if {@code context} is {@code null}
      */
-    public AccessControlContext(ProtectionDomain context[])
+    public AccessControlContext(ProtectionDomain[] context)
     {
         if (context.length == 0) {
             this.context = null;
@@ -282,7 +282,7 @@
      * package private constructor for AccessController.getContext()
      */
 
-    AccessControlContext(ProtectionDomain context[],
+    AccessControlContext(ProtectionDomain[] context,
                          boolean isPrivileged)
     {
         this.context = context;
@@ -643,7 +643,7 @@
     /*
      * Combine the current (stack) and assigned domains.
      */
-    private static ProtectionDomain[] combine(ProtectionDomain[]current,
+    private static ProtectionDomain[] combine(ProtectionDomain[] current,
         ProtectionDomain[] assigned) {
 
         // current could be null if only system code is on the stack;
@@ -666,7 +666,7 @@
         int n = (skipAssigned) ? 0 : assigned.length;
 
         // now we combine both of them, and create a new context
-        ProtectionDomain pd[] = new ProtectionDomain[slen + n];
+        ProtectionDomain[] pd = new ProtectionDomain[slen + n];
 
         // first copy in the assigned context domains, no need to compress
         if (!skipAssigned) {
@@ -695,7 +695,7 @@
             } else if (skipAssigned && n == slen) {
                 return current;
             }
-            ProtectionDomain tmp[] = new ProtectionDomain[n];
+            ProtectionDomain[] tmp = new ProtectionDomain[n];
             System.arraycopy(pd, 0, tmp, 0, n);
             pd = tmp;
         }
--- a/src/java.base/share/classes/java/security/CodeSource.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/CodeSource.java	Wed Jul 15 10:00:15 2015 -0700
@@ -65,7 +65,7 @@
     /*
      * The code signers. Certificate chains are concatenated.
      */
-    private transient java.security.cert.Certificate certs[] = null;
+    private transient java.security.cert.Certificate[] certs = null;
 
     // cached SocketPermission used for matchLocation
     private transient SocketPermission sp;
@@ -91,7 +91,7 @@
      * @param certs the certificate(s). It may be null. The contents of the
      * array are copied to protect against subsequent modification.
      */
-    public CodeSource(URL url, java.security.cert.Certificate certs[]) {
+    public CodeSource(URL url, java.security.cert.Certificate[] certs) {
         this.location = url;
         if (url != null) {
             this.locationNoFragString = URLUtil.urlNoFragString(url);
--- a/src/java.base/share/classes/java/security/Permissions.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/Permissions.java	Wed Jul 15 10:00:15 2015 -0700
@@ -289,9 +289,9 @@
         if (unresolvedPerms == null)
             return null;
 
-        java.security.cert.Certificate certs[] = null;
+        java.security.cert.Certificate[] certs = null;
 
-        Object signers[] = p.getClass().getSigners();
+        Object[] signers = p.getClass().getSigners();
 
         int n = 0;
         if (signers != null) {
--- a/src/java.base/share/classes/java/security/SecureRandom.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/SecureRandom.java	Wed Jul 15 10:00:15 2015 -0700
@@ -69,7 +69,7 @@
  *
  * <pre>
  *      SecureRandom random = new SecureRandom();
- *      byte bytes[] = new byte[20];
+ *      byte[] bytes = new byte[20];
  *      random.nextBytes(bytes);
  * </pre>
  *
@@ -77,7 +77,7 @@
  * to generate a given number of seed bytes (to seed other random number
  * generators, for example):
  * <pre>
- *      byte seed[] = random.generateSeed(20);
+ *      byte[] seed = random.generateSeed(20);
  * </pre>
  *
  * Note: Depending on the implementation, the {@code generateSeed} and
@@ -186,7 +186,7 @@
      *
      * @param seed the seed.
      */
-    public SecureRandom(byte seed[]) {
+    public SecureRandom(byte[] seed) {
         super(0);
         getDefaultPRNG(true, seed);
     }
@@ -486,7 +486,7 @@
     @Override
     final protected int next(int numBits) {
         int numBytes = (numBits+7)/8;
-        byte b[] = new byte[numBytes];
+        byte[] b = new byte[numBytes];
         int next = 0;
 
         nextBytes(b);
--- a/src/java.base/share/classes/java/security/UnresolvedPermission.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/UnresolvedPermission.java	Wed Jul 15 10:00:15 2015 -0700
@@ -130,7 +130,7 @@
      */
     private String actions;
 
-    private transient java.security.cert.Certificate certs[];
+    private transient java.security.cert.Certificate[] certs;
 
     /**
      * Creates a new UnresolvedPermission containing the permission
@@ -152,7 +152,7 @@
     public UnresolvedPermission(String type,
                                 String name,
                                 String actions,
-                                java.security.cert.Certificate certs[])
+                                java.security.cert.Certificate[] certs)
     {
         super(type);
 
@@ -224,7 +224,7 @@
      * try and resolve this permission using the class loader of the permission
      * that was passed in.
      */
-    Permission resolve(Permission p, java.security.cert.Certificate certs[]) {
+    Permission resolve(Permission p, java.security.cert.Certificate[] certs) {
         if (this.certs != null) {
             // if p wasn't signed, we don't have a match
             if (certs == null) {
--- a/src/java.base/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java	Wed Jul 15 10:00:15 2015 -0700
@@ -54,7 +54,7 @@
     private final BigInteger primeExponentP;
     private final BigInteger primeExponentQ;
     private final BigInteger crtCoefficient;
-    private final RSAOtherPrimeInfo otherPrimeInfo[];
+    private final RSAOtherPrimeInfo[] otherPrimeInfo;
 
    /**
     * Creates a new {@code RSAMultiPrimePrivateCrtKeySpec}
--- a/src/java.base/share/classes/java/util/ArrayList.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/ArrayList.java	Wed Jul 15 10:00:15 2015 -0700
@@ -178,7 +178,8 @@
     public ArrayList(Collection<? extends E> c) {
         elementData = c.toArray();
         if ((size = elementData.length) != 0) {
-            // c.toArray might (incorrectly) not return Object[] (see 6260652)
+            // defend against c.toArray (incorrectly) not returning Object[]
+            // (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652)
             if (elementData.getClass() != Object[].class)
                 elementData = Arrays.copyOf(elementData, size, Object[].class);
         } else {
--- a/src/java.base/share/classes/java/util/Arrays.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/Arrays.java	Wed Jul 15 10:00:15 2015 -0700
@@ -3820,7 +3820,7 @@
 
         @Override
         public Object[] toArray() {
-            return a.clone();
+            return Arrays.copyOf(a, a.length, Object[].class);
         }
 
         @Override
--- a/src/java.base/share/classes/java/util/Vector.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/Vector.java	Wed Jul 15 10:00:15 2015 -0700
@@ -174,7 +174,8 @@
     public Vector(Collection<? extends E> c) {
         elementData = c.toArray();
         elementCount = elementData.length;
-        // c.toArray might (incorrectly) not return Object[] (see 6260652)
+        // defend against c.toArray (incorrectly) not returning Object[]
+        // (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652)
         if (elementData.getClass() != Object[].class)
             elementData = Arrays.copyOf(elementData, elementCount, Object[].class);
     }
--- a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Wed Jul 15 10:00:15 2015 -0700
@@ -134,7 +134,8 @@
             elements = ((CopyOnWriteArrayList<?>)c).getArray();
         else {
             elements = c.toArray();
-            // c.toArray might (incorrectly) not return Object[] (see 6260652)
+            // defend against c.toArray (incorrectly) not returning Object[]
+            // (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652)
             if (elements.getClass() != Object[].class)
                 elements = Arrays.copyOf(elements, elements.length, Object[].class);
         }
--- a/src/java.base/share/classes/java/util/stream/AbstractPipeline.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/AbstractPipeline.java	Wed Jul 15 10:00:15 2015 -0700
@@ -489,15 +489,17 @@
 
     @Override
     @SuppressWarnings("unchecked")
-    final <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
+    final <P_IN> boolean copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
         @SuppressWarnings({"rawtypes","unchecked"})
         AbstractPipeline p = AbstractPipeline.this;
         while (p.depth > 0) {
             p = p.previousStage;
         }
+
         wrappedSink.begin(spliterator.getExactSizeIfKnown());
-        p.forEachWithCancel(spliterator, wrappedSink);
+        boolean cancelled = p.forEachWithCancel(spliterator, wrappedSink);
         wrappedSink.end();
+        return cancelled;
     }
 
     @Override
@@ -602,8 +604,9 @@
      *
      * @param spliterator the spliterator to pull elements from
      * @param sink the sink to push elements to
+     * @return true if the cancellation was requested
      */
-    abstract void forEachWithCancel(Spliterator<E_OUT> spliterator, Sink<E_OUT> sink);
+    abstract boolean forEachWithCancel(Spliterator<E_OUT> spliterator, Sink<E_OUT> sink);
 
     /**
      * Make a node builder compatible with this stream shape.
--- a/src/java.base/share/classes/java/util/stream/DoublePipeline.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/DoublePipeline.java	Wed Jul 15 10:00:15 2015 -0700
@@ -40,6 +40,7 @@
 import java.util.function.DoubleToLongFunction;
 import java.util.function.DoubleUnaryOperator;
 import java.util.function.IntFunction;
+import java.util.function.LongPredicate;
 import java.util.function.ObjDoubleConsumer;
 import java.util.function.Supplier;
 
@@ -153,10 +154,12 @@
     }
 
     @Override
-    final void forEachWithCancel(Spliterator<Double> spliterator, Sink<Double> sink) {
+    final boolean forEachWithCancel(Spliterator<Double> spliterator, Sink<Double> sink) {
         Spliterator.OfDouble spl = adapt(spliterator);
         DoubleConsumer adaptedSink = adapt(sink);
-        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+        boolean cancelled;
+        do { } while (!(cancelled = sink.cancellationRequested()) && spl.tryAdvance(adaptedSink));
+        return cancelled;
     }
 
     @Override
@@ -353,6 +356,16 @@
     }
 
     @Override
+    public final DoubleStream takeWhile(DoublePredicate predicate) {
+        return WhileOps.makeTakeWhileDouble(this, predicate);
+    }
+
+    @Override
+    public final DoubleStream dropWhile(DoublePredicate predicate) {
+        return WhileOps.makeDropWhileDouble(this, predicate);
+    }
+
+    @Override
     public final DoubleStream sorted() {
         return SortedOps.makeDouble(this);
     }
--- a/src/java.base/share/classes/java/util/stream/DoubleStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/DoubleStream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,13 @@
  */
 package java.util.stream;
 
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.DoubleSummaryStatistics;
 import java.util.Objects;
 import java.util.OptionalDouble;
 import java.util.PrimitiveIterator;
 import java.util.Spliterator;
 import java.util.Spliterators;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.BiConsumer;
 import java.util.function.DoubleBinaryOperator;
 import java.util.function.DoubleConsumer;
@@ -280,6 +275,137 @@
     DoubleStream skip(long n);
 
     /**
+     * Returns, if this stream is ordered, a stream consisting of the longest
+     * prefix of elements taken from this stream that match the given predicate.
+     * Otherwise returns, if this stream is unordered, a stream consisting of a
+     * subset of elements taken from this stream that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to take any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * takes all elements (the result is the same is the input), or if no
+     * elements of the stream match the given predicate then no elements are
+     * taken (the result is an empty stream).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code takeWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as
+     * {@link #generate(DoubleSupplier)}) or removing the ordering constraint
+     * with {@link #unordered()} may result in significant speedups of
+     * {@code takeWhile()} in parallel pipelines, if the semantics of your
+     * situation permit.  If consistency with encounter order is required, and
+     * you are experiencing poor performance or memory utilization with
+     * {@code takeWhile()} in parallel pipelines, switching to sequential
+     * execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default DoubleStream takeWhile(DoublePredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.doubleStream(
+                new WhileOps.UnorderedWhileSpliterator.OfDouble.Taking(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
+     * Returns, if this stream is ordered, a stream consisting of the remaining
+     * elements of this stream after dropping the longest prefix of elements
+     * that match the given predicate.  Otherwise returns, if this stream is
+     * unordered, a stream consisting of the remaining elements of this stream
+     * after dropping a subset of elements that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to drop any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * drops all elements (the result is an empty stream), or if no elements of
+     * the stream match the given predicate then no elements are dropped (the
+     * result is the same is the input).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code dropWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as
+     * {@link #generate(DoubleSupplier)}) or removing the ordering constraint
+     * with {@link #unordered()} may result in significant speedups of
+     * {@code dropWhile()} in parallel pipelines, if the semantics of your
+     * situation permit.  If consistency with encounter order is required, and
+     * you are experiencing poor performance or memory utilization with
+     * {@code dropWhile()} in parallel pipelines, switching to sequential
+     * execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default DoubleStream dropWhile(DoublePredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.doubleStream(
+                new WhileOps.UnorderedWhileSpliterator.OfDouble.Dropping(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
      * Performs an action for each element of this stream.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
--- a/src/java.base/share/classes/java/util/stream/IntPipeline.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/IntPipeline.java	Wed Jul 15 10:00:15 2015 -0700
@@ -156,10 +156,12 @@
     }
 
     @Override
-    final void forEachWithCancel(Spliterator<Integer> spliterator, Sink<Integer> sink) {
+    final boolean forEachWithCancel(Spliterator<Integer> spliterator, Sink<Integer> sink) {
         Spliterator.OfInt spl = adapt(spliterator);
         IntConsumer adaptedSink = adapt(sink);
-        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+        boolean cancelled;
+        do { } while (!(cancelled = sink.cancellationRequested()) && spl.tryAdvance(adaptedSink));
+        return cancelled;
     }
 
     @Override
@@ -387,6 +389,16 @@
     }
 
     @Override
+    public final IntStream takeWhile(IntPredicate predicate) {
+        return WhileOps.makeTakeWhileInt(this, predicate);
+    }
+
+    @Override
+    public final IntStream dropWhile(IntPredicate predicate) {
+        return WhileOps.makeDropWhileInt(this, predicate);
+    }
+
+    @Override
     public final IntStream sorted() {
         return SortedOps.makeInt(this);
     }
--- a/src/java.base/share/classes/java/util/stream/IntStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/IntStream.java	Wed Jul 15 10:00:15 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
@@ -273,6 +273,135 @@
     IntStream skip(long n);
 
     /**
+     * Returns, if this stream is ordered, a stream consisting of the longest
+     * prefix of elements taken from this stream that match the given predicate.
+     * Otherwise returns, if this stream is unordered, a stream consisting of a
+     * subset of elements taken from this stream that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to take any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * takes all elements (the result is the same is the input), or if no
+     * elements of the stream match the given predicate then no elements are
+     * taken (the result is an empty stream).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code takeWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as {@link #generate(IntSupplier)})
+     * or removing the ordering constraint with {@link #unordered()} may result
+     * in significant speedups of {@code takeWhile()} in parallel pipelines, if
+     * the semantics of your situation permit.  If consistency with encounter
+     * order is required, and you are experiencing poor performance or memory
+     * utilization with {@code takeWhile()} in parallel pipelines, switching to
+     * sequential execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default IntStream takeWhile(IntPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.intStream(
+                new WhileOps.UnorderedWhileSpliterator.OfInt.Taking(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
+     * Returns, if this stream is ordered, a stream consisting of the remaining
+     * elements of this stream after dropping the longest prefix of elements
+     * that match the given predicate.  Otherwise returns, if this stream is
+     * unordered, a stream consisting of the remaining elements of this stream
+     * after dropping a subset of elements that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to drop any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * drops all elements (the result is an empty stream), or if no elements of
+     * the stream match the given predicate then no elements are dropped (the
+     * result is the same is the input).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code dropWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as {@link #generate(IntSupplier)})
+     * or removing the ordering constraint with {@link #unordered()} may result
+     * in significant speedups of {@code dropWhile()} in parallel pipelines, if
+     * the semantics of your situation permit.  If consistency with encounter
+     * order is required, and you are experiencing poor performance or memory
+     * utilization with {@code dropWhile()} in parallel pipelines, switching to
+     * sequential execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default IntStream dropWhile(IntPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.intStream(
+                new WhileOps.UnorderedWhileSpliterator.OfInt.Dropping(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
      * Performs an action for each element of this stream.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
--- a/src/java.base/share/classes/java/util/stream/LongPipeline.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/LongPipeline.java	Wed Jul 15 10:00:15 2015 -0700
@@ -154,10 +154,12 @@
     }
 
     @Override
-    final void forEachWithCancel(Spliterator<Long> spliterator, Sink<Long> sink) {
+    final boolean forEachWithCancel(Spliterator<Long> spliterator, Sink<Long> sink) {
         Spliterator.OfLong spl = adapt(spliterator);
         LongConsumer adaptedSink =  adapt(sink);
-        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+        boolean cancelled;
+        do { } while (!(cancelled = sink.cancellationRequested()) && spl.tryAdvance(adaptedSink));
+        return cancelled;
     }
 
     @Override
@@ -368,6 +370,16 @@
     }
 
     @Override
+    public final LongStream takeWhile(LongPredicate predicate) {
+        return WhileOps.makeTakeWhileLong(this, predicate);
+    }
+
+    @Override
+    public final LongStream dropWhile(LongPredicate predicate) {
+        return WhileOps.makeDropWhileLong(this, predicate);
+    }
+
+    @Override
     public final LongStream sorted() {
         return SortedOps.makeLong(this);
     }
--- a/src/java.base/share/classes/java/util/stream/LongStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/LongStream.java	Wed Jul 15 10:00:15 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
@@ -24,11 +24,7 @@
  */
 package java.util.stream;
 
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.LongSummaryStatistics;
 import java.util.Objects;
 import java.util.OptionalDouble;
@@ -36,7 +32,6 @@
 import java.util.PrimitiveIterator;
 import java.util.Spliterator;
 import java.util.Spliterators;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.function.LongBinaryOperator;
@@ -278,6 +273,137 @@
     LongStream skip(long n);
 
     /**
+     * Returns, if this stream is ordered, a stream consisting of the longest
+     * prefix of elements taken from this stream that match the given predicate.
+     * Otherwise returns, if this stream is unordered, a stream consisting of a
+     * subset of elements taken from this stream that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to take any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * takes all elements (the result is the same is the input), or if no
+     * elements of the stream match the given predicate then no elements are
+     * taken (the result is an empty stream).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code takeWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as
+     * {@link #generate(LongSupplier)}) or removing the ordering constraint with
+     * {@link #unordered()} may result in significant speedups of
+     * {@code takeWhile()} in parallel pipelines, if the semantics of your
+     * situation permit.  If consistency with encounter order is required, and
+     * you are experiencing poor performance or memory utilization with
+     * {@code takeWhile()} in parallel pipelines, switching to sequential
+     * execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default LongStream takeWhile(LongPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.longStream(
+                new WhileOps.UnorderedWhileSpliterator.OfLong.Taking(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
+     * Returns, if this stream is ordered, a stream consisting of the remaining
+     * elements of this stream after dropping the longest prefix of elements
+     * that match the given predicate.  Otherwise returns, if this stream is
+     * unordered, a stream consisting of the remaining elements of this stream
+     * after dropping a subset of elements that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to drop any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * drops all elements (the result is an empty stream), or if no elements of
+     * the stream match the given predicate then no elements are dropped (the
+     * result is the same is the input).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code dropWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as
+     * {@link #generate(LongSupplier)}) or removing the ordering constraint with
+     * {@link #unordered()} may result in significant speedups of
+     * {@code dropWhile()} in parallel pipelines, if the semantics of your
+     * situation permit.  If consistency with encounter order is required, and
+     * you are experiencing poor performance or memory utilization with
+     * {@code dropWhile()} in parallel pipelines, switching to sequential
+     * execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default LongStream dropWhile(LongPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.longStream(
+                new WhileOps.UnorderedWhileSpliterator.OfLong.Dropping(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
      * Performs an action for each element of this stream.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
--- a/src/java.base/share/classes/java/util/stream/Node.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/Node.java	Wed Jul 15 10:00:15 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
@@ -125,7 +125,11 @@
         Node.Builder<T> nodeBuilder = Nodes.builder(size, generator);
         nodeBuilder.begin(size);
         for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
-        for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
+        if (to == count()) {
+            spliterator.forEachRemaining(nodeBuilder);
+        } else {
+            for (int i = 0; i < size && spliterator.tryAdvance(nodeBuilder); i++) { }
+        }
         nodeBuilder.end();
         return nodeBuilder.build();
     }
@@ -360,7 +364,11 @@
             Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size);
             nodeBuilder.begin(size);
             for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { }
-            for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
+            if (to == count()) {
+                spliterator.forEachRemaining((IntConsumer) nodeBuilder);
+            } else {
+                for (int i = 0; i < size && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
+            }
             nodeBuilder.end();
             return nodeBuilder.build();
         }
@@ -433,7 +441,11 @@
             Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size);
             nodeBuilder.begin(size);
             for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { }
-            for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
+            if (to == count()) {
+                spliterator.forEachRemaining((LongConsumer) nodeBuilder);
+            } else {
+                for (int i = 0; i < size && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
+            }
             nodeBuilder.end();
             return nodeBuilder.build();
         }
@@ -508,7 +520,11 @@
             Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size);
             nodeBuilder.begin(size);
             for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { }
-            for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
+            if (to == count()) {
+                spliterator.forEachRemaining((DoubleConsumer) nodeBuilder);
+            } else {
+                for (int i = 0; i < size && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
+            }
             nodeBuilder.end();
             return nodeBuilder.build();
         }
--- a/src/java.base/share/classes/java/util/stream/Nodes.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/Nodes.java	Wed Jul 15 10:00:15 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
@@ -69,6 +69,14 @@
     private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong();
     private static final Node.OfDouble EMPTY_DOUBLE_NODE = new EmptyNode.OfDouble();
 
+    /**
+     * @return an array generator for an array whose elements are of type T.
+     */
+    @SuppressWarnings("unchecked")
+    static <T> IntFunction<T[]> castingArray() {
+        return size -> (T[]) new Object[size];
+    }
+
     // General shape-based node creation methods
 
     /**
--- a/src/java.base/share/classes/java/util/stream/PipelineHelper.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/PipelineHelper.java	Wed Jul 15 10:00:15 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
@@ -136,8 +136,9 @@
      *
      * @param wrappedSink the destination {@code Sink}
      * @param spliterator the source {@code Spliterator}
+     * @return true if the cancellation was requested
      */
-    abstract <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
+    abstract <P_IN> boolean copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
 
     /**
      * Takes a {@code Sink} that accepts elements of the output type of the
--- a/src/java.base/share/classes/java/util/stream/ReferencePipeline.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/ReferencePipeline.java	Wed Jul 15 10:00:15 2015 -0700
@@ -122,8 +122,10 @@
     }
 
     @Override
-    final void forEachWithCancel(Spliterator<P_OUT> spliterator, Sink<P_OUT> sink) {
-        do { } while (!sink.cancellationRequested() && spliterator.tryAdvance(sink));
+    final boolean forEachWithCancel(Spliterator<P_OUT> spliterator, Sink<P_OUT> sink) {
+        boolean cancelled;
+        do { } while (!(cancelled = sink.cancellationRequested()) && spliterator.tryAdvance(sink));
+        return cancelled;
     }
 
     @Override
@@ -411,6 +413,16 @@
             return SliceOps.makeRef(this, n, -1);
     }
 
+    @Override
+    public final Stream<P_OUT> takeWhile(Predicate<? super P_OUT> predicate) {
+        return WhileOps.makeTakeWhileRef(this, predicate);
+    }
+
+    @Override
+    public final Stream<P_OUT> dropWhile(Predicate<? super P_OUT> predicate) {
+        return WhileOps.makeDropWhileRef(this, predicate);
+    }
+
     // Terminal operations from Stream
 
     @Override
--- a/src/java.base/share/classes/java/util/stream/SliceOps.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/SliceOps.java	Wed Jul 15 10:00:15 2015 -0700
@@ -96,11 +96,6 @@
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private static <T> IntFunction<T[]> castingArray() {
-        return size -> (T[]) new Object[size];
-    }
-
     /**
      * Appends a "slice" operation to the provided stream.  The slice operation
      * may be may be skip-only, limit-only, or skip-and-limit.
@@ -151,7 +146,7 @@
                     //     cancellation will be more aggressive cancelling later tasks
                     //     if the target slice size has been reached from a given task,
                     //     cancellation should also clear local results if any
-                    return new SliceTask<>(this, helper, spliterator, castingArray(), skip, limit).
+                    return new SliceTask<>(this, helper, spliterator, Nodes.castingArray(), skip, limit).
                             invoke().spliterator();
                 }
             }
--- a/src/java.base/share/classes/java/util/stream/Stream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/java/util/stream/Stream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -24,7 +24,6 @@
  */
 package java.util.stream;
 
-import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
@@ -481,6 +480,135 @@
     Stream<T> skip(long n);
 
     /**
+     * Returns, if this stream is ordered, a stream consisting of the longest
+     * prefix of elements taken from this stream that match the given predicate.
+     * Otherwise returns, if this stream is unordered, a stream consisting of a
+     * subset of elements taken from this stream that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to take any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * takes all elements (the result is the same is the input), or if no
+     * elements of the stream match the given predicate then no elements are
+     * taken (the result is an empty stream).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code takeWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as {@link #generate(Supplier)}) or
+     * removing the ordering constraint with {@link #unordered()} may result in
+     * significant speedups of {@code takeWhile()} in parallel pipelines, if the
+     * semantics of your situation permit.  If consistency with encounter order
+     * is required, and you are experiencing poor performance or memory
+     * utilization with {@code takeWhile()} in parallel pipelines, switching to
+     * sequential execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default Stream<T> takeWhile(Predicate<? super T> predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.stream(
+                new WhileOps.UnorderedWhileSpliterator.OfRef.Taking<>(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
+     * Returns, if this stream is ordered, a stream consisting of the remaining
+     * elements of this stream after dropping the longest prefix of elements
+     * that match the given predicate.  Otherwise returns, if this stream is
+     * unordered, a stream consisting of the remaining elements of this stream
+     * after dropping a subset of elements that match the given predicate.
+     *
+     * <p>If this stream is ordered then the longest prefix is a contiguous
+     * sequence of elements of this stream that match the given predicate.  The
+     * first element of the sequence is the first element of this stream, and
+     * the element immediately following the last element of the sequence does
+     * not match the given predicate.
+     *
+     * <p>If this stream is unordered, and some (but not all) elements of this
+     * stream match the given predicate, then the behavior of this operation is
+     * nondeterministic; it is free to drop any subset of matching elements
+     * (which includes the empty set).
+     *
+     * <p>Independent of whether this stream is ordered or unordered if all
+     * elements of this stream match the given predicate then this operation
+     * drops all elements (the result is an empty stream), or if no elements of
+     * the stream match the given predicate then no elements are dropped (the
+     * result is the same is the input).
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @implSpec
+     * The default implementation obtains the {@link #spliterator() spliterator}
+     * of this stream, wraps that spliterator so as to support the semantics
+     * of this operation on traversal, and returns a new stream associated with
+     * the wrapped spliterator.  The returned stream preserves the execution
+     * characteristics of this stream (namely parallel or sequential execution
+     * as per {@link #isParallel()}) but the wrapped spliterator may choose to
+     * not support splitting.  When the returned stream is closed, the close
+     * handlers for both the returned and this stream are invoked.
+     *
+     * @apiNote
+     * While {@code dropWhile()} is generally a cheap operation on sequential
+     * stream pipelines, it can be quite expensive on ordered parallel
+     * pipelines, since the operation is constrained to return not just any
+     * valid prefix, but the longest prefix of elements in the encounter order.
+     * Using an unordered stream source (such as {@link #generate(Supplier)}) or
+     * removing the ordering constraint with {@link #unordered()} may result in
+     * significant speedups of {@code dropWhile()} in parallel pipelines, if the
+     * semantics of your situation permit.  If consistency with encounter order
+     * is required, and you are experiencing poor performance or memory
+     * utilization with {@code dropWhile()} in parallel pipelines, switching to
+     * sequential execution with {@link #sequential()} may improve performance.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements to determine the longest
+     *                  prefix of elements.
+     * @return the new stream
+     */
+    default Stream<T> dropWhile(Predicate<? super T> predicate) {
+        Objects.requireNonNull(predicate);
+        // Reuses the unordered spliterator, which, when encounter is present,
+        // is safe to use as long as it configured not to split
+        return StreamSupport.stream(
+                new WhileOps.UnorderedWhileSpliterator.OfRef.Dropping<>(spliterator(), true, predicate),
+                isParallel()).onClose(this::close);
+    }
+
+    /**
      * Performs an action for each element of this stream.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/util/stream/WhileOps.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,1394 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.util.Comparator;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoublePredicate;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.LongConsumer;
+import java.util.function.LongPredicate;
+import java.util.function.Predicate;
+
+/**
+ * Factory for instances of a takeWhile and dropWhile operations
+ * that produce subsequences of their input stream.
+ *
+ * @since 1.9
+ */
+final class WhileOps {
+
+    static final int TAKE_FLAGS = StreamOpFlag.NOT_SIZED | StreamOpFlag.IS_SHORT_CIRCUIT;
+
+    static final int DROP_FLAGS = StreamOpFlag.NOT_SIZED;
+
+    /**
+     * Appends a "takeWhile" operation to the provided Stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt taking.
+     */
+    static <T> Stream<T> makeTakeWhileRef(AbstractPipeline<?, T, ?> upstream,
+                                          Predicate<? super T> predicate) {
+        Objects.requireNonNull(predicate);
+        return new ReferencePipeline.StatefulOp<T, T>(upstream, StreamShape.REFERENCE, TAKE_FLAGS) {
+            @Override
+            <P_IN> Spliterator<T> opEvaluateParallelLazy(PipelineHelper<T> helper,
+                                                         Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Nodes.castingArray())
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfRef.Taking<>(
+                            helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+                                              Spliterator<P_IN> spliterator,
+                                              IntFunction<T[]> generator) {
+                return new TakeWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<T> opWrapSink(int flags, Sink<T> sink) {
+                return new Sink.ChainedReference<T, T>(sink) {
+                    boolean take = true;
+
+                    @Override
+                    public void begin(long size) {
+                        downstream.begin(-1);
+                    }
+
+                    @Override
+                    public void accept(T t) {
+                        if (take = predicate.test(t)) {
+                            downstream.accept(t);
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return !take || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "takeWhile" operation to the provided IntStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt taking.
+     */
+    static IntStream makeTakeWhileInt(AbstractPipeline<?, Integer, ?> upstream,
+                                      IntPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new IntPipeline.StatefulOp<Integer>(upstream, StreamShape.INT_VALUE, TAKE_FLAGS) {
+            @Override
+            <P_IN> Spliterator<Integer> opEvaluateParallelLazy(PipelineHelper<Integer> helper,
+                                                               Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Integer[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfInt.Taking(
+                            (Spliterator.OfInt) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+                                                    Spliterator<P_IN> spliterator,
+                                                    IntFunction<Integer[]> generator) {
+                return new TakeWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt<Integer>(sink) {
+                    boolean take = true;
+
+                    @Override
+                    public void begin(long size) {
+                        downstream.begin(-1);
+                    }
+
+                    @Override
+                    public void accept(int t) {
+                        if (take = predicate.test(t)) {
+                            downstream.accept(t);
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return !take || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "takeWhile" operation to the provided LongStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt taking.
+     */
+    static LongStream makeTakeWhileLong(AbstractPipeline<?, Long, ?> upstream,
+                                        LongPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new LongPipeline.StatefulOp<Long>(upstream, StreamShape.LONG_VALUE, TAKE_FLAGS) {
+            @Override
+            <P_IN> Spliterator<Long> opEvaluateParallelLazy(PipelineHelper<Long> helper,
+                                                            Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Long[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfLong.Taking(
+                            (Spliterator.OfLong) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 IntFunction<Long[]> generator) {
+                return new TakeWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong<Long>(sink) {
+                    boolean take = true;
+
+                    @Override
+                    public void begin(long size) {
+                        downstream.begin(-1);
+                    }
+
+                    @Override
+                    public void accept(long t) {
+                        if (take = predicate.test(t)) {
+                            downstream.accept(t);
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return !take || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "takeWhile" operation to the provided DoubleStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt taking.
+     */
+    static DoubleStream makeTakeWhileDouble(AbstractPipeline<?, Double, ?> upstream,
+                                            DoublePredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new DoublePipeline.StatefulOp<Double>(upstream, StreamShape.DOUBLE_VALUE, TAKE_FLAGS) {
+            @Override
+            <P_IN> Spliterator<Double> opEvaluateParallelLazy(PipelineHelper<Double> helper,
+                                                              Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Double[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfDouble.Taking(
+                            (Spliterator.OfDouble) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+                                                   Spliterator<P_IN> spliterator,
+                                                   IntFunction<Double[]> generator) {
+                return new TakeWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble<Double>(sink) {
+                    boolean take = true;
+
+                    @Override
+                    public void begin(long size) {
+                        downstream.begin(-1);
+                    }
+
+                    @Override
+                    public void accept(double t) {
+                        if (take = predicate.test(t)) {
+                            downstream.accept(t);
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return !take || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * A specialization for the dropWhile operation that controls if
+     * elements to be dropped are counted and passed downstream.
+     * <p>
+     * This specialization is utilized by the {@link TakeWhileTask} for
+     * pipelines that are ordered.  In such cases elements cannot be dropped
+     * until all elements have been collected.
+     *
+     * @param <T> the type of both input and output elements
+     */
+    interface DropWhileOp<T> {
+        /**
+         * Accepts a {@code Sink} which will receive the results of this
+         * dropWhile operation, and return a {@code DropWhileSink} which
+         * accepts
+         * elements and which performs the dropWhile operation passing the
+         * results to the provided {@code Sink}.
+         *
+         * @param sink sink to which elements should be sent after processing
+         * @param retainAndCountDroppedElements true if elements to be dropped
+         * are counted and passed to the sink, otherwise such elements
+         * are actually dropped and not passed to the sink.
+         * @return a dropWhile sink
+         */
+        DropWhileSink<T> opWrapSink(Sink<T> sink, boolean retainAndCountDroppedElements);
+    }
+
+    /**
+     * A specialization for a dropWhile sink.
+     *
+     * @param <T> the type of both input and output elements
+     */
+    interface DropWhileSink<T> extends Sink<T> {
+        /**
+         * @return the could of elements that would have been dropped and
+         * instead were passed downstream.
+         */
+        long getDropCount();
+    }
+
+    /**
+     * Appends a "dropWhile" operation to the provided Stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt dropping.
+     */
+    static <T> Stream<T> makeDropWhileRef(AbstractPipeline<?, T, ?> upstream,
+                                          Predicate<? super T> predicate) {
+        Objects.requireNonNull(predicate);
+
+        class Op extends ReferencePipeline.StatefulOp<T, T> implements DropWhileOp<T> {
+            public Op(AbstractPipeline<?, T, ?> upstream, StreamShape inputShape, int opFlags) {
+                super(upstream, inputShape, opFlags);
+            }
+
+            @Override
+            <P_IN> Spliterator<T> opEvaluateParallelLazy(PipelineHelper<T> helper,
+                                                         Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Nodes.castingArray())
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfRef.Dropping<>(
+                            helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+                                              Spliterator<P_IN> spliterator,
+                                              IntFunction<T[]> generator) {
+                return new DropWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<T> opWrapSink(int flags, Sink<T> sink) {
+                return opWrapSink(sink, false);
+            }
+
+            public DropWhileSink<T> opWrapSink(Sink<T> sink, boolean retainAndCountDroppedElements) {
+                class OpSink extends Sink.ChainedReference<T, T> implements DropWhileSink<T> {
+                    long dropCount;
+                    boolean take;
+
+                    OpSink() {
+                        super(sink);
+                    }
+
+                    @Override
+                    public void accept(T t) {
+                        boolean takeElement = take || (take = !predicate.test(t));
+
+                        // If ordered and element is dropped increment index
+                        // for possible future truncation
+                        if (retainAndCountDroppedElements && !takeElement)
+                            dropCount++;
+
+                        // If ordered need to process element, otherwise
+                        // skip if element is dropped
+                        if (retainAndCountDroppedElements || takeElement)
+                            downstream.accept(t);
+                    }
+
+                    @Override
+                    public long getDropCount() {
+                        return dropCount;
+                    }
+                }
+                return new OpSink();
+            }
+        }
+        return new Op(upstream, StreamShape.REFERENCE, DROP_FLAGS);
+    }
+
+    /**
+     * Appends a "dropWhile" operation to the provided IntStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt dropping.
+     */
+    static IntStream makeDropWhileInt(AbstractPipeline<?, Integer, ?> upstream,
+                                      IntPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        class Op extends IntPipeline.StatefulOp<Integer> implements DropWhileOp<Integer> {
+            public Op(AbstractPipeline<?, Integer, ?> upstream, StreamShape inputShape, int opFlags) {
+                super(upstream, inputShape, opFlags);
+            }
+
+            @Override
+            <P_IN> Spliterator<Integer> opEvaluateParallelLazy(PipelineHelper<Integer> helper,
+                                                               Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Integer[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfInt.Dropping(
+                            (Spliterator.OfInt) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+                                                    Spliterator<P_IN> spliterator,
+                                                    IntFunction<Integer[]> generator) {
+                return new DropWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return opWrapSink(sink, false);
+            }
+
+            public DropWhileSink<Integer> opWrapSink(Sink<Integer> sink, boolean retainAndCountDroppedElements) {
+                class OpSink extends Sink.ChainedInt<Integer> implements DropWhileSink<Integer> {
+                    long dropCount;
+                    boolean take;
+
+                    OpSink() {
+                        super(sink);
+                    }
+
+                    @Override
+                    public void accept(int t) {
+                        boolean takeElement = take || (take = !predicate.test(t));
+
+                        // If ordered and element is dropped increment index
+                        // for possible future truncation
+                        if (retainAndCountDroppedElements && !takeElement)
+                            dropCount++;
+
+                        // If ordered need to process element, otherwise
+                        // skip if element is dropped
+                        if (retainAndCountDroppedElements || takeElement)
+                            downstream.accept(t);
+                    }
+
+                    @Override
+                    public long getDropCount() {
+                        return dropCount;
+                    }
+                }
+                return new OpSink();
+            }
+        }
+        return new Op(upstream, StreamShape.INT_VALUE, DROP_FLAGS);
+    }
+
+    /**
+     * Appends a "dropWhile" operation to the provided LongStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt dropping.
+     */
+    static LongStream makeDropWhileLong(AbstractPipeline<?, Long, ?> upstream,
+                                        LongPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        class Op extends LongPipeline.StatefulOp<Long> implements DropWhileOp<Long> {
+            public Op(AbstractPipeline<?, Long, ?> upstream, StreamShape inputShape, int opFlags) {
+                super(upstream, inputShape, opFlags);
+            }
+
+            @Override
+            <P_IN> Spliterator<Long> opEvaluateParallelLazy(PipelineHelper<Long> helper,
+                                                            Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Long[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfLong.Dropping(
+                            (Spliterator.OfLong) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 IntFunction<Long[]> generator) {
+                return new DropWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return opWrapSink(sink, false);
+            }
+
+            public DropWhileSink<Long> opWrapSink(Sink<Long> sink, boolean retainAndCountDroppedElements) {
+                class OpSink extends Sink.ChainedLong<Long> implements DropWhileSink<Long> {
+                    long dropCount;
+                    boolean take;
+
+                    OpSink() {
+                        super(sink);
+                    }
+
+                    @Override
+                    public void accept(long t) {
+                        boolean takeElement = take || (take = !predicate.test(t));
+
+                        // If ordered and element is dropped increment index
+                        // for possible future truncation
+                        if (retainAndCountDroppedElements && !takeElement)
+                            dropCount++;
+
+                        // If ordered need to process element, otherwise
+                        // skip if element is dropped
+                        if (retainAndCountDroppedElements || takeElement)
+                            downstream.accept(t);
+                    }
+
+                    @Override
+                    public long getDropCount() {
+                        return dropCount;
+                    }
+                }
+                return new OpSink();
+            }
+        }
+        return new Op(upstream, StreamShape.LONG_VALUE, DROP_FLAGS);
+    }
+
+    /**
+     * Appends a "dropWhile" operation to the provided DoubleStream.
+     *
+     * @param upstream a reference stream with element type T
+     * @param predicate the predicate that returns false to halt dropping.
+     */
+    static DoubleStream makeDropWhileDouble(AbstractPipeline<?, Double, ?> upstream,
+                                            DoublePredicate predicate) {
+        Objects.requireNonNull(predicate);
+        class Op extends DoublePipeline.StatefulOp<Double> implements DropWhileOp<Double> {
+            public Op(AbstractPipeline<?, Double, ?> upstream, StreamShape inputShape, int opFlags) {
+                super(upstream, inputShape, opFlags);
+            }
+
+            @Override
+            <P_IN> Spliterator<Double> opEvaluateParallelLazy(PipelineHelper<Double> helper,
+                                                              Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    return opEvaluateParallel(helper, spliterator, Double[]::new)
+                            .spliterator();
+                }
+                else {
+                    return new UnorderedWhileSpliterator.OfDouble.Dropping(
+                            (Spliterator.OfDouble) helper.wrapSpliterator(spliterator), false, predicate);
+                }
+            }
+
+            @Override
+            <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+                                                   Spliterator<P_IN> spliterator,
+                                                   IntFunction<Double[]> generator) {
+                return new DropWhileTask<>(this, helper, spliterator, generator)
+                        .invoke();
+            }
+
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return opWrapSink(sink, false);
+            }
+
+            public DropWhileSink<Double> opWrapSink(Sink<Double> sink, boolean retainAndCountDroppedElements) {
+                class OpSink extends Sink.ChainedDouble<Double> implements DropWhileSink<Double> {
+                    long dropCount;
+                    boolean take;
+
+                    OpSink() {
+                        super(sink);
+                    }
+
+                    @Override
+                    public void accept(double t) {
+                        boolean takeElement = take || (take = !predicate.test(t));
+
+                        // If ordered and element is dropped increment index
+                        // for possible future truncation
+                        if (retainAndCountDroppedElements && !takeElement)
+                            dropCount++;
+
+                        // If ordered need to process element, otherwise
+                        // skip if element is dropped
+                        if (retainAndCountDroppedElements || takeElement)
+                            downstream.accept(t);
+                    }
+
+                    @Override
+                    public long getDropCount() {
+                        return dropCount;
+                    }
+                }
+                return new OpSink();
+            }
+        }
+        return new Op(upstream, StreamShape.DOUBLE_VALUE, DROP_FLAGS);
+    }
+
+    //
+
+    /**
+     * A spliterator supporting takeWhile and dropWhile operations over an
+     * underlying spliterator whose covered elements have no encounter order.
+     * <p>
+     * Concrete subclasses of this spliterator support reference and primitive
+     * types for takeWhile and dropWhile.
+     * <p>
+     * For the takeWhile operation if during traversal taking completes then
+     * taking is cancelled globally for the splitting and traversal of all
+     * related spliterators.
+     * Cancellation is governed by a shared {@link AtomicBoolean} instance.  A
+     * spliterator in the process of taking when cancellation occurs will also
+     * be cancelled but not necessarily immediately.  To reduce contention on
+     * the {@link AtomicBoolean} instance, cancellation make be acted on after
+     * a small number of additional elements have been traversed.
+     * <p>
+     * For the dropWhile operation if during traversal dropping completes for
+     * some, but not all elements, then it is cancelled globally for the
+     * traversal of all related spliterators (splitting is not cancelled).
+     * Cancellation is governed in the same manner as for the takeWhile
+     * operation.
+     *
+     * @param <T> the type of elements returned by this spliterator
+     * @param <T_SPLITR> the type of the spliterator
+     */
+    static abstract class UnorderedWhileSpliterator<T, T_SPLITR extends Spliterator<T>> implements Spliterator<T> {
+        // Power of two constant minus one used for modulus of count
+        static final int CANCEL_CHECK_COUNT = (1 << 6) - 1;
+
+        // The underlying spliterator
+        final T_SPLITR s;
+        // True if no splitting should be performed, if true then
+        // this spliterator may be used for an underlying spliterator whose
+        // covered elements have an encounter order
+        // See use in stream take/dropWhile default default methods
+        final boolean noSplitting;
+        // True when operations are cancelled for all related spliterators
+        // For taking, spliterators cannot split or traversed
+        // For dropping, spliterators cannot be traversed
+        final AtomicBoolean cancel;
+        // True while taking or dropping should be performed when traversing
+        boolean takeOrDrop = true;
+        // The count of elements traversed
+        int count;
+
+        UnorderedWhileSpliterator(T_SPLITR s, boolean noSplitting) {
+            this.s = s;
+            this.noSplitting = noSplitting;
+            this.cancel = new AtomicBoolean();
+        }
+
+        UnorderedWhileSpliterator(T_SPLITR s, UnorderedWhileSpliterator<T, T_SPLITR> parent) {
+            this.s = s;
+            this.noSplitting = parent.noSplitting;
+            this.cancel = parent.cancel;
+        }
+
+        @Override
+        public long estimateSize() {
+            return s.estimateSize();
+        }
+
+        @Override
+        public int characteristics() {
+            // Size is not known
+            return s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED);
+        }
+
+        @Override
+        public long getExactSizeIfKnown() {
+            return -1L;
+        }
+
+        @Override
+        public Comparator<? super T> getComparator() {
+            return s.getComparator();
+        }
+
+        @Override
+        public T_SPLITR trySplit() {
+            @SuppressWarnings("unchecked")
+            T_SPLITR ls = noSplitting ? null : (T_SPLITR) s.trySplit();
+            return ls != null ? makeSpliterator(ls) : null;
+        }
+
+        boolean checkCancelOnCount() {
+            return count != 0 || !cancel.get();
+        }
+
+        abstract T_SPLITR makeSpliterator(T_SPLITR s);
+
+        static abstract class OfRef<T> extends UnorderedWhileSpliterator<T, Spliterator<T>> implements Consumer<T> {
+            final Predicate<? super T> p;
+            T t;
+
+            OfRef(Spliterator<T> s, boolean noSplitting, Predicate<? super T> p) {
+                super(s, noSplitting);
+                this.p = p;
+            }
+
+            OfRef(Spliterator<T> s, OfRef<T> parent) {
+                super(s, parent);
+                this.p = parent.p;
+            }
+
+            @Override
+            public void accept(T t) {
+                count = (count + 1) & CANCEL_CHECK_COUNT;
+                this.t = t;
+            }
+
+            static final class Taking<T> extends OfRef<T> {
+                Taking(Spliterator<T> s, boolean noSplitting, Predicate<? super T> p) {
+                    super(s, noSplitting, p);
+                }
+
+                Taking(Spliterator<T> s, Taking<T> parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(Consumer<? super T> action) {
+                    boolean test = true;
+                    if (takeOrDrop &&               // If can take
+                        checkCancelOnCount() && // and if not cancelled
+                        s.tryAdvance(this) &&   // and if advanced one element
+                        (test = p.test(t))) {   // and test on element passes
+                        action.accept(t);           // then accept element
+                        return true;
+                    }
+                    else {
+                        // Taking is finished
+                        takeOrDrop = false;
+                        // Cancel all further traversal and splitting operations
+                        // only if test of element failed (short-circuited)
+                        if (!test)
+                            cancel.set(true);
+                        return false;
+                    }
+                }
+
+                @Override
+                public Spliterator<T> trySplit() {
+                    // Do not split if all operations are cancelled
+                    return cancel.get() ? null : super.trySplit();
+                }
+
+                @Override
+                Spliterator<T> makeSpliterator(Spliterator<T> s) {
+                    return new Taking<>(s, this);
+                }
+            }
+
+            static final class Dropping<T> extends OfRef<T> {
+                Dropping(Spliterator<T> s, boolean noSplitting, Predicate<? super T> p) {
+                    super(s, noSplitting, p);
+                }
+
+                Dropping(Spliterator<T> s, Dropping<T> parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(Consumer<? super T> action) {
+                    if (takeOrDrop) {
+                        takeOrDrop = false;
+                        boolean adv;
+                        boolean dropped = false;
+                        while ((adv = s.tryAdvance(this)) &&  // If advanced one element
+                               checkCancelOnCount() &&        // and if not cancelled
+                               p.test(t)) {                   // and test on element passes
+                            dropped = true;                   // then drop element
+                        }
+
+                        // Report advanced element, if any
+                        if (adv) {
+                            // Cancel all further dropping if one or more elements
+                            // were previously dropped
+                            if (dropped)
+                                cancel.set(true);
+                            action.accept(t);
+                        }
+                        return adv;
+                    }
+                    else {
+                        return s.tryAdvance(action);
+                    }
+                }
+
+                @Override
+                Spliterator<T> makeSpliterator(Spliterator<T> s) {
+                    return new Dropping<>(s, this);
+                }
+            }
+        }
+
+        static abstract class OfInt extends UnorderedWhileSpliterator<Integer, Spliterator.OfInt> implements IntConsumer, Spliterator.OfInt {
+            final IntPredicate p;
+            int t;
+
+            OfInt(Spliterator.OfInt s, boolean noSplitting, IntPredicate p) {
+                super(s, noSplitting);
+                this.p = p;
+            }
+
+            OfInt(Spliterator.OfInt s, UnorderedWhileSpliterator.OfInt parent) {
+                super(s, parent);
+                this.p = parent.p;
+            }
+
+            @Override
+            public void accept(int t) {
+                count = (count + 1) & CANCEL_CHECK_COUNT;
+                this.t = t;
+            }
+
+            static final class Taking extends UnorderedWhileSpliterator.OfInt {
+                Taking(Spliterator.OfInt s, boolean noSplitting, IntPredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Taking(Spliterator.OfInt s, UnorderedWhileSpliterator.OfInt parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(IntConsumer action) {
+                    boolean test = true;
+                    if (takeOrDrop &&               // If can take
+                        checkCancelOnCount() && // and if not cancelled
+                        s.tryAdvance(this) &&   // and if advanced one element
+                        (test = p.test(t))) {   // and test on element passes
+                        action.accept(t);           // then accept element
+                        return true;
+                    }
+                    else {
+                        // Taking is finished
+                        takeOrDrop = false;
+                        // Cancel all further traversal and splitting operations
+                        // only if test of element failed (short-circuited)
+                        if (!test)
+                            cancel.set(true);
+                        return false;
+                    }
+                }
+
+                @Override
+                public Spliterator.OfInt trySplit() {
+                    // Do not split if all operations are cancelled
+                    return cancel.get() ? null : super.trySplit();
+                }
+
+                @Override
+                Spliterator.OfInt makeSpliterator(Spliterator.OfInt s) {
+                    return new Taking(s, this);
+                }
+            }
+
+            static final class Dropping extends UnorderedWhileSpliterator.OfInt {
+                Dropping(Spliterator.OfInt s, boolean noSplitting, IntPredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Dropping(Spliterator.OfInt s, UnorderedWhileSpliterator.OfInt parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(IntConsumer action) {
+                    if (takeOrDrop) {
+                        takeOrDrop = false;
+                        boolean adv;
+                        boolean dropped = false;
+                        while ((adv = s.tryAdvance(this)) &&  // If advanced one element
+                               checkCancelOnCount() &&        // and if not cancelled
+                               p.test(t)) {                   // and test on element passes
+                            dropped = true;                   // then drop element
+                        }
+
+                        // Report advanced element, if any
+                        if (adv) {
+                            // Cancel all further dropping if one or more elements
+                            // were previously dropped
+                            if (dropped)
+                                cancel.set(true);
+                            action.accept(t);
+                        }
+                        return adv;
+                    }
+                    else {
+                        return s.tryAdvance(action);
+                    }
+                }
+
+                @Override
+                Spliterator.OfInt makeSpliterator(Spliterator.OfInt s) {
+                    return new Dropping(s, this);
+                }
+            }
+        }
+
+        static abstract class OfLong extends UnorderedWhileSpliterator<Long, Spliterator.OfLong> implements LongConsumer, Spliterator.OfLong {
+            final LongPredicate p;
+            long t;
+
+            OfLong(Spliterator.OfLong s, boolean noSplitting, LongPredicate p) {
+                super(s, noSplitting);
+                this.p = p;
+            }
+
+            OfLong(Spliterator.OfLong s, UnorderedWhileSpliterator.OfLong parent) {
+                super(s, parent);
+                this.p = parent.p;
+            }
+
+            @Override
+            public void accept(long t) {
+                count = (count + 1) & CANCEL_CHECK_COUNT;
+                this.t = t;
+            }
+
+            static final class Taking extends UnorderedWhileSpliterator.OfLong {
+                Taking(Spliterator.OfLong s, boolean noSplitting, LongPredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Taking(Spliterator.OfLong s, UnorderedWhileSpliterator.OfLong parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(LongConsumer action) {
+                    boolean test = true;
+                    if (takeOrDrop &&               // If can take
+                        checkCancelOnCount() && // and if not cancelled
+                        s.tryAdvance(this) &&   // and if advanced one element
+                        (test = p.test(t))) {   // and test on element passes
+                        action.accept(t);           // then accept element
+                        return true;
+                    }
+                    else {
+                        // Taking is finished
+                        takeOrDrop = false;
+                        // Cancel all further traversal and splitting operations
+                        // only if test of element failed (short-circuited)
+                        if (!test)
+                            cancel.set(true);
+                        return false;
+                    }
+                }
+
+                @Override
+                public Spliterator.OfLong trySplit() {
+                    // Do not split if all operations are cancelled
+                    return cancel.get() ? null : super.trySplit();
+                }
+
+                @Override
+                Spliterator.OfLong makeSpliterator(Spliterator.OfLong s) {
+                    return new Taking(s, this);
+                }
+            }
+
+            static final class Dropping extends UnorderedWhileSpliterator.OfLong {
+                Dropping(Spliterator.OfLong s, boolean noSplitting, LongPredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Dropping(Spliterator.OfLong s, UnorderedWhileSpliterator.OfLong parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(LongConsumer action) {
+                    if (takeOrDrop) {
+                        takeOrDrop = false;
+                        boolean adv;
+                        boolean dropped = false;
+                        while ((adv = s.tryAdvance(this)) &&  // If advanced one element
+                               checkCancelOnCount() &&        // and if not cancelled
+                               p.test(t)) {                   // and test on element passes
+                            dropped = true;                   // then drop element
+                        }
+
+                        // Report advanced element, if any
+                        if (adv) {
+                            // Cancel all further dropping if one or more elements
+                            // were previously dropped
+                            if (dropped)
+                                cancel.set(true);
+                            action.accept(t);
+                        }
+                        return adv;
+                    }
+                    else {
+                        return s.tryAdvance(action);
+                    }
+                }
+
+                @Override
+                Spliterator.OfLong makeSpliterator(Spliterator.OfLong s) {
+                    return new Dropping(s, this);
+                }
+            }
+        }
+
+        static abstract class OfDouble extends UnorderedWhileSpliterator<Double, Spliterator.OfDouble> implements DoubleConsumer, Spliterator.OfDouble {
+            final DoublePredicate p;
+            double t;
+
+            OfDouble(Spliterator.OfDouble s, boolean noSplitting, DoublePredicate p) {
+                super(s, noSplitting);
+                this.p = p;
+            }
+
+            OfDouble(Spliterator.OfDouble s, UnorderedWhileSpliterator.OfDouble parent) {
+                super(s, parent);
+                this.p = parent.p;
+            }
+
+            @Override
+            public void accept(double t) {
+                count = (count + 1) & CANCEL_CHECK_COUNT;
+                this.t = t;
+            }
+
+            static final class Taking extends UnorderedWhileSpliterator.OfDouble {
+                Taking(Spliterator.OfDouble s, boolean noSplitting, DoublePredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Taking(Spliterator.OfDouble s, UnorderedWhileSpliterator.OfDouble parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(DoubleConsumer action) {
+                    boolean test = true;
+                    if (takeOrDrop &&               // If can take
+                        checkCancelOnCount() && // and if not cancelled
+                        s.tryAdvance(this) &&   // and if advanced one element
+                        (test = p.test(t))) {   // and test on element passes
+                        action.accept(t);           // then accept element
+                        return true;
+                    }
+                    else {
+                        // Taking is finished
+                        takeOrDrop = false;
+                        // Cancel all further traversal and splitting operations
+                        // only if test of element failed (short-circuited)
+                        if (!test)
+                            cancel.set(true);
+                        return false;
+                    }
+                }
+
+                @Override
+                public Spliterator.OfDouble trySplit() {
+                    // Do not split if all operations are cancelled
+                    return cancel.get() ? null : super.trySplit();
+                }
+
+                @Override
+                Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s) {
+                    return new Taking(s, this);
+                }
+            }
+
+            static final class Dropping extends UnorderedWhileSpliterator.OfDouble {
+                Dropping(Spliterator.OfDouble s, boolean noSplitting, DoublePredicate p) {
+                    super(s, noSplitting, p);
+                }
+
+                Dropping(Spliterator.OfDouble s, UnorderedWhileSpliterator.OfDouble parent) {
+                    super(s, parent);
+                }
+
+                @Override
+                public boolean tryAdvance(DoubleConsumer action) {
+                    if (takeOrDrop) {
+                        takeOrDrop = false;
+                        boolean adv;
+                        boolean dropped = false;
+                        while ((adv = s.tryAdvance(this)) &&  // If advanced one element
+                               checkCancelOnCount() &&        // and if not cancelled
+                               p.test(t)) {                   // and test on element passes
+                            dropped = true;                   // then drop element
+                        }
+
+                        // Report advanced element, if any
+                        if (adv) {
+                            // Cancel all further dropping if one or more elements
+                            // were previously dropped
+                            if (dropped)
+                                cancel.set(true);
+                            action.accept(t);
+                        }
+                        return adv;
+                    }
+                    else {
+                        return s.tryAdvance(action);
+                    }
+                }
+
+                @Override
+                Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s) {
+                    return new Dropping(s, this);
+                }
+            }
+        }
+    }
+
+
+    //
+
+    /**
+     * {@code ForkJoinTask} implementing takeWhile computation.
+     * <p>
+     * If the pipeline has encounter order then all tasks to the right of
+     * a task where traversal was short-circuited are cancelled.
+     * The results of completed (and cancelled) tasks are discarded.
+     * The result of merging a short-circuited left task and right task (which
+     * may or may not be short-circuited) is that left task.
+     * <p>
+     * If the pipeline has no encounter order then all tasks to the right of
+     * a task where traversal was short-circuited are cancelled.
+     * The results of completed (and possibly cancelled) tasks are not
+     * discarded, as there is no need to throw away computed results.
+     * The result of merging does not change if a left task was
+     * short-circuited.
+     * No attempt is made, once a leaf task stopped taking, for it to cancel
+     * all other tasks, and further more, short-circuit the computation with its
+     * result.
+     *
+     * @param <P_IN> Input element type to the stream pipeline
+     * @param <P_OUT> Output element type from the stream pipeline
+     */
+    @SuppressWarnings("serial")
+    private static final class TakeWhileTask<P_IN, P_OUT>
+            extends AbstractShortCircuitTask<P_IN, P_OUT, Node<P_OUT>, TakeWhileTask<P_IN, P_OUT>> {
+        private final AbstractPipeline<P_OUT, P_OUT, ?> op;
+        private final IntFunction<P_OUT[]> generator;
+        private final boolean isOrdered;
+        private long thisNodeSize;
+        // True if a short-circuited
+        private boolean shortCircuited;
+        // True if completed, must be set after the local result
+        private volatile boolean completed;
+
+        TakeWhileTask(AbstractPipeline<P_OUT, P_OUT, ?> op,
+                      PipelineHelper<P_OUT> helper,
+                      Spliterator<P_IN> spliterator,
+                      IntFunction<P_OUT[]> generator) {
+            super(helper, spliterator);
+            this.op = op;
+            this.generator = generator;
+            this.isOrdered = StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags());
+        }
+
+        TakeWhileTask(TakeWhileTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+            this.generator = parent.generator;
+            this.isOrdered = parent.isOrdered;
+        }
+
+        @Override
+        protected TakeWhileTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+            return new TakeWhileTask<>(this, spliterator);
+        }
+
+        @Override
+        protected final Node<P_OUT> getEmptyResult() {
+            return Nodes.emptyNode(op.getOutputShape());
+        }
+
+        @Override
+        protected final Node<P_OUT> doLeaf() {
+            Node.Builder<P_OUT> builder = helper.makeNodeBuilder(-1, generator);
+            Sink<P_OUT> s = op.opWrapSink(helper.getStreamAndOpFlags(), builder);
+
+            if (shortCircuited = helper.copyIntoWithCancel(helper.wrapSink(s), spliterator)) {
+                // Cancel later nodes if the predicate returned false
+                // during traversal
+                cancelLaterNodes();
+            }
+
+            Node<P_OUT> node = builder.build();
+            thisNodeSize = node.count();
+            return node;
+        }
+
+        @Override
+        public final void onCompletion(CountedCompleter<?> caller) {
+            if (!isLeaf()) {
+                Node<P_OUT> result;
+                shortCircuited = leftChild.shortCircuited | rightChild.shortCircuited;
+                if (isOrdered && canceled) {
+                    thisNodeSize = 0;
+                    result = getEmptyResult();
+                }
+                else if (isOrdered && leftChild.shortCircuited) {
+                    // If taking finished on the left node then
+                    // use the left node result
+                    thisNodeSize = leftChild.thisNodeSize;
+                    result = leftChild.getLocalResult();
+                }
+                else {
+                    thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize;
+                    result = merge();
+                }
+
+                setLocalResult(result);
+            }
+
+            completed = true;
+            super.onCompletion(caller);
+        }
+
+        Node<P_OUT> merge() {
+            if (leftChild.thisNodeSize == 0) {
+                // If the left node size is 0 then
+                // use the right node result
+                return rightChild.getLocalResult();
+            }
+            else if (rightChild.thisNodeSize == 0) {
+                // If the right node size is 0 then
+                // use the left node result
+                return leftChild.getLocalResult();
+            }
+            else {
+                // Combine the left and right nodes
+                return Nodes.conc(op.getOutputShape(),
+                                  leftChild.getLocalResult(), rightChild.getLocalResult());
+            }
+        }
+
+        @Override
+        protected void cancel() {
+            super.cancel();
+            if (isOrdered && completed)
+                // If the task is completed then clear the result, if any
+                // to aid GC
+                setLocalResult(getEmptyResult());
+        }
+    }
+
+    /**
+     * {@code ForkJoinTask} implementing dropWhile computation.
+     * <p>
+     * If the pipeline has encounter order then each leaf task will not
+     * drop elements but will obtain a count of the elements that would have
+     * been otherwise dropped. That count is used as an index to track
+     * elements to be dropped. Merging will update the index so it corresponds
+     * to the index that is the end of the global prefix of elements to be
+     * dropped. The root is truncated according to that index.
+     * <p>
+     * If the pipeline has no encounter order then each leaf task will drop
+     * elements. Leaf tasks are ordinarily merged. No truncation of the root
+     * node is required.
+     * No attempt is made, once a leaf task stopped dropping, for it to cancel
+     * all other tasks, and further more, short-circuit the computation with
+     * its result.
+     *
+     * @param <P_IN> Input element type to the stream pipeline
+     * @param <P_OUT> Output element type from the stream pipeline
+     */
+    @SuppressWarnings("serial")
+    private static final class DropWhileTask<P_IN, P_OUT>
+            extends AbstractTask<P_IN, P_OUT, Node<P_OUT>, DropWhileTask<P_IN, P_OUT>> {
+        private final AbstractPipeline<P_OUT, P_OUT, ?> op;
+        private final IntFunction<P_OUT[]> generator;
+        private final boolean isOrdered;
+        private long thisNodeSize;
+        // The index from which elements of the node should be taken
+        // i.e. the node should be truncated from [takeIndex, thisNodeSize)
+        // Equivalent to the count of dropped elements
+        private long index;
+
+        DropWhileTask(AbstractPipeline<P_OUT, P_OUT, ?> op,
+                      PipelineHelper<P_OUT> helper,
+                      Spliterator<P_IN> spliterator,
+                      IntFunction<P_OUT[]> generator) {
+            super(helper, spliterator);
+            assert op instanceof DropWhileOp;
+            this.op = op;
+            this.generator = generator;
+            this.isOrdered = StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags());
+        }
+
+        DropWhileTask(DropWhileTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+            this.generator = parent.generator;
+            this.isOrdered = parent.isOrdered;
+        }
+
+        @Override
+        protected DropWhileTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+            return new DropWhileTask<>(this, spliterator);
+        }
+
+        @Override
+        protected final Node<P_OUT> doLeaf() {
+            boolean isChild = !isRoot();
+            // If this not the root and pipeline is ordered and size is known
+            // then pre-size the builder
+            long sizeIfKnown = isChild && isOrdered && StreamOpFlag.SIZED.isPreserved(op.sourceOrOpFlags)
+                               ? op.exactOutputSizeIfKnown(spliterator)
+                               : -1;
+            Node.Builder<P_OUT> builder = helper.makeNodeBuilder(sizeIfKnown, generator);
+            @SuppressWarnings("unchecked")
+            DropWhileOp<P_OUT> dropOp = (DropWhileOp<P_OUT>) op;
+            // If this leaf is the root then there is no merging on completion
+            // and there is no need to retain dropped elements
+            DropWhileSink<P_OUT> s = dropOp.opWrapSink(builder, isOrdered && isChild);
+            helper.wrapAndCopyInto(s, spliterator);
+
+            Node<P_OUT> node = builder.build();
+            thisNodeSize = node.count();
+            index = s.getDropCount();
+            return node;
+        }
+
+        @Override
+        public final void onCompletion(CountedCompleter<?> caller) {
+            if (!isLeaf()) {
+                if (isOrdered) {
+                    index = leftChild.index;
+                    // If a contiguous sequence of dropped elements
+                    // include those of the right node, if any
+                    if (index == leftChild.thisNodeSize)
+                        index += rightChild.index;
+                }
+
+                thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize;
+                Node<P_OUT> result = merge();
+                setLocalResult(isRoot() ? doTruncate(result) : result);
+            }
+
+            super.onCompletion(caller);
+        }
+
+        private Node<P_OUT> merge() {
+            if (leftChild.thisNodeSize == 0) {
+                // If the left node size is 0 then
+                // use the right node result
+                return rightChild.getLocalResult();
+            }
+            else if (rightChild.thisNodeSize == 0) {
+                // If the right node size is 0 then
+                // use the left node result
+                return leftChild.getLocalResult();
+            }
+            else {
+                // Combine the left and right nodes
+                return Nodes.conc(op.getOutputShape(),
+                                  leftChild.getLocalResult(), rightChild.getLocalResult());
+            }
+        }
+
+        private Node<P_OUT> doTruncate(Node<P_OUT> input) {
+            return isOrdered
+                   ? input.truncate(index, input.count(), generator)
+                   : input;
+        }
+    }
+}
--- a/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java	Wed Jul 15 10:00:15 2015 -0700
@@ -156,8 +156,10 @@
          * This value is used to indicate that not-yet-interpreted data
          * has been previously received from the remote side, and does
          * not need to be received again.
+         * <P>
+         * This handshake status only applies to DTLS.
          *
-         * @since   1.9
+         * @since   9
          */
         NEED_UNWRAP_AGAIN;
     }
@@ -219,7 +221,7 @@
      *          arguments are null, or if {@code bytesConsumed} or
      *          {@code bytesProduced} is negative
      *
-     * @since   1.9
+     * @since   9
      */
     public SSLEngineResult(Status status, HandshakeStatus handshakeStatus,
             int bytesConsumed, int bytesProduced, long sequenceNumber) {
@@ -302,7 +304,7 @@
      *
      * @see     java.lang.Long#compareUnsigned(long, long)
      *
-     * @since   1.9
+     * @since   9
      */
     final public long sequenceNumber() {
         return sequenceNumber;
--- a/src/java.base/share/classes/sun/security/pkcs/PKCS7.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/pkcs/PKCS7.java	Wed Jul 15 10:00:15 2015 -0700
@@ -507,7 +507,7 @@
         // certificates (optional)
         if (certificates != null && certificates.length != 0) {
             // cast to X509CertImpl[] since X509CertImpl implements DerEncoder
-            X509CertImpl implCerts[] = new X509CertImpl[certificates.length];
+            X509CertImpl[] implCerts = new X509CertImpl[certificates.length];
             for (int i = 0; i < certificates.length; i++) {
                 if (certificates[i] instanceof X509CertImpl)
                     implCerts[i] = (X509CertImpl) certificates[i];
--- a/src/java.base/share/classes/sun/security/pkcs/PKCS8Key.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/pkcs/PKCS8Key.java	Wed Jul 15 10:00:15 2015 -0700
@@ -78,7 +78,7 @@
      * data is stored and transmitted losslessly, but no knowledge
      * about this particular algorithm is available.
      */
-    private PKCS8Key (AlgorithmId algid, byte key [])
+    private PKCS8Key (AlgorithmId algid, byte[] key)
     throws InvalidKeyException {
         this.algid = algid;
         this.key = key;
--- a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Wed Jul 15 10:00:15 2015 -0700
@@ -154,28 +154,28 @@
 
     private static final Debug debug = Debug.getInstance("pkcs12");
 
-    private static final int keyBag[]  = {1, 2, 840, 113549, 1, 12, 10, 1, 2};
-    private static final int certBag[] = {1, 2, 840, 113549, 1, 12, 10, 1, 3};
-    private static final int secretBag[] = {1, 2, 840, 113549, 1, 12, 10, 1, 5};
+    private static final int[] keyBag  = {1, 2, 840, 113549, 1, 12, 10, 1, 2};
+    private static final int[] certBag = {1, 2, 840, 113549, 1, 12, 10, 1, 3};
+    private static final int[] secretBag = {1, 2, 840, 113549, 1, 12, 10, 1, 5};
 
-    private static final int pkcs9Name[]  = {1, 2, 840, 113549, 1, 9, 20};
-    private static final int pkcs9KeyId[] = {1, 2, 840, 113549, 1, 9, 21};
+    private static final int[] pkcs9Name  = {1, 2, 840, 113549, 1, 9, 20};
+    private static final int[] pkcs9KeyId = {1, 2, 840, 113549, 1, 9, 21};
 
-    private static final int pkcs9certType[] = {1, 2, 840, 113549, 1, 9, 22, 1};
+    private static final int[] pkcs9certType = {1, 2, 840, 113549, 1, 9, 22, 1};
 
-    private static final int pbeWithSHAAnd40BitRC2CBC[] =
+    private static final int[] pbeWithSHAAnd40BitRC2CBC =
                                         {1, 2, 840, 113549, 1, 12, 1, 6};
-    private static final int pbeWithSHAAnd3KeyTripleDESCBC[] =
+    private static final int[] pbeWithSHAAnd3KeyTripleDESCBC =
                                         {1, 2, 840, 113549, 1, 12, 1, 3};
-    private static final int pbes2[] = {1, 2, 840, 113549, 1, 5, 13};
+    private static final int[] pbes2 = {1, 2, 840, 113549, 1, 5, 13};
     // TODO: temporary Oracle OID
     /*
      * { joint-iso-itu-t(2) country(16) us(840) organization(1) oracle(113894)
      *   jdk(746875) crypto(1) id-at-trustedKeyUsage(1) }
      */
-    private static final int TrustedKeyUsage[] =
+    private static final int[] TrustedKeyUsage =
                                         {2, 16, 840, 1, 113894, 746875, 1, 1};
-    private static final int AnyExtendedKeyUsage[] = {2, 5, 29, 37, 0};
+    private static final int[] AnyExtendedKeyUsage = {2, 5, 29, 37, 0};
 
     private static ObjectIdentifier PKCS8ShroudedKeyBag_OID;
     private static ObjectIdentifier CertBag_OID;
@@ -243,7 +243,7 @@
     // A private key entry and its supporting certificate chain
     private static class PrivateKeyEntry extends KeyEntry {
         byte[] protectedPrivKey;
-        Certificate chain[];
+        Certificate[] chain;
     };
 
     // A secret key
--- a/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java	Wed Jul 15 10:00:15 2015 -0700
@@ -403,7 +403,7 @@
                         debug.println("  "+perm);
                     }
                 } catch (ClassNotFoundException cnfe) {
-                    Certificate certs[];
+                    Certificate[] certs;
                     if (pe.signedBy != null) {
                         certs = getCertificates(keyStore, pe.signedBy);
                     } else {
@@ -623,7 +623,7 @@
             init();
         }
 
-        final CodeSource codesource[] = {null};
+        final CodeSource[] codesource = {null};
 
         codesource[0] = canonicalizeCodebase(cs, true);
 
@@ -666,7 +666,7 @@
         // now see if any of the keys are trusted ids.
 
         if (!ignoreIdentityScope) {
-            Certificate certs[] = codesource[0].getCertificates();
+            Certificate[] certs = codesource[0].getCertificates();
             if (certs != null) {
                 for (int k=0; k < certs.length; k++) {
                     if (aliasMapping.get(certs[k]) == null &&
--- a/src/java.base/share/classes/sun/security/provider/DSAParameterGenerator.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/DSAParameterGenerator.java	Wed Jul 15 10:00:15 2015 -0700
@@ -237,7 +237,7 @@
             BigInteger offset = ONE;
             /* Step 11 */
             for (counter = 0; counter < 4*valueL; counter++) {
-                BigInteger V[] = new BigInteger[n + 1];
+                BigInteger[] V = new BigInteger[n + 1];
                 /* Step 11.1 */
                 for (int j = 0; j <= n; j++) {
                     BigInteger J = BigInteger.valueOf(j);
--- a/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java	Wed Jul 15 10:00:15 2015 -0700
@@ -82,7 +82,7 @@
     private static class KeyEntry {
         Date date; // the creation date of this entry
         byte[] protectedPrivKey;
-        Certificate chain[];
+        Certificate[] chain;
     };
 
     // Trusted certificates
@@ -604,7 +604,7 @@
              * the keystore (such as deleting or modifying key or
              * certificate entries).
              */
-            byte digest[] = md.digest();
+            byte[] digest = md.digest();
 
             dos.write(digest);
             dos.flush();
@@ -770,9 +770,8 @@
              * with
              */
             if (password != null) {
-                byte computed[], actual[];
-                computed = md.digest();
-                actual = new byte[computed.length];
+                byte[] computed = md.digest();
+                byte[] actual = new byte[computed.length];
                 dis.readFully(actual);
                 for (int i = 0; i < computed.length; i++) {
                     if (computed[i] != actual[i]) {
--- a/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 15 10:00:15 2015 -0700
@@ -795,7 +795,7 @@
                         // an unresolved permission which will be resolved
                         // when implies is called
                         // Add it to entry
-                        Certificate certs[];
+                        Certificate[] certs;
                         if (pe.signedBy != null) {
                             certs = getCertificates(keyStore,
                                                     pe.signedBy,
@@ -817,7 +817,7 @@
                         debug.println("  "+perm);
                     }
                 } catch (ClassNotFoundException cnfe) {
-                    Certificate certs[];
+                    Certificate[] certs;
                     if (pe.signedBy != null) {
                         certs = getCertificates(keyStore,
                                                 pe.signedBy,
@@ -2032,7 +2032,7 @@
          *
          * @serial
          */
-        private Certificate certs[];
+        private Certificate[] certs;
 
         /**
          * Creates a new SelfPermission containing the permission
@@ -2048,7 +2048,7 @@
          * certificate first and the (root) certificate authority last).
          */
         public SelfPermission(String type, String name, String actions,
-                              Certificate certs[])
+                              Certificate[] certs)
         {
             super(type);
             if (type == null) {
--- a/src/java.base/share/classes/sun/security/provider/PolicyParser.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/PolicyParser.java	Wed Jul 15 10:00:15 2015 -0700
@@ -1353,7 +1353,7 @@
         }
     }
 
-    public static void main(String arg[]) throws Exception {
+    public static void main(String[] arg) throws Exception {
         try (FileReader fr = new FileReader(arg[0]);
              FileWriter fw = new FileWriter(arg[1])) {
             PolicyParser pp = new PolicyParser(true);
--- a/src/java.base/share/classes/sun/security/provider/SecureRandom.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/provider/SecureRandom.java	Wed Jul 15 10:00:15 2015 -0700
@@ -85,7 +85,7 @@
      *
      * @param seed the seed.
      */
-    private SecureRandom(byte seed[]) {
+    private SecureRandom(byte[] seed) {
         init(seed);
     }
 
--- a/src/java.base/share/classes/sun/security/ssl/ByteBufferInputStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/ByteBufferInputStream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -70,7 +70,7 @@
      * Increments position().
      */
     @Override
-    public int read(byte b[]) throws IOException {
+    public int read(byte[] b) throws IOException {
 
         if (bb == null) {
             throw new IOException("read on a closed InputStream");
@@ -85,7 +85,7 @@
      * Increments position().
      */
     @Override
-    public int read(byte b[], int off, int len) throws IOException {
+    public int read(byte[] b, int off, int len) throws IOException {
 
         if (bb == null) {
             throw new IOException("read on a closed InputStream");
--- a/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Wed Jul 15 10:00:15 2015 -0700
@@ -810,7 +810,7 @@
             String alias = null;
             int keytypesTmpSize = keytypesTmp.size();
             if (keytypesTmpSize != 0) {
-                String keytypes[] =
+                String[] keytypes =
                         keytypesTmp.toArray(new String[keytypesTmpSize]);
 
                 if (conn != null) {
--- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Wed Jul 15 10:00:15 2015 -0700
@@ -48,7 +48,7 @@
      * This value may be empty if it was included in the
      * client's certificate ...
      */
-    private byte dh_Yc[];               // 1 to 2^16 -1 bytes
+    private byte[] dh_Yc;               // 1 to 2^16 -1 bytes
 
     BigInteger getClientPublicKey() {
         return dh_Yc == null ? null : new BigInteger(1, dh_Yc);
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeInStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeInStream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -146,7 +146,7 @@
     byte[] getBytes8() throws IOException {
         int len = getInt8();
         verifyLength(len);
-        byte b[] = new byte[len];
+        byte[] b = new byte[len];
 
         read(b);
         return b;
@@ -155,7 +155,7 @@
     public byte[] getBytes16() throws IOException {
         int len = getInt16();
         verifyLength(len);
-        byte b[] = new byte[len];
+        byte[] b = new byte[len];
 
         read(b);
         return b;
@@ -164,7 +164,7 @@
     byte[] getBytes24() throws IOException {
         int len = getInt24();
         verifyLength(len);
-        byte b[] = new byte[len];
+        byte[] b = new byte[len];
 
         read(b);
         return b;
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Wed Jul 15 10:00:15 2015 -0700
@@ -689,8 +689,8 @@
 static final
 class RSA_ServerKeyExchange extends ServerKeyExchange
 {
-    private byte rsa_modulus[];     // 1 to 2^16 - 1 bytes
-    private byte rsa_exponent[];    // 1 to 2^16 - 1 bytes
+    private byte[] rsa_modulus;     // 1 to 2^16 - 1 bytes
+    private byte[] rsa_exponent;    // 1 to 2^16 - 1 bytes
 
     private Signature signature;
     private byte[] signatureBytes;
@@ -698,7 +698,7 @@
     /*
      * Hash the nonces and the ephemeral RSA public key.
      */
-    private void updateSignature(byte clntNonce[], byte svrNonce[])
+    private void updateSignature(byte[] clntNonce, byte[] svrNonce)
             throws SignatureException {
         int tmp;
 
@@ -827,11 +827,11 @@
     private final static boolean dhKeyExchangeFix =
         Debug.getBooleanProperty("com.sun.net.ssl.dhKeyExchangeFix", true);
 
-    private byte                dh_p [];        // 1 to 2^16 - 1 bytes
-    private byte                dh_g [];        // 1 to 2^16 - 1 bytes
-    private byte                dh_Ys [];       // 1 to 2^16 - 1 bytes
+    private byte[]                dh_p;        // 1 to 2^16 - 1 bytes
+    private byte[]                dh_g;        // 1 to 2^16 - 1 bytes
+    private byte[]                dh_Ys;       // 1 to 2^16 - 1 bytes
 
-    private byte                signature [];
+    private byte[]                signature;
 
     // protocol version being established using this ServerKeyExchange message
     ProtocolVersion protocolVersion;
@@ -857,8 +857,8 @@
      * with the cert chain which was sent ... for DHE_DSS and DHE_RSA
      * key exchange.  (Constructor called by server.)
      */
-    DH_ServerKeyExchange(DHCrypt obj, PrivateKey key, byte clntNonce[],
-            byte svrNonce[], SecureRandom sr,
+    DH_ServerKeyExchange(DHCrypt obj, PrivateKey key, byte[] clntNonce,
+            byte[] svrNonce, SecureRandom sr,
             SignatureAndHashAlgorithm signAlgorithm,
             ProtocolVersion protocolVersion) throws GeneralSecurityException {
 
@@ -913,7 +913,7 @@
      * DHE_DSS or DHE_RSA key exchange.  (Called by client.)
      */
     DH_ServerKeyExchange(HandshakeInStream input, PublicKey publicKey,
-            byte clntNonce[], byte svrNonce[], int messageSize,
+            byte[] clntNonce, byte[] svrNonce, int messageSize,
             Collection<SignatureAndHashAlgorithm> localSupportedSignAlgs,
             ProtocolVersion protocolVersion)
             throws IOException, GeneralSecurityException {
@@ -948,7 +948,7 @@
         }
 
         // read the signature
-        byte signature[];
+        byte[] signature;
         if (dhKeyExchangeFix) {
             signature = input.getBytes16();
         } else {
@@ -1004,8 +1004,8 @@
     /*
      * Update sig with nonces and Diffie-Hellman public key.
      */
-    private void updateSignature(Signature sig, byte clntNonce[],
-            byte svrNonce[]) throws SignatureException {
+    private void updateSignature(Signature sig, byte[] clntNonce,
+            byte[] svrNonce) throws SignatureException {
         int tmp;
 
         sig.update(clntNonce);
@@ -1268,8 +1268,8 @@
             }
     }
 
-    private void updateSignature(Signature sig, byte clntNonce[],
-            byte svrNonce[]) throws SignatureException {
+    private void updateSignature(Signature sig, byte[] clntNonce,
+            byte[] svrNonce) throws SignatureException {
         sig.update(clntNonce);
         sig.update(svrNonce);
 
@@ -1334,7 +1334,7 @@
      * DER encoded distinguished name.
      * TLS requires that its not longer than 65535 bytes.
      */
-    byte name[];
+    byte[] name;
 
     DistinguishedName(HandshakeInStream input) throws IOException {
         name = input.getBytes16();
@@ -1411,8 +1411,8 @@
     private final static byte[] TYPES_ECC =
         { cct_rsa_sign, cct_dss_sign, cct_ecdsa_sign };
 
-    byte                types [];               // 1 to 255 types
-    DistinguishedName   authorities [];         // 3 to 2^16 - 1
+    byte[]                types;               // 1 to 255 types
+    DistinguishedName[]   authorities;         // 3 to 2^16 - 1
         // ... "3" because that's the smallest DER-encoded X500 DN
 
     // protocol version being established using this CertificateRequest message
@@ -1424,7 +1424,7 @@
     // length of supported_signature_algorithms
     private int algorithmsLen;
 
-    CertificateRequest(X509Certificate ca[], KeyExchange keyExchange,
+    CertificateRequest(X509Certificate[] ca, KeyExchange keyExchange,
             Collection<SignatureAndHashAlgorithm> signAlgs,
             ProtocolVersion protocolVersion) throws IOException {
 
@@ -2063,7 +2063,7 @@
         if (protocolVersion.useTLS10PlusSpec()) {
             // TLS 1.0+
             try {
-                byte [] seed;
+                byte[] seed;
                 String prfAlg;
                 PRF prf;
 
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -119,7 +119,7 @@
         }
     }
 
-    public void putBytes16(byte b[]) throws IOException {
+    public void putBytes16(byte[] b) throws IOException {
         if (b == null) {
             putInt16(0);
         } else {
@@ -128,7 +128,7 @@
         }
     }
 
-    void putBytes24(byte b[]) throws IOException {
+    void putBytes24(byte[] b) throws IOException {
         if (b == null) {
             putInt24(0);
         } else {
--- a/src/java.base/share/classes/sun/security/ssl/MAC.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/MAC.java	Wed Jul 15 10:00:15 2015 -0700
@@ -52,7 +52,7 @@
     final static MAC TLS_NULL = new MAC(false);
 
     // Value of the null MAC is fixed
-    private static final byte nullMAC[] = new byte[0];
+    private static final byte[] nullMAC = new byte[0];
 
     // internal identifier for the MAC algorithm
     private final MacAlg macAlg;
--- a/src/java.base/share/classes/sun/security/ssl/RandomCookie.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/RandomCookie.java	Wed Jul 15 10:00:15 2015 -0700
@@ -38,7 +38,7 @@
  */
 final class RandomCookie {
 
-    byte random_bytes[];  // exactly 32 bytes
+    byte[] random_bytes;  // exactly 32 bytes
 
     RandomCookie(SecureRandom generator) {
         long temp = System.currentTimeMillis() / 1000;
--- a/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Wed Jul 15 10:00:15 2015 -0700
@@ -986,7 +986,7 @@
                 ClientKeyExchangeService.find(keyExchange.name) == null) {
 
             CertificateRequest m4;
-            X509Certificate caCerts[];
+            X509Certificate[] caCerts;
 
             Collection<SignatureAndHashAlgorithm> localSignAlgs = null;
             if (protocolVersion.useTLS12PlusSpec()) {
--- a/src/java.base/share/classes/sun/security/ssl/SessionId.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/SessionId.java	Wed Jul 15 10:00:15 2015 -0700
@@ -43,7 +43,7 @@
 class SessionId
 {
     static int MAX_LENGTH = 32;
-    private byte sessionId [];          // max 32 bytes
+    private byte[] sessionId;          // max 32 bytes
 
     /** Constructs a new session ID ... perhaps for a rejoinable session */
     SessionId (boolean isRejoinable, SecureRandom generator)
@@ -56,7 +56,7 @@
     }
 
     /** Constructs a session ID from a byte array (max size 32 bytes) */
-    SessionId (byte sessionId [])
+    SessionId (byte[] sessionId)
         { this.sessionId = sessionId; }
 
     /** Returns the length of the ID, in bytes */
@@ -64,7 +64,7 @@
         { return sessionId.length; }
 
     /** Returns the bytes in the ID.  May be an empty array.  */
-    byte [] getId ()
+    byte[] getId ()
     {
         return sessionId.clone ();
     }
@@ -106,7 +106,7 @@
             return false;
 
         SessionId s = (SessionId) obj;
-        byte b [] = s.getId ();
+        byte[] b = s.getId ();
 
         if (b.length != sessionId.length)
             return false;
--- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -94,13 +94,13 @@
     }
 
     @Override
-    public void checkClientTrusted(X509Certificate chain[], String authType)
+    public void checkClientTrusted(X509Certificate[] chain, String authType)
             throws CertificateException {
         checkTrusted(chain, authType, (Socket)null, true);
     }
 
     @Override
-    public void checkServerTrusted(X509Certificate chain[], String authType)
+    public void checkServerTrusted(X509Certificate[] chain, String authType)
             throws CertificateException {
         checkTrusted(chain, authType, (Socket)null, false);
     }
--- a/src/java.base/share/classes/sun/security/util/ManifestDigester.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/util/ManifestDigester.java	Wed Jul 15 10:00:15 2015 -0700
@@ -37,7 +37,7 @@
     public static final String MF_MAIN_ATTRS = "Manifest-Main-Attributes";
 
     /** the raw bytes of the manifest */
-    private byte rawBytes[];
+    private byte[] rawBytes;
 
     /** the offset/length pair for a section */
     private HashMap<String, Entry> entries; // key is a UTF-8 string
@@ -107,7 +107,7 @@
         return false;
     }
 
-    public ManifestDigester(byte bytes[])
+    public ManifestDigester(byte[] bytes)
     {
         rawBytes = bytes;
         entries = new HashMap<>();
@@ -181,7 +181,7 @@
         }
     }
 
-    private boolean isNameAttr(byte bytes[], int start)
+    private boolean isNameAttr(byte[] bytes, int start)
     {
         return ((bytes[start] == 'N') || (bytes[start] == 'n')) &&
                ((bytes[start+1] == 'a') || (bytes[start+1] == 'A')) &&
@@ -261,11 +261,10 @@
         return e;
     }
 
-    public byte[] manifestDigest(MessageDigest md)
-        {
-            md.reset();
-            md.update(rawBytes, 0, rawBytes.length);
-            return md.digest();
-        }
+    public byte[] manifestDigest(MessageDigest md) {
+        md.reset();
+        md.update(rawBytes, 0, rawBytes.length);
+        return md.digest();
+    }
 
 }
--- a/src/java.base/share/classes/sun/security/util/ManifestEntryVerifier.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/util/ManifestEntryVerifier.java	Wed Jul 15 10:00:15 2015 -0700
@@ -165,7 +165,7 @@
     /**
      * update the digests for the digests we are interested in
      */
-    public void update(byte buffer[], int off, int len) {
+    public void update(byte[] buffer, int off, int len) {
         if (skip) return;
 
         for (int i=0; i < digests.size(); i++) {
--- a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java	Wed Jul 15 10:00:15 2015 -0700
@@ -212,7 +212,7 @@
      * Constructor, from an array of integers.
      * Validity check included.
      */
-    public ObjectIdentifier (int values []) throws IOException
+    public ObjectIdentifier(int[] values) throws IOException
     {
         checkCount(values.length);
         checkFirstComponent(values[0]);
--- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Wed Jul 15 10:00:15 2015 -0700
@@ -55,7 +55,7 @@
     private PKCS7 block;
 
     /** the raw bytes of the .SF file */
-    private byte sfBytes[];
+    private byte[] sfBytes;
 
     /** the name of the signature block file, uppercased and without
      *  the extension (.DSA/.RSA/.EC)
@@ -84,7 +84,7 @@
     public SignatureFileVerifier(ArrayList<CodeSigner[]> signerCache,
                                  ManifestDigester md,
                                  String name,
-                                 byte rawBytes[])
+                                 byte[] rawBytes)
         throws IOException, CertificateException
     {
         // new PKCS7() calls CertificateFactory.getInstance()
@@ -129,7 +129,7 @@
      * used to set the raw bytes of the .SF file when it
      * is external to the signature block file.
      */
-    public void setSignatureFile(byte sfBytes[])
+    public void setSignatureFile(byte[] sfBytes)
     {
         this.sfBytes = sfBytes;
     }
@@ -511,7 +511,7 @@
      * CodeSigner objects. We do this only *once* for a given
      * signature block file.
      */
-    private CodeSigner[] getSigners(SignerInfo infos[], PKCS7 block)
+    private CodeSigner[] getSigners(SignerInfo[] infos, PKCS7 block)
         throws IOException, NoSuchAlgorithmException, SignatureException,
             CertificateException {
 
--- a/src/java.base/share/classes/sun/security/x509/AVA.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/AVA.java	Wed Jul 15 10:00:15 2015 -0700
@@ -967,7 +967,7 @@
 
                     previousWhite = false;
 
-                    byte valueBytes[] = null;
+                    byte[] valueBytes = null;
                     try {
                         valueBytes = Character.toString(c).getBytes("UTF8");
                     } catch (IOException ie) {
@@ -1051,7 +1051,7 @@
                 // using the hex format below.  This will be used only
                 // when the value is not a string type
 
-                byte    data [] = value.toByteArray();
+                byte[] data = value.toByteArray();
 
                 retval.append('#');
                 for (int i = 0; i < data.length; i++) {
--- a/src/java.base/share/classes/sun/security/x509/AlgIdDSA.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/AlgIdDSA.java	Wed Jul 15 10:00:15 2015 -0700
@@ -117,7 +117,7 @@
      * @param q the DSS/DSA parameter "Q"
      * @param g the DSS/DSA parameter "G"
      */
-    public AlgIdDSA (byte p [], byte q [], byte g [])
+    public AlgIdDSA (byte[] p, byte[] q, byte[] g)
     throws IOException
     {
         this (new BigInteger (1, p),
--- a/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Wed Jul 15 10:00:15 2015 -0700
@@ -648,12 +648,12 @@
     /*
      * COMMON PUBLIC KEY TYPES
      */
-    private static final int DH_data[] = { 1, 2, 840, 113549, 1, 3, 1 };
-    private static final int DH_PKIX_data[] = { 1, 2, 840, 10046, 2, 1 };
-    private static final int DSA_OIW_data[] = { 1, 3, 14, 3, 2, 12 };
-    private static final int DSA_PKIX_data[] = { 1, 2, 840, 10040, 4, 1 };
-    private static final int RSA_data[] = { 2, 5, 8, 1, 1 };
-    private static final int RSAEncryption_data[] =
+    private static final int[] DH_data = { 1, 2, 840, 113549, 1, 3, 1 };
+    private static final int[] DH_PKIX_data = { 1, 2, 840, 10046, 2, 1 };
+    private static final int[] DSA_OIW_data = { 1, 3, 14, 3, 2, 12 };
+    private static final int[] DSA_PKIX_data = { 1, 2, 840, 10040, 4, 1 };
+    private static final int[] RSA_data = { 2, 5, 8, 1, 1 };
+    private static final int[] RSAEncryption_data =
                                  { 1, 2, 840, 113549, 1, 1, 1 };
 
     public static final ObjectIdentifier DH_oid;
@@ -674,27 +674,27 @@
     /*
      * COMMON SIGNATURE ALGORITHMS
      */
-    private static final int md2WithRSAEncryption_data[] =
+    private static final int[] md2WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 2 };
-    private static final int md5WithRSAEncryption_data[] =
+    private static final int[] md5WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 4 };
-    private static final int sha1WithRSAEncryption_data[] =
+    private static final int[] sha1WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 5 };
-    private static final int sha1WithRSAEncryption_OIW_data[] =
+    private static final int[] sha1WithRSAEncryption_OIW_data =
                                        { 1, 3, 14, 3, 2, 29 };
-    private static final int sha224WithRSAEncryption_data[] =
+    private static final int[] sha224WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 14 };
-    private static final int sha256WithRSAEncryption_data[] =
+    private static final int[] sha256WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 11 };
-    private static final int sha384WithRSAEncryption_data[] =
+    private static final int[] sha384WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 12 };
-    private static final int sha512WithRSAEncryption_data[] =
+    private static final int[] sha512WithRSAEncryption_data =
                                        { 1, 2, 840, 113549, 1, 1, 13 };
-    private static final int shaWithDSA_OIW_data[] =
+    private static final int[] shaWithDSA_OIW_data =
                                        { 1, 3, 14, 3, 2, 13 };
-    private static final int sha1WithDSA_OIW_data[] =
+    private static final int[] sha1WithDSA_OIW_data =
                                        { 1, 3, 14, 3, 2, 27 };
-    private static final int dsaWithSHA1_PKIX_data[] =
+    private static final int[] dsaWithSHA1_PKIX_data =
                                        { 1, 2, 840, 10040, 4, 3 };
 
     public static final ObjectIdentifier md2WithRSAEncryption_oid;
--- a/src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Wed Jul 15 10:00:15 2015 -0700
@@ -69,7 +69,7 @@
     public static final String S_MIME_CA = "s_mime_ca";
     public static final String OBJECT_SIGNING_CA = "object_signing_ca";
 
-    private static final int CertType_data[] = { 2, 16, 840, 1, 113730, 1, 1 };
+    private static final int[] CertType_data = { 2, 16, 840, 1, 113730, 1, 1 };
 
     /**
      * Object identifier for the Netscape-Cert-Type extension.
--- a/src/java.base/share/classes/sun/security/x509/OIDMap.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/OIDMap.java	Wed Jul 15 10:00:15 2015 -0700
@@ -102,7 +102,7 @@
     private static final String OCSPNOCHECK = ROOT + "." +
                                         OCSPNoCheckExtension.NAME;
 
-    private static final int NetscapeCertType_data[] =
+    private static final int[] NetscapeCertType_data =
         { 2, 16, 840, 1, 113730, 1, 1 };
 
     /** Map ObjectIdentifier(oid) -> OIDInfo(info) */
--- a/src/java.base/share/classes/sun/security/x509/PKIXExtensions.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/PKIXExtensions.java	Wed Jul 15 10:00:15 2015 -0700
@@ -49,32 +49,32 @@
  */
 public class PKIXExtensions {
     // The object identifiers
-    private static final int AuthorityKey_data [] = { 2, 5, 29, 35 };
-    private static final int SubjectKey_data [] = { 2, 5, 29, 14 };
-    private static final int KeyUsage_data [] = { 2, 5, 29, 15 };
-    private static final int PrivateKeyUsage_data [] = { 2, 5, 29, 16 };
-    private static final int CertificatePolicies_data [] = { 2, 5, 29, 32 };
-    private static final int PolicyMappings_data [] = { 2, 5, 29, 33 };
-    private static final int SubjectAlternativeName_data [] = { 2, 5, 29, 17 };
-    private static final int IssuerAlternativeName_data [] = { 2, 5, 29, 18 };
-    private static final int SubjectDirectoryAttributes_data [] = { 2, 5, 29, 9 };
-    private static final int BasicConstraints_data [] = { 2, 5, 29, 19 };
-    private static final int NameConstraints_data [] = { 2, 5, 29, 30 };
-    private static final int PolicyConstraints_data [] = { 2, 5, 29, 36 };
-    private static final int CRLDistributionPoints_data [] = { 2, 5, 29, 31 };
-    private static final int CRLNumber_data [] = { 2, 5, 29, 20 };
-    private static final int IssuingDistributionPoint_data [] = { 2, 5, 29, 28 };
-    private static final int DeltaCRLIndicator_data [] = { 2, 5, 29, 27 };
-    private static final int ReasonCode_data [] = { 2, 5, 29, 21 };
-    private static final int HoldInstructionCode_data [] = { 2, 5, 29, 23 };
-    private static final int InvalidityDate_data [] = { 2, 5, 29, 24 };
-    private static final int ExtendedKeyUsage_data [] = { 2, 5, 29, 37 };
-    private static final int InhibitAnyPolicy_data [] = { 2, 5, 29, 54 };
-    private static final int CertificateIssuer_data [] = { 2, 5, 29, 29 };
-    private static final int AuthInfoAccess_data [] = { 1, 3, 6, 1, 5, 5, 7, 1, 1};
-    private static final int SubjectInfoAccess_data [] = { 1, 3, 6, 1, 5, 5, 7, 1, 11};
-    private static final int FreshestCRL_data [] = { 2, 5, 29, 46 };
-    private static final int OCSPNoCheck_data [] = { 1, 3, 6, 1, 5, 5, 7,
+    private static final int[] AuthorityKey_data = { 2, 5, 29, 35 };
+    private static final int[] SubjectKey_data = { 2, 5, 29, 14 };
+    private static final int[] KeyUsage_data = { 2, 5, 29, 15 };
+    private static final int[] PrivateKeyUsage_data = { 2, 5, 29, 16 };
+    private static final int[] CertificatePolicies_data = { 2, 5, 29, 32 };
+    private static final int[] PolicyMappings_data = { 2, 5, 29, 33 };
+    private static final int[] SubjectAlternativeName_data = { 2, 5, 29, 17 };
+    private static final int[] IssuerAlternativeName_data = { 2, 5, 29, 18 };
+    private static final int[] SubjectDirectoryAttributes_data = { 2, 5, 29, 9 };
+    private static final int[] BasicConstraints_data = { 2, 5, 29, 19 };
+    private static final int[] NameConstraints_data = { 2, 5, 29, 30 };
+    private static final int[] PolicyConstraints_data = { 2, 5, 29, 36 };
+    private static final int[] CRLDistributionPoints_data = { 2, 5, 29, 31 };
+    private static final int[] CRLNumber_data = { 2, 5, 29, 20 };
+    private static final int[] IssuingDistributionPoint_data = { 2, 5, 29, 28 };
+    private static final int[] DeltaCRLIndicator_data = { 2, 5, 29, 27 };
+    private static final int[] ReasonCode_data = { 2, 5, 29, 21 };
+    private static final int[] HoldInstructionCode_data = { 2, 5, 29, 23 };
+    private static final int[] InvalidityDate_data = { 2, 5, 29, 24 };
+    private static final int[] ExtendedKeyUsage_data = { 2, 5, 29, 37 };
+    private static final int[] InhibitAnyPolicy_data = { 2, 5, 29, 54 };
+    private static final int[] CertificateIssuer_data = { 2, 5, 29, 29 };
+    private static final int[] AuthInfoAccess_data = { 1, 3, 6, 1, 5, 5, 7, 1, 1};
+    private static final int[] SubjectInfoAccess_data = { 1, 3, 6, 1, 5, 5, 7, 1, 11};
+    private static final int[] FreshestCRL_data = { 2, 5, 29, 46 };
+    private static final int[] OCSPNoCheck_data = { 1, 3, 6, 1, 5, 5, 7,
                                                     48, 1, 5};
 
     /**
--- a/src/java.base/share/classes/sun/security/x509/X500Name.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/X500Name.java	Wed Jul 15 10:00:15 2015 -0700
@@ -1119,25 +1119,25 @@
      * Includes all those specified in RFC 5280 as MUST or SHOULD
      * be recognized
      */
-    private static final int commonName_data[] = { 2, 5, 4, 3 };
-    private static final int SURNAME_DATA[] = { 2, 5, 4, 4 };
-    private static final int SERIALNUMBER_DATA[] = { 2, 5, 4, 5 };
-    private static final int countryName_data[] = { 2, 5, 4, 6 };
-    private static final int localityName_data[] = { 2, 5, 4, 7 };
-    private static final int stateName_data[] = { 2, 5, 4, 8 };
-    private static final int streetAddress_data[] = { 2, 5, 4, 9 };
-    private static final int orgName_data[] = { 2, 5, 4, 10 };
-    private static final int orgUnitName_data[] = { 2, 5, 4, 11 };
-    private static final int title_data[] = { 2, 5, 4, 12 };
-    private static final int GIVENNAME_DATA[] = { 2, 5, 4, 42 };
-    private static final int INITIALS_DATA[] = { 2, 5, 4, 43 };
-    private static final int GENERATIONQUALIFIER_DATA[] = { 2, 5, 4, 44 };
-    private static final int DNQUALIFIER_DATA[] = { 2, 5, 4, 46 };
+    private static final int[] commonName_data = { 2, 5, 4, 3 };
+    private static final int[] SURNAME_DATA = { 2, 5, 4, 4 };
+    private static final int[] SERIALNUMBER_DATA = { 2, 5, 4, 5 };
+    private static final int[] countryName_data = { 2, 5, 4, 6 };
+    private static final int[] localityName_data = { 2, 5, 4, 7 };
+    private static final int[] stateName_data = { 2, 5, 4, 8 };
+    private static final int[] streetAddress_data = { 2, 5, 4, 9 };
+    private static final int[] orgName_data = { 2, 5, 4, 10 };
+    private static final int[] orgUnitName_data = { 2, 5, 4, 11 };
+    private static final int[] title_data = { 2, 5, 4, 12 };
+    private static final int[] GIVENNAME_DATA = { 2, 5, 4, 42 };
+    private static final int[] INITIALS_DATA = { 2, 5, 4, 43 };
+    private static final int[] GENERATIONQUALIFIER_DATA = { 2, 5, 4, 44 };
+    private static final int[] DNQUALIFIER_DATA = { 2, 5, 4, 46 };
 
-    private static final int ipAddress_data[] = { 1, 3, 6, 1, 4, 1, 42, 2, 11, 2, 1 };
-    private static final int DOMAIN_COMPONENT_DATA[] =
+    private static final int[] ipAddress_data = { 1, 3, 6, 1, 4, 1, 42, 2, 11, 2, 1 };
+    private static final int[] DOMAIN_COMPONENT_DATA =
         { 0, 9, 2342, 19200300, 100, 1, 25 };
-    private static final int userid_data[] =
+    private static final int[] userid_data =
         { 0, 9, 2342, 19200300, 100, 1, 1 };
 
 
--- a/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -1086,7 +1086,7 @@
             throw new CRLException("Invalid DER-encoded CRL data");
 
         signedCRL = val.toByteArray();
-        DerValue seq[] = new DerValue[3];
+        DerValue[] seq = new DerValue[3];
 
         seq[0] = val.data.getDerValue();
         seq[1] = val.data.getDerValue();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/META-INF/services/java.net.ContentHandlerFactory	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Provider for content handlers
+sun.awt.www.content.MultimediaContentHandlers
--- a/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java	Wed Jul 15 10:00:15 2015 -0700
@@ -142,7 +142,8 @@
     public IdentityArrayList(Collection<? extends E> c) {
         elementData = c.toArray();
         size = elementData.length;
-        // c.toArray might (incorrectly) not return Object[] (see 6260652)
+        // defend against c.toArray (incorrectly) not returning Object[]
+        // (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652)
         if (elementData.getClass() != Object[].class)
             elementData = Arrays.copyOf(elementData, size, Object[].class);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/MultimediaContentHandlers.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.www.content;
+
+import sun.awt.www.content.audio.wav;
+import sun.awt.www.content.audio.x_aiff;
+import sun.awt.www.content.image.gif;
+import sun.awt.www.content.audio.aiff;
+import sun.awt.www.content.audio.basic;
+import sun.awt.www.content.audio.x_wav;
+import sun.awt.www.content.image.jpeg;
+import sun.awt.www.content.image.png;
+import sun.awt.www.content.image.x_xbitmap;
+import sun.awt.www.content.image.x_xpixmap;
+
+import java.net.ContentHandler;
+import java.net.ContentHandlerFactory;
+
+public final class MultimediaContentHandlers implements ContentHandlerFactory {
+
+    @Override
+    public ContentHandler createContentHandler(String mimetype) {
+        switch (mimetype) {
+            case "audio/aiff":      return new aiff();
+            case "audio/basic":     return new basic();
+            case "audio/wav":       return new wav();
+            case "audio/x-aiff":    return new x_aiff();
+            case "audio/x-wav":     return new x_wav();
+            case "image/gif":       return new gif();
+            case "image/jpeg":      return new jpeg();
+            case "image/png":       return new png();
+            case "image/x-xbitmap": return new x_xbitmap();
+            case "image/x-xpixmap": return new x_xpixmap();
+            default:                return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/audio/aiff.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/**
+ * Basic .aiff audio handler.
+ * @author  Jeff Nisewanger
+ */
+package sun.awt.www.content.audio;
+
+import java.net.*;
+import java.io.IOException;
+import sun.applet.AppletAudioClip;
+
+/**
+ * Returns an AppletAudioClip object.
+ */
+public class aiff extends ContentHandler {
+    public Object getContent(URLConnection uc) throws IOException {
+        return new AppletAudioClip(uc);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/audio/basic.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/**
+ * Basic .au and .snd audio handler.
+ * @author  Jeff Nisewanger
+ */
+package sun.awt.www.content.audio;
+
+import java.net.*;
+import java.io.IOException;
+import sun.applet.AppletAudioClip;
+
+/**
+ * Returns an AppletAudioClip object.
+ * This provides backwards compatibility with the behavior
+ * of ClassLoader.getResource().getContent() on JDK1.1.
+ */
+public class basic extends ContentHandler {
+    public Object getContent(URLConnection uc) throws IOException {
+        return new AppletAudioClip(uc);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/audio/wav.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/**
+ * Basic .wav audio handler.
+ * @author  Jeff Nisewanger
+ */
+package sun.awt.www.content.audio;
+
+import java.net.*;
+import java.io.IOException;
+import sun.applet.AppletAudioClip;
+
+/**
+ * Returns an AppletAudioClip object.
+ */
+public class wav extends ContentHandler {
+    public Object getContent(URLConnection uc) throws IOException {
+        return new AppletAudioClip(uc);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/audio/x_aiff.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/**
+ * Basic .aiff audio handler.
+ * @author  Jeff Nisewanger
+ */
+package sun.awt.www.content.audio;
+
+import java.net.*;
+import java.io.IOException;
+import sun.applet.AppletAudioClip;
+
+/**
+ * Returns an AppletAudioClip object.
+ */
+public class x_aiff extends ContentHandler {
+    public Object getContent(URLConnection uc) throws IOException {
+        return new AppletAudioClip(uc);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/audio/x_wav.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+/**
+ * Basic .wav audio handler.
+ * @author  Jeff Nisewanger
+ */
+package sun.awt.www.content.audio;
+
+import java.net.*;
+import java.io.IOException;
+import sun.applet.AppletAudioClip;
+
+/**
+ * Returns an AppletAudioClip object.
+ */
+public class x_wav extends ContentHandler {
+    public Object getContent(URLConnection uc) throws IOException {
+        return new AppletAudioClip(uc);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/image/gif.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1994, 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.awt.www.content.image;
+
+import java.net.*;
+import sun.awt.image.*;
+import java.io.IOException;
+import java.awt.Image;
+import java.awt.Toolkit;
+
+
+public class gif extends ContentHandler {
+    public Object getContent(URLConnection urlc) throws java.io.IOException {
+        return new URLImageSource(urlc);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
+        Class<?>[] cls = classes;
+        for (int i = 0; i < cls.length; i++) {
+            if (cls[i].isAssignableFrom(URLImageSource.class)) {
+                return new URLImageSource(urlc);
+            }
+            if (cls[i].isAssignableFrom(Image.class)) {
+                Toolkit tk = Toolkit.getDefaultToolkit();
+                return tk.createImage(new URLImageSource(urlc));
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/image/jpeg.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1995, 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.awt.www.content.image;
+
+import java.net.*;
+import sun.awt.image.*;
+import java.io.IOException;
+import java.awt.Image;
+import java.awt.Toolkit;
+
+public class jpeg extends ContentHandler {
+    public Object getContent(URLConnection urlc) throws java.io.IOException {
+        return new URLImageSource(urlc);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
+        Class<?>[] cls = classes;
+        for (int i = 0; i < cls.length; i++) {
+            if (cls[i].isAssignableFrom(URLImageSource.class)) {
+                return new URLImageSource(urlc);
+            }
+            if (cls[i].isAssignableFrom(Image.class)) {
+                Toolkit tk = Toolkit.getDefaultToolkit();
+                return tk.createImage(new URLImageSource(urlc));
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/image/png.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * 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.awt.www.content.image;
+
+import java.net.*;
+import java.io.IOException;
+import sun.awt.image.*;
+import java.awt.Image;
+import java.awt.Toolkit;
+
+public class png extends ContentHandler {
+    public Object getContent(URLConnection urlc) throws java.io.IOException {
+        return new URLImageSource(urlc);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
+        Class<?>[] cls = classes;
+        for (int i = 0; i < cls.length; i++) {
+            if (cls[i].isAssignableFrom(URLImageSource.class)) {
+                return new URLImageSource(urlc);
+            }
+            if (cls[i].isAssignableFrom(Image.class)) {
+                Toolkit tk = Toolkit.getDefaultToolkit();
+                return tk.createImage(new URLImageSource(urlc));
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/image/x_xbitmap.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1994, 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.awt.www.content.image;
+
+import java.net.*;
+import sun.awt.image.*;
+import java.awt.Image;
+import java.awt.Toolkit;
+
+public class x_xbitmap extends ContentHandler {
+    public Object getContent(URLConnection urlc) throws java.io.IOException {
+        return new URLImageSource(urlc);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
+        Class<?>[] cls = classes;
+        for (int i = 0; i < cls.length; i++) {
+            if (cls[i].isAssignableFrom(URLImageSource.class)) {
+                return new URLImageSource(urlc);
+            }
+            if (cls[i].isAssignableFrom(Image.class)) {
+                Toolkit tk = Toolkit.getDefaultToolkit();
+                return tk.createImage(new URLImageSource(urlc));
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/awt/www/content/image/x_xpixmap.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1994, 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.awt.www.content.image;
+
+import java.net.*;
+import sun.awt.image.*;
+import java.awt.Image;
+import java.awt.Toolkit;
+
+public class x_xpixmap extends ContentHandler {
+    public Object getContent(URLConnection urlc) throws java.io.IOException {
+        return new URLImageSource(urlc);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
+        Class<?>[] cls = classes;
+        for (int i = 0; i < cls.length; i++) {
+            if (cls[i].isAssignableFrom(URLImageSource.class)) {
+                return new URLImageSource(urlc);
+            }
+            if (cls[i].isAssignableFrom(Image.class)) {
+                Toolkit tk = Toolkit.getDefaultToolkit();
+                return tk.createImage(new URLImageSource(urlc));
+            }
+        }
+        return null;
+    }
+}
--- a/src/java.desktop/share/classes/sun/net/www/content/audio/aiff.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.
- */
-
-/**
- * Basic .aiff audio handler.
- * @author  Jeff Nisewanger
- */
-package sun.net.www.content.audio;
-
-import java.net.*;
-import java.io.IOException;
-import sun.applet.AppletAudioClip;
-
-/**
- * Returns an AppletAudioClip object.
- */
-public class aiff extends ContentHandler {
-    public Object getContent(URLConnection uc) throws IOException {
-        return new AppletAudioClip(uc);
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/audio/basic.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.
- */
-
-/**
- * Basic .au and .snd audio handler.
- * @author  Jeff Nisewanger
- */
-package sun.net.www.content.audio;
-
-import java.net.*;
-import java.io.IOException;
-import sun.applet.AppletAudioClip;
-
-/**
- * Returns an AppletAudioClip object.
- * This provides backwards compatibility with the behavior
- * of ClassLoader.getResource().getContent() on JDK1.1.
- */
-public class basic extends ContentHandler {
-    public Object getContent(URLConnection uc) throws IOException {
-        return new AppletAudioClip(uc);
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/audio/wav.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.
- */
-
-/**
- * Basic .wav audio handler.
- * @author  Jeff Nisewanger
- */
-package sun.net.www.content.audio;
-
-import java.net.*;
-import java.io.IOException;
-import sun.applet.AppletAudioClip;
-
-/**
- * Returns an AppletAudioClip object.
- */
-public class wav extends ContentHandler {
-    public Object getContent(URLConnection uc) throws IOException {
-        return new AppletAudioClip(uc);
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/audio/x_aiff.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.
- */
-
-/**
- * Basic .aiff audio handler.
- * @author  Jeff Nisewanger
- */
-package sun.net.www.content.audio;
-
-import java.net.*;
-import java.io.IOException;
-import sun.applet.AppletAudioClip;
-
-/**
- * Returns an AppletAudioClip object.
- */
-public class x_aiff extends ContentHandler {
-    public Object getContent(URLConnection uc) throws IOException {
-        return new AppletAudioClip(uc);
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/audio/x_wav.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.
- */
-
-/**
- * Basic .wav audio handler.
- * @author  Jeff Nisewanger
- */
-package sun.net.www.content.audio;
-
-import java.net.*;
-import java.io.IOException;
-import sun.applet.AppletAudioClip;
-
-/**
- * Returns an AppletAudioClip object.
- */
-public class x_wav extends ContentHandler {
-    public Object getContent(URLConnection uc) throws IOException {
-        return new AppletAudioClip(uc);
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/image/gif.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1994, 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.net.www.content.image;
-
-import java.net.*;
-import sun.awt.image.*;
-import java.io.IOException;
-import java.awt.Image;
-import java.awt.Toolkit;
-
-
-public class gif extends ContentHandler {
-    public Object getContent(URLConnection urlc) throws java.io.IOException {
-        return new URLImageSource(urlc);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
-        Class<?>[] cls = classes;
-        for (int i = 0; i < cls.length; i++) {
-            if (cls[i].isAssignableFrom(URLImageSource.class)) {
-                return new URLImageSource(urlc);
-            }
-            if (cls[i].isAssignableFrom(Image.class)) {
-                Toolkit tk = Toolkit.getDefaultToolkit();
-                return tk.createImage(new URLImageSource(urlc));
-            }
-        }
-        return null;
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/image/jpeg.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1995, 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.net.www.content.image;
-
-import java.net.*;
-import sun.awt.image.*;
-import java.io.IOException;
-import java.awt.Image;
-import java.awt.Toolkit;
-
-public class jpeg extends ContentHandler {
-    public Object getContent(URLConnection urlc) throws java.io.IOException {
-        return new URLImageSource(urlc);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
-        Class<?>[] cls = classes;
-        for (int i = 0; i < cls.length; i++) {
-            if (cls[i].isAssignableFrom(URLImageSource.class)) {
-                return new URLImageSource(urlc);
-            }
-            if (cls[i].isAssignableFrom(Image.class)) {
-                Toolkit tk = Toolkit.getDefaultToolkit();
-                return tk.createImage(new URLImageSource(urlc));
-            }
-        }
-        return null;
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/image/png.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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.net.www.content.image;
-
-import java.net.*;
-import java.io.IOException;
-import sun.awt.image.*;
-import java.awt.Image;
-import java.awt.Toolkit;
-
-public class png extends ContentHandler {
-    public Object getContent(URLConnection urlc) throws java.io.IOException {
-        return new URLImageSource(urlc);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
-        Class<?>[] cls = classes;
-        for (int i = 0; i < cls.length; i++) {
-            if (cls[i].isAssignableFrom(URLImageSource.class)) {
-                return new URLImageSource(urlc);
-            }
-            if (cls[i].isAssignableFrom(Image.class)) {
-                Toolkit tk = Toolkit.getDefaultToolkit();
-                return tk.createImage(new URLImageSource(urlc));
-            }
-        }
-        return null;
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/image/x_xbitmap.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1994, 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.net.www.content.image;
-
-import java.net.*;
-import sun.awt.image.*;
-import java.awt.Image;
-import java.awt.Toolkit;
-
-public class x_xbitmap extends ContentHandler {
-    public Object getContent(URLConnection urlc) throws java.io.IOException {
-        return new URLImageSource(urlc);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
-        Class<?>[] cls = classes;
-        for (int i = 0; i < cls.length; i++) {
-            if (cls[i].isAssignableFrom(URLImageSource.class)) {
-                return new URLImageSource(urlc);
-            }
-            if (cls[i].isAssignableFrom(Image.class)) {
-                Toolkit tk = Toolkit.getDefaultToolkit();
-                return tk.createImage(new URLImageSource(urlc));
-            }
-        }
-        return null;
-    }
-}
--- a/src/java.desktop/share/classes/sun/net/www/content/image/x_xpixmap.java	Wed Jul 15 15:48:32 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1994, 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.net.www.content.image;
-
-import java.net.*;
-import sun.awt.image.*;
-import java.awt.Image;
-import java.awt.Toolkit;
-
-public class x_xpixmap extends ContentHandler {
-    public Object getContent(URLConnection urlc) throws java.io.IOException {
-        return new URLImageSource(urlc);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
-        Class<?>[] cls = classes;
-        for (int i = 0; i < cls.length; i++) {
-            if (cls[i].isAssignableFrom(URLImageSource.class)) {
-                return new URLImageSource(urlc);
-            }
-            if (cls[i].isAssignableFrom(Image.class)) {
-                Toolkit tk = Toolkit.getDefaultToolkit();
-                return tk.createImage(new URLImageSource(urlc));
-            }
-        }
-        return null;
-    }
-}
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/ServicePermission.java	Wed Jul 15 10:00:15 2015 -0700
@@ -427,7 +427,7 @@
 
 
     /*
-      public static void main(String args[]) throws Exception {
+      public static void main(String[] args) throws Exception {
       ServicePermission this_ =
       new ServicePermission(args[0], "accept");
       ServicePermission that_ =
--- a/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -75,7 +75,7 @@
     }
 
     GSSCredentialImpl(GSSManagerImpl gssManager, GSSName name,
-                      int lifetime, Oid mechs[], int usage)
+                      int lifetime, Oid[] mechs, int usage)
         throws GSSException {
         init(gssManager);
         boolean defaultList = false;
--- a/src/java.security.jgss/share/classes/sun/security/jgss/GSSManagerImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/GSSManagerImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -128,7 +128,7 @@
         return new GSSNameImpl(this, nameStr, nameType);
     }
 
-    public GSSName createName(byte name[], Oid nameType)
+    public GSSName createName(byte[] name, Oid nameType)
         throws GSSException {
         return new GSSNameImpl(this, name, nameType);
     }
@@ -138,7 +138,7 @@
         return new GSSNameImpl(this, nameStr, nameType, mech);
     }
 
-    public GSSName createName(byte name[], Oid nameType, Oid mech)
+    public GSSName createName(byte[] name, Oid nameType, Oid mech)
         throws GSSException {
         return new GSSNameImpl(this, name, nameType, mech);
     }
@@ -155,7 +155,7 @@
     }
 
     public GSSCredential createCredential(GSSName aName,
-                                          int lifetime, Oid mechs[], int usage)
+                                          int lifetime, Oid[] mechs, int usage)
         throws GSSException {
         return wrap(new GSSCredentialImpl(this, aName, lifetime, mechs, usage));
     }
--- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5Context.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5Context.java	Wed Jul 15 10:00:15 2015 -0700
@@ -159,7 +159,7 @@
     /**
      * Constructor for Krb5Context to import a previously exported context.
      */
-    public Krb5Context(GSSCaller caller, byte [] interProcessToken)
+    public Krb5Context(GSSCaller caller, byte[] interProcessToken)
         throws GSSException {
         throw new GSSException(GSSException.UNAVAILABLE,
                                -1, "GSS Import Context not available");
@@ -905,7 +905,7 @@
      * and verifyMIC care about the remote sequence number (peerSeqNumber).
      */
 
-    public final byte[] wrap(byte inBuf[], int offset, int len,
+    public final byte[] wrap(byte[] inBuf, int offset, int len,
                              MessageProp msgProp) throws GSSException {
         if (DEBUG) {
             System.out.println("Krb5Context.wrap: data=["
@@ -943,7 +943,7 @@
         }
     }
 
-    public final int wrap(byte inBuf[], int inOffset, int len,
+    public final int wrap(byte[] inBuf, int inOffset, int len,
                           byte[] outBuf, int outOffset,
                           MessageProp msgProp) throws GSSException {
 
@@ -977,7 +977,7 @@
         }
     }
 
-    public final void wrap(byte inBuf[], int offset, int len,
+    public final void wrap(byte[] inBuf, int offset, int len,
                            OutputStream os, MessageProp msgProp)
         throws GSSException {
 
@@ -1032,7 +1032,7 @@
         wrap(data, 0, data.length, os, msgProp);
     }
 
-    public final byte[] unwrap(byte inBuf[], int offset, int len,
+    public final byte[] unwrap(byte[] inBuf, int offset, int len,
                                MessageProp msgProp)
         throws GSSException {
 
@@ -1069,7 +1069,7 @@
             return data;
         }
 
-    public final int unwrap(byte inBuf[], int inOffset, int len,
+    public final int unwrap(byte[] inBuf, int inOffset, int len,
                              byte[] outBuf, int outOffset,
                              MessageProp msgProp) throws GSSException {
 
@@ -1141,7 +1141,7 @@
         }
     }
 
-    public final byte[] getMIC(byte []inMsg, int offset, int len,
+    public final byte[] getMIC(byte[] inMsg, int offset, int len,
                                MessageProp msgProp)
         throws GSSException {
 
@@ -1166,7 +1166,7 @@
             }
         }
 
-    private int getMIC(byte []inMsg, int offset, int len,
+    private int getMIC(byte[] inMsg, int offset, int len,
                        byte[] outBuf, int outOffset,
                        MessageProp msgProp)
         throws GSSException {
@@ -1236,7 +1236,7 @@
         getMIC(data, 0, data.length, os, msgProp);
     }
 
-    public final void verifyMIC(byte []inTok, int tokOffset, int tokLen,
+    public final void verifyMIC(byte[] inTok, int tokOffset, int tokLen,
                                 byte[] inMsg, int msgOffset, int msgLen,
                                 MessageProp msgProp)
         throws GSSException {
@@ -1293,7 +1293,7 @@
      * @param os the output token will be written to this stream
      * @exception GSSException
      */
-    public final byte [] export() throws GSSException {
+    public final byte[] export() throws GSSException {
         throw new GSSException(GSSException.UNAVAILABLE, -1,
                                "GSS Export Context not available");
     }
--- a/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Jul 15 10:00:15 2015 -0700
@@ -265,7 +265,7 @@
     /**
      * For apps that want simplicity and don't care about buffer copies.
      */
-    public byte[] wrap(byte inBuf[], int offset, int len,
+    public byte[] wrap(byte[] inBuf, int offset, int len,
                        MessageProp msgProp) throws GSSException;
 
     /**
@@ -275,7 +275,7 @@
      *
      * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
      *
-    public int wrap(byte inBuf[], int inOffset, int len,
+    public int wrap(byte[] inBuf, int inOffset, int len,
                     byte[] outBuf, int outOffset,
                     MessageProp msgProp) throws GSSException;
 
@@ -292,7 +292,7 @@
      *
      * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
      *
-    public void wrap(byte inBuf[], int offset, int len,
+    public void wrap(byte[] inBuf, int offset, int len,
                      OutputStream os, MessageProp msgProp)
         throws GSSException;
     */
@@ -314,7 +314,7 @@
     /**
      * For apps that want simplicity and don't care about buffer copies.
      */
-    public byte[] unwrap(byte inBuf[], int offset, int len,
+    public byte[] unwrap(byte[] inBuf, int offset, int len,
                          MessageProp msgProp) throws GSSException;
 
     /**
@@ -324,7 +324,7 @@
      *
      * NOTE: This method is not defined in public class org.ietf.jgss.GSSContext
      *
-    public int unwrap(byte inBuf[], int inOffset, int len,
+    public int unwrap(byte[] inBuf, int inOffset, int len,
                       byte[] outBuf, int outOffset,
                       MessageProp msgProp) throws GSSException;
 
@@ -356,7 +356,7 @@
                         MessageProp msgProp)
                 throws GSSException;
 
-    public byte[] getMIC(byte []inMsg, int offset, int len,
+    public byte[] getMIC(byte[] inMsg, int offset, int len,
                          MessageProp msgProp) throws GSSException;
 
     /**
@@ -372,7 +372,7 @@
     public void verifyMIC(InputStream is, InputStream msgStr,
                            MessageProp mProp) throws GSSException;
 
-    public void verifyMIC(byte []inTok, int tokOffset, int tokLen,
+    public void verifyMIC(byte[] inTok, int tokOffset, int tokLen,
                           byte[] inMsg, int msgOffset, int msgLen,
                           MessageProp msgProp) throws GSSException;
 
--- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Wed Jul 15 10:00:15 2015 -0700
@@ -372,7 +372,7 @@
         }
         return cStub.wrap(pContext, data, msgProp);
     }
-    public void wrap(byte inBuf[], int offset, int len,
+    public void wrap(byte[] inBuf, int offset, int len,
                      OutputStream os, MessageProp msgProp)
         throws GSSException {
         try {
--- a/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Wed Jul 15 10:00:15 2015 -0700
@@ -78,7 +78,7 @@
                             if (DEBUG) err.printStackTrace();
                             return null;
                         }
-                        String gssLibs[] = new String[0];
+                        String[] gssLibs = new String[0];
                         String defaultLib = System.getProperty(LIB_PROP);
                         if (defaultLib == null || defaultLib.trim().equals("")) {
                             String osname = System.getProperty("os.name");
--- a/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java	Wed Jul 15 10:00:15 2015 -0700
@@ -568,7 +568,7 @@
         temp.putInteger(bint);
         bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
         temp = new DerOutputStream();
-        DerValue der[] = new DerValue[nameStrings.length];
+        DerValue[] der = new DerValue[nameStrings.length];
         for (int i = 0; i < nameStrings.length; i++) {
             der[i] = new KerberosString(nameStrings[i]).toDerValue();
         }
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/Authenticator.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/Authenticator.java	Wed Jul 15 10:00:15 2015 -0700
@@ -198,7 +198,7 @@
         if (authorizationData != null) {
             v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte) 0x08), authorizationData.asn1Encode()));
         }
-        DerValue der[] = new DerValue[v.size()];
+        DerValue[] der = new DerValue[v.size()];
         v.copyInto(der);
         temp = new DerOutputStream();
         temp.putSequence(der);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/AuthorizationData.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/AuthorizationData.java	Wed Jul 15 10:00:15 2015 -0700
@@ -120,7 +120,7 @@
      */
     public byte[] asn1Encode() throws Asn1Exception, IOException {
         DerOutputStream bytes = new DerOutputStream();
-        DerValue der[] = new DerValue[entry.length];
+        DerValue[] der = new DerValue[entry.length];
         for (int i = 0; i < entry.length; i++) {
             der[i] = new DerValue(entry[i].asn1Encode());
         }
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncAPRepPart.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncAPRepPart.java	Wed Jul 15 10:00:15 2015 -0700
@@ -151,7 +151,7 @@
             v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
                     true, (byte) 0x03), temp.toByteArray()));
         }
-        DerValue der[] = new DerValue[v.size()];
+        DerValue[] der = new DerValue[v.size()];
         v.copyInto(der);
         temp = new DerOutputStream();
         temp.putSequence(der);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbCredPart.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbCredPart.java	Wed Jul 15 10:00:15 2015 -0700
@@ -129,7 +129,7 @@
 
         subDer = der.getData().getDerValue();
         if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x00) {
-            DerValue derValues[] = subDer.getData().getSequence(1);
+            DerValue[] derValues = subDer.getData().getSequence(1);
             ticketInfo = new KrbCredInfo[derValues.length];
             for (int i = 0; i < derValues.length; i++) {
                 ticketInfo[i] = new KrbCredInfo(derValues[i]);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java	Wed Jul 15 10:00:15 2015 -0700
@@ -98,8 +98,8 @@
             throw new KrbException(Krb5.KRB_ERR_GENERIC, "Bad name");
 
         String host = components[1];
-        InetAddress addr[] = InetAddress.getAllByName(host);
-        HostAddress hAddrs[] = new HostAddress[addr.length];
+        InetAddress[] addr = InetAddress.getAllByName(host);
+        HostAddress[] hAddrs = new HostAddress[addr.length];
 
         for (int i = 0; i < addr.length; i++) {
             hAddrs[i] = new HostAddress(addr[i]);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReqBody.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReqBody.java	Wed Jul 15 10:00:15 2015 -0700
@@ -269,7 +269,7 @@
             ticketsTemp.write(DerValue.tag_SequenceOf, temp);
             v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0B), ticketsTemp.toByteArray()));
         }
-        DerValue der[] = new DerValue[v.size()];
+        DerValue[] der = new DerValue[v.size()];
         v.copyInto(der);
         temp = new DerOutputStream();
         temp.putSequence(der);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java	Wed Jul 15 10:00:15 2015 -0700
@@ -172,7 +172,7 @@
         }
         if (caddr != null)
             v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), caddr.asn1Encode()));
-        DerValue der[] = new DerValue[v.size()];
+        DerValue[] der = new DerValue[v.size()];
         v.copyInto(der);
         DerOutputStream out = new DerOutputStream();
         out.putSequence(der);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/NetClient.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/NetClient.java	Wed Jul 15 10:00:15 2015 -0700
@@ -200,7 +200,7 @@
 
     @Override
     public byte[] receive() throws IOException {
-        byte ibuf[] = new byte[bufSize];
+        byte[] ibuf = new byte[bufSize];
         dgPacketIn = new DatagramPacket(ibuf, ibuf.length);
         try {
             dgSocket.receive(dgPacketIn);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/Ticket.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/Ticket.java	Wed Jul 15 10:00:15 2015 -0700
@@ -135,7 +135,7 @@
     public byte[] asn1Encode() throws Asn1Exception, IOException {
         DerOutputStream bytes = new DerOutputStream();
         DerOutputStream temp = new DerOutputStream();
-        DerValue der[] = new DerValue[4];
+        DerValue[] der = new DerValue[4];
         temp.putInteger(BigInteger.valueOf(tkt_vno));
         bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
         bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), sname.getRealm().asn1Encode());
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java	Wed Jul 15 10:00:15 2015 -0700
@@ -357,7 +357,7 @@
         if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
         }
-        long times[] = readTimes();
+        long[] times = readTimes();
         KerberosTime authtime = new KerberosTime(times[0]);
         KerberosTime starttime =
                 (times[1]==0) ? null : new KerberosTime(times[1]);
@@ -374,9 +374,9 @@
                     ((renewTill==null)?"null":renewTill.toDate().toString()));
         }
         boolean skey = readskey();
-        boolean flags[] = readFlags();
+        boolean[] flags = readFlags();
         TicketFlags tFlags = new TicketFlags(flags);
-        HostAddress addr[] = readAddr();
+        HostAddress[] addr = readAddr();
         HostAddresses addrs = null;
         if (addr != null) {
             addrs = new HostAddresses(addr);
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/crc32.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/crc32.java	Wed Jul 15 10:00:15 2015 -0700
@@ -112,7 +112,7 @@
      * This version is more efficient than the byte-at-a-time version;
      * it avoids data copies and reduces per-byte call overhead.
      */
-    protected synchronized void engineUpdate(byte input[], int offset,
+    protected synchronized void engineUpdate(byte[] input, int offset,
                                              int len) {
         processData(input, offset, len);
     }
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/KerberosPreMasterSecret.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ssl/KerberosPreMasterSecret.java	Wed Jul 15 10:00:15 2015 -0700
@@ -53,8 +53,8 @@
 final class KerberosPreMasterSecret {
 
     private ProtocolVersion protocolVersion; // preMaster [0,1]
-    private byte preMaster[];           // 48 bytes
-    private byte encrypted[];
+    private byte[] preMaster;           // 48 bytes
+    private byte[] encrypted;
 
     /**
      * Constructor used by client to generate premaster secret.
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/ClientFactoryImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/ClientFactoryImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -47,13 +47,13 @@
   * @author Rosanna Lee
   */
 final public class ClientFactoryImpl implements SaslClientFactory {
-    private static final String myMechs[] = {
+    private static final String[] myMechs = {
         "EXTERNAL",
         "CRAM-MD5",
         "PLAIN",
     };
 
-    private static final int mechPolicies[] = {
+    private static final int[] mechPolicies = {
         // %%% RL: Policies should actually depend on the external channel
         PolicyUtils.NOPLAINTEXT|PolicyUtils.NOACTIVE|PolicyUtils.NODICTIONARY,
         PolicyUtils.NOPLAINTEXT|PolicyUtils.NOANONYMOUS,    // CRAM-MD5
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Server.java	Wed Jul 15 10:00:15 2015 -0700
@@ -165,7 +165,7 @@
                 PasswordCallback pcb =
                     new PasswordCallback("CRAM-MD5 password: ", false);
                 cbh.handle(new Callback[]{ncb,pcb});
-                char pwChars[] = pcb.getPassword();
+                char[] pwChars = pcb.getPassword();
                 if (pwChars == null || pwChars.length == 0) {
                     // user has no password; OK to disclose to server
                     aborted = true;
@@ -190,7 +190,7 @@
                 clearPassword();
 
                 // Check whether digest is as expected
-                byte [] expectedDigest = digest.getBytes("UTF8");
+                byte[] expectedDigest = digest.getBytes("UTF8");
                 int digestLen = responseData.length - ulen - 1;
                 if (expectedDigest.length != digestLen) {
                     aborted = true;
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/ServerFactoryImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/ServerFactoryImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -41,11 +41,11 @@
   * @author Rosanna Lee
   */
 final public class ServerFactoryImpl implements SaslServerFactory {
-    private static final String myMechs[] = {
+    private static final String[] myMechs = {
         "CRAM-MD5", //
     };
 
-    private static final int mechPolicies[] = {
+    private static final int[] mechPolicies = {
         PolicyUtils.NOPLAINTEXT|PolicyUtils.NOANONYMOUS,      // CRAM-MD5
     };
 
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Wed Jul 15 10:00:15 2015 -0700
@@ -272,7 +272,7 @@
      */
 
     /** This array maps the characters to their 6 bit values */
-    private final static char pem_array[] = {
+    private final static char[] pem_array = {
         //       0   1   2   3   4   5   6   7
                 'A','B','C','D','E','F','G','H', // 0
                 'I','J','K','L','M','N','O','P', // 1
@@ -1068,7 +1068,7 @@
                 byte[] hMAC_MD5 = m.doFinal();
 
                 /* First 10 bytes of HMAC_MD5 digest */
-                byte macBuffer[] = new byte[10];
+                byte[] macBuffer = new byte[10];
                 System.arraycopy(hMAC_MD5, 0, macBuffer, 0, 10);
 
                 return macBuffer;
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -44,9 +44,9 @@
 public final class FactoryImpl implements SaslClientFactory,
 SaslServerFactory{
 
-    private static final String myMechs[] = { "DIGEST-MD5" };
+    private static final String[] myMechs = { "DIGEST-MD5" };
     private static final int DIGEST_MD5 = 0;
-    private static final int mechPolicies[] = {
+    private static final int[] mechPolicies = {
         PolicyUtils.NOPLAINTEXT|PolicyUtils.NOANONYMOUS};
 
     /**
--- a/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -43,8 +43,8 @@
 public final class FactoryImpl implements SaslClientFactory,
 SaslServerFactory{
 
-    private static final String myMechs[] = { "NTLM" };
-    private static final int mechPolicies[] = {
+    private static final String[] myMechs = { "NTLM" };
+    private static final int[] mechPolicies = {
             PolicyUtils.NOPLAINTEXT|PolicyUtils.NOANONYMOUS
     };
 
--- a/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java	Wed Jul 15 10:00:15 2015 -0700
@@ -66,7 +66,7 @@
     class KeyEntry
     {
         private Key privateKey;
-        private X509Certificate certChain[];
+        private X509Certificate[] certChain;
         private String alias;
 
         KeyEntry(Key key, X509Certificate[] chain) {
--- a/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Cipher.java	Wed Jul 15 10:00:15 2015 -0700
@@ -175,7 +175,7 @@
         this.algorithm = algorithm;
         this.mechanism = mechanism;
 
-        String algoParts[] = algorithm.split("/");
+        String[] algoParts = algorithm.split("/");
 
         if (algoParts[0].startsWith("AES")) {
             blockSize = 16;
--- a/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java	Wed Jul 15 10:00:15 2015 -0700
@@ -164,7 +164,7 @@
         private X509Certificate cert = null;
 
         // chain
-        private X509Certificate chain[] = null;
+        private X509Certificate[] chain = null;
 
         // true if CKA_ID for private key and cert match up
         private boolean matched = false;
--- a/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS.java	Wed Jul 15 10:00:15 2015 -0700
@@ -42,7 +42,7 @@
 public class CK_AES_CTR_PARAMS {
 
     private final long ulCounterBits;
-    private final byte cb[];
+    private final byte[] cb;
 
     public CK_AES_CTR_PARAMS(byte[] cb) {
         ulCounterBits = 128;
--- a/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoException.java	Wed Jul 15 10:00:15 2015 -0700
@@ -40,7 +40,7 @@
     private static final long serialVersionUID = -933864511110035746L;
 
     // NOTE: check /usr/include/sys/crypto/common.h for updates
-    private static final String ERROR_MSG[] = {
+    private static final String[] ERROR_MSG = {
         "CRYPTO_SUCCESS",
         "CRYPTO_CANCEL",
         "CRYPTO_HOST_MEMORY",
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Crypt.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Crypt.java	Wed Jul 15 10:00:15 2015 -0700
@@ -377,7 +377,7 @@
      *
      */
 
-    public static void main(String arg[]) {
+    public static void main(String[] arg) {
 
         if (arg.length!=2) {
             System.err.println("usage: Crypt password salt");
@@ -386,7 +386,7 @@
 
         Crypt c = new Crypt();
         try {
-            byte result[] = c.crypt
+            byte[] result = c.crypt
                 (arg[0].getBytes("ISO-8859-1"), arg[1].getBytes("ISO-8859-1"));
             for (int i=0; i<result.length; i++) {
                 System.out.println(" "+i+" "+(char)result[i]);
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Wed Jul 15 10:00:15 2015 -0700
@@ -729,8 +729,8 @@
 
         Crypt c = new Crypt();
         try {
-            byte oldCrypt[] = encryptedPassword.getBytes("UTF8");
-            byte newCrypt[] = c.crypt(password.getBytes("UTF8"),
+            byte[] oldCrypt = encryptedPassword.getBytes("UTF8");
+            byte[] newCrypt = c.crypt(password.getBytes("UTF8"),
                                       oldCrypt);
             if (newCrypt.length != oldCrypt.length)
                 return false;
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Wed Jul 15 10:00:15 2015 -0700
@@ -122,8 +122,9 @@
  * must also be set to true; Otherwise a configuration error will
  * be returned.</dd>
  * <dt>{@code renewTGT}:</dt>
- * <dd>Set this to true, if you want to renew
- * the TGT. If this is set, {@code useTicketCache} must also be
+ * <dd>Set this to true, if you want to renew the TGT when it's more than
+ * half-way expired (the time until expiration is less than the time
+ * since start time). If this is set, {@code useTicketCache} must also be
  * set to true; otherwise a configuration error will be returned.</dd>
  * <dt>{@code doNotPrompt}:</dt>
  * <dd>Set this to true if you do not want to be
@@ -649,17 +650,19 @@
                     (principal, ticketCacheName);
 
                 if (cred != null) {
-                    // check to renew credentials
+                    if (renewTGT && isOld(cred)) {
+                        // renew if ticket is old.
+                        Credentials newCred = renewCredentials(cred);
+                        if (newCred != null) {
+                            cred = newCred;
+                        }
+                    }
                     if (!isCurrent(cred)) {
-                        if (renewTGT) {
-                            cred = renewCredentials(cred);
-                        } else {
-                            // credentials have expired
-                            cred = null;
-                            if (debug)
-                                System.out.println("Credentials are" +
-                                                " no longer valid");
-                        }
+                        // credentials have expired
+                        cred = null;
+                        if (debug)
+                            System.out.println("Credentials are" +
+                                    " no longer valid");
                     }
                 }
 
@@ -968,7 +971,7 @@
         }
     }
 
-    private boolean isCurrent(Credentials creds)
+    private static boolean isCurrent(Credentials creds)
     {
         Date endTime = creds.getEndTime();
         if (endTime != null) {
@@ -977,6 +980,23 @@
         return true;
     }
 
+    private static boolean isOld(Credentials creds)
+    {
+        Date endTime = creds.getEndTime();
+        if (endTime != null) {
+            Date authTime = creds.getAuthTime();
+            long now = System.currentTimeMillis();
+            if (authTime != null) {
+                // pass the mid between auth and end
+                return now - authTime.getTime() > endTime.getTime() - now;
+            } else {
+                // will expire in less than 2 hours
+                return now <= endTime.getTime() - 1000*3600*2L;
+            }
+        }
+        return false;
+    }
+
     private Credentials renewCredentials(Credentials creds)
     {
         Credentials lcreds;
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/NTLoginModule.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/NTLoginModule.java	Wed Jul 15 10:00:15 2015 -0700
@@ -81,7 +81,7 @@
     private NTDomainPrincipal userDomain;               // user domain
     private NTSidDomainPrincipal domainSID;             // domain SID
     private NTSidPrimaryGroupPrincipal primaryGroup;    // primary group
-    private NTSidGroupPrincipal groups[];               // supplementary groups
+    private NTSidGroupPrincipal[] groups;               // supplementary groups
     private NTNumericCredential iToken;                 // impersonation token
 
     /**
@@ -194,7 +194,7 @@
         if (ntSystem.getGroupIDs() != null &&
             ntSystem.getGroupIDs().length > 0) {
 
-            String groupSIDs[] = ntSystem.getGroupIDs();
+            String[] groupSIDs = ntSystem.getGroupIDs();
             groups = new NTSidGroupPrincipal[groupSIDs.length];
             for (int i = 0; i < groupSIDs.length; i++) {
                 groups[i] = new NTSidGroupPrincipal(groupSIDs[i]);
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/NTSystem.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/NTSystem.java	Wed Jul 15 10:00:15 2015 -0700
@@ -40,7 +40,7 @@
     private String domain;
     private String domainSID;
     private String userSID;
-    private String groupIDs[];
+    private String[] groupIDs;
     private String primaryGroupID;
     private long   impersonationToken;
 
--- a/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/FactoryImpl.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/FactoryImpl.java	Wed Jul 15 10:00:15 2015 -0700
@@ -38,10 +38,10 @@
   * @author Rosanna Lee
   */
 public final class FactoryImpl implements SaslClientFactory, SaslServerFactory {
-    private static final String myMechs[] = {
+    private static final String[] myMechs = {
         "GSSAPI"};
 
-    private static final int mechPolicies[] = {
+    private static final int[] mechPolicies = {
         PolicyUtils.NOPLAINTEXT|PolicyUtils.NOANONYMOUS|PolicyUtils.NOACTIVE
     };
 
--- a/test/ProblemList.txt	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/ProblemList.txt	Wed Jul 15 10:00:15 2015 -0700
@@ -298,6 +298,9 @@
 # 8051770
 sun/security/provider/SecureRandom/StrongSecureRandom.java      macosx-10.10
 
+# 8074580
+sun/security/pkcs11/rsa/TestKeyPairGenerator.java               generic-all
+
 ############################################################################
 
 # jdk_sound
--- a/test/java/lang/ProcessHandle/InfoTest.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/lang/ProcessHandle/InfoTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -32,24 +32,24 @@
 import java.nio.file.attribute.UserPrincipal;
 import java.time.Duration;
 import java.time.Instant;
-import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Random;
-import java.util.Scanner;
-import java.util.StringTokenizer;
 import java.util.concurrent.TimeUnit;
 
 import jdk.testlibrary.Platform;
+import jdk.testlibrary.Utils;
+
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.testng.TestNG;
 
 /*
  * @test
+ * @build jdk.testlibrary.*
  * @library /lib/testlibrary
  * @summary Functions of ProcessHandle.Info
  * @author Roger Riggs
@@ -91,16 +91,16 @@
                 "test runner is included.");
         ProcessHandle self = ProcessHandle.current();
 
-        Duration somecpu = Duration.ofMillis(200L);
-        Instant end = Instant.now().plus(somecpu);
+        Duration someCPU = Duration.ofMillis(200L);
+        Instant end = Instant.now().plus(someCPU);
         while (Instant.now().isBefore(end)) {
             // waste the cpu
         }
         ProcessHandle.Info info = self.info();
         System.out.printf(" info: %s%n", info);
         Optional<Duration> totalCpu = info.totalCpuDuration();
-        if (totalCpu.isPresent() && (totalCpu.get().compareTo(somecpu) < 0)) {
-            Assert.fail("reported cputime less than expected: " + somecpu + ", " +
+        if (totalCpu.isPresent() && (totalCpu.get().compareTo(someCPU) < 0)) {
+            Assert.fail("reported cputime less than expected: " + someCPU + ", " +
                     "actual: " + info.totalCpuDuration());
         }
     }
@@ -111,17 +111,16 @@
     @Test
     public static void test2() {
         try {
-            long cpulooptime = 1 << 8;
+            long cpuLoopTime = 100;             // 100 ms
             String[] extraArgs = {"pid", "parent", "stdin"};
-            Instant beforeStart = Instant.now().truncatedTo(ChronoUnit.SECONDS);
             JavaChild p1 = JavaChild.spawnJavaChild((Object[])extraArgs);
             Instant afterStart = Instant.now();
 
             try (BufferedReader lines = p1.outputReader()) {
                 Duration lastCpu = Duration.ofMillis(0L);
-                for (int j = 0; j < 20; j++) {
+                for (int j = 0; j < 10; j++) {
 
-                    p1.sendAction("cpuloop", cpulooptime);
+                    p1.sendAction("cpuloop", cpuLoopTime);
                     p1.sendAction("cputime", "");
 
                     // Read cputime from child
@@ -187,17 +186,21 @@
                     if (info.totalCpuDuration().isPresent()) {
                         Duration totalCPU = info.totalCpuDuration().get();
                         Duration epsilon = Duration.ofMillis(200L);
-                        Assert.assertTrue(totalCPU.toNanos() > 0L,
-                                "total cpu time expected > 0ms, actual: " + totalCPU);
-                        Assert.assertTrue(totalCPU.toNanos() < lastCpu.toNanos() + 10_000_000_000L,
-                                "total cpu time expected < 10s more than previous iteration, actual: " + totalCPU);
                         if (childCpuTime != null) {
                             System.out.printf(" info.totalCPU: %s, childCpuTime: %s, diff: %s%n",
-                                    totalCPU.toNanos(), childCpuTime.toNanos(), childCpuTime.toNanos() - totalCPU.toNanos());
+                                    totalCPU.toNanos(), childCpuTime.toNanos(),
+                                    childCpuTime.toNanos() - totalCPU.toNanos());
                             Assert.assertTrue(checkEpsilon(childCpuTime, totalCPU, epsilon),
                                     childCpuTime + " should be within " +
                                             epsilon + " of " + totalCPU);
                         }
+                        Assert.assertTrue(totalCPU.toNanos() > 0L,
+                                "total cpu time expected > 0ms, actual: " + totalCPU);
+                        long t = Utils.adjustTimeout(10L);  // Adjusted timeout seconds
+                        Assert.assertTrue(totalCPU.toNanos() < lastCpu.toNanos() + t * 1_000_000_000L,
+                                "total cpu time expected < " + t
+                                        + " seconds more than previous iteration, actual: "
+                                        + (totalCPU.toNanos() - lastCpu.toNanos()));
                         lastCpu = totalCPU;
                     }
 
@@ -209,7 +212,7 @@
                     }
                 }
             }
-            p1.waitFor(5, TimeUnit.SECONDS);
+            p1.waitFor(Utils.adjustTimeout(5), TimeUnit.SECONDS);
         } catch (IOException | InterruptedException ie) {
             ie.printStackTrace(System.out);
             Assert.fail("unexpected exception", ie);
@@ -252,7 +255,7 @@
                 Assert.assertTrue(p.waitFor(15, TimeUnit.SECONDS));
             }
         } catch (IOException | InterruptedException ex) {
-            ex.printStackTrace(System.out);;
+            ex.printStackTrace(System.out);
         } finally {
             // Destroy any children that still exist
             ProcessUtil.destroyProcessTree(ProcessHandle.current());
@@ -274,7 +277,7 @@
 
         if (dur1.isPresent() && dur2.isPresent()) {
             Duration total1 = dur1.get();
-            Duration total2 = dur2.get();       ;
+            Duration total2 = dur2.get();
             System.out.printf(" total1 vs. mbean: %s, getProcessCpuTime: %s, diff: %s%n",
                     Objects.toString(total1), myCputime1, myCputime1.minus(total1));
             System.out.printf(" total2 vs. mbean: %s, getProcessCpuTime: %s, diff: %s%n",
@@ -326,7 +329,7 @@
      * @param d1 a Duration - presumed to be shorter
      * @param d2 a 2nd Duration - presumed to be greater (or within Epsilon)
      * @param epsilon Epsilon the amount of overlap allowed
-     * @return
+     * @return true if d2 is greater than d1 or within epsilon, false otherwise
      */
     static boolean checkEpsilon(Duration d1, Duration d2, Duration epsilon) {
         if (d1.toNanos() <= d2.toNanos()) {
@@ -339,7 +342,7 @@
     /**
      * Spawn a native process with the provided arguments.
      * @param command the executable of native process
-     * @args
+     * @param args to start a new process
      * @return the Process that was started
      * @throws IOException thrown by ProcessBuilder.start
      */
--- a/test/java/lang/ProcessHandle/JavaChild.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/lang/ProcessHandle/JavaChild.java	Wed Jul 15 10:00:15 2015 -0700
@@ -281,12 +281,12 @@
                         sendResult(action, Integer.toString(millis));
                         break;
                     case "cpuloop":
-                        long times = Long.valueOf(args[nextArg++]);
-                        Instant end = Instant.now().plusMillis(times);
-                        while (Instant.now().isBefore(end)) {
-                            // burn the cpu til the time is up
+                        long cpuMillis = Long.valueOf(args[nextArg++]);
+                        long cpuTarget = getCpuTime() + cpuMillis * 1_000_000L;
+                        while (getCpuTime() < cpuTarget) {
+                            // burn the cpu until the time is up
                         }
-                        sendResult(action, times);
+                        sendResult(action, cpuMillis);
                         break;
                     case "cputime":
                         sendResult(action, getCpuTime());
--- a/test/java/lang/ProcessHandle/OnExitTest.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/lang/ProcessHandle/OnExitTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -27,16 +27,19 @@
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
+
+import jdk.testlibrary.Utils;
+
 import org.testng.annotations.Test;
 import org.testng.Assert;
 import org.testng.TestNG;
 
 /*
  * @test
+ * @build jdk.testlibrary.Utils
  * @summary Functions of Process.onExit and ProcessHandle.onExit
  * @author Roger Riggs
  */
@@ -88,6 +91,7 @@
      */
     @Test
     public static void test2() {
+        ProcessHandle procHandle = null;
         try {
             ConcurrentHashMap<ProcessHandle, ProcessHandle> processes = new ConcurrentHashMap<>();
             List<ProcessHandle> children = getChildren(ProcessHandle.current());
@@ -96,7 +100,7 @@
                     "Expected to start with zero children; " + children);
 
             JavaChild proc = JavaChild.spawnJavaChild("stdin");
-            ProcessHandle procHandle = proc.toHandle();
+            procHandle = proc.toHandle();
             printf(" spawned: %d%n", proc.getPid());
 
             proc.forEachOutputLine((s) -> {
@@ -114,7 +118,8 @@
 
             // Poll until all 9 child processes exist or the timeout is reached
             int expected = 9;
-            Instant endTimeout = Instant.now().plusSeconds(10L);
+            long timeout = Utils.adjustTimeout(10L);
+            Instant endTimeout = Instant.now().plusSeconds(timeout);
             do {
                 Thread.sleep(200L);
                 printf(" subprocess count: %d, waiting for %d%n", processes.size(), expected);
@@ -123,16 +128,17 @@
 
             children = getAllChildren(procHandle);
 
-            ArrayBlockingQueue<ProcessHandle> completions = new ArrayBlockingQueue<>(expected + 1);
+            ConcurrentHashMap<ProcessHandle, CompletableFuture<ProcessHandle>> completions =
+                    new ConcurrentHashMap<>();
             Instant startTime = Instant.now();
             // Create a future for each of the 9 children
             processes.forEach( (p, parent) -> {
-                        p.onExit().whenComplete((ph, ex) -> {
+                        CompletableFuture<ProcessHandle> cf = p.onExit().whenComplete((ph, ex) -> {
                             Duration elapsed = Duration.between(startTime, Instant.now());
-                            completions.add(ph);
                             printf("whenComplete: pid: %s, exception: %s, thread: %s, elapsed: %s%n",
                                     ph, ex, Thread.currentThread(), elapsed);
                         });
+                        completions.put(p, cf);
                     });
 
             // Check that each of the spawned processes is included in the children
@@ -153,20 +159,23 @@
             proc.destroy();  // kill off the parent
             proc.waitFor();
 
-            // Wait for all the processes to be completed
+            // Wait for all the processes and corresponding onExit CF to be completed
             processes.forEach((p, parent) -> {
                 try {
                     p.onExit().get();
+                    completions.get(p).join();
                 } catch (InterruptedException | ExecutionException ex) {
                     // ignore
                 }
             });
 
-            // Verify that all 9 exit handlers were called
-            processes.forEach((p, parent) ->
-                Assert.assertTrue(completions.contains(p), "Child onExit not called: " + p
-                        + ", parent: " + parent
-                        + ": " + p.info()));
+            // Verify that all 9 exit handlers were called with the correct ProcessHandle
+            processes.forEach((p, parent) -> {
+                ProcessHandle value = completions.get(p).getNow(null);
+                Assert.assertEquals(p, value, "onExit.get value expected: " + p
+                        + ", actual: " + value
+                        + ": " + p.info());
+            });
 
             // Show the status of the original children
             children.forEach(p -> printProcess(p, "after onExit:"));
@@ -176,13 +185,12 @@
             List<ProcessHandle> children2 = getAllChildren(procHandle);
             printf(" children2: %s%n", children2.toString());
             Assert.assertEquals(children2.size(), 0, "After onExit, expected no children");
-
-            Assert.assertEquals(remaining.size(), 0, "Unaccounted for children");
-
         } catch (IOException | InterruptedException ex) {
             Assert.fail(ex.getMessage());
         } finally {
-            destroyProcessTree(ProcessHandle.current());
+            if (procHandle != null) {
+                destroyProcessTree(procHandle);
+            }
         }
     }
 
--- a/test/java/lang/ProcessHandle/TreeTest.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/lang/ProcessHandle/TreeTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -75,10 +75,12 @@
                 spawned.add(JavaChild.spawnJavaChild("pid", "stdin"));
             }
 
-            List<ProcessHandle> subprocesses = getChildren(self);
-            subprocesses.forEach(ProcessUtil::printProcess);
-            count = subprocesses.size();
-            Assert.assertEquals(count, MAXCHILDREN, "Wrong number of spawned children");
+            // Verify spawned Process is in list of children
+            final List<ProcessHandle> initialChildren = getChildren(self);
+            spawned.stream()
+                    .map(Process::toHandle)
+                    .filter(p -> !initialChildren.contains(p))
+                    .forEach(p -> Assert.fail("Spawned process missing from children: " + p));
 
             // Send exit command to each spawned Process
             spawned.forEach(p -> {
@@ -102,20 +104,25 @@
                 });
 
             // Verify that ProcessHandle.isAlive sees each of them as not alive
-            for (ProcessHandle ph : subprocesses) {
+            for (Process p : spawned) {
+                ProcessHandle ph = p.toHandle();
                 Assert.assertFalse(ph.isAlive(),
                         "ProcessHandle.isAlive for exited process: " + ph);
             }
 
-            // Verify no current children are visible
-            count = getChildren(self).size();
-            Assert.assertEquals(count, 0, "Children destroyed, should be zero");
+            // Verify spawned processes are not visible as children
+            final List<ProcessHandle> afterChildren = getChildren(self);
+            spawned.stream()
+                    .map(Process::toHandle)
+                    .filter(p -> afterChildren.contains(p))
+                    .forEach(p -> Assert.fail("Spawned process missing from children: " + p));
 
         } catch (IOException ioe) {
             Assert.fail("unable to spawn process", ioe);
         } finally {
             // Cleanup any left over processes
-            spawned.stream().map(Process::toHandle)
+            spawned.stream()
+                    .map(Process::toHandle)
                     .filter(ProcessHandle::isAlive)
                     .forEach(ph -> printDeep(ph, "test1 cleanup: "));
             destroyProcessTree(ProcessHandle.current());
@@ -127,7 +134,6 @@
      */
     @Test
     public static void test2() {
-        ProcessHandle p1Handle = null;
         try {
             ProcessHandle self = ProcessHandle.current();
             List<ProcessHandle> initialChildren = getChildren(self);
@@ -138,7 +144,7 @@
             }
 
             JavaChild p1 = JavaChild.spawnJavaChild("stdin");
-            p1Handle = p1.toHandle();
+            ProcessHandle p1Handle = p1.toHandle();
             printf("  p1 pid: %d%n", p1.getPid());
 
             int spawnNew = 3;
@@ -187,9 +193,6 @@
             throw new RuntimeException(t);
         } finally {
             // Cleanup any left over processes
-            if (p1Handle.isAlive()) {
-                printDeep(p1Handle, "test2 cleanup: ");
-            }
             destroyProcessTree(ProcessHandle.current());
         }
     }
@@ -205,7 +208,10 @@
             JavaChild p1 = JavaChild.spawnJavaChild("stdin");
             ProcessHandle p1Handle = p1.toHandle();
             printf(" p1: %s%n", p1.getPid());
-            long count = getChildren(self).size();
+
+            List<ProcessHandle> subprocesses = getChildren(self);
+            subprocesses.forEach(ProcessUtil::printProcess);
+            long count = subprocesses.size();
             Assert.assertEquals(count, 1, "Wrong number of spawned children");
 
             int newChildren = 3;
@@ -213,7 +219,7 @@
             p1.sendAction("spawn", newChildren, "stdin");
 
             // Wait for the new processes and save the list
-            List<ProcessHandle> subprocesses = waitForAllChildren(p1Handle, newChildren);
+            subprocesses = waitForAllChildren(p1Handle, newChildren);
             printDeep(p1Handle, "allChildren");
 
             Assert.assertEquals(subprocesses.size(), newChildren, "Wrong number of children");
@@ -249,6 +255,9 @@
             Assert.fail("Spawn of subprocess failed", ioe);
         } catch (InterruptedException inte) {
             Assert.fail("InterruptedException", inte);
+        } finally {
+            // Cleanup any left over processes
+            destroyProcessTree(ProcessHandle.current());
         }
     }
 
@@ -299,16 +308,15 @@
     }
 
     /**
-     * A test for scale; launch a large number (39) of subprocesses.
+     * A test for scale; launch a large number (14) of subprocesses.
      */
     @Test
     public static void test5() {
         int factor = 2;
-        ProcessHandle p1Handle = null;
         Instant start = Instant.now();
         try {
             JavaChild p1 = JavaChild.spawnJavaChild("stdin");
-            p1Handle = p1.toHandle();
+            ProcessHandle p1Handle = p1.toHandle();
 
             printf("Spawning %d x %d x %d processes, pid: %d%n",
                     factor, factor, factor, p1.getPid());
@@ -325,18 +333,14 @@
             int newChildren = factor * (1 + factor * (1 + factor));
             List<ProcessHandle> children = ProcessUtil.waitForAllChildren(p1Handle, newChildren);
 
-            Assert.assertEquals(p1.children()
-                    .filter(ProcessUtil::isNotWindowsConsole)
-                    .count(), factor, "expected direct children");
-            Assert.assertEquals(p1.allChildren()
-                    .filter(ProcessUtil::isNotWindowsConsole)
-                    .count(),
-                    factor * factor * factor + factor * factor + factor,
-                    "expected all children");
+            Assert.assertEquals(getChildren(p1Handle).size(),
+                    factor, "expected direct children");
+            long count = getAllChildren(p1Handle).size();
+            long totalChildren = factor * factor * factor + factor * factor + factor;
+            Assert.assertTrue(count >= totalChildren,
+                    "expected at least " + totalChildren + ", actual: " + count);
 
-            List<ProcessHandle> subprocesses = p1.allChildren()
-                    .filter(ProcessUtil::isNotWindowsConsole)
-                    .collect(Collectors.toList());
+            List<ProcessHandle> subprocesses = getAllChildren(p1Handle);
             printf(" allChildren:  %s%n",
                     subprocesses.stream().map(p -> p.getPid())
                     .collect(Collectors.toList()));
@@ -347,10 +351,6 @@
             Assert.fail("Unexpected Exception", ex);
         } finally {
             printf("Duration: %s%n", Duration.between(start, Instant.now()));
-            // Cleanup any left over processes
-            if (p1Handle.isAlive()) {
-                printDeep(p1Handle, "test5 cleanup: ");
-            }
             destroyProcessTree(ProcessHandle.current());
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/ContentHandlers/ContentHandlersTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,371 @@
+/*
+ * 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.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.SequenceInputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static java.lang.String.format;
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.singleton;
+import static java.util.Collections.singletonMap;
+
+/*
+ * @test
+ * @bug 8064925
+ * @summary Basic test for ContentHandler. Ensures discovery paths for content
+ *          handlers follow a particular order.
+ */
+public class ContentHandlersTest {
+
+    public static void main(String[] args) throws Throwable {
+        step1_ContentHandlerFactory();
+        step2_ServiceLoader();
+        step3_UserDefined();
+        step4_BuiltIn();
+    }
+
+    private static void step1_ContentHandlerFactory() throws IOException {
+        String factoryClassFqn = "net.java.openjdk.test.TestContentHandlerFactory";
+
+        Path tmp = Files.createDirectory(Paths.get("ContentHandlersTest-1"));
+
+        Path src = templatesHome().resolve("test.template");
+        Path dst = tmp.resolve("Test.java");
+        Files.copy(src, dst);
+
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        Path dst1 = fromTemplate(templatesHome().resolve("broken_factory.template"),
+                factoryClassFqn, tmp);
+
+        javac(build, dst, dst1);
+
+        Result r = java(emptyMap(), singleton(build), "Test", factoryClassFqn);
+
+        if (r.exitValue == 0 || !r.output.startsWith(
+                stackTraceStringForBrokenFactory(factoryClassFqn))) {
+            throw new RuntimeException(
+                    "Expected a different kind of failure: " + r.output);
+        }
+    }
+
+    private static void step2_ServiceLoader() throws IOException {
+        String factoryClassFqn = "net.java.openjdk.test.TestContentHandlerFactory";
+
+        Path tmp = Files.createDirectory(Paths.get("ContentHandlersTest-2"));
+
+        Path src = templatesHome().resolve("test.template");
+        Path dst = tmp.resolve("Test.java");
+        Files.copy(src, dst);
+
+        Path dst1 = fromTemplate(templatesHome().resolve("broken_constructor_factory.template"),
+                factoryClassFqn, tmp);
+
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        javac(build, dst);
+
+        Path explodedJar = Files.createDirectory(tmp.resolve("exploded-jar"));
+        Path services = Files.createDirectories(explodedJar.resolve("META-INF")
+                .resolve("services"));
+
+        Path s = services.resolve("java.net.ContentHandlerFactory");
+
+        try (FileWriter fw = new FileWriter(s.toFile())) {
+            fw.write(factoryClassFqn);
+        }
+
+        javac(explodedJar, dst1);
+        jar(tmp.resolve("test.jar"), explodedJar);
+
+        Files.copy(tmp.resolve("test.jar"), build.resolve("test.jar"));
+
+        Result r = java(emptyMap(), asList(build.resolve("test.jar"), build), "Test");
+
+        if (r.exitValue == 0 || !verifyOutput(r.output, factoryClassFqn))
+            throw new RuntimeException(r.output);
+    }
+
+    private static void step3_UserDefined() throws IOException {
+        String packagePrefix = "net.java.openjdk.test";
+        String fqn = packagePrefix + ".text.plain";
+
+        Path tmp = Files.createDirectory(Paths.get("ContentHandlersTest-3"));
+
+        Path src = templatesHome().resolve("test.template");
+        Path dst = tmp.resolve("Test.java");
+        Files.copy(src, dst);
+
+        Path dst1 = fromTemplate(templatesHome().resolve("plain.template"),
+                fqn, tmp);
+
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        javac(build, dst);
+
+        Path classes = Files.createDirectory(tmp.resolve("classes"));
+
+        javac(classes, dst1);
+
+        Map<String, String> m = singletonMap("java.content.handler.pkgs", packagePrefix);
+        Result r = java(m, asList(build, classes), "Test");
+
+        if (r.exitValue != 0 || !r.output.contains(fqn))
+            throw new RuntimeException(r.output);
+    }
+
+    private static void step4_BuiltIn() throws IOException {
+        Path tmp = Files.createDirectory(Paths.get("ContentHandlersTest-4"));
+
+        Path src = templatesHome().resolve("test.template");
+        Path dst = tmp.resolve("Test.java");
+        Files.copy(src, dst);
+
+        Path build = Files.createDirectory(tmp.resolve("build"));
+
+        javac(build, dst);
+
+        Result r = java(emptyMap(), singleton(build), "Test");
+
+        if (r.exitValue != 0 || !r.output.contains("sun.net.www.content.text.PlainTextInputStream"))
+            throw new RuntimeException(r.output);
+    }
+
+    private static String stackTraceStringForBrokenFactory(String fqn) {
+        return "Exception in thread \"main\" java.lang.RuntimeException: " +
+                "This is a broken factory. It is supposed to throw this exception.";
+    }
+
+    private static Path fromTemplate(Path srcTemplate,
+                                     String factoryFqn,
+                                     Path dstFolder) throws IOException {
+
+        String factorySimpleName, packageName;
+        int i = factoryFqn.lastIndexOf('.');
+        if (i < 0) {
+            packageName = "";
+            factorySimpleName = factoryFqn;
+        } else {
+            packageName = factoryFqn.substring(0, i);
+            factorySimpleName = factoryFqn.substring(i + 1);
+        }
+
+        Path result = dstFolder.resolve(factorySimpleName + ".java");
+        File dst = result.toFile();
+        File src = srcTemplate.toFile();
+        try (BufferedReader r = new BufferedReader(new FileReader(src));
+             BufferedWriter w = new BufferedWriter(new FileWriter(dst))) {
+
+            List<String> lines = processTemplate(packageName, factorySimpleName,
+                    r.lines()).collect(Collectors.toList());
+
+            Iterator<String> it = lines.iterator();
+            if (it.hasNext())
+                w.write(it.next());
+            while (it.hasNext()) {
+                w.newLine();
+                w.write(it.next());
+            }
+        }
+        return result;
+    }
+
+    private static Stream<String> processTemplate(String packageName,
+                                                  String factorySimpleName,
+                                                  Stream<String> lines) {
+        Function<String, String> pckg;
+
+        if (packageName.isEmpty()) {
+            pckg = s -> s.contains("$package") ? "" : s;
+        } else {
+            pckg = s -> s.replaceAll("\\$package", packageName);
+        }
+
+        Function<String, String> factory
+                = s -> s.replaceAll("\\$className", factorySimpleName);
+
+        return lines.map(pckg).map(factory);
+    }
+
+    // IMO, that's the easiest way that gives you a fair amount of confidence in
+    // that j.u.ServiceLoader is loading a factory rather than Class.forName
+    private static boolean verifyOutput(String output, String fqn) {
+        String s1 = String.format("java.util.ServiceConfigurationError: " +
+                "java.net.ContentHandlerFactory: " +
+                "Provider %s could not be instantiated", fqn);
+
+        return output.contains(s1);
+    }
+
+    private static void jar(Path jarName, Path jarRoot) {
+        String jar = getJDKTool("jar");
+        ProcessBuilder p = new ProcessBuilder(jar, "cf", jarName.toString(),
+                "-C", jarRoot.toString(), ".");
+        quickFail(run(p));
+    }
+
+    private static void javac(Path compilationOutput, Path... sourceFiles) {
+        String javac = getJDKTool("javac");
+        List<String> commands = new ArrayList<>();
+        commands.addAll(asList(javac, "-d", compilationOutput.toString()));
+        List<Path> paths = asList(sourceFiles);
+        commands.addAll(paths.stream()
+                .map(Path::toString)
+                .collect(Collectors.toList()));
+        quickFail(run(new ProcessBuilder(commands)));
+    }
+
+    private static void quickFail(Result r) {
+        if (r.exitValue != 0)
+            throw new RuntimeException(r.output);
+    }
+
+    private static Result java(Map<String, String> properties,
+                               Collection<Path> classpath,
+                               String classname, String... args) {
+
+        String java = getJDKTool("java");
+
+        List<String> commands = new ArrayList<>();
+        commands.add(java);
+        commands.addAll(properties.entrySet()
+                .stream()
+                .map(e -> "-D" + e.getKey() + "=" + e.getValue())
+                .collect(Collectors.toList()));
+
+        String cp = classpath.stream()
+                .map(Path::toString)
+                .collect(Collectors.joining(File.pathSeparator));
+        commands.add("-cp");
+        commands.add(cp);
+        commands.add(classname);
+        commands.addAll(Arrays.asList(args));
+
+        return run(new ProcessBuilder(commands));
+    }
+
+    private static Result run(ProcessBuilder b) {
+        Process p;
+        try {
+            p = b.start();
+        } catch (IOException e) {
+            throw new RuntimeException(
+                    format("Couldn't start process '%s'", b.command()), e);
+        }
+
+        String output;
+        try {
+            output = toString(p.getInputStream(), p.getErrorStream());
+        } catch (IOException e) {
+            throw new RuntimeException(
+                    format("Couldn't read process output '%s'", b.command()), e);
+        }
+
+        try {
+            p.waitFor();
+        } catch (InterruptedException e) {
+            throw new RuntimeException(
+                    format("Process hasn't finished '%s'", b.command()), e);
+        }
+
+        return new Result(p.exitValue(), output);
+    }
+
+    private static String getJDKTool(String name) {
+        String testJdk = System.getProperty("test.jdk");
+        if (testJdk == null)
+            throw new RuntimeException("Please provide test.jdk property at a startup");
+        return testJdk + File.separator + "bin" + File.separator + name;
+    }
+
+    private static Path templatesHome() {
+        String testSrc = System.getProperty("test.src");
+        if (testSrc == null)
+            throw new RuntimeException("Please provide test.src property at a startup");
+        return Paths.get(testSrc);
+    }
+
+    private static String toString(InputStream... src) throws IOException {
+        StringWriter dst = new StringWriter();
+        Reader concatenated =
+                new InputStreamReader(
+                        new SequenceInputStream(
+                                Collections.enumeration(asList(src))));
+        copy(concatenated, dst);
+        return dst.toString();
+    }
+
+    private static void copy(Reader src, Writer dst) throws IOException {
+        int len;
+        char[] buf = new char[1024];
+        try {
+            while ((len = src.read(buf)) != -1)
+                dst.write(buf, 0, len);
+        } finally {
+            try {
+                src.close();
+            } catch (IOException ignored1) {
+            } finally {
+                try {
+                    dst.close();
+                } catch (IOException ignored2) {
+                }
+            }
+        }
+    }
+
+    private static class Result {
+
+        final int exitValue;
+        final String output;
+
+        private Result(int exitValue, String output) {
+            this.exitValue = exitValue;
+            this.output = output;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/ContentHandlers/broken_constructor_factory.template	Wed Jul 15 10:00:15 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.
+ */
+
+package $package;
+
+import java.net.ContentHandler;
+import java.net.ContentHandlerFactory;
+
+public class $className implements ContentHandlerFactory {
+
+    public $className() {
+        throw new RuntimeException(
+                "This is a broken factory. It is supposed to throw this exception.");
+    }
+
+    @Override
+    public ContentHandler createContentHandler(String mimetype) {
+        throw new RuntimeException( "This method is not supposed to be called.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/ContentHandlers/broken_factory.template	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package $package;
+
+import java.net.ContentHandler;
+import java.net.ContentHandlerFactory;
+
+public class $className implements ContentHandlerFactory {
+
+    @Override
+    public ContentHandler createContentHandler(String mimetype) {
+        throw new RuntimeException(
+                "This is a broken factory. It is supposed to throw this exception.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/ContentHandlers/plain.template	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package;
+
+import java.io.IOException;
+import java.net.ContentHandler;
+import java.net.URLConnection;
+
+public final class $className extends ContentHandler {
+
+    @Override
+    public Object getContent(URLConnection urlc) throws IOException {
+        return this;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLConnection/ContentHandlers/test.template	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,79 @@
+/*
+ * 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.ByteArrayInputStream;
+import java.io.InputStream;
+import java.net.ContentHandlerFactory;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+
+public class Test {
+
+    public static void main(String[] args) throws Exception {
+        if (args.length > 0) {
+            String fqn = args[0];
+
+            @SuppressWarnings("unchecked")
+            Class<? extends ContentHandlerFactory> c =
+                    (Class<? extends ContentHandlerFactory>) Class.forName(fqn);
+
+            ContentHandlerFactory f = c.newInstance();
+
+            URLConnection.setContentHandlerFactory(f);
+        }
+
+        // One does not simply use a ContentHandler...
+        // From an end user perspective ContentHandler is used indirectly
+        // and it's more like SPI rather than API. So there's a certain amount
+        // of preparations needs to be done beforehand.
+
+        URLStreamHandlerFactory streamHandlerFactory =
+                (protocol) ->
+                        new URLStreamHandler() {
+                            @Override
+                            protected URLConnection openConnection(URL u) {
+                                return newUrlConnection(u);
+                            }
+                        };
+
+        URL.setURLStreamHandlerFactory(streamHandlerFactory);
+
+        // Finally
+        Object content = new URL("whatever:").getContent();
+
+        System.out.println("Content class is: " + content.getClass());
+    }
+
+    private static URLConnection newUrlConnection(URL u) {
+        return new URLConnection(u) {
+            @Override public void connect() { }
+
+            @Override
+            public InputStream getInputStream() { return null; }
+
+            @Override public String getContentType() { return "text/plain"; }
+        };
+    }
+}
--- a/test/java/util/Collection/MOAT.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/util/Collection/MOAT.java	Wed Jul 15 10:00:15 2015 -0700
@@ -356,13 +356,7 @@
             }
 
             check(c.toArray().length == c.size());
-            check(c.toArray().getClass() == Object[].class
-                  ||
-                  // !!!!
-                  // 6260652: (coll) Arrays.asList(x).toArray().getClass()
-                  // should be Object[].class
-                  (c.getClass().getName().equals("java.util.Arrays$ArrayList"))
-                  );
+            check(c.toArray().getClass() == Object[].class);
             for (int size : new int[]{0,1,c.size(), c.size()+1}) {
                 Integer[] a = c.toArray(new Integer[size]);
                 check((size > c.size()) || a.length == c.size());
--- a/test/java/util/logging/LoggingDeadlock2.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/util/logging/LoggingDeadlock2.java	Wed Jul 15 10:00:15 2015 -0700
@@ -57,35 +57,59 @@
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.LogManager;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.util.concurrent.TimeUnit;
 
 public class LoggingDeadlock2 {
 
+    // ask child process to dumpstack after 60secs
+    public static final long DUMP_STACK_FREQUENCY_MS = 60000;
+
+    // A marker that allows to validate the subprocess output.
+    public static final String MARKER = "$";
+
     public static void realMain(String arg[]) throws Throwable {
         try {
             System.out.println(javaChildArgs);
             ProcessBuilder pb = new ProcessBuilder(javaChildArgs);
             ProcessResults r = run(pb.start());
             equal(r.exitValue(), 99);
-            equal(r.out(), "");
+
+            // output of subprocess should end with "$"
+            final String out = r.out();
+            final String trailingOutput = out.indexOf(MARKER) > -1
+                    ? out.substring(out.indexOf(MARKER)+MARKER.length())
+                    : out;
+            equal(trailingOutput, "");
             equal(r.err(), "");
+            equal(out.startsWith("JavaChild started"), true);
+            equal(out.endsWith("$"), true);
         } catch (Throwable t) { unexpected(t); }
     }
 
     public static class JavaChild {
         public static void main(String args[]) throws Throwable {
+            System.out.println("JavaChild started");
+
             final CyclicBarrier startingGate = new CyclicBarrier(2);
             final Throwable[] thrown = new Throwable[1];
 
             // Some random variation, to help tickle races.
             final Random rnd = new Random();
+            final long seed = rnd.nextLong();
+            rnd.setSeed(seed);
+            System.out.println("seed=" + seed);
             final boolean dojoin = rnd.nextBoolean();
             final int JITTER = 1024;
             final int iters1 = rnd.nextInt(JITTER);
             final int iters2 = JITTER - iters1;
             final AtomicInteger counter = new AtomicInteger(0);
+            System.out.println("dojoin=" + dojoin);
+            System.out.println("iters1=" + iters1);
+            System.out.println("iters2=" + iters2);
 
             Thread exiter = new Thread() {
                 public void run() {
@@ -101,6 +125,12 @@
                 }};
             exiter.start();
 
+            System.out.println("exiter started");
+
+            // signal end of verbose output
+            System.out.print(MARKER);
+            System.out.flush();
+
             startingGate.await();
             for (int i = 0; i < iters2; i++)
                 counter.getAndIncrement();
@@ -124,6 +154,9 @@
     private static final String javaExe =
         System.getProperty("java.home") +
         File.separator + "bin" + File.separator + "java";
+    private static final String jstackExe =
+        System.getProperty("java.home") +
+        File.separator + "bin" + File.separator + "jstack";
 
     private static final String classpath =
         System.getProperty("java.class.path");
@@ -182,10 +215,15 @@
         public void run() {
             try {
                 Reader r = new InputStreamReader(is);
-                char[] buf = new char[4096];
                 int n;
-                while ((n = r.read(buf)) > 0) {
-                    sb.append(buf,0,n);
+                while ((n = r.read()) > 0) {
+                    sb.append((char)n);
+
+                    // prints everything immediately to System.out so that we can
+                    // see the traces even in the event of a test timeout
+                    System.out.write((char)n);
+                    System.out.flush();
+
                 }
             } catch (Throwable t) {
                 throwable = t;
@@ -196,6 +234,56 @@
         }
     }
 
+    /**
+     * If the child process deadlocks, then the parent may fail in timeout.
+     * In that case, we won't have any interesting traces, unless we manage
+     * to get a thread dump from the child.
+     * It is unsure whether obtaining a thread dump from a deadlocked child
+     * will work - but maybe we could see something if the timeout is a false
+     * positive (the child has not deadlocked but hasn't managed to fully start
+     * yet, for instance).
+     * The idea here is to periodically try to obtain a thread dump from the
+     * child, every 60sec - which should be always less than the jtreg timeout.
+     */
+    private static class TimeoutThread extends Thread {
+        final long ms;
+        final Process process;
+        TimeoutThread(long ms, Process p) {
+            super("TimeoutThread");
+            setDaemon(true);
+            this.ms = ms;
+            this.process = p;
+        }
+
+        @Override
+        public void run() {
+            long start = System.nanoTime();
+            try {
+                while (true) {
+                    sleep(ms);
+                    System.err.println("Timeout reached: " + ms);
+                    if (process.isAlive()) {
+                        long pid = process.getPid();
+                        ProcessBuilder jstack = new ProcessBuilder(jstackExe, String.valueOf(pid));
+                        System.err.println("Dumping subprocess stack: " + pid);
+                        Process p = jstack.inheritIO().start();
+                        p.waitFor(ms, TimeUnit.MILLISECONDS);
+                    } else {
+                        System.err.println("Process is not alive!");
+                        break;
+                    }
+                }
+            } catch (InterruptedException ex) {
+                System.err.println("Interrupted: " + ex);
+            } catch (IOException io) {
+                System.err.println("Failed to get stack from subprocess");
+                io.printStackTrace();
+            }
+        }
+
+
+    }
+
     private static ProcessResults run(Process p) {
         Throwable throwable = null;
         int exitValue = -1;
@@ -208,10 +296,15 @@
             new StreamAccumulator(p.getErrorStream());
 
         try {
+            System.out.println("Waiting for child process to exit");
             outAccumulator.start();
             errAccumulator.start();
 
+            // ask subprocess to dump stack every 60 secs.
+            new TimeoutThread(DUMP_STACK_FREQUENCY_MS, p).start();
+
             exitValue = p.waitFor();
+            System.out.println("\nChild exited with status: " + exitValue);
 
             outAccumulator.join();
             errAccumulator.join();
--- a/test/java/util/regex/RegExTest.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/util/regex/RegExTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@
  * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
  * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
  * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
- * 8027645 8035076 8039124 8035975 8074678
+ * 8027645 8035076 8039124 8035975 8074678 6854417
  * @library /lib/testlibrary
  * @build jdk.testlibrary.*
  * @run main RegExTest
- * @key intermittent randomness
+ * @key randomness
  */
 
 import java.util.function.Function;
@@ -3554,15 +3554,26 @@
             // Create a short pattern to search for
             int patternLength = generator.nextInt(7) + 4;
             StringBuffer patternBuffer = new StringBuffer(patternLength);
-            for (int x=0; x<patternLength; x++) {
-                int ch = baseCharacter + generator.nextInt(26);
-                if (Character.isSupplementaryCodePoint(ch)) {
-                    patternBuffer.append(Character.toChars(ch));
-                } else {
-                    patternBuffer.append((char)ch);
+            String pattern;
+            retry: for (;;) {
+                for (int x=0; x<patternLength; x++) {
+                    int ch = baseCharacter + generator.nextInt(26);
+                    if (Character.isSupplementaryCodePoint(ch)) {
+                        patternBuffer.append(Character.toChars(ch));
+                    } else {
+                        patternBuffer.append((char)ch);
+                    }
                 }
+                pattern = patternBuffer.toString();
+
+                // Avoid patterns that start and end with the same substring
+                // See JDK-6854417
+                for (int x=1; x <patternLength; x++) {
+                    if (pattern.startsWith(pattern.substring(x)))
+                        continue retry;
+                }
+                break;
             }
-            String pattern =  patternBuffer.toString();
             Pattern p = Pattern.compile(pattern);
 
             // Create a buffer with random ASCII chars that does
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/stream/bootlib/java/util/stream/DefaultMethodStreams.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,984 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Comparator;
+import java.util.DoubleSummaryStatistics;
+import java.util.IntSummaryStatistics;
+import java.util.Iterator;
+import java.util.LongSummaryStatistics;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.PrimitiveIterator;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoubleFunction;
+import java.util.function.DoublePredicate;
+import java.util.function.DoubleToIntFunction;
+import java.util.function.DoubleToLongFunction;
+import java.util.function.DoubleUnaryOperator;
+import java.util.function.Function;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
+import java.util.function.LongPredicate;
+import java.util.function.LongToDoubleFunction;
+import java.util.function.LongToIntFunction;
+import java.util.function.LongUnaryOperator;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.ObjIntConsumer;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+import static java.util.stream.Collectors.*;
+
+public final class DefaultMethodStreams {
+
+    static {
+        // Verify that default methods are not overridden
+        verify(DefaultMethodRefStream.class);
+        verify(DefaultMethodIntStream.class);
+        verify(DefaultMethodLongStream.class);
+        verify(DefaultMethodDoubleStream.class);
+    }
+
+    static void verify(Class<?> del) {
+        // Find the stream interface
+        Class<?> s = Stream.of(del.getInterfaces())
+                .filter(c -> BaseStream.class.isAssignableFrom(c))
+                .findFirst().get();
+
+        // Get all default methods on the stream class
+        Set<String> dms = Stream.of(s.getMethods())
+                .filter(m -> !Modifier.isStatic(m.getModifiers()))
+                .filter(m -> !m.isBridge())
+                .filter(Method::isDefault)
+                .map(Method::getName)
+                .collect(toSet());
+
+        // Get all methods on the delegating class
+        Set<String> ims = Stream.of(del.getMethods())
+                .filter(m -> !Modifier.isStatic(m.getModifiers()))
+                .filter(m -> m.getDeclaringClass() == del)
+                .map(Method::getName)
+                .collect(toSet());
+
+        if (ims.stream().anyMatch(dms::contains)) {
+            throw new AssertionError(String.format("%s overrides default methods of %s\n", del, s));
+        }
+    }
+
+    /**
+     * Creates a stream that for the next operation either delegates to
+     * a default method on {@link Stream}, if present for that operation,
+     * otherwise delegates to an underlying stream.
+     *
+     * @param s the underlying stream to be delegated to for non-default
+     * methods.
+     * @param <T> the type of the stream elements
+     * @return the delegating stream
+     */
+    public static <T> Stream<T> delegateTo(Stream<T> s) {
+        return new DefaultMethodRefStream<>(s);
+    }
+
+    /**
+     * Creates a stream that for the next operation either delegates to
+     * a default method on {@link IntStream}, if present for that operation,
+     * otherwise delegates to an underlying stream.
+     *
+     * @param s the underlying stream to be delegated to for non-default
+     * methods.
+     * @return the delegating stream
+     */
+    public static IntStream delegateTo(IntStream s) {
+        return new DefaultMethodIntStream(s);
+    }
+
+    /**
+     * Creates a stream that for the next operation either delegates to
+     * a default method on {@link LongStream}, if present for that operation,
+     * otherwise delegates to an underlying stream.
+     *
+     * @param s the underlying stream to be delegated to for non-default
+     * methods.
+     * @return the delegating stream
+     */
+    public static LongStream delegateTo(LongStream s) {
+        return new DefaultMethodLongStream(s);
+    }
+
+    /**
+     * Creates a stream that for the next operation either delegates to
+     * a default method on {@link DoubleStream}, if present for that operation,
+     * otherwise delegates to an underlying stream.
+     *
+     * @param s the underlying stream to be delegated to for non-default
+     * methods.
+     * @return the delegating stream
+     */
+    public static DoubleStream delegateTo(DoubleStream s) {
+        return new DefaultMethodDoubleStream(s);
+    }
+
+    /**
+     * A stream that delegates the next operation to a default method, if
+     * present, or to the same operation of an underlying stream.
+     *
+     * @param <T> the type of the stream elements
+     */
+    static final class DefaultMethodRefStream<T> implements Stream<T> {
+        final Stream<T> s;
+
+        DefaultMethodRefStream(Stream<T> s) {
+            this.s = s;
+        }
+
+
+        // Delegating non-default methods
+
+        @Override
+        public Stream<T> filter(Predicate<? super T> predicate) {
+            return s.filter(predicate);
+        }
+
+        @Override
+        public <R> Stream<R> map(Function<? super T, ? extends R> mapper) {
+            return s.map(mapper);
+        }
+
+        @Override
+        public IntStream mapToInt(ToIntFunction<? super T> mapper) {
+            return s.mapToInt(mapper);
+        }
+
+        @Override
+        public LongStream mapToLong(ToLongFunction<? super T> mapper) {
+            return s.mapToLong(mapper);
+        }
+
+        @Override
+        public DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper) {
+            return s.mapToDouble(mapper);
+        }
+
+        @Override
+        public <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
+            return s.flatMap(mapper);
+        }
+
+        @Override
+        public IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper) {
+            return s.flatMapToInt(mapper);
+        }
+
+        @Override
+        public LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper) {
+            return s.flatMapToLong(mapper);
+        }
+
+        @Override
+        public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
+            return s.flatMapToDouble(mapper);
+        }
+
+        @Override
+        public Stream<T> distinct() {
+            return s.distinct();
+        }
+
+        @Override
+        public Stream<T> sorted() {
+            return s.sorted();
+        }
+
+        @Override
+        public Stream<T> sorted(Comparator<? super T> comparator) {
+            return s.sorted(comparator);
+        }
+
+        @Override
+        public Stream<T> peek(Consumer<? super T> action) {
+            return s.peek(action);
+        }
+
+        @Override
+        public Stream<T> limit(long maxSize) {
+            return s.limit(maxSize);
+        }
+
+        @Override
+        public Stream<T> skip(long n) {
+            return s.skip(n);
+        }
+
+        @Override
+        public void forEach(Consumer<? super T> action) {
+            s.forEach(action);
+        }
+
+        @Override
+        public void forEachOrdered(Consumer<? super T> action) {
+            s.forEachOrdered(action);
+        }
+
+        @Override
+        public Object[] toArray() {
+            return s.toArray();
+        }
+
+        @Override
+        public <A> A[] toArray(IntFunction<A[]> generator) {
+            return s.toArray(generator);
+        }
+
+        @Override
+        public T reduce(T identity, BinaryOperator<T> accumulator) {
+            return s.reduce(identity, accumulator);
+        }
+
+        @Override
+        public Optional<T> reduce(BinaryOperator<T> accumulator) {
+            return s.reduce(accumulator);
+        }
+
+        @Override
+        public <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner) {
+            return s.reduce(identity, accumulator, combiner);
+        }
+
+        @Override
+        public <R> R collect(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator, BiConsumer<R, R> combiner) {
+            return s.collect(supplier, accumulator, combiner);
+        }
+
+        @Override
+        public <R, A> R collect(Collector<? super T, A, R> collector) {
+            return s.collect(collector);
+        }
+
+        @Override
+        public Optional<T> min(Comparator<? super T> comparator) {
+            return s.min(comparator);
+        }
+
+        @Override
+        public Optional<T> max(Comparator<? super T> comparator) {
+            return s.max(comparator);
+        }
+
+        @Override
+        public long count() {
+            return s.count();
+        }
+
+        @Override
+        public boolean anyMatch(Predicate<? super T> predicate) {
+            return s.anyMatch(predicate);
+        }
+
+        @Override
+        public boolean allMatch(Predicate<? super T> predicate) {
+            return s.allMatch(predicate);
+        }
+
+        @Override
+        public boolean noneMatch(Predicate<? super T> predicate) {
+            return s.noneMatch(predicate);
+        }
+
+        @Override
+        public Optional<T> findFirst() {
+            return s.findFirst();
+        }
+
+        @Override
+        public Optional<T> findAny() {
+            return s.findAny();
+        }
+
+        @Override
+        public Iterator<T> iterator() {
+            return s.iterator();
+        }
+
+        @Override
+        public Spliterator<T> spliterator() {
+            return s.spliterator();
+        }
+
+        @Override
+        public boolean isParallel() {
+            return s.isParallel();
+        }
+
+        @Override
+        public Stream<T> sequential() {
+            return s.sequential();
+        }
+
+        @Override
+        public Stream<T> parallel() {
+            return s.parallel();
+        }
+
+        @Override
+        public Stream<T> unordered() {
+            return s.unordered();
+        }
+
+        @Override
+        public Stream<T> onClose(Runnable closeHandler) {
+            return s.onClose(closeHandler);
+        }
+
+        @Override
+        public void close() {
+            s.close();
+        }
+    }
+
+    static final class DefaultMethodIntStream implements IntStream {
+        final IntStream s;
+
+        public DefaultMethodIntStream(IntStream s) {
+            this.s = s;
+        }
+
+
+        // Delegating non-default methods
+
+        @Override
+        public IntStream filter(IntPredicate predicate) {
+            return s.filter(predicate);
+        }
+
+        @Override
+        public IntStream map(IntUnaryOperator mapper) {
+            return s.map(mapper);
+        }
+
+        @Override
+        public <U> Stream<U> mapToObj(IntFunction<? extends U> mapper) {
+            return s.mapToObj(mapper);
+        }
+
+        @Override
+        public LongStream mapToLong(IntToLongFunction mapper) {
+            return s.mapToLong(mapper);
+        }
+
+        @Override
+        public DoubleStream mapToDouble(IntToDoubleFunction mapper) {
+            return s.mapToDouble(mapper);
+        }
+
+        @Override
+        public IntStream flatMap(IntFunction<? extends IntStream> mapper) {
+            return s.flatMap(mapper);
+        }
+
+        @Override
+        public IntStream distinct() {
+            return s.distinct();
+        }
+
+        @Override
+        public IntStream sorted() {
+            return s.sorted();
+        }
+
+        @Override
+        public IntStream peek(IntConsumer action) {
+            return s.peek(action);
+        }
+
+        @Override
+        public IntStream limit(long maxSize) {
+            return s.limit(maxSize);
+        }
+
+        @Override
+        public IntStream skip(long n) {
+            return s.skip(n);
+        }
+
+        @Override
+        public void forEach(IntConsumer action) {
+            s.forEach(action);
+        }
+
+        @Override
+        public void forEachOrdered(IntConsumer action) {
+            s.forEachOrdered(action);
+        }
+
+        @Override
+        public int[] toArray() {
+            return s.toArray();
+        }
+
+        @Override
+        public int reduce(int identity, IntBinaryOperator op) {
+            return s.reduce(identity, op);
+        }
+
+        @Override
+        public OptionalInt reduce(IntBinaryOperator op) {
+            return s.reduce(op);
+        }
+
+        @Override
+        public <R> R collect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R, R> combiner) {
+            return s.collect(supplier, accumulator, combiner);
+        }
+
+        @Override
+        public int sum() {
+            return s.sum();
+        }
+
+        @Override
+        public OptionalInt min() {
+            return s.min();
+        }
+
+        @Override
+        public OptionalInt max() {
+            return s.max();
+        }
+
+        @Override
+        public long count() {
+            return s.count();
+        }
+
+        @Override
+        public OptionalDouble average() {
+            return s.average();
+        }
+
+        @Override
+        public IntSummaryStatistics summaryStatistics() {
+            return s.summaryStatistics();
+        }
+
+        @Override
+        public boolean anyMatch(IntPredicate predicate) {
+            return s.anyMatch(predicate);
+        }
+
+        @Override
+        public boolean allMatch(IntPredicate predicate) {
+            return s.allMatch(predicate);
+        }
+
+        @Override
+        public boolean noneMatch(IntPredicate predicate) {
+            return s.noneMatch(predicate);
+        }
+
+        @Override
+        public OptionalInt findFirst() {
+            return s.findFirst();
+        }
+
+        @Override
+        public OptionalInt findAny() {
+            return s.findAny();
+        }
+
+        @Override
+        public LongStream asLongStream() {
+            return s.asLongStream();
+        }
+
+        @Override
+        public DoubleStream asDoubleStream() {
+            return s.asDoubleStream();
+        }
+
+        @Override
+        public Stream<Integer> boxed() {
+            return s.boxed();
+        }
+
+        @Override
+        public IntStream sequential() {
+            return s.sequential();
+        }
+
+        @Override
+        public IntStream parallel() {
+            return s.parallel();
+        }
+
+        @Override
+        public PrimitiveIterator.OfInt iterator() {
+            return s.iterator();
+        }
+
+        @Override
+        public Spliterator.OfInt spliterator() {
+            return s.spliterator();
+        }
+
+        @Override
+        public boolean isParallel() {
+            return s.isParallel();
+        }
+
+        @Override
+        public IntStream unordered() {
+            return s.unordered();
+        }
+
+        @Override
+        public IntStream onClose(Runnable closeHandler) {
+            return s.onClose(closeHandler);
+        }
+
+        @Override
+        public void close() {
+            s.close();
+        }
+    }
+
+    static final class DefaultMethodLongStream implements LongStream {
+        final LongStream s;
+
+        public DefaultMethodLongStream(LongStream s) {
+            this.s = s;
+        }
+
+
+        // Delegating non-default methods
+
+        @Override
+        public void forEach(LongConsumer action) {
+            s.forEach(action);
+        }
+
+        @Override
+        public LongStream filter(LongPredicate predicate) {
+            return s.filter(predicate);
+        }
+
+        @Override
+        public LongStream map(LongUnaryOperator mapper) {
+            return s.map(mapper);
+        }
+
+        @Override
+        public <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) {
+            return s.mapToObj(mapper);
+        }
+
+        @Override
+        public IntStream mapToInt(LongToIntFunction mapper) {
+            return s.mapToInt(mapper);
+        }
+
+        @Override
+        public DoubleStream mapToDouble(LongToDoubleFunction mapper) {
+            return s.mapToDouble(mapper);
+        }
+
+        @Override
+        public LongStream flatMap(LongFunction<? extends LongStream> mapper) {
+            return s.flatMap(mapper);
+        }
+
+        @Override
+        public LongStream distinct() {
+            return s.distinct();
+        }
+
+        @Override
+        public LongStream sorted() {
+            return s.sorted();
+        }
+
+        @Override
+        public LongStream peek(LongConsumer action) {
+            return s.peek(action);
+        }
+
+        @Override
+        public LongStream limit(long maxSize) {
+            return s.limit(maxSize);
+        }
+
+        @Override
+        public LongStream skip(long n) {
+            return s.skip(n);
+        }
+
+        @Override
+        public void forEachOrdered(LongConsumer action) {
+            s.forEachOrdered(action);
+        }
+
+        @Override
+        public long[] toArray() {
+            return s.toArray();
+        }
+
+        @Override
+        public long reduce(long identity, LongBinaryOperator op) {
+            return s.reduce(identity, op);
+        }
+
+        @Override
+        public OptionalLong reduce(LongBinaryOperator op) {
+            return s.reduce(op);
+        }
+
+        @Override
+        public <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R, R> combiner) {
+            return s.collect(supplier, accumulator, combiner);
+        }
+
+        @Override
+        public long sum() {
+            return s.sum();
+        }
+
+        @Override
+        public OptionalLong min() {
+            return s.min();
+        }
+
+        @Override
+        public OptionalLong max() {
+            return s.max();
+        }
+
+        @Override
+        public long count() {
+            return s.count();
+        }
+
+        @Override
+        public OptionalDouble average() {
+            return s.average();
+        }
+
+        @Override
+        public LongSummaryStatistics summaryStatistics() {
+            return s.summaryStatistics();
+        }
+
+        @Override
+        public boolean anyMatch(LongPredicate predicate) {
+            return s.anyMatch(predicate);
+        }
+
+        @Override
+        public boolean allMatch(LongPredicate predicate) {
+            return s.allMatch(predicate);
+        }
+
+        @Override
+        public boolean noneMatch(LongPredicate predicate) {
+            return s.noneMatch(predicate);
+        }
+
+        @Override
+        public OptionalLong findFirst() {
+            return s.findFirst();
+        }
+
+        @Override
+        public OptionalLong findAny() {
+            return s.findAny();
+        }
+
+        @Override
+        public DoubleStream asDoubleStream() {
+            return s.asDoubleStream();
+        }
+
+        @Override
+        public Stream<Long> boxed() {
+            return s.boxed();
+        }
+
+        @Override
+        public LongStream sequential() {
+            return s.sequential();
+        }
+
+        @Override
+        public LongStream parallel() {
+            return s.parallel();
+        }
+
+        @Override
+        public PrimitiveIterator.OfLong iterator() {
+            return s.iterator();
+        }
+
+        @Override
+        public Spliterator.OfLong spliterator() {
+            return s.spliterator();
+        }
+
+        @Override
+        public boolean isParallel() {
+            return s.isParallel();
+        }
+
+        @Override
+        public LongStream unordered() {
+            return s.unordered();
+        }
+
+        @Override
+        public LongStream onClose(Runnable closeHandler) {
+            return s.onClose(closeHandler);
+        }
+
+        @Override
+        public void close() {
+            s.close();
+        }
+    }
+
+    static final class DefaultMethodDoubleStream implements DoubleStream {
+        final DoubleStream s;
+
+        public DefaultMethodDoubleStream(DoubleStream s) {
+            this.s = s;
+        }
+
+        @Override
+        public DoubleStream filter(DoublePredicate predicate) {
+            return s.filter(predicate);
+        }
+
+        @Override
+        public DoubleStream map(DoubleUnaryOperator mapper) {
+            return s.map(mapper);
+        }
+
+        @Override
+        public <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper) {
+            return s.mapToObj(mapper);
+        }
+
+        @Override
+        public IntStream mapToInt(DoubleToIntFunction mapper) {
+            return s.mapToInt(mapper);
+        }
+
+        @Override
+        public LongStream mapToLong(DoubleToLongFunction mapper) {
+            return s.mapToLong(mapper);
+        }
+
+        @Override
+        public DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) {
+            return s.flatMap(mapper);
+        }
+
+        @Override
+        public DoubleStream distinct() {
+            return s.distinct();
+        }
+
+        @Override
+        public DoubleStream sorted() {
+            return s.sorted();
+        }
+
+        @Override
+        public DoubleStream peek(DoubleConsumer action) {
+            return s.peek(action);
+        }
+
+        @Override
+        public DoubleStream limit(long maxSize) {
+            return s.limit(maxSize);
+        }
+
+        @Override
+        public DoubleStream skip(long n) {
+            return s.skip(n);
+        }
+
+        @Override
+        public void forEach(DoubleConsumer action) {
+            s.forEach(action);
+        }
+
+        @Override
+        public void forEachOrdered(DoubleConsumer action) {
+            s.forEachOrdered(action);
+        }
+
+        @Override
+        public double[] toArray() {
+            return s.toArray();
+        }
+
+        @Override
+        public double reduce(double identity, DoubleBinaryOperator op) {
+            return s.reduce(identity, op);
+        }
+
+        @Override
+        public OptionalDouble reduce(DoubleBinaryOperator op) {
+            return s.reduce(op);
+        }
+
+        @Override
+        public <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R, R> combiner) {
+            return s.collect(supplier, accumulator, combiner);
+        }
+
+        @Override
+        public double sum() {
+            return s.sum();
+        }
+
+        @Override
+        public OptionalDouble min() {
+            return s.min();
+        }
+
+        @Override
+        public OptionalDouble max() {
+            return s.max();
+        }
+
+        @Override
+        public long count() {
+            return s.count();
+        }
+
+        @Override
+        public OptionalDouble average() {
+            return s.average();
+        }
+
+        @Override
+        public DoubleSummaryStatistics summaryStatistics() {
+            return s.summaryStatistics();
+        }
+
+        @Override
+        public boolean anyMatch(DoublePredicate predicate) {
+            return s.anyMatch(predicate);
+        }
+
+        @Override
+        public boolean allMatch(DoublePredicate predicate) {
+            return s.allMatch(predicate);
+        }
+
+        @Override
+        public boolean noneMatch(DoublePredicate predicate) {
+            return s.noneMatch(predicate);
+        }
+
+        @Override
+        public OptionalDouble findFirst() {
+            return s.findFirst();
+        }
+
+        @Override
+        public OptionalDouble findAny() {
+            return s.findAny();
+        }
+
+        @Override
+        public Stream<Double> boxed() {
+            return s.boxed();
+        }
+
+        @Override
+        public DoubleStream sequential() {
+            return s.sequential();
+        }
+
+        @Override
+        public DoubleStream parallel() {
+            return s.parallel();
+        }
+
+        @Override
+        public PrimitiveIterator.OfDouble iterator() {
+            return s.iterator();
+        }
+
+        @Override
+        public Spliterator.OfDouble spliterator() {
+            return s.spliterator();
+        }
+
+        @Override
+        public boolean isParallel() {
+            return s.isParallel();
+        }
+
+        @Override
+        public DoubleStream unordered() {
+            return s.unordered();
+        }
+
+        @Override
+        public DoubleStream onClose(Runnable closeHandler) {
+            return s.onClose(closeHandler);
+        }
+
+        @Override
+        public void close() {
+            s.close();
+        }
+    }
+}
\ No newline at end of file
--- a/test/java/util/stream/bootlib/java/util/stream/StreamTestDataProvider.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/java/util/stream/bootlib/java/util/stream/StreamTestDataProvider.java	Wed Jul 15 10:00:15 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
@@ -119,7 +119,7 @@
 
         // Simple combination of numbers and null values, probably excessive but may catch
         // errors for initialization/termination/sequence
-        // @@@ This is separate from the other data for now until nulls are consitently supported by
+        // @@@ This is separate from the other data for now until nulls are consistently supported by
         // all operations
         {
             List<Object[]> list = new ArrayList<>();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,304 @@
+/*
+ * 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.
+ */
+package org.openjdk.tests.java.util.stream;
+
+import org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BooleanSupplier;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import java.util.stream.DefaultMethodStreams;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.OpTestCase;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toCollection;
+
+/*
+ * @test
+ * @bug 8071597
+ */
+@Test
+public class WhileOpStatefulTest extends OpTestCase {
+    static final long COUNT_PERIOD = 100;
+
+    static final long EXECUTION_TIME_LIMIT = TimeUnit.SECONDS.toMillis(10);
+
+    static final long TAKE_WHILE_COUNT_LIMIT = 100_000;
+
+    static final int DROP_SOURCE_SIZE = 10_000;
+
+    static final long DROP_WHILE_COUNT_LIMIT = 5000;
+
+    @Test
+    public void testTimedTakeWithCount() {
+        testTakeWhileMulti(
+                s -> {
+                    BooleanSupplier isWithinTakePeriod =
+                            within(System.currentTimeMillis(), COUNT_PERIOD);
+                    s.takeWhile(e -> isWithinTakePeriod.getAsBoolean())
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                },
+                s -> {
+                    BooleanSupplier isWithinTakePeriod =
+                            within(System.currentTimeMillis(), COUNT_PERIOD);
+                    s.takeWhile(e -> isWithinTakePeriod.getAsBoolean())
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                },
+                s -> {
+                    BooleanSupplier isWithinTakePeriod =
+                            within(System.currentTimeMillis(), COUNT_PERIOD);
+                    s.takeWhile(e -> isWithinTakePeriod.getAsBoolean())
+                            .map(e -> 1).reduce(0, Long::sum);
+                },
+                s -> {
+                    BooleanSupplier isWithinTakePeriod =
+                            within(System.currentTimeMillis(), COUNT_PERIOD);
+                    s.takeWhile(e -> isWithinTakePeriod.getAsBoolean())
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                });
+    }
+
+    @Test
+    public void testCountTakeWithCount() {
+        testTakeWhileMulti(
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(rc <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(rc <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .map(e -> 1).reduce(0, Long::sum);
+                    assertTrue(rc <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(rc <= c.get());
+                });
+    }
+
+    @Test
+    public void testCountTakeWithToArray() {
+        testTakeWhileMulti(
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    Object[] ra = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(ra.length <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    int[] ra = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(ra.length <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long[] ra = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(ra.length <= c.get());
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    double[] ra = s.takeWhile(e -> c.getAndIncrement() < TAKE_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(ra.length <= c.get());
+                });
+    }
+
+
+    @Test
+    public void testCountDropWithCount() {
+        testDropWhileMulti(
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(rc <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(rc <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .map(e -> 1).reduce(0, Long::sum);
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(rc <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long rc = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .mapToLong(e -> 1).reduce(0, Long::sum);
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(rc <= DROP_SOURCE_SIZE);
+                });
+    }
+
+    @Test
+    public void testCountDropWithToArray() {
+        testDropWhileMulti(
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    Object[] ra = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(ra.length <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    int[] ra = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(ra.length <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    long[] ra = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(ra.length <= DROP_SOURCE_SIZE);
+                },
+                s -> {
+                    AtomicLong c = new AtomicLong();
+                    double[] ra = s.dropWhile(e -> c.getAndIncrement() < DROP_WHILE_COUNT_LIMIT)
+                            .toArray();
+                    assertTrue(c.get() >= DROP_WHILE_COUNT_LIMIT);
+                    assertTrue(ra.length <= DROP_SOURCE_SIZE);
+                });
+    }
+
+
+    private void testTakeWhileMulti(Consumer<Stream<Integer>> mRef,
+                                    Consumer<IntStream> mInt,
+                                    Consumer<LongStream> mLong,
+                                    Consumer<DoubleStream> mDouble) {
+        Map<String, Supplier<Stream<Integer>>> sources = new HashMap<>();
+        sources.put("Stream.generate()", () -> Stream.generate(() -> 1));
+        sources.put("Stream.iterate()", () -> Stream.iterate(1, x -> 1));
+        sources.put("Stream.iterate().unordered()", () -> Stream.iterate(1, x -> 1));
+        testWhileMulti(sources, mRef, mInt, mLong, mDouble);
+    }
+
+    private void testDropWhileMulti(Consumer<Stream<Integer>> mRef,
+                                    Consumer<IntStream> mInt,
+                                    Consumer<LongStream> mLong,
+                                    Consumer<DoubleStream> mDouble) {
+        Map<String, Supplier<Stream<Integer>>> sources = new HashMap<>();
+        sources.put("IntStream.range().boxed()",
+                    () -> IntStream.range(0, DROP_SOURCE_SIZE).boxed());
+        sources.put("IntStream.range().boxed().unordered()",
+                    () -> IntStream.range(0, DROP_SOURCE_SIZE).boxed().unordered());
+        sources.put("LinkedList.stream()",
+                    () -> IntStream.range(0, DROP_SOURCE_SIZE).boxed()
+                            .collect(toCollection(LinkedList::new))
+                            .stream());
+        sources.put("LinkedList.stream().unordered()",
+                    () -> IntStream.range(0, DROP_SOURCE_SIZE).boxed()
+                            .collect(toCollection(LinkedList::new))
+                            .stream()
+                            .unordered());
+        testWhileMulti(sources, mRef, mInt, mLong, mDouble);
+    }
+
+    private void testWhileMulti(Map<String, Supplier<Stream<Integer>>> sources,
+                                Consumer<Stream<Integer>> mRef,
+                                Consumer<IntStream> mInt,
+                                Consumer<LongStream> mLong,
+                                Consumer<DoubleStream> mDouble) {
+        Map<String, Function<Stream<Integer>, Stream<Integer>>> transforms = new HashMap<>();
+        transforms.put("Stream.sequential()", s -> {
+            BooleanSupplier isWithinExecutionPeriod = within(System.currentTimeMillis(),
+                                                             EXECUTION_TIME_LIMIT);
+            return s.peek(e -> {
+                if (!isWithinExecutionPeriod.getAsBoolean()) {
+                    throw new RuntimeException();
+                }
+            });
+        });
+        transforms.put("Stream.parallel()", s -> {
+            BooleanSupplier isWithinExecutionPeriod = within(System.currentTimeMillis(),
+                                                             EXECUTION_TIME_LIMIT);
+            return s.parallel()
+                    .peek(e -> {
+                        if (!isWithinExecutionPeriod.getAsBoolean()) {
+                            throw new RuntimeException();
+                        }
+                    });
+        });
+
+        Map<String, Consumer<Stream<Integer>>> actions = new HashMap<>();
+        actions.put("Ref", mRef);
+        actions.put("Int", s -> mInt.accept(s.mapToInt(e -> e)));
+        actions.put("Long", s -> mLong.accept(s.mapToLong(e -> e)));
+        actions.put("Double", s -> mDouble.accept(s.mapToDouble(e -> e)));
+        actions.put("Ref using defaults", s -> mRef.accept(DefaultMethodStreams.delegateTo(s)));
+        actions.put("Int using defaults", s -> mInt.accept(DefaultMethodStreams.delegateTo(s.mapToInt(e -> e))));
+        actions.put("Long using defaults", s -> mLong.accept(DefaultMethodStreams.delegateTo(s.mapToLong(e -> e))));
+        actions.put("Double using defaults", s -> mDouble.accept(DefaultMethodStreams.delegateTo(s.mapToDouble(e -> e))));
+
+        for (Map.Entry<String, Supplier<Stream<Integer>>> s : sources.entrySet()) {
+            setContext("source", s.getKey());
+
+            for (Map.Entry<String, Function<Stream<Integer>, Stream<Integer>>> t : transforms.entrySet()) {
+                setContext("transform", t.getKey());
+
+                for (Map.Entry<String, Consumer<Stream<Integer>>> a : actions.entrySet()) {
+                    setContext("shape", a.getKey());
+
+                    Stream<Integer> stream = s.getValue().get();
+                    stream = t.getValue().apply(stream);
+                    a.getValue().accept(stream);
+                }
+            }
+        }
+    }
+
+    static BooleanSupplier within(long start, long durationInMillis) {
+        return () -> (System.currentTimeMillis() - start) < durationInMillis;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,361 @@
+/*
+ * 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.
+ */
+package org.openjdk.tests.java.util.stream;
+
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.DefaultMethodStreams;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LambdaTestHelpers;
+import java.util.stream.LongStream;
+import java.util.stream.OpTestCase;
+import java.util.stream.Stream;
+import java.util.stream.StreamTestDataProvider;
+import java.util.stream.TestData;
+
+/*
+ * @test
+ * @bug 8071597
+ */
+@Test
+public class WhileOpTest extends OpTestCase {
+
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testTakeWhileOps(String name, TestData.OfRef<Integer> data) {
+        for (int size : sizes(data.size())) {
+            setContext("takeWhile", size);
+
+            testWhileMulti(data,
+                           whileResultAsserter(data, WhileOp.Take, e -> e < size),
+                           s -> s.takeWhile(e -> e < size),
+                           s -> s.takeWhile(e -> e < size),
+                           s -> s.takeWhile(e -> e < size),
+                           s -> s.takeWhile(e -> e < size));
+
+
+            testWhileMulti(data,
+                           whileResultAsserter(data, WhileOp.Take, e -> e < size / 2),
+                           s -> s.takeWhile(e -> e < size).takeWhile(e -> e < size / 2),
+                           s -> s.takeWhile(e -> e < size).takeWhile(e -> e < size / 2),
+                           s -> s.takeWhile(e -> e < size).takeWhile(e -> e < size / 2),
+                           s -> s.takeWhile(e -> e < size).takeWhile(e -> e < size / 2));
+        }
+    }
+
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testDropWhileOps(String name, TestData.OfRef<Integer> data) {
+        for (int size : sizes(data.size())) {
+            setContext("dropWhile", size);
+
+            testWhileMulti(data,
+                           whileResultAsserter(data, WhileOp.Drop, e -> e < size),
+                           s -> s.dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size));
+
+            testWhileMulti(data,
+                           whileResultAsserter(data, WhileOp.Drop, e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).dropWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).dropWhile(e -> e < size));
+        }
+    }
+
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testDropTakeWhileOps(String name, TestData.OfRef<Integer> data) {
+        for (int size : sizes(data.size())) {
+            setContext("dropWhile", size);
+
+            testWhileMulti(data,
+                           whileResultAsserter(data, WhileOp.Undefined, null),
+                           s -> s.dropWhile(e -> e < size / 2).takeWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).takeWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).takeWhile(e -> e < size),
+                           s -> s.dropWhile(e -> e < size / 2).takeWhile(e -> e < size));
+        }
+    }
+
+    /**
+     * While operation type to be asserted on
+     */
+    enum WhileOp {
+        /**
+         * The takeWhile operation
+         */
+        Take,
+        /**
+         * The dropWhile operation
+         */
+        Drop,
+        /**
+         * The operation(s) are undefined
+         */
+        Undefined
+    }
+
+    /**
+     * Create a result asserter for takeWhile or dropWhile operations.
+     * <p>
+     * If the stream pipeline consists of the takeWhile operation
+     * ({@link WhileOp#Take}) or the dropWhile operation ({@link WhileOp#Drop})
+     * then specific assertions can be made on the actual result based on the
+     * input elements, {@code inputData}, and whether those elements match the
+     * predicate, {@code p}, of the operation.
+     * <p>
+     * If the input elements have an encounter order then the actual result
+     * is asserted against the result of operating sequentially on input
+     * elements given the predicate and in accordance with the operation
+     * semantics. (The actual result whether produced sequentially or in
+     * parallel should the same.)
+     * <p>
+     * If the input elements have no encounter order then an actual result
+     * is, for practical purposes, considered non-deterministic.
+     * Consider an input list of lists that contains all possible permutations
+     * of the input elements, and a output list of lists that is the result of
+     * applying the pipeline with the operation sequentially to each input
+     * list.
+     * Any list in the output lists is a valid result. It's not practical to
+     * test in such a manner.
+     * For a takeWhile operation the following assertions can be made if
+     * only some of the input elements match the predicate (i.e. taking will
+     * short-circuit the pipeline):
+     * <ol>
+     * <li>The set of output elements is a subset of the set of matching
+     * input elements</li>
+     * <li>The set of output elements and the set of non-matching input
+     * element are disjoint</li>
+     * </ol>
+     * For a dropWhile operation the following assertions can be made:
+     * <ol>
+     * <li>The set of non-matching input elements is a subset of the set of
+     * output elements</li>
+     * <li>The set of matching output elements is a subset of the set of
+     * matching input elements</li>
+     * </ol>
+     *
+     * @param inputData the elements input into the stream pipeline
+     * @param op the operation of the stream pipeline, one of takeWhile,
+     * dropWhile, or an undefined set of operations (possibly including
+     * two or more takeWhile and/or dropWhile operations, or because
+     * the predicate is not stateless).
+     * @param p the stateless predicate applied to the operation, ignored if
+     * the
+     * operation is {@link WhileOp#Undefined}.
+     * @param <T> the type of elements
+     * @return a result asserter
+     */
+    private <T> ResultAsserter<Iterable<T>> whileResultAsserter(Iterable<T> inputData,
+                                                                WhileOp op,
+                                                                Predicate<? super T> p) {
+        return (act, exp, ord, par) -> {
+            if (par & !ord) {
+                List<T> input = new ArrayList<>();
+                inputData.forEach(input::add);
+
+                List<T> output = new ArrayList<>();
+                act.forEach(output::add);
+
+                if (op == WhileOp.Take) {
+                    List<T> matchingInput = new ArrayList<>();
+                    List<T> nonMatchingInput = new ArrayList<>();
+                    input.forEach(t -> {
+                        if (p.test(t))
+                            matchingInput.add(t);
+                        else
+                            nonMatchingInput.add(t);
+                    });
+
+                    // If some, not all, elements are taken
+                    if (matchingInput.size() < input.size()) {
+                        assertTrue(output.size() <= matchingInput.size(),
+                                   "Output is larger than the matching input");
+
+                        // The output must be a subset of the matching input
+                        assertTrue(matchingInput.containsAll(output),
+                                   "Output is not a subset of the matching input");
+
+                        // The output must not contain any non matching elements
+                        for (T nonMatching : nonMatchingInput) {
+                            assertFalse(output.contains(nonMatching),
+                                        "Output and non-matching input are not disjoint");
+                        }
+                    }
+                }
+                else if (op == WhileOp.Drop) {
+                    List<T> matchingInput = new ArrayList<>();
+                    List<T> nonMatchingInput = new ArrayList<>();
+                    input.forEach(t -> {
+                        if (p.test(t))
+                            matchingInput.add(t);
+                        else
+                            nonMatchingInput.add(t);
+                    });
+
+                    // The non matching input must be a subset of output
+                    assertTrue(output.containsAll(nonMatchingInput),
+                               "Non-matching input is not a subset of the output");
+
+                    // The matching output must be a subset of the matching input
+                    List<T> matchingOutput = new ArrayList<>();
+                    output.forEach(i -> {
+                        if (p.test(i))
+                            matchingOutput.add(i);
+                    });
+                    assertTrue(matchingInput.containsAll(matchingOutput),
+                               "Matching output is not a subset of matching input");
+                }
+
+                // Note: if there is a combination of takeWhile and dropWhile then specific
+                // assertions cannot be performed.
+                // All that can be reliably asserted is the output is a subset of the input
+
+                assertTrue(input.containsAll(output));
+            }
+            else {
+                // For specific operations derive expected result from the input
+                if (op == WhileOp.Take) {
+                    List<T> takeInput = new ArrayList<>();
+                    for (T t : inputData) {
+                        if (p.test(t))
+                            takeInput.add(t);
+                        else
+                            break;
+                    }
+
+                    LambdaTestHelpers.assertContents(act, takeInput);
+                }
+                else if (op == WhileOp.Drop) {
+                    List<T> dropInput = new ArrayList<>();
+                    for (T t : inputData) {
+                        if (dropInput.size() > 0 || !p.test(t))
+                            dropInput.add(t);
+                    }
+
+                    LambdaTestHelpers.assertContents(act, dropInput);
+                }
+
+                LambdaTestHelpers.assertContents(act, exp);
+            }
+        };
+    }
+
+    private Collection<Integer> sizes(int s) {
+        Set<Integer> sizes = new LinkedHashSet<>();
+
+        sizes.add(0);
+        sizes.add(1);
+        sizes.add(s / 4);
+        sizes.add(s / 2);
+        sizes.add(3 * s / 4);
+        sizes.add(Math.max(0, s - 1));
+        sizes.add(s);
+        sizes.add(Integer.MAX_VALUE);
+
+        return sizes;
+    }
+
+    private void testWhileMulti(TestData.OfRef<Integer> data,
+                                ResultAsserter<Iterable<Integer>> ra,
+                                Function<Stream<Integer>, Stream<Integer>> mRef,
+                                Function<IntStream, IntStream> mInt,
+                                Function<LongStream, LongStream> mLong,
+                                Function<DoubleStream, DoubleStream> mDouble) {
+        Map<String, Function<Stream<Integer>, Stream<Integer>>> ms = new HashMap<>();
+        ms.put("Ref", mRef);
+        ms.put("Int", s -> mInt.apply(s.mapToInt(e -> e)).mapToObj(e -> e));
+        ms.put("Long", s -> mLong.apply(s.mapToLong(e -> e)).mapToObj(e -> (int) e));
+        ms.put("Double", s -> mDouble.apply(s.mapToDouble(e -> e)).mapToObj(e -> (int) e));
+        ms.put("Ref using defaults", s -> mRef.apply(DefaultMethodStreams.delegateTo(s)));
+        ms.put("Int using defaults", s -> mInt.apply(DefaultMethodStreams.delegateTo(s.mapToInt(e -> e))).mapToObj(e -> e));
+        ms.put("Long using defaults", s -> mLong.apply(DefaultMethodStreams.delegateTo(s.mapToLong(e -> e))).mapToObj(e -> (int) e));
+        ms.put("Double using defaults", s -> mDouble.apply(DefaultMethodStreams.delegateTo(s.mapToDouble(e -> e))).mapToObj(e -> (int) e));
+
+        testWhileMulti(data, ra, ms);
+    }
+
+    private final void testWhileMulti(TestData.OfRef<Integer> data,
+                                      ResultAsserter<Iterable<Integer>> ra,
+                                      Map<String, Function<Stream<Integer>, Stream<Integer>>> ms) {
+        for (Map.Entry<String, Function<Stream<Integer>, Stream<Integer>>> e : ms.entrySet()) {
+            setContext("shape", e.getKey());
+
+            withData(data)
+                    .stream(e.getValue())
+                    .resultAsserter(ra)
+                    .exercise();
+        }
+    }
+
+    @Test
+    public void testRefDefaultClose() {
+        AtomicBoolean isClosed = new AtomicBoolean();
+        Stream<Integer> s = Stream.of(1, 2, 3).onClose(() -> isClosed.set(true));
+        try (Stream<Integer> ds = DefaultMethodStreams.delegateTo(s).takeWhile(e -> e < 3)) {
+            ds.count();
+        }
+        assertTrue(isClosed.get());
+    }
+
+    @Test
+    public void testIntDefaultClose() {
+        AtomicBoolean isClosed = new AtomicBoolean();
+        IntStream s = IntStream.of(1, 2, 3).onClose(() -> isClosed.set(true));
+        try (IntStream ds = DefaultMethodStreams.delegateTo(s).takeWhile(e -> e < 3)) {
+            ds.count();
+        }
+        assertTrue(isClosed.get());
+    }
+
+    @Test
+    public void testLongDefaultClose() {
+        AtomicBoolean isClosed = new AtomicBoolean();
+        LongStream s = LongStream.of(1, 2, 3).onClose(() -> isClosed.set(true));
+        try (LongStream ds = DefaultMethodStreams.delegateTo(s).takeWhile(e -> e < 3)) {
+            ds.count();
+        }
+        assertTrue(isClosed.get());
+    }
+
+    @Test
+    public void testDoubleDefaultClose() {
+        AtomicBoolean isClosed = new AtomicBoolean();
+        DoubleStream s = DoubleStream.of(1, 2, 3).onClose(() -> isClosed.set(true));
+        try (DoubleStream ds = DefaultMethodStreams.delegateTo(s).takeWhile(e -> e < 3)) {
+            ds.count();
+        }
+        assertTrue(isClosed.get());
+    }
+}
--- a/test/javax/net/ssl/DTLS/DTLSOverDatagram.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/javax/net/ssl/DTLS/DTLSOverDatagram.java	Wed Jul 15 10:00:15 2015 -0700
@@ -46,8 +46,8 @@
  * An example to show the way to use SSLEngine in datagram connections.
  */
 public class DTLSOverDatagram {
-    private static int MAX_HANDSHAKE_LOOPS = 60;
-    private static int MAX_APP_READ_LOOPS = 10;
+    private static int MAX_HANDSHAKE_LOOPS = 200;
+    private static int MAX_APP_READ_LOOPS = 60;
 
     /*
      * The following is to set up the keystores.
--- a/test/sun/security/krb5/auto/BadKdc1.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/sun/security/krb5/auto/BadKdc1.java	Wed Jul 15 10:00:15 2015 -0700
@@ -53,7 +53,7 @@
                // k3 off k2 on
                "(122212(22){1,2}|1222323232-)", // 1
                // k1 on
-               "(12(12){1,2}|122232-)"  // empty
+               "(12(12){1,2}|122212|122232-)"  // empty
        );
    }
 }
--- a/test/sun/security/krb5/auto/KDC.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/sun/security/krb5/auto/KDC.java	Wed Jul 15 10:00:15 2015 -0700
@@ -811,7 +811,7 @@
                     new TransitedEncoding(1, new byte[0]),  // TODO
                     new KerberosTime(new Date()),
                     body.from,
-                    till, body.rtime,
+                    till, etp.renewTill,
                     body.addresses != null ? body.addresses
                             : etp.caddr,
                     null);
@@ -834,7 +834,7 @@
                     tFlags,
                     new KerberosTime(new Date()),
                     body.from,
-                    till, body.rtime,
+                    till, etp.renewTill,
                     service,
                     body.addresses
                     );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/krb5/auto/Renew.java	Wed Jul 15 10:00:15 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * 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 8058290
+ * @summary JAAS Krb5LoginModule has suspect ticket-renewal logic,
+ *          relies on clockskew grace
+ * @modules java.base/sun.net.spi.nameservice
+ *          java.base/sun.security.util
+ *          java.security.jgss/sun.security.krb5
+ *          java.security.jgss/sun.security.krb5.internal
+ *          java.security.jgss/sun.security.krb5.internal.ccache
+ *          java.security.jgss/sun.security.krb5.internal.crypto
+ *          java.security.jgss/sun.security.krb5.internal.ktab
+ * @compile -XDignore.symbol.file Renew.java
+ * @run main/othervm Renew 1
+ * @run main/othervm Renew 2
+ * @run main/othervm Renew 3
+ */
+
+import sun.security.krb5.Config;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Date;
+import javax.security.auth.kerberos.KerberosTicket;
+
+public class Renew {
+
+    public static void main(String[] args) throws Exception {
+
+        // Three test cases:
+        // 1. renewTGT=false
+        // 2. renewTGT=true with a short life time, renew will happen
+        // 3. renewTGT=true with a long life time, renew won't happen
+        int test = Integer.parseInt(args[0]);
+
+        OneKDC k = new OneKDC(null);
+        KDC.saveConfig(OneKDC.KRB5_CONF, k,
+                "renew_lifetime = 1d",
+                "ticket_lifetime = " + (test == 2? "10s": "8h"));
+        Config.refresh();
+        k.writeJAASConf();
+
+        // KDC would save ccache in a file
+        System.setProperty("test.kdc.save.ccache", "cache.here");
+
+        Files.write(Paths.get(OneKDC.JAAS_CONF), Arrays.asList(
+                "first {",
+                "   com.sun.security.auth.module.Krb5LoginModule required;",
+                "};",
+                "second {",
+                "   com.sun.security.auth.module.Krb5LoginModule required",
+                "   doNotPrompt=true",
+                "   renewTGT=" + (test != 1),
+                "   useTicketCache=true",
+                "   ticketCache=cache.here;",
+                "};"
+        ));
+
+        Context c;
+
+        // The first login uses username and password
+        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        Date d1 = c.s().getPrivateCredentials(KerberosTicket.class).iterator().next().getAuthTime();
+
+        // 6s is longer than half of 10s
+        Thread.sleep(6000);
+
+        // The second login uses the cache
+        c = Context.fromJAAS("second");
+        Date d2 = c.s().getPrivateCredentials(KerberosTicket.class).iterator().next().getAuthTime();
+
+        if (test == 2) {
+            if (d1.equals(d2)) {
+                throw new Exception("Ticket not renewed");
+            }
+        } else {
+            if (!d1.equals(d2)) {
+                throw new Exception("Ticket renewed");
+            }
+        }
+    }
+}
--- a/test/sun/security/tools/jarsigner/TsacertOptionTest.java	Wed Jul 15 15:48:32 2015 +0300
+++ b/test/sun/security/tools/jarsigner/TsacertOptionTest.java	Wed Jul 15 10:00:15 2015 -0700
@@ -120,6 +120,9 @@
             // specify -tsadigestalg option because
             // TSA server uses SHA-1 digest algorithm
              OutputAnalyzer analyzer = ProcessTools.executeCommand(JARSIGNER,
+                    "-J-Dhttp.proxyHost=",
+                    "-J-Dhttp.proxyPort=",
+                    "-J-Djava.net.useSystemProxies=",
                     "-verbose",
                     "-keystore", KEYSTORE,
                     "-storepass", PASSWORD,