< prev index next >

src/java.base/share/classes/jdk/internal/jrtfs/SystemImage.java

Print this page

 61             return new SystemImage() {
 62                 @Override
 63                 Node findNode(String path) throws IOException {
 64                     return image.findNode(path);
 65                 }
 66                 @Override
 67                 byte[] getResource(Node node) throws IOException {
 68                     return image.getResource(node);
 69                 }
 70                 @Override
 71                 void close() throws IOException {
 72                     image.close();
 73                 }
 74             };
 75         }
 76         if (Files.notExists(explodedModulesDir))
 77             throw new FileSystemNotFoundException(explodedModulesDir.toString());
 78         return new ExplodedImage(explodedModulesDir);
 79     }
 80 
 81     static final String RUNTIME_HOME;
 82     // "modules" jimage file Path
 83     static final Path moduleImageFile;
 84     // "modules" jimage exists or not?
 85     static final boolean modulesImageExists;
 86     // <JAVA_HOME>/modules directory Path
 87     static final Path explodedModulesDir;
 88 
 89     static {
 90         PrivilegedAction<String> pa = SystemImage::findHome;
 91         RUNTIME_HOME = AccessController.doPrivileged(pa);
 92 
 93         FileSystem fs = FileSystems.getDefault();
 94         moduleImageFile = fs.getPath(RUNTIME_HOME, "lib", "modules");
 95         explodedModulesDir = fs.getPath(RUNTIME_HOME, "modules");
 96 
 97         modulesImageExists = AccessController.doPrivileged(
 98             new PrivilegedAction<Boolean>() {
 99                 @Override
100                 public Boolean run() {
101                     return Files.isRegularFile(moduleImageFile);
102                 }
103             });
104     }
105 
106     /**
107      * Returns the appropriate JDK home for this usage of the FileSystemProvider.

 61             return new SystemImage() {
 62                 @Override
 63                 Node findNode(String path) throws IOException {
 64                     return image.findNode(path);
 65                 }
 66                 @Override
 67                 byte[] getResource(Node node) throws IOException {
 68                     return image.getResource(node);
 69                 }
 70                 @Override
 71                 void close() throws IOException {
 72                     image.close();
 73                 }
 74             };
 75         }
 76         if (Files.notExists(explodedModulesDir))
 77             throw new FileSystemNotFoundException(explodedModulesDir.toString());
 78         return new ExplodedImage(explodedModulesDir);
 79     }
 80 
 81     private static final String RUNTIME_HOME;
 82     // "modules" jimage file Path
 83     private static final Path moduleImageFile;
 84     // "modules" jimage exists or not?
 85     private static final boolean modulesImageExists;
 86     // <JAVA_HOME>/modules directory Path
 87     private static final Path explodedModulesDir;
 88 
 89     static {
 90         PrivilegedAction<String> pa = SystemImage::findHome;
 91         RUNTIME_HOME = AccessController.doPrivileged(pa);
 92 
 93         FileSystem fs = FileSystems.getDefault();
 94         moduleImageFile = fs.getPath(RUNTIME_HOME, "lib", "modules");
 95         explodedModulesDir = fs.getPath(RUNTIME_HOME, "modules");
 96 
 97         modulesImageExists = AccessController.doPrivileged(
 98             new PrivilegedAction<Boolean>() {
 99                 @Override
100                 public Boolean run() {
101                     return Files.isRegularFile(moduleImageFile);
102                 }
103             });
104     }
105 
106     /**
107      * Returns the appropriate JDK home for this usage of the FileSystemProvider.
< prev index next >