changeset 2741:eb5fc32790eb

8066731: javac does not work on exploded image Reviewed-by: jjg, mchung Contributed-by: alan.bateman@oracle.com
author jjg
date Thu, 04 Dec 2014 14:57:40 -0800
parents c956c25f9334
children 23a3a063a906
files src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java	Wed Dec 03 19:28:40 2014 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java	Thu Dec 04 14:57:40 2014 -0800
@@ -31,8 +31,10 @@
 import java.nio.file.DirectoryStream;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
+import java.nio.file.FileSystemNotFoundException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.ProviderNotFoundException;
 import java.nio.file.spi.FileSystemProvider;
 import java.util.Collections;
 import java.util.HashMap;
@@ -79,11 +81,12 @@
     }
 
     public static boolean isAvailable() {
-        for (FileSystemProvider p: FileSystemProvider.installedProviders()) {
-            if (p.getScheme().equals("jrt"))
-                return true;
+        try {
+            FileSystems.getFileSystem(URI.create("jrt:/"));
+            return true;
+        } catch (ProviderNotFoundException | FileSystemNotFoundException e) {
+            return false;
         }
-        return false;
     }