changeset 14293:5e70a502b37c

8132994: /modules and /packages should not be parsed by the jimage parser Reviewed-by: sundar
author jlaskey
date Tue, 26 Apr 2016 11:55:52 -0300
parents d24c177b70ac
children ae10dd067bcd
files src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java
diffstat 1 files changed, 24 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageLocationWriter.java	Mon Apr 25 16:34:03 2016 -0700
+++ b/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)