8184904: jdk/internal/jrtfs/WithSecurityManager fails with exploded builds
authorxiaofeya
Thu, 20 Jul 2017 06:49:20 -0700
changeset 45931 31e9b8581d65
parent 45930 e9f9389a5be3
child 45932 dbe2fd2c7567
child 47158 8e481491fba8
8184904: jdk/internal/jrtfs/WithSecurityManager fails with exploded builds Reviewed-by: alanb
jdk/test/jdk/internal/jrtfs/Basic.java
jdk/test/jdk/internal/jrtfs/WithSecurityManager.java
--- a/jdk/test/jdk/internal/jrtfs/Basic.java	Thu Jul 20 01:18:03 2017 +0000
+++ b/jdk/test/jdk/internal/jrtfs/Basic.java	Thu Jul 20 06:49:20 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/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java	Thu Jul 20 01:18:03 2017 +0000
+++ b/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java	Thu Jul 20 06:49:20 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 = ".";