30 import com.sun.tools.classfile.ConstantPoolException; |
30 import com.sun.tools.classfile.ConstantPoolException; |
31 import com.sun.tools.classfile.RuntimeAnnotations_attribute; |
31 import com.sun.tools.classfile.RuntimeAnnotations_attribute; |
32 import com.sun.tools.classfile.Dependencies.ClassFileError; |
32 import com.sun.tools.classfile.Dependencies.ClassFileError; |
33 import java.io.IOException; |
33 import java.io.IOException; |
34 import java.io.InputStream; |
34 import java.io.InputStream; |
|
35 import java.io.BufferedInputStream; |
35 import java.nio.file.FileVisitResult; |
36 import java.nio.file.FileVisitResult; |
36 import java.nio.file.Files; |
37 import java.nio.file.Files; |
37 import java.nio.file.Path; |
38 import java.nio.file.Path; |
38 import java.nio.file.Paths; |
39 import java.nio.file.Paths; |
39 import java.nio.file.SimpleFileVisitor; |
40 import java.nio.file.SimpleFileVisitor; |
89 } |
90 } |
90 return modules; |
91 return modules; |
91 } |
92 } |
92 |
93 |
93 private static List<Archive> initModules(Path mpath) throws IOException { |
94 private static List<Archive> initModules(Path mpath) throws IOException { |
94 try (InputStream in = PlatformClassPath.class |
95 String fn = System.getProperty("jdeps.modules.xml"); |
95 .getResourceAsStream("resources/modules.xml")) { |
96 if (fn!= null) { |
96 return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in)); |
97 Path p = Paths.get(fn); |
|
98 try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) { |
|
99 return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in)); |
|
100 } |
|
101 } else { |
|
102 try (InputStream in = PlatformClassPath.class |
|
103 .getResourceAsStream("resources/jdeps-modules.xml")) { |
|
104 return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in)); |
|
105 } |
97 } |
106 } |
98 } |
107 } |
99 |
108 |
100 private static List<Archive> initLegacyImage(Path home) throws IOException { |
109 private static List<Archive> initLegacyImage(Path home) throws IOException { |
101 LegacyImageHelper cfr = new LegacyImageHelper(home); |
110 LegacyImageHelper cfr = new LegacyImageHelper(home); |
102 List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives); |
111 List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives); |
103 try (InputStream in = PlatformClassPath.class |
112 try (InputStream in = PlatformClassPath.class |
104 .getResourceAsStream("resources/modules.xml")) { |
113 .getResourceAsStream("resources/jdeps-modules.xml")) { |
105 archives.addAll(ModulesXmlReader.loadFromImage(cfr, in)); |
114 archives.addAll(ModulesXmlReader.loadFromImage(cfr, in)); |
106 return archives; |
115 return archives; |
107 } |
116 } |
108 } |
117 } |
109 |
118 |