-
Bug
-
Resolution: Won't Fix
-
P4
-
None
Consider the following code that expects to walk the contents of java.base:
ImageReader imageReader = ImageReaderFactory.getImageReader();
ImageReader.Node top = imageReader.findNode("/modules/java.base");
Deque<ImageReader.Node> stack = new ArrayDeque<>();
stack.push(top);
while (!stack.isEmpty()) {
ImageReader.Node dir = stack.poll();
for (ImageReader.Node node : dir.getChildren()) {
if (node.isDirectory()) {
stack.push(node);
} else {
System.out.println(node.getName());
}
}
}
It only prints out module-info.class when it should list all resources in the module.
The issue seems to be that getChildren() returns a Node that is not completed.
The ModuleReader list() implementation in jigsaw/jake works arounds this issue by calling findNode to re-find child nodes that are also directories.
ImageReader imageReader = ImageReaderFactory.getImageReader();
ImageReader.Node top = imageReader.findNode("/modules/java.base");
Deque<ImageReader.Node> stack = new ArrayDeque<>();
stack.push(top);
while (!stack.isEmpty()) {
ImageReader.Node dir = stack.poll();
for (ImageReader.Node node : dir.getChildren()) {
if (node.isDirectory()) {
stack.push(node);
} else {
System.out.println(node.getName());
}
}
}
It only prints out module-info.class when it should list all resources in the module.
The issue seems to be that getChildren() returns a Node that is not completed.
The ModuleReader list() implementation in jigsaw/jake works arounds this issue by calling findNode to re-find child nodes that are also directories.