Skip to content

Commit e5c7293

Browse files
david-beaumontRoger Riggs
authored andcommitted
8371645: BasicImageReader getEntryNames() is stateful and cannot be called more than once
Reviewed-by: alanb, rriggs
1 parent 56a27d1 commit e5c7293

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,12 @@ private int getLocationIndex(String module, String name) {
317317
}
318318

319319
public String[] getEntryNames() {
320-
int[] attributeOffsets = new int[offsets.capacity()];
321-
offsets.get(attributeOffsets);
322-
return IntStream.of(attributeOffsets)
323-
.filter(o -> o != 0)
324-
.mapToObj(o -> ImageLocation.readFrom(this, o).getFullName())
325-
.sorted()
326-
.toArray(String[]::new);
320+
return IntStream.range(0, offsets.capacity())
321+
.map(offsets::get)
322+
.filter(o -> o != 0)
323+
.mapToObj(o -> ImageLocation.readFrom(this, o).getFullName())
324+
.sorted()
325+
.toArray(String[]::new);
327326
}
328327

329328
ImageLocation getLocation(int offset) {

0 commit comments

Comments
 (0)