< prev index next >

src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java

Print this page
@@ -296,11 +296,11 @@
          } else if (!parent.mkdirs()) {
              throw TASK_HELPER.newBadArgs("err.cannot.create.dir",
                                          parent.getAbsolutePath());
          }
  
-         if (!ImageResourcesTree.isTreeInfoResource(name)) {
+         if (location.getType() == ImageLocation.LocationType.RESOURCE) {
              Files.write(resource.toPath(), bytes);
          }
      }
  
      private static final int OFFSET_WIDTH = 12;

@@ -413,25 +413,22 @@
  
                          if (!match) {
                              continue;
                          }
  
-                         if (!ImageResourcesTree.isTreeInfoResource(name)) {
+                         ImageLocation location = reader.findLocation(name);
+                         if (location.getType() == ImageLocation.LocationType.RESOURCE) {
                              if (moduleAction != null) {
-                                 int offset = name.indexOf('/', 1);
- 
-                                 String newModule = offset != -1 ?
-                                         name.substring(1, offset) :
-                                         "<unknown>";
- 
+                                 String newModule = location.getModule();
+                                 if (newModule.isEmpty()) {
+                                     newModule = "<unknown>";
+                                 }
                                  if (!oldModule.equals(newModule)) {
                                      moduleAction.apply(reader, oldModule, newModule);
                                      oldModule = newModule;
                                  }
                              }
- 
-                             ImageLocation location = reader.findLocation(name);
                              resourceAction.apply(reader, name, location);
                          }
                      }
                  }
              } catch (IOException ioe) {
< prev index next >