changeset 17777:509e7250736b

Merge
author prr
date Thu, 06 Jul 2017 09:22:45 -0700
parents ef390b05c25d 9dcc29929c85
children 5fcac4064fdd
files
diffstat 23 files changed, 182 insertions(+), 155 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Jul 06 09:22:45 2017 -0700
@@ -47,6 +47,7 @@
 #define LOCALEIDLENGTH  128
 char *getMacOSXLocale(int cat) {
     const char* retVal = NULL;
+    char localeString[LOCALEIDLENGTH];
 
     switch (cat) {
     case LC_MESSAGES:
@@ -74,73 +75,114 @@
             }
             CFRelease(languages);
 
+            // Explicitly supply region, if there is none
+            char *hyphenPos = strchr(languageString, '-');
+            int langStrLen = strlen(languageString);
+
+            if (hyphenPos == NULL || // languageString contains ISO639 only, e.g., "en"
+                languageString + langStrLen - hyphenPos == 5) { // ISO639-ScriptCode, e.g., "en-Latn"
+                CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
+                               localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding());
+                char *underscorePos = strrchr(localeString, '_');
+                char *region = NULL;
+
+                if (underscorePos != NULL) {
+                    region = underscorePos + 1;
+                }
+
+                if (region != NULL) {
+                    strcat(languageString, "-");
+                    strcat(languageString, region);
+                }
+            }
+
             retVal = languageString;
-
-            // Special case for Portuguese in Brazil:
-            // The language code needs the "_BR" region code (to distinguish it
-            // from Portuguese in Portugal), but this is missing when using the
-            // "Portuguese (Brazil)" language.
-            // If language is "pt" and the current locale is pt_BR, return pt_BR.
-            char localeString[LOCALEIDLENGTH];
-            if (strcmp(retVal, "pt") == 0 &&
-                    CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
-                                       localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) &&
-                    strcmp(localeString, "pt_BR") == 0) {
-                retVal = localeString;
-            }
         }
         break;
+
     default:
         {
-            char localeString[LOCALEIDLENGTH];
             if (!CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
                                     localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding())) {
                 return NULL;
             }
