fill nameMap outside of the loop parsing LFHs
@@ -295,6 +295,7 @@ private ZipFile(final SeekableByteChannel channel, final String archiveName,
final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag =
populateFromCentralDirectory();
resolveLocalFileHeaderData(entriesWithoutUTF8Flag);
+ fillNameMap();
success = true;
} finally {
closed = !success;
@@ -1064,7 +1065,13 @@ private void resolveLocalFileHeaderData(final Map<ZipArchiveEntry, NameAndCommen
ZipUtil.setNameAndCommentFromExtraFields(ze, nc.name,
nc.comment);
}
+ }
+ }
+ private void fillNameMap() {
+ for (final ZipArchiveEntry ze : entries) {
+ // entries is filled in populateFromCentralDirectory and
+ // never modified
final String name = ze.getName();
LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
if (entriesOfThatName == null) {
