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


The following commit(s) were added to refs/heads/master by this push:
     new 97a392346 [COMPRESS-654] Add test
97a392346 is described below

commit 97a392346a0abf973e402145d78d2ecfcadb0482
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Feb 1 09:03:13 2024 -0500

    [COMPRESS-654] Add test
---
 .../apache/commons/compress/archivers/Lister.java  |   2 +-
 .../commons/compress/archivers/ListerTest.java     |  44 +++++++++++++++++++++
 .../COMPRESS-654/ruff-aarch64-apple-darwin.tar     | Bin 0 -> 13200896 bytes
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java 
b/src/main/java/org/apache/commons/compress/archivers/Lister.java
index 667e58b03..dc7f5d3a8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/Lister.java
+++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java
@@ -111,7 +111,7 @@ public final class Lister {
      * @throws ArchiveException Archiver related Exception.
      * @throws IOException      an I/O exception.
      */
-    public static void main(final String[] args) throws ArchiveException, 
IOException {
+    public static void main(final String... args) throws ArchiveException, 
IOException {
         if (args == null || args.length == 0) {
             usage();
             return;
diff --git 
a/src/test/java/org/apache/commons/compress/archivers/ListerTest.java 
b/src/test/java/org/apache/commons/compress/archivers/ListerTest.java
new file mode 100644
index 000000000..c179ab2ba
--- /dev/null
+++ b/src/test/java/org/apache/commons/compress/archivers/ListerTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.compress.archivers;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+public class ListerTest {
+
+    @Test
+    public void testCompress654() throws ArchiveException, IOException {
+//        Analysing ruff-aarch64-apple-darwin.tar
+//        Created 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream@17f052a3
+//        ruff
+//        Exception in thread "main" java.io.IOException: Truncated TAR archive
+//        at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:694)
+//        at 
org.apache.commons.compress.utils.IOUtils.readFully(IOUtils.java:244)
+//        at org.apache.commons.compress.utils.IOUtils.skip(IOUtils.java:355)
+//        at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:451)
+//        at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:426)
+//        at 
org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextEntry(TarArchiveInputStream.java:50)
+//        at 
org.apache.commons.compress.archivers.Lister.listStream(Lister.java:79)
+//        at org.apache.commons.compress.archivers.Lister.main(Lister.java:133)
+        
Lister.main("src/test/resources/org/apache/commons/compress/COMPRESS-654/ruff-aarch64-apple-darwin.tar");
+    }
+}
diff --git 
a/src/test/resources/org/apache/commons/compress/COMPRESS-654/ruff-aarch64-apple-darwin.tar
 
b/src/test/resources/org/apache/commons/compress/COMPRESS-654/ruff-aarch64-apple-darwin.tar
new file mode 100644
index 000000000..09ed3495d
Binary files /dev/null and 
b/src/test/resources/org/apache/commons/compress/COMPRESS-654/ruff-aarch64-apple-darwin.tar
 differ

Reply via email to