+
             retVal = localeString;
         }
         break;
     }
 
     if (retVal != NULL) {
-        // Language IDs use the language designators and (optional) region
-        // and script designators of BCP 47.  So possible formats are:
-        //
-        // "en"         (language designator only)
-        // "haw"        (3-letter lanuage designator)
-        // "en-GB"      (language with alpha-2 region designator)
-        // "es-419"     (language with 3-digit UN M.49 area code)
-        // "zh-Hans"    (language with ISO 15924 script designator)
-        // "zh-Hans-US"  (language with ISO 15924 script designator and region)
-        // "zh-Hans-419" (language with ISO 15924 script designator and UN M.49)
-        //
-        // In the case of region designators (alpha-2 and/or UN M.49), we convert
-        // to our locale string format by changing '-' to '_'.  That is, if
-        // the '-' is followed by fewer than 4 chars.
-        char* scriptOrRegion = strchr(retVal, '-');
-        if (scriptOrRegion != NULL) {
-            int length = strlen(scriptOrRegion);
-            if (length > 5) {
-                // Region and script both exist. Honor the script for now
-                scriptOrRegion[5] = '\0';
-            } else if (length < 5) {
-                *scriptOrRegion = '_';
+        return strdup(convertToPOSIXLocale(retVal));
+    }
 
-                assert((length == 3 &&
-                    // '-' followed by a 2 character region designator
-                      isalpha(scriptOrRegion[1]) &&
-                      isalpha(scriptOrRegion[2])) ||
-                       (length == 4 &&
-                    // '-' followed by a 3-digit UN M.49 area code
-                      isdigit(scriptOrRegion[1]) &&
-                      isdigit(scriptOrRegion[2]) &&
-                      isdigit(scriptOrRegion[3])));
-            }
+    return NULL;
+}
+
+/* Language IDs use the language designators and (optional) region
+ * and script designators of BCP 47.  So possible formats are:
+ *
+ * "en"         (language designator only)
+ * "haw"        (3-letter lanuage designator)
+ * "en-GB"      (language with alpha-2 region designator)
+ * "es-419"     (language with 3-digit UN M.49 area code)
+ * "zh-Hans"    (language with ISO 15924 script designator)
+ * "zh-Hans-US"  (language with ISO 15924 script designator and region)
+ * "zh-Hans-419" (language with ISO 15924 script designator and UN M.49)
+ *
+ * convert these tags into POSIX conforming locale string, i.e.,
+ * lang{_region}{@script}. e.g., for "zh-Hans-US" into "zh_US@Hans"
+ */
+const char * convertToPOSIXLocale(const char* src) {
+    char* scriptRegion = strchr(src, '-');
+    if (scriptRegion != NULL) {
+        int length = strlen(scriptRegion);
+        char* region = strchr(scriptRegion + 1, '-');
+        char* atMark = NULL;
+
+        if (region == NULL) {
+            // CFLocaleGetIdentifier() returns '_' before region
+            region = strchr(scriptRegion + 1, '_');
         }
 
-        return strdup(retVal);
+        *scriptRegion = '_';
+        if (length > 5) {
+            // Region and script both exist.
+            char tmpScript[4];
+            int regionLength = length - 6;
+            atMark = scriptRegion + 1 + regionLength;
+            memcpy(tmpScript, scriptRegion + 1, 4);
+            memmove(scriptRegion + 1, region + 1, regionLength);
+            memcpy(atMark + 1, tmpScript, 4);
+        } else if (length == 5) {
+            // script only
+            atMark = scriptRegion;
+        }
+
+        if (atMark != NULL) {
+            *atMark = '@';
+
+            // assert script code
+            assert(isalpha(atMark[1]) &&
+                   isalpha(atMark[2]) &&
+                   isalpha(atMark[3]) &&
+                   isalpha(atMark[4]));
+        }
+
+        assert(((length == 3 || length == 8) &&
+            // '_' followed by a 2 character region designator
+                isalpha(scriptRegion[1]) &&
+                isalpha(scriptRegion[2])) ||
+                ((length == 4 || length == 9) &&
+            // '_' followed by a 3-digit UN M.49 area code
+                isdigit(scriptRegion[1]) &&
+                isdigit(scriptRegion[2]) &&
+                isdigit(scriptRegion[3])) ||
+            // '@' followed by a 4 character script code (already validated above)
+                (length == 5));
     }
-    return NULL;
+
+    return src;
 }
 
 char *setupMacOSXLocale(int cat) {
--- a/src/java.base/macosx/native/libjava/java_props_macosx.h	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.h	Thu Jul 06 09:22:45 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,7 @@
 #include "java_props.h"
 
 char *setupMacOSXLocale(int cat);
+const char *convertToPOSIXLocale(const char* src);
 void setOSNameAndVersion(java_props_t *sprops);
 void setUserHome(java_props_t *sprops);
 void setProxyProperties(java_props_t *sProps);
--- a/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Jul 06 09:22:45 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
@@ -195,12 +195,10 @@
         if (max$ItypesPerOtype$ <= 0.0f)
             throw new IllegalArgumentException("Non-positive "
                                                + "max$ItypesPerOtype$");
-        if (!Charset.atBugLevel("1.4")) {
-            if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
-                throw new IllegalArgumentException("average$ItypesPerOtype$"
-                                                   + " exceeds "
-                                                   + "max$ItypesPerOtype$");
-        }
+        if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
+            throw new IllegalArgumentException("average$ItypesPerOtype$"
+                                               + " exceeds "
+                                               + "max$ItypesPerOtype$");
         this.replacement = replacement;
         this.average$ItypesPerOtype$ = average$ItypesPerOtype$;
         this.max$ItypesPerOtype$ = max$ItypesPerOtype$;
--- a/src/java.base/share/classes/java/nio/charset/Charset.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java	Thu Jul 06 09:22:45 2017 -0700
@@ -281,19 +281,6 @@
 
     /* -- Static methods -- */
 
-    private static volatile String bugLevel;
-
-    static boolean atBugLevel(String bl) {              // package-private
-        String level = bugLevel;
-        if (level == null) {
-            if (!VM.isBooted())
-                return false;
-            bugLevel = level = GetPropertyAction
-                    .privilegedGetProperty("sun.nio.cs.bugLevel", "");
-        }
-        return level.equals(bl);
-    }
-
     /**
      * Checks that the given string is a legal charset name. </p>
      *
@@ -305,7 +292,7 @@
      */
     private static void checkName(String s) {
         int n = s.length();
-        if (n == 0 && !atBugLevel("1.4")) {
+        if (n == 0) {
             throw new IllegalCharsetNameException(s);
         }
         for (int i = 0; i < n; i++) {
--- a/src/java.base/unix/native/libjava/locale_str.h	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/unix/native/libjava/locale_str.h	Thu Jul 06 09:22:45 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -211,6 +211,16 @@
     "iqtelif", "Latn",
     "latin", "Latn",
 #endif
+    "Arab", "Arab",
+    "Cyrl", "Cyrl",
+    "Deva", "Deva",
+    "Ethi", "Ethi",
+    "Hans", "Hans",
+    "Hant", "Hant",
+    "Latn", "Latn",
+    "Sund", "Sund",
+    "Syrc", "Syrc",
+    "Tfng", "Tfng",
     "", "",
 };
 
--- a/src/java.base/windows/classes/java/io/WinNTFileSystem.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/src/java.base/windows/classes/java/io/WinNTFileSystem.java	Thu Jul 06 09:22:45 2017 -0700
@@ -27,6 +27,7 @@
 
 import java.io.File;
 import java.nio.file.Path;
+import java.util.BitSet;
 import java.util.Locale;
 import java.util.Properties;
 import sun.security.action.GetPropertyAction;
@@ -586,24 +587,12 @@
 
     @Override
     public File[] listRoots() {
-        int ds = listRoots0();
-        int n = 0;
-        for (int i = 0; i < 26; i++) {
-            if (((ds >> i) & 1) != 0) {
-                if (!access((char)('A' + i) + ":" + slash))
-                    ds &= ~(1 << i);
-                else
-                    n++;
-            }
-        }
-        File[] fs = new File[n];
-        int j = 0;
-        char slash = this.slash;
-        for (int i = 0; i < 26; i++) {
-            if (((ds >> i) & 1) != 0)
-                fs[j++] = new File((char)('A' + i) + ":" + slash);
-        }
-        return fs;
+        return BitSet
+            .valueOf(new long[] {listRoots0()})
+            .stream()
+            .mapToObj(i -> new File((char)('A' + i) + ":" + slash))
+            .filter(f -> access(f.getPath()) && f.exists())
+            .toArray(File[]::new);
     }
 
     private static native int listRoots0();
--- a/test/java/lang/ModuleTests/AnnotationsTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/lang/ModuleTests/AnnotationsTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -28,6 +28,7 @@
 import java.lang.module.ModuleFinder;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -74,7 +75,7 @@
     public void testNamedModule() throws IOException {
 
         // "deprecate" java.xml
-        Path dir = Files.createTempDirectory("mods");
+        Path dir = Files.createTempDirectory(Paths.get(""), "mods");
         deprecateModule("java.xml", true, "9", dir);
 
         // "load" the cloned java.xml
--- a/test/java/lang/ProcessHandle/OnExitTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/lang/ProcessHandle/OnExitTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -42,14 +42,7 @@
  * @test
  * @key intermittent
  * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          jdk.management
  * @build jdk.test.lib.Utils
- *        jdk.test.lib.Asserts
- *        jdk.test.lib.JDKToolFinder
- *        jdk.test.lib.JDKToolLauncher
- *        jdk.test.lib.Platform
- *        jdk.test.lib.process.*
  * @run testng OnExitTest
  * @summary Functions of Process.onExit and ProcessHandle.onExit
  * @author Roger Riggs
@@ -251,10 +244,30 @@
                 }
                 Assert.assertNull(line, "waitpid didn't wait");
 
+                A.toHandle().onExit().thenAccept(p -> {
+                    System.out.printf(" A.toHandle().onExit().A info: %s, now: %s%n",
+                            p.info(), Instant.now());
+                });
+
+                A.onExit().thenAccept(p -> {
+                    System.out.printf(" A.onExit().A info: %s, now: %s%n",
+                            p.info(), Instant.now());
+                });
+
+                ProcessHandle.Info A_info = A.info();
+
                 A.sendAction("exit", 0L);
 
                 // Look for B to report that A has exited
                 do {
+                    Instant start = Instant.now();
+                    while (blines.isEmpty() && A.isAlive()) {
+                        A_info = A.info(); // Spin
+                    }
+                    Instant end = Instant.now();
+                    System.out.printf(" a.isAlive: %s, a.info: %s, @%s%n", A.isAlive(), A.info(),
+                            Duration.between(start, end));
+
                     split = getSplitLine(blines);
                 } while (!"waitpid".equals(split[1]));
 
--- a/test/java/lang/invoke/DefineClassTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/lang/invoke/DefineClassTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -37,6 +37,7 @@
 import java.net.URLClassLoader;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
@@ -164,14 +165,16 @@
      */
     @Test
     public void testTwoProtectionDomains() throws Exception {
+        Path here = Paths.get("");
+
         // p.C1 in one exploded directory
-        Path dir1 = Files.createTempDirectory("classes");
+        Path dir1 = Files.createTempDirectory(here, "classes");
         Path p = Files.createDirectory(dir1.resolve("p"));
         Files.write(p.resolve("C1.class"), generateClass("p.C1"));
         URL url1 = dir1.toUri().toURL();
 
         // p.C2 in another exploded directory
-        Path dir2 = Files.createTempDirectory("classes");
+        Path dir2 = Files.createTempDirectory(here, "classes");
         p = Files.createDirectory(dir2.resolve("p"));
         Files.write(p.resolve("C2.class"), generateClass("p.C2"));
         URL url2 = dir2.toUri().toURL();
--- a/test/java/lang/module/ConfigurationTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/lang/module/ConfigurationTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -42,6 +42,7 @@
 import java.lang.module.ResolvedModule;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 import java.util.Optional;
 import java.util.Set;
@@ -2117,7 +2118,7 @@
             target = null;
         }
         String name = descriptor.name();
-        Path dir = Files.createTempDirectory(name);
+        Path dir = Files.createTempDirectory(Paths.get(""), name);
         Path mi = dir.resolve("module-info.class");
         try (OutputStream out = Files.newOutputStream(mi)) {
             ModuleInfoWriter.write(descriptor, target, out);
--- a/test/java/lang/module/customfs/ModulesInCustomFileSystem.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/lang/module/customfs/ModulesInCustomFileSystem.java	Thu Jul 06 09:22:45 2017 -0700
@@ -48,6 +48,7 @@
 
 @Test
 public class ModulesInCustomFileSystem {
+    private static final Path HERE = Paths.get("");
 
     /**
      * Test exploded modules in a JAR file system.
@@ -59,7 +60,7 @@
         assertEquals(mlib, m2.getParent());
 
         // create JAR file containing m1/** and m2/**
-        Path jar = Files.createTempDirectory("mlib").resolve("modules.jar");
+        Path jar = Files.createTempDirectory(HERE, "mlib").resolve("modules.jar");
         JarUtils.createJarFile(jar, mlib);
         testJarFileSystem(jar);
     }
@@ -70,12 +71,12 @@
     public void testModularJARsInJarFileSystem() throws Exception {
         Path m1 = findModuleDirectory("m1");
         Path m2 = findModuleDirectory("m2");
-        Path contents = Files.createTempDirectory("contents");
+        Path contents = Files.createTempDirectory(HERE, "contents");
         JarUtils.createJarFile(contents.resolve("m1.jar"), m1);
         JarUtils.createJarFile(contents.resolve("m2.jar"), m2);
 
         // create JAR file containing m1.jar and m2.jar
-        Path jar = Files.createTempDirectory("mlib").resolve("modules.jar");
+        Path jar = Files.createTempDirectory(HERE, "mlib").resolve("modules.jar");
         JarUtils.createJarFile(jar, contents);
         testJarFileSystem(jar);
     }
--- a/test/java/net/httpclient/TimeoutOrdering.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/net/httpclient/TimeoutOrdering.java	Thu Jul 06 09:22:45 2017 -0700
@@ -38,7 +38,6 @@
 
 /**
  * @test
- * @key intermittent
  * @summary Ensures that timeouts of multiple requests are handled in correct order
  * @run main/othervm TimeoutOrdering
  */
--- a/test/java/net/httpclient/http2/BasicTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/net/httpclient/http2/BasicTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8087112
+ * @key intermittent
  * @library /lib/testlibrary server
  * @build jdk.testlibrary.SimpleSSLContext
  * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
--- a/test/java/net/httpclient/http2/ErrorTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/net/httpclient/http2/ErrorTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -25,7 +25,6 @@
  * @test
  * @bug 8157105
  * @library /lib/testlibrary server
- * @key intermittent
  * @build jdk.testlibrary.SimpleSSLContext
  * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
  *          jdk.incubator.httpclient/jdk.incubator.http.internal.frame
--- a/test/java/net/httpclient/http2/FixedThreadPoolTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/net/httpclient/http2/FixedThreadPoolTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8087112
+ * @key intermittent
  * @library /lib/testlibrary server
  * @build jdk.testlibrary.SimpleSSLContext
  * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
--- a/test/java/nio/channels/AsynchronousChannelGroup/SetupJar.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/channels/AsynchronousChannelGroup/SetupJar.java	Thu Jul 06 09:22:45 2017 -0700
@@ -21,14 +21,19 @@
  * questions.
  */
 
+import java.io.File;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
 public class SetupJar {
-
     public static void main(String args[]) throws Exception {
-        Path classes = Paths.get(System.getProperty("test.classes", ""));
-        JarUtils.createJarFile(Paths.get("privileged.jar"),
-                               classes.resolve("bootlib"));
+        String cp = System.getProperty("test.class.path");
+        Path bootlib = Stream.of(cp.split(File.pathSeparator))
+                .map(Paths::get)
+                .filter(e -> e.endsWith("bootlib"))  // file name
+                .findAny()
+                .orElseThrow(() -> new InternalError("bootlib not found"));
+        JarUtils.createJarFile(Paths.get("privileged.jar"), bootlib);
     }
 }
--- a/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Thu Jul 06 09:22:45 2017 -0700
@@ -26,7 +26,7 @@
  * @summary Stress test connections through the loopback interface
  * @run main StressLoopback
  * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback
- * @key randomness intermittent
+ * @key randomness
  */
 
 import java.nio.ByteBuffer;
--- a/test/java/nio/channels/FileChannel/Transfer4GBFile.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/channels/FileChannel/Transfer4GBFile.java	Thu Jul 06 09:22:45 2017 -0700
@@ -23,7 +23,6 @@
 
 /* @test
  * @bug 4638365
- * @key intermittent
  * @summary Test FileChannel.transferFrom and transferTo for 4GB files
  * @run testng/timeout=300 Transfer4GBFile
  */
--- a/test/java/nio/channels/FileChannel/TransferTo6GBFile.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/channels/FileChannel/TransferTo6GBFile.java	Thu Jul 06 09:22:45 2017 -0700
@@ -23,7 +23,6 @@
 
 /* @test
  * @bug 6253145
- * @key intermittent
  * @summary Test FileChannel.transferTo with file positions up to 8GB
  * @run testng/timeout=300 TransferTo6GBFile
  */
--- a/test/java/nio/charset/Charset/EmptyCharsetName.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/charset/Charset/EmptyCharsetName.java	Thu Jul 06 09:22:45 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
@@ -25,10 +25,6 @@
  * @bug 4786884
  * @summary Ensure that passing the empty string to Charset methods and
  *          constructors causes an IllegalArgumentException to be thrown
- *
- * @build EmptyCharsetName
- * @run main EmptyCharsetName
- * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 EmptyCharsetName
  */
 
 import java.io.*;
@@ -38,8 +34,6 @@
 
 public class EmptyCharsetName {
 
-    static boolean compat;
-
     static abstract class Test {
 
         public abstract void go() throws Exception;
@@ -48,13 +42,6 @@
             try {
                 go();
             } catch (Exception x) {
-                if (compat) {
-                    if (x instanceof UnsupportedCharsetException) {
-                        System.err.println("Thrown as expected: " + x);
-                        return;
-                    }
-                    throw new Exception("Exception thrown", x);
-                }
                 if (x instanceof IllegalCharsetNameException) {
                     System.err.println("Thrown as expected: " + x);
                     return;
@@ -63,18 +50,13 @@
                                     + x.getClass().getName(),
                                     x);
             }
-            if (!compat)
-                throw new Exception("No exception thrown");
+            throw new Exception("No exception thrown");
         }
 
     }
 
     public static void main(String[] args) throws Exception {
 
-        // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
-        String bl = System.getProperty("sun.nio.cs.bugLevel");
-        compat = (bl != null && bl.equals("1.4"));
-
         new Test() {
                 public void go() throws Exception {
                     Charset.forName("");
--- a/test/java/nio/charset/CharsetDecoder/AverageMax.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/nio/charset/CharsetDecoder/AverageMax.java	Thu Jul 06 09:22:45 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
@@ -24,10 +24,6 @@
 /* @test
  * @bug 4853350
  * @summary Ensure that averages do not exceed maxima
- *
- * @build AverageMax
- * @run main AverageMax
- * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 AverageMax
  */
 
 import java.nio.*;
@@ -36,8 +32,6 @@
 
 public class AverageMax {
 
-    static boolean compat;
-
     static abstract class Test {
 
         public abstract void go() throws Exception;
@@ -46,9 +40,6 @@
             try {
                 go();
             } catch (Exception x) {
-                if (compat) {
-                    throw new Exception("Exception thrown", x);
-                }
                 if (x instanceof IllegalArgumentException) {
                     System.err.println("Thrown as expected: " + x);
                     return;
@@ -57,17 +48,13 @@
                                     + x.getClass().getName(),
                                     x);
             }
-            if (!compat)
-                throw new Exception("No exception thrown");
+            throw new Exception("No exception thrown");
         }
 
     }
 
     public static void main(String[] args) throws Exception {
 
-        // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
-        String bl = System.getProperty("sun.nio.cs.bugLevel");
-        compat = (bl != null && bl.equals("1.4"));
         final Charset ascii = Charset.forName("US-ASCII");
 
         new Test() {
--- a/test/java/util/ServiceLoader/ModulesTest.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/java/util/ServiceLoader/ModulesTest.java	Thu Jul 06 09:22:45 2017 -0700
@@ -33,6 +33,7 @@
  * @summary Basic test for ServiceLoader with a provider deployed as a module.
  */
 
+import java.io.File;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
 import java.nio.file.Files;
@@ -49,6 +50,7 @@
 import java.util.ServiceLoader.Provider;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javax.script.ScriptEngineFactory;
 
 import org.testng.annotations.Test;
@@ -236,8 +238,10 @@
      */
     @Test
     public void testWithAutomaticModule() throws Exception {
+        Path here = Paths.get("");
+        Path jar = Files.createTempDirectory(here, "lib").resolve("pearscript.jar");
         Path classes = Paths.get(System.getProperty("test.classes"));
-        Path jar = Files.createTempDirectory("lib").resolve("pearscript.jar");
+
         JarUtils.createJarFile(jar, classes, "META-INF", "org");
 
         ModuleFinder finder = ModuleFinder.of(jar);
@@ -353,8 +357,7 @@
                 .isPresent());
 
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
-        ModuleFinder finder = ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.of(testModulePath());
 
         // layer1
         Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
@@ -451,11 +454,10 @@
 
     /**
      * Create a custom layer by resolving the given module names. The modules
-     * are located in the {@code ${test.classes}/modules} directory.
+     * are located on the test module path ({@code ${test.module.path}}).
      */
     private ModuleLayer createCustomLayer(String... modules) {
-        Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
-        ModuleFinder finder = ModuleFinder.of(dir);
+        ModuleFinder finder = ModuleFinder.of(testModulePath());
         Set<String> roots = new HashSet<>();
         Collections.addAll(roots, modules);
         ModuleLayer bootLayer = ModuleLayer.boot();
@@ -467,6 +469,13 @@
         return layer;
     }
 
+    private Path[] testModulePath() {
+        String mp = System.getProperty("test.module.path");
+        return Stream.of(mp.split(File.pathSeparator))
+                .map(Paths::get)
+                .toArray(Path[]::new);
+    }
+
     private <E> List<E> collectAll(ServiceLoader<E> loader) {
         List<E> list = new ArrayList<>();
         Iterator<E> iterator = loader.iterator();
--- a/test/javax/net/ssl/ciphersuites/ECCurvesconstraints.java	Thu Jul 06 16:45:56 2017 +0530
+++ b/test/javax/net/ssl/ciphersuites/ECCurvesconstraints.java	Thu Jul 06 09:22:45 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
@@ -32,7 +32,7 @@
  * @test
  * @bug 8148516
  * @summary Improve the default strength of EC in JDK
- * @modules jdk.crypyo.ec
+ * @modules jdk.crypto.ec
  * @run main/othervm ECCurvesconstraints PKIX
  * @run main/othervm ECCurvesconstraints SunX509
  */