Skip to content

Commit d790873

Browse files
committed
Adjust exception message. Javadoc typo. Resue own method.
1 parent e32e939 commit d790873

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import java.util.Objects;
2424

2525
/**
26-
* A IOException based on a list of Throwable causes.
26+
* An IOException based on a list of Throwable causes.
2727
* <p>
2828
* The first exception in the list is used as this exception's cause and is accessible with the usual
2929
* {@link #getCause()} while the complete list is accessible with {@link #getCauseList()}.
@@ -54,7 +54,7 @@ private static boolean isEmpty(final List<? extends Throwable> causeList) {
5454
}
5555

5656
private static String toMessage(final List<? extends Throwable> causeList) {
57-
return String.format("%,d exceptions: %s", causeList == null ? 0 : causeList.size(), causeList);
57+
return String.format("%,d exception(s): %s", causeList == null ? 0 : causeList.size(), causeList);
5858
}
5959

6060
private final List<? extends Throwable> causeList;
@@ -100,7 +100,7 @@ public <T extends Throwable> T getCause(final int index) {
100100
* @return The list of causes.
101101
*/
102102
public <T extends Throwable> T getCause(final int index, final Class<T> clazz) {
103-
return clazz.cast(causeList.get(index));
103+
return clazz.cast(getCause(index));
104104
}
105105

106106
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void testPrintStackTrace() {
108108
final PrintWriter pw = new PrintWriter(sw);
109109
sqlExceptionList.printStackTrace(pw);
110110
final String st = sw.toString();
111-
assertTrue(st.startsWith("org.apache.commons.io.IOExceptionList: 1 exceptions: [java.io.EOFException]"));
111+
assertTrue(st.startsWith("org.apache.commons.io.IOExceptionList: 1 exception(s): [java.io.EOFException]"));
112112
assertTrue(st.contains("Caused by: java.io.EOFException"));
113113
}
114114
}

0 commit comments

Comments
 (0)