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 2026/07/14 17:32:53 UTC

(commons-compress) branch master updated (65cef25a6 -> ed1688069)

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

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


    from 65cef25a6 Sort members.
     new 5d2aa430e Use final
     new c6a6e1eb6 Use final
     new 2d67854c8 Use compact array declaration.
     new 61bb6f526 Remove extra parentheses
     new 16e9af271 Merge if statements
     new 9ef3ff4c3 Add @Override
     new f1facbb25 Use final
     new 699e96547 Use final
     new 1acb51e02 Use final
     new 6596145fc Use final
     new cde5f03b9 Remove extra parentheses
     new ed1688069 Remove extra parentheses

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../archivers/cpio/CpioArchiveInputStream.java      | 21 +++------------------
 .../archivers/tar/TarArchiveInputStream.java        |  4 ++--
 .../tar/TarArchiveSparseZeroInputStream.java        |  2 +-
 .../commons/compress/archivers/tar/TarFile.java     |  2 +-
 .../harmony/internal/AttributeLayoutParser.java     |  4 ++--
 .../commons/compress/harmony/pack200/IcBands.java   |  1 +
 .../commons/compress/harmony/unpack200/BandSet.java |  2 +-
 .../harmony/unpack200/NewAttributeBands.java        | 12 ++++++------
 .../bytecode/LineNumberTableAttribute.java          |  2 +-
 .../apache/commons/compress/utils/ArchiveUtils.java |  2 +-
 .../compress/archivers/tar/TarUtilsTest.java        |  2 +-
 .../bzip2/BZip2CompressorInputStreamTest.java       |  2 +-
 12 files changed, 21 insertions(+), 35 deletions(-)


(commons-compress) 09/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1acb51e0264eb602ce6b20d2bf506b368ba7a20b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:30:12 2026 -0400

    Use final
    
    Remove extra parentheses.
