Fabian Meumertzheim created COMPRESS-568:
--------------------------------------------
Summary: NullPointerException in
X5455_ExtendedTimestamp.getLocalFileDataData
Key: COMPRESS-568
URL: https://issues.apache.org/jira/browse/COMPRESS-568
Project: Commons Compress
Issue Type: Bug
Affects Versions: 1.20
Reporter: Fabian Meumertzheim
Attachments: npe.zip
The following snippet of code throws an undeclared NullPointerException:
{code:java}
byte[] bytes =
base64.getDecoder().decode("UEsDBAoACQAAAGu0ukYdiHewEwAAAAcAAAADABwAYWFhVVQDAAn5ygAAUEsFBgAAAAAC/////////0IAAAAABQAAUEsBAh4DCgAJAP8ABbS6RgAAAAAAIAAHAAAAAAAAAAAAAAABAABQSwUGAAAAAP///wU=");
SeekableInMemoryByteChannel input = new SeekableInMemoryByteChannel(bytes);
try { ZipFile file = new ZipFile(input); } catch (IOException ignored) {}
{code}
The stack trace is:
{noformat}
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)
{noformat}
I also attached the input as a ZIP file.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)