< prev index next >

test/jdk/tools/jimage/ImageReaderDuplicateChildNodesTest.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -66,21 +66,21 @@
              if (parent == null) {
                  throw new RuntimeException("ImageReader could not locate " + integersParentResource
                          + " in " + imagePath);
              }
              // now verify that the parent node which is a directory, doesn't have duplicate children
-             final List<ImageReader.Node> children = parent.getChildren();
-             if (children == null || children.isEmpty()) {
+             final List<String> childNames = parent.getChildNames().toList();
+             if (childNames.isEmpty()) {
                  throw new RuntimeException("ImageReader did not return any child resources under "
                          + integersParentResource + " in " + imagePath);
              }
              final Set<ImageReader.Node> uniqueChildren = new HashSet<>();
-             for (final ImageReader.Node child : children) {
-                 final boolean unique = uniqueChildren.add(child);
+             for (final String childName : childNames) {
+                 final boolean unique = uniqueChildren.add(reader.findNode(childName));
                  if (!unique) {
                      throw new RuntimeException("ImageReader returned duplicate child resource "
-                             + child + " under " + parent + " from image " + imagePath);
+                             + childName + " under " + parent + " from image " + imagePath);
                  }
              }
          }
      }
  }
< prev index next >