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
The following commit(s) were added to refs/heads/master by this push:
new aa73cb8c More precise exceptions
aa73cb8c is described below
commit aa73cb8c3c95038daeba90b5b43e5c63080a8f8c
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jul 21 12:35:52 2022 -0400
More precise exceptions
---
src/main/java/org/apache/commons/io/IOUtils.java | 4 ++--
src/test/java/org/apache/commons/io/IOUtilsTest.java | 3 +--
.../java/org/apache/commons/io/input/AbstractInputStreamTest.java | 3 ++-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/IOUtils.java
b/src/main/java/org/apache/commons/io/IOUtils.java
index fda772ec..129b142c 100644
--- a/src/main/java/org/apache/commons/io/IOUtils.java
+++ b/src/main/java/org/apache/commons/io/IOUtils.java
@@ -391,10 +391,10 @@ public class IOUtils {
* Closes the given {@link Closeable}s as null-safe operations.
*
* @param closeables The resource(s) to close, may be null.
- * @throws IOException if an I/O error occurs.
+ * @throws IOExceptionList if an I/O error occurs.
* @since 2.8.0
*/
- public static void close(final Closeable... closeables) throws IOException
{
+ public static void close(final Closeable... closeables) throws
IOExceptionList {
IOConsumer.forAll(closeables, IOUtils::close);
}
diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java
b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index 105dd00e..1a4f39fc 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -338,8 +338,7 @@ public class IOUtilsTest {
assertDoesNotThrow(() -> IOUtils.close(closeables));
assertDoesNotThrow(() -> IOUtils.close((Closeable[]) null));
assertDoesNotThrow(() -> IOUtils.close(new StringReader("s"),
nullCloseable));
- assertThrows(IOException.class,
- () -> IOUtils.close(nullCloseable, new ThrowOnCloseReader(new
StringReader("s"))));
+ assertThrows(IOException.class, () -> IOUtils.close(nullCloseable, new
ThrowOnCloseReader(new StringReader("s"))));
}
@Test
diff --git
a/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
b/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
index 8be2d503..11435ba8 100644
--- a/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOExceptionList;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomUtils;
import org.junit.jupiter.api.AfterEach;
@@ -53,7 +54,7 @@ public abstract class AbstractInputStreamTest {
}
@AfterEach
- public void tearDown() throws IOException {
+ public void tearDown() throws IOExceptionList {
inputFile.delete();
IOUtils.close(inputStreams);
}