---
 .../apache/commons/compress/archivers/tar/TarArchiveInputStream.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 5bdc5921a..ed6b61006 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -660,7 +660,7 @@ public boolean markSupported() {
      * @throws IOException on error.
      */
     @Override
-    public int read(final byte[] buf, final int offset, int numToRead) throws IOException {
+    public int read(final byte[] buf, final int offset, final int numToRead) throws IOException {
         IOUtils.checkFromIndexSize(buf, offset, numToRead);
         if (numToRead == 0) {
             return 0;
@@ -763,7 +763,7 @@ public long skip(final long n) throws IOException {
     private void skipRecordPadding() throws IOException {
         final long entrySize = currEntry != null ? currEntry.getSize() : 0;
         if (!isDirectory() && entrySize > 0 && entrySize % getRecordSize() != 0) {
-            final long padding = getRecordSize() - (entrySize % getRecordSize());
+            final long padding = getRecordSize() - entrySize % getRecordSize();
             final long skipped = IOUtils.skip(in, padding);
             count(skipped);
             if (skipped != padding) {


(commons-compress) 08/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 699e96547fe2f249f1d7993d5f56079c0d831ebb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:28:03 2026 -0400

    Use final
---
 .../compress/harmony/unpack200/NewAttributeBands.java        | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
index fe6821c38..5af5ee141 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
@@ -81,32 +81,32 @@ private interface AttributeLayoutElement {
     private class AttributeLayoutFactory implements AttributeLayoutParser.Factory<LayoutElement> {
 
         @Override
-        public LayoutElement createCall(int callableIndex) {
+        public LayoutElement createCall(final int callableIndex) {
             return new Call(callableIndex);
         }
 
         @Override
-        public LayoutElement createCallable(List<LayoutElement> body) throws Pack200Exception {
+        public LayoutElement createCallable(final List<LayoutElement> body) throws Pack200Exception {
             return new Callable(body);
         }
 
         @Override
-        public LayoutElement createIntegral(String tag) {
+        public LayoutElement createIntegral(final String tag) {
             return new Integral(tag);
         }
 
         @Override
-        public LayoutElement createReference(String tag) {
+        public LayoutElement createReference(final String tag) {
             return new Reference(tag);
         }
 
         @Override
-        public LayoutElement createReplication(String unsignedInt, List<LayoutElement> body) throws Pack200Exception {
+        public LayoutElement createReplication(final String unsignedInt, final List<LayoutElement> body) throws Pack200Exception {
             return new Replication(unsignedInt, body);
         }
 
         @Override
-        public LayoutElement createUnion(String anyInt, List<UnionCaseData<LayoutElement>> cases, List<LayoutElement> body) throws Pack200Exception {
+        public LayoutElement createUnion(final String anyInt, final List<UnionCaseData<LayoutElement>> cases, final List<LayoutElement> body) throws Pack200Exception {
             final List<UnionCase> unionCases = new ArrayList<>();
             for (final UnionCaseData<LayoutElement> unionCaseData : cases) {
                 unionCases.add(new UnionCase(unionCaseData.tagRanges, unionCaseData.body, false));


(commons-compress) 06/12: Add @Override

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9ef3ff4c3264bfd6f4e6322c0d3ccce26718e37d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:27:24 2026 -0400

    Add @Override
---
 src/main/java/org/apache/commons/compress/harmony/pack200/IcBands.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/IcBands.java b/src/main/java/org/apache/commons/compress/harmony/pack200/IcBands.java
index cec570ee8..fb2b01f25 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/IcBands.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/IcBands.java
@@ -63,6 +63,7 @@ public boolean equals(final Object o) {
             return false;
         }
 
+        @Override
         public int hashCode() {
             return Objects.hash(C, F, C2, N);
         }


(commons-compress) 12/12: Remove extra parentheses

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ed168806927e198490dd4ba00f5b2ed5c5f67c94
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:32:10 2026 -0400

    Remove extra parentheses
---
 .../java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
index 8da7f8e13..0689677f0 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
@@ -104,7 +104,7 @@ private static String createPosixLongNameByUtf8Bytes(final int totalBytes) {
     private static byte[] paddedUtf8Bytes(final String s) {
         final int blockSize = 1024;
         final byte[] bytes = s.getBytes(UTF_8);
-        return Arrays.copyOf(bytes, ((bytes.length + blockSize - 1) / blockSize) * blockSize);
+        return Arrays.copyOf(bytes, (bytes.length + blockSize - 1) / blockSize * blockSize);
     }
 
     private static Map<String, String> parsePaxHeaders(final byte[] data, final List<TarArchiveStructSparse> sparseHeaders,


(commons-compress) 10/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6596145fc30987a61efb778b4c22c405894e43b9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:30:22 2026 -0400

    Use final
---
 .../commons/compress/archivers/tar/TarArchiveSparseZeroInputStream.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseZeroInputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseZeroInputStream.java
index 8bffc08a5..e9db8d747 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseZeroInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveSparseZeroInputStream.java
@@ -40,7 +40,7 @@ public int read() {
     }
 
     @Override
-    public int read(byte[] b, int off, int len) throws IOException {
+    public int read(final byte[] b, final int off, final int len) throws IOException {
         IOUtils.checkFromIndexSize(b, off, len);
         if (len == 0) {
             return 0;


(commons-compress) 02/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c6a6e1eb6ede274a533e75039c6fe065d2572a67
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:25:02 2026 -0400

    Use final
---
 .../commons/compress/harmony/internal/AttributeLayoutParser.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/internal/AttributeLayoutParser.java b/src/main/java/org/apache/commons/compress/harmony/internal/AttributeLayoutParser.java
index edfece93f..1864143e1 100644
--- a/src/main/java/org/apache/commons/compress/harmony/internal/AttributeLayoutParser.java
+++ b/src/main/java/org/apache/commons/compress/harmony/internal/AttributeLayoutParser.java
@@ -156,9 +156,9 @@ private boolean eof() {
         return p >= definition.length();
     }
 
-    private char expect(char... expected) throws Pack200Exception {
+    private char expect(final char... expected) throws Pack200Exception {
         final char c = next();
-        for (char e : expected) {
+        for (final char e : expected) {
             if (c == e) {
                 return c;
             }


(commons-compress) 01/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5d2aa430ee0e1b6b9b7d5b5032f4b2563effdf3c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:24:36 2026 -0400

    Use final
---
 src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
index b3f25137c..77bea1d8a 100644
--- a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
@@ -46,7 +46,7 @@ public class ArchiveUtils {
      * @throws MemoryLimitException If the length is valid, but too large for the current JVM to handle.
      * @since 1.29.0
      */
-    public static int checkEntryNameLength(long length, int maxEntryNameLength, String archiveType)
+    public static int checkEntryNameLength(final long length, final int maxEntryNameLength, final String archiveType)
             throws ArchiveException, MemoryLimitException {
         if (length > maxEntryNameLength) {
             throw new ArchiveException("Invalid %s archive entry: Invalid file name length %,d (must be between 1 and %,d). If the file is not corrupt, " +


(commons-compress) 11/12: Remove extra parentheses

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cde5f03b96fee2419e079cf2048dc9559be4aa71
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:31:54 2026 -0400

    Remove extra parentheses
---
 src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
index 2b2c3711c..54c36dd3d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
@@ -619,7 +619,7 @@ protected final void setAtEOF(final boolean eof) {
      */
     private void skipRecordPadding() throws IOException {
         if (!isDirectory() && currEntry.getSize() > 0 && currEntry.getSize() % recordSize != 0) {
-            final long padding = recordSize - (currEntry.getSize() % recordSize);
+            final long padding = recordSize - currEntry.getSize() % recordSize;
             repositionForwardBy(padding);
             throwExceptionIfPositionIsNotInArchive();
         }


(commons-compress) 03/12: Use compact array declaration.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2d67854c8527bf218d15c65e034fb696f2d0a13a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:25:36 2026 -0400

    Use compact array declaration.
---
 .../java/org/apache/commons/compress/harmony/unpack200/BandSet.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/BandSet.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/BandSet.java
index 8f7c1314e..856a17d2e 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/BandSet.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/BandSet.java
@@ -47,7 +47,7 @@
  */
 public abstract class BandSet {
 
-    private static final String[][] EMPTY_STRINGS = new String[][] { {} };
+    private static final String[][] EMPTY_STRINGS = { {} };
 
     static int sumPositive(final int[] counts) throws Pack200Exception {
         int totalCount = 0;


(commons-compress) 05/12: Merge if statements

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 16e9af2718804cf4926d4d59bca8f7ab9f167320
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:27:04 2026 -0400

    Merge if statements
---
 .../archivers/cpio/CpioArchiveInputStream.java      | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
index 321ab10bc..f258b2e6b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
@@ -143,29 +143,14 @@ public static boolean matches(final byte[] signature, final int length) {
         }
         // Check Ascii (String) values
         // 3037 3037 30nn
-        if (signature[0] != 0x30) {
-            return false;
-        }
-        if (signature[1] != 0x37) {
-            return false;
-        }
-        if (signature[2] != 0x30) {
-            return false;
-        }
-        if (signature[3] != 0x37) {
+        if (signature[0] != 0x30 || signature[1] != 0x37 || signature[2] != 0x30 || signature[3] != 0x37) {
             return false;
         }
         if (signature[4] != 0x30) {
             return false;
         }
         // Check last byte
-        if (signature[5] == 0x31) {
-            return true;
-        }
-        if (signature[5] == 0x32) {
-            return true;
-        }
-        if (signature[5] == 0x37) {
+        if (signature[5] == 0x31 || signature[5] == 0x32 || signature[5] == 0x37) {
             return true;
         }
         return false;
@@ -419,7 +404,7 @@ private long readBinaryLong(final int length, final boolean swapHalfWord) throws
         return CpioUtil.byteArray2long(tmp, swapHalfWord);
     }
 
-    private String readEntryName(int lengthWithNull) throws IOException {
+    private String readEntryName(final int lengthWithNull) throws IOException {
         final int length = ArchiveUtils.checkEntryNameLength(lengthWithNull - 1, getMaxEntryNameLength(), "CPIO");
         // don't include trailing NUL in file name to decode
         final byte[] tmpBuffer = readRange(length);


(commons-compress) 04/12: Remove extra parentheses

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 61bb6f52633ff113878f0be5decace63f4956886
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:25:58 2026 -0400

    Remove extra parentheses
---
 .../compress/compressors/bzip2/BZip2CompressorInputStreamTest.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
index 4f186148f..0095cf5c3 100644
--- a/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStreamTest.java
@@ -110,7 +110,7 @@ void testCreateHuffmanDecodingTablesWithLargeAlphaSize() {
         final char[] codeLengths = new char[258];
         for (int i = 0; i < codeLengths.length; i++) {
             // Use all code lengths within valid range [1, 20]
-            codeLengths[i] = (char) ((i % MAX_CODE_LEN) + 1);
+            codeLengths[i] = (char) (i % MAX_CODE_LEN + 1);
         }
         data.temp_charArray2d[0] = codeLengths;
         assertDoesNotThrow(


(commons-compress) 07/12: Use final

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f1facbb254286271d56543289e317a40b5684ba9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 14 13:27:36 2026 -0400

    Use final
---
 .../compress/harmony/unpack200/bytecode/LineNumberTableAttribute.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/LineNumberTableAttribute.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/LineNumberTableAttribute.java
index dd906eea2..ed692b457 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/LineNumberTableAttribute.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/LineNumberTableAttribute.java
@@ -39,7 +39,7 @@ public static void setAttributeName(final CPUTF8 cpUTF8Value) {
         attributeName = cpUTF8Value;
     }
 
-    private int lineNumberTableLength;
+    private final int lineNumberTableLength;
     private final int[] startPcs;
     private final int[] lineNumbers;