You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/04/09 12:07:12 UTC

[cxf] branch 3.3.x-fixes updated (ed4a82a -> cd8c352)

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

reta pushed a change to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from ed4a82a  Build fix
     new 0324562  CXF-8442 Java 16 & CachedOutputStream Fix IOException closed after multiple close() & postClose() calls  (#771)
     new d90dc0e  Fixed Checkstyle errors
     new 89eea14  CXF-8442: remove close() and doClose(), the complex relationships between these methods led to the issues that isClosed flag being set before closing the streams (as the result, streams stayed open)
     new cd8c352  Recording .gitmergeinfo Changes

The 4 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:
 .gitmergeinfo                                             |  4 ++++
 .../java/org/apache/cxf/io/CacheAndWriteOutputStream.java | 15 ++++++++-------
 .../org/apache/cxf/io/CacheAndWriteOutputStreamTest.java  | 12 ++++++++++++
 3 files changed, 24 insertions(+), 7 deletions(-)

[cxf] 01/04: CXF-8442 Java 16 & CachedOutputStream Fix IOException closed after multiple close() & postClose() calls (#771)

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

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 0324562f5ce93fa66b03a7a18eadcc8fb18cee76
Author: Michael Auß <54...@users.noreply.github.com>
AuthorDate: Fri Apr 9 00:10:58 2021 +0200

    CXF-8442 Java 16 & CachedOutputStream Fix IOException closed after multiple close() & postClose() calls  (#771)
    
    * CXF-8442 Fix IOException on multiple close() & postClose() calls in CachedOutputStream
    
    * Revert "CXF-8442 Fix IOException on multiple close() & postClose() calls in CachedOutputStream"
    
    This reverts commit 99a6fc19 in CachedOutputStream
    
    * CXF-8442 Fix IOException on multiple close() & postClose() calls in CachedOutputStream by tracking closed status of flowThroughStream
    
    * CXF-8442 Fix IOException on multiple close() & postClose() calls in CachedOutputStream by tracking closed status of flowThroughStream
---
 .../apache/cxf/io/CacheAndWriteOutputStream.java   | 23 +++++++++++++++++-----
 .../cxf/io/CacheAndWriteOutputStreamTest.java      | 12 +++++++++++
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
index 0af9145..bc3df0c 100644
--- a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
@@ -29,7 +29,7 @@ import java.io.OutputStream;
  *
  */
 public class CacheAndWriteOutputStream extends CachedOutputStream {
-
+    private boolean isClosed = false;
     OutputStream flowThroughStream;
     long count;
     long limit = Long.MAX_VALUE;
@@ -47,19 +47,32 @@ public class CacheAndWriteOutputStream extends CachedOutputStream {
     }
 
     public void closeFlowthroughStream() throws IOException {
-        flowThroughStream.flush();
-        flowThroughStream.close();
+        postClose();
     }
 
     protected void postClose() throws IOException {
-        flowThroughStream.flush();
-        flowThroughStream.close();
+        if (!isClosed) {
+            flowThroughStream.flush();
+            flowThroughStream.close();
+            isClosed = true;
+        }
     }
 
     public OutputStream getFlowThroughStream() {
         return flowThroughStream;
     }
 
+    @Override
+    protected void doClose() throws IOException {
+        super.doClose();
+        isClosed = true;
+    }
+
+    @Override
+    public void close() throws IOException {
+        super.close();
+        isClosed = true;
+    }
 
     @Override
     protected void onWrite() throws IOException {
diff --git a/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java b/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
index 32d3e8f..171b6fd 100644
--- a/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
+++ b/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.io;
 
+import org.junit.Test;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
@@ -38,4 +40,14 @@ public class CacheAndWriteOutputStreamTest extends CachedOutputStreamTest {
     protected Object createCache() {
         return new CacheAndWriteOutputStream(baos);
     }
+
+    @Test
+    public void testCloseMultipleTimes() throws IOException {
+        CacheAndWriteOutputStream cacheAndWriteOutputStream = new CacheAndWriteOutputStream(baos);
+        cacheAndWriteOutputStream.close();
+        cacheAndWriteOutputStream.close();
+        cacheAndWriteOutputStream.close();
+        cacheAndWriteOutputStream.close();
+
+    }
 }

[cxf] 03/04: CXF-8442: remove close() and doClose(), the complex relationships between these methods led to the issues that isClosed flag being set before closing the streams (as the result, streams stayed open)

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

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 89eea141f335078da89b54c8cc6feb1bfd673af5
Author: reta <dr...@gmail.com>
AuthorDate: Thu Apr 8 21:11:48 2021 -0400

    CXF-8442: remove close() and doClose(), the complex relationships between these methods led to the issues that isClosed flag being set before closing the streams (as the result, streams stayed open)
    
    (cherry picked from commit 7d2928fc88add3b7fae27144d89c07b2801c8aee)
    (cherry picked from commit b15ce32e79cd7d3aca3fcc652686690c9745b8d8)
---
 .../java/org/apache/cxf/io/CacheAndWriteOutputStream.java  | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
index 482e68c..d89edb9 100644
--- a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
@@ -61,19 +61,7 @@ public class CacheAndWriteOutputStream extends CachedOutputStream {
     public OutputStream getFlowThroughStream() {
         return flowThroughStream;
     }
-
-    @Override
-    protected void doClose() throws IOException {
-        super.doClose();
-        isClosed = true;
-    }
-
-    @Override
-    public void close() throws IOException {
-        super.close();
-        isClosed = true;
-    }
-
+    
     @Override
     protected void onWrite() throws IOException {
         // does nothing

[cxf] 04/04: Recording .gitmergeinfo Changes

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

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit cd8c3521de34d8f3d89c96266639da241fb9fa82
Author: reta <dr...@gmail.com>
AuthorDate: Fri Apr 9 08:01:05 2021 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 8af7848..a8d2910 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -352,6 +352,7 @@ B 8bbe66a1ae5744ec72d9619e95efa606b080b169
 B 8c67eee0538975d0ecfa9b9719824d15cf296625
 B 8d62ad92dbd57e8bb99e0704ffde0faf66b719b7
 B 8dc92f19a88809b3f113a6d0ded07b9cfc0d3777
+B 8e72c98447e0b398018e08659f0c61de5f8c852f
 B 8f93152ae86c2d24b95ed9ce5599e6f5453091bc
 B 8f980049b3494dd370db259f358a1d3e869301e7
 B 91634e844c1a062588ee3b338949d77621e3f8ab
@@ -422,6 +423,7 @@ B ac00941d07b9562391b16ecdc650dcedbce03ce4
 B ac56abee9c1256742bbcfe45afbd4fdf6585da55
 B ad0ae5dac3623c9a69b7d7d6985ea0be7fd30966
 B ad1d36d802548ae177784a8f6fdc35c8612dfd4f
+B ad962ee4cbd5aa430cb48a969e0fef94294c2294
 B adb1b8b6280a738f3b2b4f6ea40ee902d94cc2dd
 B adf55e5b73a51180379027ebf22800adcd9a7d56
 B adfa9ff834fcf81d4d9d15e14ef8c420b4e05a00
@@ -666,6 +668,7 @@ M 180578d01f361d77ce7f42dd760fa8d5f245ce7e
 M 1820f1a94b08ba840c3868ac3e1f3b7751540a08
 M 1a14a904c9f8af53650860ff94af2ef50f4260ed
 M 1b3296e55205c19727a89476f442b3adab9a731a
+M 1b51787d4680a03ac1fa72be40c9fe76064089c5
 M 1ceb6d0928a62d8c6b07fad0db25e92d2d4b273d
 M 1d055e6c5c0783c4c7a28ff36849efa5d010fa4c
 M 1e3817e3f7d51d093bff81d2520fb7cef82f0df8
@@ -709,6 +712,7 @@ M 400e003302aab3b83b630a006dbe66324c7ce0d8
 M 40f52264a62fdad1d0971e7ebdbd86848367f7e8
 M 4162189dabdb22aec54dc3c5ae93cf42b0575d3d
 M 420f6f35915cbd50cc175a6a10359125516b0213
+M 46142a21738c072e5bd369d5c8060b0430e09b0c
 M 464e41a12dea11a00c86a370b31d7a7f009cb8e9
 M 4699995c6ef392a98615382a5824dda0d1bbe9bf
 M 48a1fbacbbe998114ee36b5e45cb6ddc5651abd4

[cxf] 02/04: Fixed Checkstyle errors

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

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit d90dc0eb8e38aa5e0a9a41365ad03e860239c6bb
Author: reta <dr...@gmail.com>
AuthorDate: Thu Apr 8 18:55:46 2021 -0400

    Fixed Checkstyle errors
    
    (cherry picked from commit 3716cd8afda08fb1fd5a078b29e3e4ca0d1d238f)
    (cherry picked from commit f3f2ca91f5ad4198ad74101f7ca89738a00130bd)
---
 core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java   | 2 +-
 .../test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
index bc3df0c..482e68c 100644
--- a/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/io/CacheAndWriteOutputStream.java
@@ -29,10 +29,10 @@ import java.io.OutputStream;
  *
  */
 public class CacheAndWriteOutputStream extends CachedOutputStream {
-    private boolean isClosed = false;
     OutputStream flowThroughStream;
     long count;
     long limit = Long.MAX_VALUE;
+    private boolean isClosed;
 
     public CacheAndWriteOutputStream(OutputStream stream) {
         super();
diff --git a/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java b/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
index 171b6fd..0a97b66 100644
--- a/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
+++ b/core/src/test/java/org/apache/cxf/io/CacheAndWriteOutputStreamTest.java
@@ -18,11 +18,11 @@
  */
 package org.apache.cxf.io;
 
-import org.junit.Test;
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
+import org.junit.Test;
+
 public class CacheAndWriteOutputStreamTest extends CachedOutputStreamTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream() {