8066731: javac does not work on exploded image
authorjjg
Thu, 04 Dec 2014 14:57:40 -0800
changeset 27859 f5bd37460a09
parent 27858 443efec4bf09
child 27860 a48998a1fc72
8066731: javac does not work on exploded image Reviewed-by: jjg, mchung Contributed-by: alan.bateman@oracle.com
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java	Wed Dec 03 19:28:40 2014 +0000
+++ b/langtools/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;
     }