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 2024/02/12 14:16:10 UTC

(commons-compress) branch master updated (baef89a20 -> 7ec306bb4)

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 baef89a20 Remove whitespace
     new 97365da27 Use IOUtils.closeQuietly()
     new 7ec306bb4 Javadoc

The 2 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:
 .../commons/compress/harmony/pack200/Archive.java   |  4 ++--
 .../commons/compress/harmony/unpack200/Archive.java | 21 +++++----------------
 2 files changed, 7 insertions(+), 18 deletions(-)


(commons-compress) 01/02: Use IOUtils.closeQuietly()

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 97365da279788efbdc163a99bc567eb10f044208
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Feb 12 09:15:46 2024 -0500

    Use IOUtils.closeQuietly()
    
    Inline single use local variable
---
 .../commons/compress/harmony/unpack200/Archive.java | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
index 287882171..6b41eff9e 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
@@ -31,6 +31,7 @@ import java.util.jar.JarOutputStream;
 import java.util.zip.GZIPInputStream;
 
 import org.apache.commons.compress.harmony.pack200.Pack200Exception;
+import org.apache.commons.io.IOUtils;
 
 /**
  * Archive is the main entry point to unpack200. An archive is constructed with either two file names, a pack file and an output file name or an input stream
@@ -202,26 +203,14 @@ public class Archive {
                 }
             }
         } finally {
-            try {
-                inputStream.close();
-            } catch (final Exception e) {
-            }
-            try {
-                outputStream.close();
-            } catch (final Exception e) {
-            }
-            if (logFile != null) {
-                try {
-                    logFile.close();
-                } catch (final Exception e) {
-                }
-            }
+            IOUtils.closeQuietly(inputStream);
+            IOUtils.closeQuietly(outputStream);
+            IOUtils.closeQuietly(logFile);
         }
         if (removePackFile) {
             boolean deleted = false;
             if (inputFileName != null) {
-                final File file = new File(inputFileName);
-                deleted = file.delete();
+                deleted = new File(inputFileName).delete();
             }
             if (!deleted) {
                 throw new Pack200Exception("Failed to delete the input file.");


(commons-compress) 02/02: Javadoc

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 7ec306bb4f8962a9873593fbec0d8424f9e0fe69
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Feb 12 09:16:05 2024 -0500

    Javadoc
---
 .../java/org/apache/commons/compress/harmony/pack200/Archive.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java b/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java
index 08ac8912a..4256a8936 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java
@@ -170,7 +170,7 @@ public class Archive {
      *
      * @param inputStream  TODO
      * @param outputStream TODO
-     * @param options      - packing options (if null then defaults are used)
+     * @param options      packing options (if null then defaults are used)
      * @throws IOException If an I/O error occurs.
      */
     public Archive(final JarInputStream inputStream, OutputStream outputStream, PackingOptions options) throws IOException {
@@ -265,7 +265,7 @@ public class Archive {
     }
 
     /**
-     * Pack the archive
+     * Packs the archive.
      *
      * @throws Pack200Exception TODO
      * @throws IOException      If an I/O error occurs.