8132994: /modules and /packages should not be parsed by the jimage parser
Reviewed-by: sundar
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java Mon Apr 25 16:34:03 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java Tue Apr 26 11:55:52 2016 -0300
@@ -61,24 +61,32 @@
String baseName;
String extensionName = "";
- int offset = fullName.indexOf('/', 1);
- if (fullName.length() >= 2 && fullName.charAt(0) == '/' && offset != -1) {
- moduleName = fullName.substring(1, offset);
- fullName = fullName.substring(offset + 1);
- }
+ if (fullName.startsWith("/modules/")) {
+ moduleName = "modules";
+ baseName = fullName.substring("/modules/".length());
+ } else if ( fullName.startsWith("/packages/")) {
+ moduleName = "packages";
+ baseName = fullName.substring("/packages/".length());
+ } else {
+ int offset = fullName.indexOf('/', 1);
+ if (fullName.length() >= 2 && fullName.charAt(0) == '/' && offset != -1) {
+ moduleName = fullName.substring(1, offset);
+ fullName = fullName.substring(offset + 1);
+ }
- offset = fullName.lastIndexOf('/');
- if (1 < offset) {
- parentName = fullName.substring(0, offset);
- fullName = fullName.substring(offset + 1);
- }
+ offset = fullName.lastIndexOf('/');
+ if (1 < offset) {
+ parentName = fullName.substring(0, offset);
+ fullName = fullName.substring(offset + 1);
+ }
- offset = fullName.lastIndexOf('.');
- if (offset != -1) {
- baseName = fullName.substring(0, offset);
- extensionName = fullName.substring(offset + 1);
- } else {
- baseName = fullName;
+ offset = fullName.lastIndexOf('.');
+ if (offset != -1) {
+ baseName = fullName.substring(0, offset);
+ extensionName = fullName.substring(offset + 1);
+ } else {
+ baseName = fullName;
+ }
}
return new ImageLocationWriter(strings)