You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/01 15:01:13 UTC

[commons-compress] 08/08: Use Objects.equals().

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

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

commit 99cc3fb7eeaed3eb7467c8771ab752f9999dd1ce
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 1 09:52:19 2020 -0500

    Use Objects.equals().
---
 .../org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index b611bda..e397fff 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 import java.util.zip.ZipException;
 
 import org.apache.commons.compress.archivers.ArchiveEntry;
@@ -995,11 +996,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
         final ZipArchiveEntry other = (ZipArchiveEntry) obj;
         final String myName = getName();
         final String otherName = other.getName();
-        if (myName == null) {
-            if (otherName != null) {
-                return false;
-            }
-        } else if (!myName.equals(otherName)) {
+        if (!Objects.equals(myName, otherName)) {
             return false;
         }
         String myComment = getComment();