changeset 17786:f2a6d80dd60e

Merge
author prr
date Thu, 20 Jul 2017 09:38:27 -0700
parents da56caf26b5c 5d71ff193033
children 134501ad7b2a
files
diffstat 28 files changed, 217 insertions(+), 115 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/io/ObjectStreamField.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/io/ObjectStreamField.java	Thu Jul 20 09:38:27 2017 -0700
@@ -45,16 +45,18 @@
 
     /** field name */
     private final String name;
-    /** canonical JVM signature of field type */
+    /** canonical JVM signature of field type, if given */
     private final String signature;
     /** field type (Object.class if unknown non-primitive type) */
     private final Class<?> type;
+    /** lazily constructed signature for the type, if no explicit signature */
+    private String typeSignature;
     /** whether or not to (de)serialize field values as unshared */
     private final boolean unshared;
     /** corresponding reflective field object, if any */
     private final Field field;
     /** offset of field value in enclosing field group */
-    private int offset = 0;
+    private int offset;
 
     /**
      * Create a Serializable field with the specified type.  This field should
@@ -91,8 +93,8 @@
         this.name = name;
         this.type = type;
         this.unshared = unshared;
-        signature = getClassSignature(type).intern();
-        field = null;
+        this.field = null;
+        this.signature = null;
     }
 
     /**
@@ -106,7 +108,7 @@
         this.name = name;
         this.signature = signature.intern();
         this.unshared = unshared;
-        field = null;
+        this.field = null;
 
         switch (signature.charAt(0)) {
             case 'Z': type = Boolean.TYPE; break;
@@ -242,7 +244,7 @@
      */
     // REMIND: deprecate?
     public char getTypeCode() {
-        return signature.charAt(0);
+        return getSignature().charAt(0);
     }
 
     /**
@@ -252,7 +254,7 @@
      */
     // REMIND: deprecate?
     public String getTypeString() {
-        return isPrimitive() ? null : signature;
+        return isPrimitive() ? null : getSignature();
     }
 
     /**
@@ -284,7 +286,7 @@
      */
     // REMIND: deprecate?
     public boolean isPrimitive() {
-        char tcode = signature.charAt(0);
+        char tcode = getTypeCode();
         return ((tcode != 'L') && (tcode != '['));
     }
 
@@ -320,7 +322,7 @@
      * Return a string that describes this field.
      */
     public String toString() {
-        return signature + ' ' + name;
+        return getSignature() + ' ' + name;
     }
 
     /**
@@ -336,6 +338,17 @@
      * that signature strings are returned for primitive fields as well).
      */
     String getSignature() {
-        return signature;
+        if (signature != null) {
+            return signature;
+        }
+
+        String sig = typeSignature;
+        // This lazy calculation is safe since signature can be null iff one
+        // of the public constructors are used, in which case type is always
+        // initialized to the exact type we want the signature to represent.
+        if (sig == null) {
+            typeSignature = sig = getClassSignature(type).intern();
+        }
+        return sig;
     }
 }
--- a/src/java.base/share/classes/java/lang/System.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/lang/System.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1960,10 +1960,6 @@
         setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
         setErr0(newPrintStream(fdErr, props.getProperty("sun.stderr.encoding")));
 
-        // Load the zip library now in order to keep java.util.zip.ZipFile
-        // from trying to use itself to load this library later.
-        loadLibrary("zip");
-
         // Setup Java signal handlers for HUP, TERM, and INT (where available).
         Terminator.setup();
 
--- a/src/java.base/share/classes/java/nio/charset/Charset.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java	Thu Jul 20 09:38:27 2017 -0700
@@ -25,6 +25,11 @@
 
 package java.nio.charset;
 
+import jdk.internal.misc.VM;
+import sun.nio.cs.StandardCharsets;
+import sun.nio.cs.ThreadLocalCoders;
+import sun.security.action.GetPropertyAction;
+
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.spi.CharsetProvider;
@@ -38,15 +43,11 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Objects;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
 import java.util.Set;
