8066731: javac does not work on exploded image
Reviewed-by: jjg, mchung
Contributed-by: alan.bateman@oracle.com
--- 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;
}