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 2023/01/01 14:14:32 UTC

[commons-compress] branch master updated (41ee8551 -> ccf26f1d)

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

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


    from 41ee8551 Use JUnit 5 assertions in JUnit 5 tests instead of JUnit 4 classes #346
     new aff44ebc Use curly-only array declaration
     new a31e0c94 Use final
     new 0b4a04e5 Use final
     new 1e1bdcb9 Use curly-only array declaration
     new 1cddcdc0 Use final
     new ccf26f1d Remove unused import

The 6 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/zip/ZipArchiveOutputStream.java      |  1 -
 .../archivers/jar/JarArchiveOutputStreamTest.java  |  4 ++--
 .../compress/archivers/tar/TarUtilsTest.java       |  2 +-
 .../compress/archivers/zip/AsiExtraFieldTest.java  |  6 +++---
 .../archivers/zip/ZipArchiveEntryTest.java         | 24 +++++++++++-----------
 .../FramedSnappyCompressorInputStreamTest.java     |  2 +-
 6 files changed, 19 insertions(+), 20 deletions(-)


[commons-compress] 01/06: Use curly-only array declaration

Posted by gg...@apache.org.
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 aff44ebc2c586ab6f44a84c24b3d910684c454a8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:58:28 2023 -0500

    Use curly-only array declaration
---
 .../apache/commons/compress/archivers/zip/AsiExtraFieldTest.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