-import java.util.ServiceLoader;
-import java.util.ServiceConfigurationError;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import jdk.internal.misc.VM;
-import sun.nio.cs.StandardCharsets;
-import sun.nio.cs.ThreadLocalCoders;
-import sun.security.action.GetPropertyAction;
 
 
 /**
@@ -635,10 +636,19 @@
      *         If the canonical name or any of the aliases are illegal
      */
     protected Charset(String canonicalName, String[] aliases) {
-        checkName(canonicalName);
         String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
-        for (int i = 0; i < as.length; i++)
-            checkName(as[i]);
+
+        // Skip checks for the standard, built-in Charsets we always load
+        // during initialization.  Use of identity is intentional to be
+        // consistent with sun.nio.cs.StandardCharsets
+        if (canonicalName != StandardCharsets.ISO_8859_1
+                && canonicalName != StandardCharsets.US_ASCII
+                && canonicalName != StandardCharsets.UTF_8) {
+            checkName(canonicalName);
+            for (int i = 0; i < as.length; i++) {
+                checkName(as[i]);
+            }
+        }
         this.name = canonicalName;
         this.aliases = as;
     }
--- a/src/java.base/share/classes/java/util/zip/Adler32.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Adler32.java	Thu Jul 20 09:38:27 2017 -0700
@@ -136,4 +136,8 @@
     @HotSpotIntrinsicCandidate
     private static native int updateByteBuffer(int adler, long addr,
                                                int off, int len);
+
+    static {
+        ZipUtils.loadLibrary();
+    }
 }
--- a/src/java.base/share/classes/java/util/zip/CRC32.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/CRC32.java	Thu Jul 20 09:38:27 2017 -0700
@@ -172,4 +172,8 @@
             throw new NullPointerException();
         }
     }
+
+    static {
+        ZipUtils.loadLibrary();
+    }
 }
--- a/src/java.base/share/classes/java/util/zip/Deflater.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Deflater.java	Thu Jul 20 09:38:27 2017 -0700
@@ -154,7 +154,7 @@
     public static final int FULL_FLUSH = 3;
 
     static {
-        /* Zip library is loaded from System.initializeSystemClass */
+        ZipUtils.loadLibrary();
         initIDs();
     }
 
--- a/src/java.base/share/classes/java/util/zip/Inflater.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java	Thu Jul 20 09:38:27 2017 -0700
@@ -85,7 +85,7 @@
     private static final byte[] defaultBuf = new byte[0];
 
     static {
-        /* Zip library is loaded from System.initializeSystemClass */
+        ZipUtils.loadLibrary();
         initIDs();
     }
 
--- a/src/java.base/share/classes/java/util/zip/ZipUtils.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/ZipUtils.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package java.util.zip;
 
 import java.nio.file.attribute.FileTime;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -245,4 +247,17 @@
     // The END header is followed by a variable length comment of size < 64k.
     static final long END_MAXLEN = 0xFFFF + ENDHDR;
     static final int READBLOCKSZ = 128;
+
+    /**
+     * Loads zip native library, if not already laoded
+     */
+    static void loadLibrary() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            System.loadLibrary("zip");
+        } else {
+            PrivilegedAction<Void> pa = () -> { System.loadLibrary("zip"); return null; };
+            AccessController.doPrivileged(pa);
+        }
+    }
 }
