You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2019/08/23 15:13:16 UTC

[commons-compress] 02/05: avoid NPE warning in Sonar

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit b2f97b2460747c82329e1247c59e74d2cfee1cbd
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Fri Aug 23 16:55:00 2019 +0200

    avoid NPE warning in Sonar
---
 .../apache/commons/compress/archivers/zip/ZipArchiveInputStream.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index 5871598..5b711dd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -393,10 +393,10 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
         current.usesZip64 = z64 != null;
         if (!current.hasDataDescriptor) {
             if (z64 != null // same as current.usesZip64 but avoids NPE warning
-                    && (cSize.equals(ZipLong.ZIP64_MAGIC) || size.equals(ZipLong.ZIP64_MAGIC)) ) {
+                    && (ZipLong.ZIP64_MAGIC.equals(cSize) || ZipLong.ZIP64_MAGIC.equals(size)) ) {
                 current.entry.setCompressedSize(z64.getCompressedSize().getLongValue());
                 current.entry.setSize(z64.getSize().getLongValue());
-            } else {
+            } else if (cSize != null && size != null) {
                 current.entry.setCompressedSize(cSize.getValue());
                 current.entry.setSize(size.getValue());
             }