index 2ac79bb7..048e82c3 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/AsiExtraFieldTest.java
@@ -117,7 +117,7 @@ public class AsiExtraFieldTest implements UnixStat {
         assertEquals(5, a1.getUserId(), "uid plain file");
         assertEquals(6, a1.getGroupId(), "gid plain file");
 
-        final byte[] data2 = new byte[] {0x75, (byte)0x8E, 0x41, (byte)0xFD, // CRC
+        final byte[] data2 = {0x75, (byte)0x8E, 0x41, (byte)0xFD,            // CRC
                                          0123, (byte)0xA0,                   // mode
                                          4, 0, 0, 0,                         // link length
                                          5, 0, 6, 0,                         // uid, gid
@@ -132,7 +132,7 @@ public class AsiExtraFieldTest implements UnixStat {
         assertEquals(6, a2.getGroupId(), "gid link");
         assertEquals("test", a2.getLinkedFile());
 
-        final byte[] data3 = new byte[] {(byte)0x8E, 0x01, (byte)0xBF, (byte)0x0E, // CRC
+        final byte[] data3 = {(byte)0x8E, 0x01, (byte)0xBF, (byte)0x0E,            // CRC
                                          0123, (byte)0x40,                         // mode
                                          0, 0, 0, 0,                               // link
                                          5, 0, 6, 0};                              // uid, gid
@@ -145,7 +145,7 @@ public class AsiExtraFieldTest implements UnixStat {
         assertEquals(5, a3.getUserId(), "uid dir");
         assertEquals(6, a3.getGroupId(), "gid dir");
 
-        final byte[] data4 = new byte[] {0, 0, 0, 0,                           // bad CRC
+        final byte[] data4 = {0, 0, 0, 0,                                      // bad CRC
                                          0123, (byte)0x40,                     // mode
                                          0, 0, 0, 0,                           // link
                                          5, 0, 6, 0};                          // uid, gid


[commons-compress] 04/06: Use curly-only array declaration

Posted by gg...@apache.org.
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 1e1bdcb9f63d9f8381ddd012740c8543164415eb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:59:10 2023 -0500

    Use curly-only array declaration
---
 .../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 bf99d211..2cf054c1 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
@@ -465,7 +465,7 @@ public class TarUtilsTest {
         assertThrows(IllegalArgumentException.class, () -> TarUtils.parseOctal(buffer1, 0, buffer1.length),
                 "Expected IllegalArgumentException - should be at least 2 bytes long");
 
-        final byte[] buffer2 = new byte[]{0}; // 1-byte array
+        final byte[] buffer2 = {0}; // 1-byte array
         assertThrows(IllegalArgumentException.class, () -> TarUtils.parseOctal(buffer2, 0, buffer2.length),
                 "Expected IllegalArgumentException - should be at least 2 bytes long");
 


[commons-compress] 03/06: Use final

Posted by gg...@apache.org.
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 0b4a04e508b20a5dedb9c4e45f88e3b691630b07
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:58:56 2023 -0500

    Use final
---
 .../commons/compress/archivers/jar/JarArchiveOutputStreamTest.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
index 1a94e4e7..d050865e 100644
--- a/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
@@ -45,12 +45,12 @@ public class JarArchiveOutputStreamTest {
         try {
 
             out = new JarArchiveOutputStream(Files.newOutputStream(testArchive.toPath()));
-            ZipArchiveEntry ze1 = new ZipArchiveEntry("foo/");
+            final ZipArchiveEntry ze1 = new ZipArchiveEntry("foo/");
             // Ensure we won't accidentally add an Extra field.
             ze1.setTime(Instant.parse("2022-12-27T12:10:23Z").toEpochMilli());
             out.putArchiveEntry(ze1);
             out.closeArchiveEntry();
-            ZipArchiveEntry ze2 = new ZipArchiveEntry("bar/");
+            final ZipArchiveEntry ze2 = new ZipArchiveEntry("bar/");
             // Ensure we won't accidentally add an Extra field.
             ze2.setTime(Instant.parse("2022-12-28T02:56:01Z").toEpochMilli());
             out.putArchiveEntry(ze2);


[commons-compress] 02/06: Use final

Posted by gg...@apache.org.
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 a31e0c94f002d25f1ee235b528406d57a4275de0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:58:43 2023 -0500

    Use final
---
 .../compressors/snappy/FramedSnappyCompressorInputStreamTest.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
index 07bd8a21..d6acbe41 100644
--- a/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStreamTest.java
@@ -186,7 +186,7 @@ public final class FramedSnappyCompressorInputStreamTest
         };
         try (final FramedSnappyCompressorInputStream in =
                      new FramedSnappyCompressorInputStream(new ByteArrayInputStream(input))) {
-            IOException exception = assertThrows(IOException.class, () -> in.read());
+            final IOException exception = assertThrows(IOException.class, () -> in.read());
             assertTrue(exception.getMessage().contains("Unskippable chunk"));
         } catch (final IOException ex) {
         }


[commons-compress] 05/06: Use final

Posted by gg...@apache.org.
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 1cddcdc0ad44d1128f633cbfccaeacdf540a0d99
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:59:40 2023 -0500

    Use final
---
 .../archivers/zip/ZipArchiveEntryTest.java         | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
index 492e3d08..a64e8734 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntryTest.java
@@ -400,12 +400,12 @@ public class ZipArchiveEntryTest {
 
         assertEquals(time.toMillis(), ze.getTime());
         assertEquals(time, ze.getLastModifiedTime());
-        X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
+        final X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
         assertNotNull(extendedTimestamp);
         assertEquals(TimeUtils.toUnixTime(time), extendedTimestamp.getModifyTime().getValue());
         assertNull(extendedTimestamp.getAccessTime());
         assertNull(extendedTimestamp.getCreateTime());
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(0L, ntfs.getAccessTime().getLongValue());
@@ -421,7 +421,7 @@ public class ZipArchiveEntryTest {
         assertEquals(time.toMillis(), ze.getTime());
         assertEquals(time, ze.getLastModifiedTime());
         assertNull(ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID));
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(0L, ntfs.getAccessTime().getLongValue());
@@ -436,12 +436,12 @@ public class ZipArchiveEntryTest {
 
         assertEquals(time.toMillis(), ze.getTime());
         assertEquals(time, ze.getLastModifiedTime());
-        X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
+        final X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
         assertNotNull(extendedTimestamp);
         assertEquals(TimeUtils.toUnixTime(time), extendedTimestamp.getModifyTime().getValue());
         assertNull(extendedTimestamp.getAccessTime());
         assertNull(extendedTimestamp.getCreateTime());
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(0L, ntfs.getAccessTime().getLongValue());
@@ -458,11 +458,11 @@ public class ZipArchiveEntryTest {
 
         assertEquals(time, ze.getTime());
         assertEquals(time, ze.getLastModifiedTime().toMillis());
-        X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
+        final X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
         assertNotNull(extendedTimestamp);
         assertEquals(TimeUtils.toUnixTime(lastAccessTime), extendedTimestamp.getAccessTime().getValue());
         assertNull(extendedTimestamp.getCreateTime());
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(TimeUtils.toNtfsTime(lastAccessTime), ntfs.getAccessTime().getLongValue());
@@ -479,11 +479,11 @@ public class ZipArchiveEntryTest {
 
         assertEquals(time, ze.getTime());
         assertEquals(time, ze.getLastModifiedTime().toMillis());
-        X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
+        final X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
         assertNotNull(extendedTimestamp);
         assertNull(extendedTimestamp.getAccessTime());
         assertEquals(TimeUtils.toUnixTime(creationTime), extendedTimestamp.getCreateTime().getValue());
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(0L, ntfs.getAccessTime().getLongValue());
@@ -502,11 +502,11 @@ public class ZipArchiveEntryTest {
 
         assertEquals(time, ze.getTime());
         assertEquals(time, ze.getLastModifiedTime().toMillis());
-        X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
+        final X5455_ExtendedTimestamp extendedTimestamp = (X5455_ExtendedTimestamp) ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID);
         assertNotNull(extendedTimestamp);
         assertEquals(TimeUtils.toUnixTime(accessTime), extendedTimestamp.getAccessTime().getValue());
         assertEquals(TimeUtils.toUnixTime(creationTime), extendedTimestamp.getCreateTime().getValue());
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(TimeUtils.toNtfsTime(accessTime), ntfs.getAccessTime().getLongValue());
@@ -526,7 +526,7 @@ public class ZipArchiveEntryTest {
         assertEquals(time, ze.getTime());
         assertEquals(time, ze.getLastModifiedTime().toMillis());
         assertNull(ze.getExtraField(X5455_ExtendedTimestamp.HEADER_ID));
-        X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
+        final X000A_NTFS ntfs = (X000A_NTFS) ze.getExtraField(X000A_NTFS.HEADER_ID);
         assertNotNull(ntfs);
         assertEquals(TimeUtils.toNtfsTime(time), ntfs.getModifyTime().getLongValue());
         assertEquals(TimeUtils.toNtfsTime(accessTime), ntfs.getAccessTime().getLongValue());


[commons-compress] 06/06: Remove unused import

Posted by gg...@apache.org.
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 ccf26f1d4084c622ab1236daccf6c0df2f71e92b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 09:11:33 2023 -0500

    Remove unused import
---
 .../apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java    | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 3800c921..babef127 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@ -29,7 +29,6 @@ import java.nio.file.LinkOption;
 import java.nio.file.OpenOption;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
-import java.util.Calendar;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedList;