Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.20
-
None
-
None
Description
The following snippet of code throws an undeclared NullPointerException:
byte[] bytes = base64.getDecoder().decode("UEsDBAoACQAAAGu0ukYdiHewEwAAAAcAAAADABwAYWFhVVQDAAn5ygAAUEsFBgAAAAAC/////////0IAAAAABQAAUEsBAh4DCgAJAP8ABbS6RgAAAAAAIAAHAAAAAAAAAAAAAAABAABQSwUGAAAAAP///wU="); SeekableInMemoryByteChannel input = new SeekableInMemoryByteChannel(bytes); try { ZipFile file = new ZipFile(input); } catch (IOException ignored) {}
The stack trace is:
java.lang.NullPointerException: Cannot invoke "org.apache.commons.compress.archivers.zip.ZipLong.getBytes()" because "this.modifyTime" is null at org.apache.commons.compress.archivers.zip.X5455_ExtendedTimestamp.getLocalFileDataData(X5455_ExtendedTimestamp.java:180) at org.apache.commons.compress.archivers.zip.ExtraFieldUtils.mergeLocalFileDataData(ExtraFieldUtils.java:250) at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setExtra(ZipArchiveEntry.java:691) at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.addExtraField(ZipArchiveEntry.java:573) at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.mergeExtraFields(ZipArchiveEntry.java:903) at org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setExtra(ZipArchiveEntry.java:676) at org.apache.commons.compress.archivers.zip.ZipFile.resolveLocalFileHeaderData(ZipFile.java:1237) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:373) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:318) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:274)
I also attached the input as a ZIP file.