--- a/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
 {
 
     public ISO_8859_1() {
-        super("ISO-8859-1", StandardCharsets.aliases_ISO_8859_1);
+        super(StandardCharsets.ISO_8859_1, StandardCharsets.aliases_ISO_8859_1);
     }
 
     public String historicalName() {
--- a/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -51,6 +51,12 @@
 
     private static final String packagePrefix = "sun.nio.cs";
 
+    public static final String US_ASCII = "US-ASCII";
+
+    public static final String ISO_8859_1 = "ISO-8859-1";
+
+    public static final String UTF_8 = "UTF-8";
+
     public StandardCharsets() {
         this.aliasMap = new Aliases();
         this.classMap = new Classes();
@@ -103,13 +109,13 @@
 
         // As all charset class names added to classMap are string literals we
         // can check identity here as an optimization
-        if (cln == "US_ASCII") {
+        if (cln == US_ASCII) {
             return cache(csn, new US_ASCII());
         }
-        if (cln == "ISO_8859_1") {
+        if (cln == ISO_8859_1) {
             return cache(csn, new ISO_8859_1());
         }
-        if (cln == "UTF_8") {
+        if (cln == UTF_8) {
             return cache(csn, new UTF_8());
         }
 
--- a/src/java.base/share/classes/sun/nio/cs/US_ASCII.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/sun/nio/cs/US_ASCII.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 {
 
     public US_ASCII() {
-        super("US-ASCII", StandardCharsets.aliases_US_ASCII);
+        super(StandardCharsets.US_ASCII, StandardCharsets.aliases_US_ASCII);
     }
 
     public String historicalName() {
--- a/src/java.base/share/classes/sun/nio/cs/UTF_8.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/sun/nio/cs/UTF_8.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
 class UTF_8 extends Unicode
 {
     public UTF_8() {
-        super("UTF-8", StandardCharsets.aliases_UTF_8);
+        super(StandardCharsets.UTF_8, StandardCharsets.aliases_UTF_8);
     }
 
     public String historicalName() {
--- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Thu Jul 20 09:38:27 2017 -0700
@@ -59,9 +59,15 @@
     /* Are we debugging ? */
     private static final Debug debug = Debug.getInstance("jar");
 
-    private static final DisabledAlgorithmConstraints JAR_DISABLED_CHECK =
+    /**
+     * Holder class to delay initialization of DisabledAlgorithmConstraints
+     * until needed.
+     */
+    private static class ConfigurationHolder {
+        static final DisabledAlgorithmConstraints JAR_DISABLED_CHECK =
             new DisabledAlgorithmConstraints(
                     DisabledAlgorithmConstraints.PROPERTY_JAR_DISABLED_ALGS);
+    }
 
     private ArrayList<CodeSigner[]> signerCache;
 
@@ -371,7 +377,7 @@
         Boolean permitted = permittedAlgs.get(algorithm);
         if (permitted == null) {
             try {
-                JAR_DISABLED_CHECK.permits(algorithm,
+                ConfigurationHolder.JAR_DISABLED_CHECK.permits(algorithm,
                         new ConstraintsParameters(timestamp));
             } catch(GeneralSecurityException e) {
                 permittedAlgs.put(algorithm, Boolean.FALSE);
--- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Thu Jul 20 09:38:27 2017 -0700
@@ -662,6 +662,11 @@
         return -1;
     }
 
+    // Validate the pid before returning the info in case /proc/pid is racy
+    if (kill(pid, 0) < 0) {
+        return -1;
+    }
+
     *totalTime = psinfo.pr_time.tv_sec * 1000000000L + psinfo.pr_time.tv_nsec;
 
     *startTime = psinfo.pr_start.tv_sec * (jlong)1000 +
--- a/src/java.base/unix/native/libjava/locale_str.h	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/unix/native/libjava/locale_str.h	Thu Jul 20 09:38:27 2017 -0700
@@ -135,16 +135,6 @@
     "sr_SP", "sr_YU",
     "tchinese", "zh_TW",
 #endif
-#ifdef MACOSX
-    "sr-Latn", "sr_CS",   // Mappings as done by old Apple JRS code
-    "tk", "tk-Cyrl",
-    "tt-Latn", "tt-Cyrl",
-    "uz", "uz_UZ",
-    "uz-Arab", "uz_UZ",
-    "uz-Latn", "uz_UZ",
-    "zh-Hans", "zh_CN",
-    "zh-Hant", "zh_TW",
-#endif
     "", "",
  };
 
--- a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -170,8 +170,8 @@
 {
     HANDLE h = (HANDLE)(handleval(env, fdo));
     if (h != INVALID_HANDLE_VALUE) {
-        jint result = CloseHandle(h);
-        if (result < 0) {
+        BOOL result = CloseHandle(h);
+        if (result == 0) {
             JNU_ThrowIOExceptionWithLastError(env, "Close failed");
         }
     }
--- a/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -334,7 +334,7 @@
                                         FileEndOfFileInfo,
                                         &eofInfo,
                                         sizeof(eofInfo));
-    if (result == FALSE) {
+    if (result == 0) {
         JNU_ThrowIOExceptionWithLastError(env, "Truncation failed");
         return IOS_THROWN;
     }
@@ -411,7 +411,7 @@
     long highPos = (long)(pos >> 32);
     DWORD lowNumBytes = (DWORD)size;
     DWORD highNumBytes = (DWORD)(size >> 32);
-    jint result = 0;
+    BOOL result = 0;
     OVERLAPPED o;
     o.hEvent = 0;
     o.Offset = lowPos;
@@ -422,7 +422,7 @@
         if (error == ERROR_IO_PENDING) {
             DWORD dwBytes;
             result = GetOverlappedResult(h, &o, &dwBytes, TRUE);
-            if (result == 0) {
+            if (result != 0) {
                 return;
             }
             error = GetLastError();
@@ -437,7 +437,7 @@
     HANDLE h = (HANDLE)fd;
     if (h != INVALID_HANDLE_VALUE) {
         int result = CloseHandle(h);
-        if (result < 0)
+        if (result == 0)
             JNU_ThrowIOExceptionWithLastError(env, "Close failed");
     }
 }
--- a/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c	Mon Jul 17 09:14:23 2017 -0700
+++ b/src/java.base/windows/native/libnio/ch/WindowsAsynchronousFileChannelImpl.c	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,5 +126,8 @@
     jlong handle)
 {
     HANDLE h = (HANDLE)jlong_to_ptr(handle);
-    CloseHandle(h);
+    BOOL result = CloseHandle(h);
+    if (result == 0) {
+        JNU_ThrowIOExceptionWithLastError(env, "Close failed");
+    }
 }
--- a/test/com/oracle/security/ucrypto/TestAES.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/com/oracle/security/ucrypto/TestAES.java	Thu Jul 20 09:38:27 2017 -0700
@@ -26,17 +26,22 @@
  * @bug 7088989 8014374 8167512 8173708
  * @summary Ensure the AES ciphers of OracleUcrypto provider works correctly
  * @key randomness
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
+ *        jdk.test.lib.Utils
  * @run main TestAES
- * @run main/othervm/java.security.policy==empty.policy TestAES
+ * @run main/othervm -Dpolicy=empty.policy TestAES
  */
 
-import java.io.*;
 import java.security.*;
 import java.security.spec.*;
 import java.util.*;
 import javax.crypto.*;
 import javax.crypto.spec.*;
 
+import jdk.test.lib.Platform;
+import jdk.test.lib.Utils;
+
 public class TestAES extends UcryptoTest {
 
     private static final String[] PADDEDCIPHER_ALGOS = {
@@ -55,10 +60,29 @@
     private static final SecretKey CIPHER_KEY =
         new SecretKeySpec(new byte[16], "AES");
 
+    private static final boolean IS_BAD_SOLARIS = isBadSolaris();
+
     public static void main(String[] args) throws Exception {
+        // It has to determine Solaris version before enabling security manager.
+        // Because that needs some permissions, like java.io.FilePermission.
+        String policy = System.getProperty("policy");
+        if (policy != null) {
+            enableSecurityManager(policy);
+        }
+
         main(new TestAES(), null);
     }
 
+    // Enables security manager and uses the specified policy file to override
+    // the default one.
+    private static void enableSecurityManager(String policy) {
+        String policyURL = "file://" + System.getProperty("test.src", ".") + "/"
+                + policy;
+        System.out.println("policyURL: " + policyURL);
+        Security.setProperty("policy.url.1", policyURL);
+        System.setSecurityManager(new SecurityManager());
+    }
+
     public void doTest(Provider prov) throws Exception {
         // Provider for testing Interoperability
         Provider sunJCEProv = Security.getProvider("SunJCE");
@@ -136,11 +160,18 @@
         boolean testPassed = true;
         byte[] in = new byte[16];
         (new SecureRandom()).nextBytes(in);
-        int blockSize = 16;
 
-        for (int j = 1; j < (in.length - 1); j++) {
-            System.out.println("Input offset size: " + j);
-            for (int i = 0; i < algos.length; i++) {
+        for (int i = 0; i < algos.length; i++) {
+            if (IS_BAD_SOLARIS
+                    && algos[i].indexOf("CFB128") != -1
+                    && p.getName().equals("OracleUcrypto")) {
+                System.out.println("Ignore cases on CFB128 due to a pre-S11.3 bug");
+                continue;
+            }
+
+            for (int j = 1; j < (in.length - 1); j++) {
+                System.out.println("Input offset size: " + j);
+
                 try {
                     // check ENC
                     Cipher c;
@@ -177,12 +208,6 @@
                     k += c.doFinal(eout, firstPartLen+1, eout.length - firstPartLen - 1, dout, k);
                     if (!checkArrays(in, in.length, dout, k)) testPassed = false;
                 } catch(Exception ex) {
-                    if (ex instanceof BadPaddingException &&
-                            algos[i].indexOf("CFB128") != -1 &&
-                            p.getName().equals("OracleUcrypto")) {
-                        System.out.println("Ignore due to a pre-S11.3 bug: " + ex);
-                        continue;
-                    }
                     System.out.println("Unexpected Exception: " + algos[i]);
                     ex.printStackTrace();
                     testPassed = false;
@@ -261,7 +286,6 @@
         }
     }
 
-
     private static void testCipherGCM(SecretKey key,
                                       Provider p) {
         boolean testPassed = true;
@@ -349,4 +373,12 @@
         }
         return equal;
     }
+
+    // The cases on CFB128 mode have to be skipped on pre-S11.3.
+    private static boolean isBadSolaris() {
+        return Platform.isSolaris()
+                && Platform.getOsVersionMajor() <= 5
+                && Platform.getOsVersionMinor() <= 11
+                && Utils.distro().compareTo("11.3") < 0;
+    }
 }
--- a/test/com/sun/jdi/LineNumberInfo.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/com/sun/jdi/LineNumberInfo.java	Thu Jul 20 09:38:27 2017 -0700
@@ -23,7 +23,7 @@
 
 /**
  *  @test
- *  @bug 4238644 4238643 4238641 4944198
+ *  @bug 4238644 4238643 4238641 4944198 8181500
  *  @summary Test javac regressions in the generation of line number info
  *  @author Gordon Hirsch
  *
@@ -72,6 +72,7 @@
         36,
         37,
         36,
+        37,
         40,
         41,
         42,
@@ -110,6 +111,7 @@
         85 ,
         93 ,
         96 ,
+        105,
         107,
         111,
         119,
--- a/test/java/io/File/createTempFile/NameTooLong.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/java/io/File/createTempFile/NameTooLong.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,8 @@
         for (String[] ps : prefixSuffix) {
             File f;
             try {
-                f = File.createTempFile(ps[0], ps[1]);
+                f = File.createTempFile(ps[0], ps[1],
+                        new File(System.getProperty("test.dir", ".")));
                 String s = f.toPath().getFileName().toString();
                 if (!s.startsWith(ps[0].substring(0, 3))) {
                     System.err.printf("%s did not start with %s%n", s,
--- a/test/java/io/File/createTempFile/SpecialTempFile.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/java/io/File/createTempFile/SpecialTempFile.java	Thu Jul 20 09:38:27 2017 -0700
@@ -30,6 +30,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class SpecialTempFile {
 
@@ -45,21 +48,21 @@
         final String exceptionMsg = "Unable to create temporary file";
         String[] dirs = { null, "." };
 
+        Path testPath = Paths.get(System.getProperty("test.dir", "."));
         for (int i = 0; i < prefix.length; i++) {
             boolean exceptionThrown = false;
             File f = null;
 
             for (String dir: dirs) {
+                Path tempDir = Files.createTempDirectory(testPath, dir);
                 System.out.println("In test " + name +
                                    ", creating temp file with prefix, " +
                                    prefix[i] + ", suffix, " + suffix[i] +
-                                   ", in dir, " + dir);
+                                   ", in dir, " + tempDir);
 
                 try {
-                    if (dir == null || dir.isEmpty())
-                        f = File.createTempFile(prefix[i], suffix[i]);
-                    else
-                        f = File.createTempFile(prefix[i], suffix[i], new File(dir));
+                    f = File.createTempFile(prefix[i], suffix[i],
+                        tempDir.toFile());
                 } catch (IOException e) {
                     if (exceptionExpected) {
                         if (e.getMessage().startsWith(exceptionMsg))
@@ -81,10 +84,6 @@
     public static void main(String[] args) throws Exception {
         // Common test
         final String name = "SpecialTempFile";
-        File f = new File(System.getProperty("java.io.tmpdir"), name);
-        if (!f.exists()) {
-            f.createNewFile();
-        }
         String[] nulPre = { name + "\u0000" };
         String[] nulSuf = { ".test" };
         test("NulName", nulPre, nulSuf, true);
--- a/test/java/nio/charset/Charset/IllegalCharsetName.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/java/nio/charset/Charset/IllegalCharsetName.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,15 +22,12 @@
  */
 
 /* @test
- * @bug 6330020
+ * @bug 6330020 8184665
  * @summary Ensure Charset.forName/isSupport throws the correct exception
  *          if the charset names passed in are illegal.
  */
 
-import java.io.*;
-import java.nio.*;
 import java.nio.charset.*;
-import java.util.*;
 
 public class IllegalCharsetName {
     public static void main(String[] args) throws Exception {
@@ -59,5 +56,18 @@
             } catch (IllegalCharsetNameException x) { //expected
             }
         }
+
+        // Standard charsets may bypass alias checking during startup, test that
+        // they're all well-behaved as a sanity test
+        checkAliases(StandardCharsets.ISO_8859_1);
+        checkAliases(StandardCharsets.US_ASCII);
+        checkAliases(StandardCharsets.UTF_8);
+    }
+
+    private static void checkAliases(Charset cs) {
+        for (String alias : cs.aliases()) {
+            Charset.forName(alias);
+            Charset.isSupported(alias);
+        }
     }
 }
--- a/test/java/nio/file/Files/probeContentType/ParallelProbes.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/java/nio/file/Files/probeContentType/ParallelProbes.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 
 public class ParallelProbes {
@@ -47,7 +48,8 @@
     }
 
     private Path createTmpFile() throws IOException {
-        final Path p = Files.createTempFile("prefix", ".json");
+        Path dir = Paths.get(System.getProperty("test.dir", "."));
+        final Path p = Files.createTempFile(dir, "prefix", ".json");
         Files.write(p, "{\"test\"}".getBytes());
         System.out.println("Write test file <" + p + ">");
         return p;
--- a/test/java/nio/file/spi/SetDefaultProvider.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/java/nio/file/spi/SetDefaultProvider.java	Thu Jul 20 09:38:27 2017 -0700
@@ -32,6 +32,7 @@
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -54,6 +55,11 @@
             new RuntimeException("jar tool not found")
         );
 
+    private static Path createTempDirectory(String prefix) throws IOException {
+        Path testDir = Paths.get(System.getProperty("test.dir", "."));
+        return Files.createTempDirectory(testDir, prefix);
+    }
+
     /**
      * Test override of default FileSystemProvider with the main application
      * on the class path.
@@ -91,7 +97,7 @@
      * is a module that is patched by an exploded patch.
      */
     public void testExplodedModuleWithExplodedPatch() throws Exception {
-        Path patchdir = Files.createTempDirectory("patch");
+        Path patchdir = createTempDirectory("patch");
         String modulePath = System.getProperty("jdk.module.path");
         int exitValue = exec(SET_DEFAULT_FSP,
                              "--patch-module", "m=" + patchdir,
@@ -105,7 +111,7 @@
      * is a module that is patched by an exploded patch.
      */
     public void testExplodedModuleWithJarPatch() throws Exception {
-        Path patchdir = Files.createTempDirectory("patch");
+        Path patchdir = createTempDirectory("patch");
         Files.createDirectory(patchdir.resolve("m.properties"));
         Path patch = createJarFile(patchdir);
         String modulePath = System.getProperty("jdk.module.path");
@@ -142,7 +148,7 @@
      * Creates a JAR file containing the entries in the given file tree.
      */
     private Path createJarFile(Path dir) throws Exception {
-        Path jar = Files.createTempDirectory("tmp").resolve("m.jar");
+        Path jar = createTempDirectory("tmp").resolve("m.jar");
         String[] args = { "--create", "--file=" + jar, "-C", dir.toString(), "." };
         int ret = JAR_TOOL.run(System.out, System.out, args);
         assertTrue(ret == 0);
--- a/test/jdk/internal/jrtfs/Basic.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/jdk/internal/jrtfs/Basic.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,15 +70,11 @@
     @BeforeClass
     public void setup() {
         theFileSystem = FileSystems.getFileSystem(URI.create("jrt:/"));
-        Path javaHomeDir = Paths.get(System.getProperty("java.home"));
-        Path jrtJarPath = javaHomeDir.resolve("jrt-fs.jar");
-        Path modulesPath = javaHomeDir.resolve("lib/modules");
-        isExplodedBuild = !Files.exists(jrtJarPath)
-                && !Files.exists(modulesPath);
-        if (Files.notExists(jrtJarPath)
-                && Files.notExists(modulesPath)) {
-            System.out.printf("Following files not exist: %s, %s",
-                    jrtJarPath.toString(), modulesPath.toString());
+        Path modulesPath = Paths.get(System.getProperty("java.home"),
+                "lib", "modules");
+        isExplodedBuild = Files.notExists(modulesPath);
+        if (isExplodedBuild) {
+            System.out.printf("%s doesn't exist.", modulesPath.toString());
             System.out.println();
             System.out.println("It is most probably an exploded build."
                     + " Skip non-default FileSystem testing.");
--- a/test/jdk/internal/jrtfs/WithSecurityManager.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/jdk/internal/jrtfs/WithSecurityManager.java	Thu Jul 20 09:38:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,16 +29,28 @@
 
 import java.net.URI;
 import java.nio.file.FileSystems;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Collections;
 
 public class WithSecurityManager {
     public static void main(String[] args) throws Exception {
+        Path modulesPath = Paths.get(System.getProperty("java.home"),
+                "lib", "modules");
+        if (Files.notExists(modulesPath)) {
+            System.out.printf("%s doesn't exist.", modulesPath.toString());
+            System.out.println();
+            System.out.println("It is most probably an exploded build."
+                    + " Skip the test.");
+            return;
+        }
+
         boolean allow = args[0].equals("allow");
 
         // set security policy to allow access
         if (allow) {
+
             String testSrc = System.getProperty("test.src");
             if (testSrc == null)
                 testSrc = ".";
--- a/test/tools/jar/multiRelease/ApiValidatorTest.java	Mon Jul 17 09:14:23 2017 -0700
+++ b/test/tools/jar/multiRelease/ApiValidatorTest.java	Thu Jul 20 09:38:27 2017 -0700
@@ -28,8 +28,7 @@
  * @modules java.base/jdk.internal.misc
  *          jdk.compiler
  *          jdk.jartool
- * @build jdk.test.lib.util.FileUtils
- *        jdk.test.lib.Utils
+ * @build jdk.test.lib.Utils
  *        jdk.test.lib.Asserts
  *        jdk.test.lib.JDKToolFinder
  *        jdk.test.lib.JDKToolLauncher
@@ -40,13 +39,10 @@
  */
 
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.util.FileUtils;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import java.io.IOException;
 import java.lang.reflect.Method;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -68,12 +64,6 @@
         classes = root.resolve("classes");
     }
 
-    @AfterMethod
-    void testCleanup() throws IOException {
-        FileUtils.deleteFileTreeWithRetry(root);
-    }
-
-
     @Test(dataProvider = "signatureChange")
     public void changeMethodSignature(String sigBase, String sigV10,
                                       boolean isAcceptable) throws Throwable {