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 f2d2a8b9c376725e118cd3f07981ecf33273e5d7
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jan 1 09:17:35 2023 -0500

    Use final
    
    - Use ternary
    - Less indentation
---
 .../commons/compress/archivers/zip/ZipArchiveEntry.java      | 12 ++++--------
 1 file changed, 4 insertions(+), 8 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 ee88c867..bf233b12 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
@@ -437,7 +437,7 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry 
implements ArchiveEn
         setExtra();
     }
 
-    private void internalAddExtraField(ZipExtraField ze) {
+    private void internalAddExtraField(final ZipExtraField ze) {
         if (ze instanceof UnparseableExtraFieldData) {
             unparseableExtra = (UnparseableExtraFieldData) ze;
         } else if (extraFields == null) {
@@ -487,11 +487,8 @@ public class ZipArchiveEntry extends 
java.util.zip.ZipEntry implements ArchiveEn
     public long getTime() {
         if (lastModifiedDateSet) {
             return getLastModifiedTime().toMillis();
-        } else if (time != -1) {
-            return time;
-        } else {
-            return super.getTime();
         }
+        return time != -1 ? time : super.getTime();
     }
 
     /**
@@ -1051,11 +1048,10 @@ public class ZipArchiveEntry extends 
java.util.zip.ZipEntry implements ArchiveEn
      * @param type the type of extra field to remove
      */
     public void removeExtraField(final ZipShort type) {
-        if (getExtraField(type) != null) {
-            internalRemoveExtraField(type);
-        } else {
+        if (getExtraField(type) == null) {
             throw new NoSuchElementException();
         }
+        internalRemoveExtraField(type);
         setExtra();
     }
 

Reply via email to