Skip to content

Commit aa73cb8

Browse files
author
Gary Gregory
committed
More precise exceptions
1 parent 63771b3 commit aa73cb8

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ public static void close(final Closeable closeable) throws IOException {
391391
* Closes the given {@link Closeable}s as null-safe operations.
392392
*
393393
* @param closeables The resource(s) to close, may be null.
394-
* @throws IOException if an I/O error occurs.
394+
* @throws IOExceptionList if an I/O error occurs.
395395
* @since 2.8.0
396396
*/
397-
public static void close(final Closeable... closeables) throws IOException {
397+
public static void close(final Closeable... closeables) throws IOExceptionList {
398398
IOConsumer.forAll(closeables, IOUtils::close);
399399
}
400400

src/test/java/org/apache/commons/io/IOUtilsTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ public void testCloseMulti() {
338338
assertDoesNotThrow(() -> IOUtils.close(closeables));
339339
assertDoesNotThrow(() -> IOUtils.close((Closeable[]) null));
340340
assertDoesNotThrow(() -> IOUtils.close(new StringReader("s"), nullCloseable));
341-
assertThrows(IOException.class,
342-
() -> IOUtils.close(nullCloseable, new ThrowOnCloseReader(new StringReader("s"))));
341+
assertThrows(IOException.class, () -> IOUtils.close(nullCloseable, new ThrowOnCloseReader(new StringReader("s"))));
343342
}
344343

345344
@Test

src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.io.InputStream;
2424

2525
import org.apache.commons.io.FileUtils;
26+
import org.apache.commons.io.IOExceptionList;
2627
import org.apache.commons.io.IOUtils;
2728
import org.apache.commons.lang3.RandomUtils;
2829
import org.junit.jupiter.api.AfterEach;
@@ -53,7 +54,7 @@ public void setUp() throws IOException {
5354
}
5455

5556
@AfterEach
56-
public void tearDown() throws IOException {
57+
public void tearDown() throws IOExceptionList {
5758
inputFile.delete();
5859
IOUtils.close(inputStreams);
5960
}

0 commit comments

Comments
 (0)