test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java
changeset 47218 918745561887
parent 47216 71c04702a3d5
child 48690 374c63fbe652
--- a/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java	Tue Sep 12 19:03:56 2017 +0200
+++ b/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java	Tue Sep 12 19:03:59 2017 +0200
@@ -162,16 +162,18 @@
 
     String findTestDir(String dir) throws IOException {
         Path path = Paths.get(dir).toAbsolutePath();
+        Path child = null;
         while (path != null && !path.endsWith("test")) {
+            child = path;
             path = path.getParent();
         }
-        if (path == null) {
+        if (child == null) {
             throw new IllegalArgumentException(dir + " is not in a test directory");
         }
-        if (!Files.isDirectory(path)) {
-            throw new IOException(path.toString() + " is not a directory");
+        if (!Files.isDirectory(child)) {
+            throw new IOException(child.toString() + " is not a directory");
         }
-        return path.toString();
+        return child.toString();
     }
 
     void compileEntries() {