You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2016/12/20 14:40:29 UTC

[1/2] commons-compress git commit: flag false positive

Repository: commons-compress
Updated Branches:
  refs/heads/master 2b5ba89b7 -> 85184c3a8


flag false positive


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ce6c33a2
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ce6c33a2
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ce6c33a2

Branch: refs/heads/master
Commit: ce6c33a2bb74d3faa76fce1c816dda24cee495fb
Parents: 2b5ba89
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Dec 20 15:35:52 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Dec 20 15:35:52 2016 +0100

----------------------------------------------------------------------
 .../commons/compress/archivers/zip/ZipArchiveOutputStream.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce6c33a2/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
----------------------------------------------------------------------
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 8ff10c0..e3066b0 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
@@ -292,7 +292,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
                 EnumSet.of(StandardOpenOption.CREATE, StandardOpenOption.WRITE,
                            StandardOpenOption.READ,
                            StandardOpenOption.TRUNCATE_EXISTING));
-            _streamCompressor = StreamCompressor.create(_channel, def);
+            // will never get opened properly when an exception is thrown so doesn't need to get closed
+            _streamCompressor = StreamCompressor.create(_channel, def); //NOSONAR
         } catch (final IOException e) {
             IOUtils.closeQuietly(_channel);
             _channel = null;


[2/2] commons-compress git commit: COMPRESS-377 properly close StreamCompressor

Posted by bo...@apache.org.
COMPRESS-377 properly close StreamCompressor


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/85184c3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/85184c3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/85184c3a

Branch: refs/heads/master
Commit: 85184c3a8945ee1cd22a3fa3a9b8cb71346f2d73
Parents: ce6c33a
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Dec 20 15:39:50 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Dec 20 15:39:50 2016 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                                          | 4 ++++
 .../commons/compress/archivers/zip/ScatterZipOutputStream.java   | 1 +
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/85184c3a/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 82f8c96..14e8df1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -90,6 +90,10 @@ The <action> type attribute can be add,update,fix,remove.
         ZipArchiveInputStream now throws an Exception if it encounters
         a broken ZIP archive rather than signaling end-of-archive.
       </action>
+      <action issue="COMPRESS-377" type="fix" date="2016-12-20">
+        ScatterZipOutputStream didn't close the StreamCompressor
+        causing a potential resource leak.
+      </action>
     </release>
     <release version="1.12" date="2016-06-21"
              description="Release 1.12 - API compatible to 1.11 but requires Java 6 at runtime.

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/85184c3a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
index 7c10d37..7e3bae0 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
@@ -125,6 +125,7 @@ public class ScatterZipOutputStream implements Closeable {
     @Override
     public void close() throws IOException {
         backingStore.close();
+        streamCompressor.close();
     }
 
     /**