8188828: Intermittent ClassNotFoundException: jdk.test.lib.Platform for compiler tests
authoriklam
Mon, 09 Oct 2017 13:11:25 -0700
changeset 47610 601807573d40
parent 47609 a1f68e415b48
child 47611 7eda0a64c199
8188828: Intermittent ClassNotFoundException: jdk.test.lib.Platform for compiler tests Summary: As a work around, remove dependency from jdk.test.lib.FileInstaller to other classes in this library Reviewed-by: iignatyev, gtriantafill, kvn, dholmes
test/lib/jdk/test/lib/FileInstaller.java
--- a/test/lib/jdk/test/lib/FileInstaller.java	Mon Oct 09 14:39:59 2017 +0200
+++ b/test/lib/jdk/test/lib/FileInstaller.java	Mon Oct 09 13:11:25 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -32,11 +32,18 @@
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
 
+// !!!
+// NOTE: this class is widely used. DO NOT depend on any other classes in any test library, or else
+// you may see intermittent ClassNotFoundException as in JDK-8188828
+// !!!
+
 /**
  * Copy a resource: file or directory recursively, using relative path(src and dst)
  * which are applied to test source directory(src) and current directory(dst)
  */
 public class FileInstaller {
+    public static final String TEST_SRC = System.getProperty("test.src", "").trim();
+
     /**
      * @param args source and destination
      * @throws IOException if an I/O error occurs
@@ -45,7 +52,7 @@
         if (args.length != 2) {
             throw new IllegalArgumentException("Unexpected number of arguments for file copy");
         }
-        Path src = Paths.get(Utils.TEST_SRC, args[0]).toAbsolutePath().normalize();
+        Path src = Paths.get(TEST_SRC, args[0]).toAbsolutePath().normalize();
         Path dst = Paths.get(args[1]).toAbsolutePath().normalize();
         if (src.toFile().exists()) {
             System.out.printf("copying %s to %s%n", src, dst);