langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
changeset 26276 0dca2378aa34
parent 25874 83c19f00452c
child 27579 d1a63c99cdd5
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Fri Aug 29 14:58:35 2014 +0200
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Fri Aug 29 10:46:33 2014 -0700
@@ -32,6 +32,7 @@
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.BufferedInputStream;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -91,9 +92,17 @@
     }
 
     private static List<Archive> initModules(Path mpath) throws IOException {
-        try (InputStream in = PlatformClassPath.class
-                .getResourceAsStream("resources/modules.xml")) {
-            return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+        String fn = System.getProperty("jdeps.modules.xml");
+        if (fn!= null) {
+            Path p = Paths.get(fn);
+            try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
+                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+            }
+        } else {
+            try (InputStream in = PlatformClassPath.class
+                    .getResourceAsStream("resources/jdeps-modules.xml")) {
+                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+            }
         }
     }
 
@@ -101,7 +110,7 @@
         LegacyImageHelper cfr = new LegacyImageHelper(home);
         List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives);
         try (InputStream in = PlatformClassPath.class
-                .getResourceAsStream("resources/modules.xml")) {
+                .getResourceAsStream("resources/jdeps-modules.xml")) {
             archives.addAll(ModulesXmlReader.loadFromImage(cfr, in));
             return archives;
         }