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/07/14 14:21:19 UTC

(commons-io) branch master updated (933e3c435 -> c73545aa9)

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-io.git


    from 933e3c435 Add BOMInputStreamTest.testCloseHandleIOException()
     new bc11cc03f BoundedInputStream does not call handleIOException() on close() when the proxied stream throws an IOException
     new 96a2ebf0a Add MessageDigestCalculatingInputStreamTest.testCloseHandleIOException()
     new 4e8c2df9e Format nit
     new c73545aa9 Add ThrottledInputStreamTest.testCloseHandleIOException()

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:
 src/changes/changes.xml                                             | 3 ++-
 src/main/java/org/apache/commons/io/input/BoundedInputStream.java   | 2 +-
 .../java/org/apache/commons/io/input/BoundedInputStreamTest.java    | 6 ++++++
 .../commons/io/input/MessageDigestCalculatingInputStreamTest.java   | 5 +++++
 .../org/apache/commons/io/input/SwappedDataInputStreamTest.java     | 5 ++---
 .../java/org/apache/commons/io/input/ThrottledInputStreamTest.java  | 5 +++++
 6 files changed, 21 insertions(+), 5 deletions(-)


(commons-io) 04/04: Add ThrottledInputStreamTest.testCloseHandleIOException()

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-io.git

commit c73545aa9fc379336721cda906d9c52418fcba44
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 14 10:04:26 2024 -0400

    Add ThrottledInputStreamTest.testCloseHandleIOException()
---
 .../java/org/apache/commons/io/input/ThrottledInputStreamTest.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/test/java/org/apache/commons/io/input/ThrottledInputStreamTest.java b/src/test/java/org/apache/commons/io/input/ThrottledInputStreamTest.java
index 0478b5811..fc63fef92 100644
--- a/src/test/java/org/apache/commons/io/input/ThrottledInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/ThrottledInputStreamTest.java
@@ -55,6 +55,11 @@ public class ThrottledInputStreamTest extends ProxyInputStreamTest<ThrottledInpu
         assertEquals(0, ThrottledInputStream.toSleepMillis(1, 2, 1_000));
     }
 
+    @Test
+    public void testCloseHandleIOException() throws IOException {
+        ProxyInputStreamTest.testCloseHandleIOException(ThrottledInputStream.builder());
+    }
+
     @Override
     protected void testEos(final ThrottledInputStream inputStream) {
         assertEquals(3, inputStream.getByteCount());


(commons-io) 01/04: BoundedInputStream does not call handleIOException() on close() when the proxied stream throws an IOException

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-io.git

commit bc11cc03f231cd7e945d5e27835dbd51a1bf841d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 14 09:47:28 2024 -0400

    BoundedInputStream does not call handleIOException() on close() when the
    proxied stream throws an IOException
---
 src/changes/changes.xml                                             | 3 ++-
 src/main/java/org/apache/commons/io/input/BoundedInputStream.java   | 2 +-
 .../java/org/apache/commons/io/input/BoundedInputStreamTest.java    | 6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 14c59ec57..f645bcaf9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -83,7 +83,8 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix"                due-to="Gary Gregory">RandomAccessFileInputStream.read() should return -1 (EOF) after the stream is closed.</action>
       <action dev="ggregory" type="fix"                due-to="Gary Gregory">ReaderInputStream.available() should return 0 after the stream is closed.</action>
       <action dev="ggregory" type="fix"                due-to="Gary Gregory">ReaderInputStream.read() should return -1 (EOF) after the stream is closed.</action>
-      <action dev="ggregory" type="fix"                due-to="Gary Gregory">AutoCloseInputStream does not call handleIOException() on close().</action>
+      <action dev="ggregory" type="fix"                due-to="Gary Gregory">AutoCloseInputStream does not call handleIOException() on close() when the proxied stream throws an IOException.</action>
+      <action dev="ggregory" type="fix"                due-to="Gary Gregory">BoundedInputStream does not call handleIOException() on close() when the proxied stream throws an IOException.</action>
       <!-- UPDATE -->
       <action dev="ggregory" type="update"             due-to="Dependabot">Bump tests commons.bytebuddy.version from 1.14.13 to 1.14.18 #615, #621, #631, #635, #642.</action>
       <action dev="ggregory" type="update"             due-to="Dependabot">Bump tests commons-codec:commons-codec from 1.16.1 to 1.17.0.</action>
diff --git a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
index 83431db3a..f3b07b718 100644
--- a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
@@ -340,7 +340,7 @@ public class BoundedInputStream extends ProxyInputStream {
     @Override
     public void close() throws IOException {
         if (propagateClose) {
-            in.close();
+            super.close();
         }
     }
 
diff --git a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
index b5617782a..d81802ff4 100644
--- a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -71,6 +72,11 @@ public class BoundedInputStreamTest {
         assertThrows(IllegalStateException.class, () -> BoundedInputStream.builder().get());
     }
 
+    @Test
+    public void testCloseHandleIOException() throws IOException {
+        ProxyInputStreamTest.testCloseHandleIOException(BoundedInputStream.builder());
+    }
+
     @SuppressWarnings("deprecation")
     @ParameterizedTest
     @ValueSource(longs = { -100, -1, 0, 1, 2, 4, 8, 16, 32, 64 })


(commons-io) 03/04: Format nit

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-io.git

commit 4e8c2df9e9c18774d890ffdb53bde77da4c4a2a7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 14 10:03:06 2024 -0400

    Format nit
---
 .../java/org/apache/commons/io/input/SwappedDataInputStreamTest.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java b/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java
index 2002670e5..7ff2fd483 100644
--- a/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/SwappedDataInputStreamTest.java
@@ -51,7 +51,7 @@ public class SwappedDataInputStreamTest {
             0x08
         };
         final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        this.sdis = new SwappedDataInputStream( bais );
+        this.sdis = new SwappedDataInputStream(bais);
     }
 
     @AfterEach
@@ -134,8 +134,7 @@ public class SwappedDataInputStreamTest {
 
     @Test
     public void testReadUTF() {
-        assertThrows(UnsupportedOperationException.class, () ->  this.sdis.readUTF(),
-                "readUTF should be unsupported. ");
+        assertThrows(UnsupportedOperationException.class, () -> this.sdis.readUTF(), "readUTF should be unsupported. ");
     }
 
     @Test


(commons-io) 02/04: Add MessageDigestCalculatingInputStreamTest.testCloseHandleIOException()

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-io.git

commit 96a2ebf0ab5d138185d0e15653bafd1aab80dc77
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 14 09:56:56 2024 -0400

    Add MessageDigestCalculatingInputStreamTest.testCloseHandleIOException()
---
 .../commons/io/input/MessageDigestCalculatingInputStreamTest.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/test/java/org/apache/commons/io/input/MessageDigestCalculatingInputStreamTest.java b/src/test/java/org/apache/commons/io/input/MessageDigestCalculatingInputStreamTest.java
index e778dda44..e1038678f 100644
--- a/src/test/java/org/apache/commons/io/input/MessageDigestCalculatingInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/MessageDigestCalculatingInputStreamTest.java
@@ -63,6 +63,11 @@ public class MessageDigestCalculatingInputStreamTest {
         }
     }
 
+    @Test
+    public void testCloseHandleIOException() throws IOException {
+        ProxyInputStreamTest.testCloseHandleIOException(MessageDigestCalculatingInputStream.builder());
+    }
+
     @Test
     public void testNormalUse() throws Exception {
         for (int i = 256; i < 8192; i *= 2) {