Adjust exception message. Javadoc typo. Resue own method.
MODIFY
src/main/java/org/apache/commons/io/IOExceptionList.java
src/main/java/org/apache/commons/io/IOExceptionList.java
import java.util.Objects;
/**
- * A IOException based on a list of Throwable causes.
+ * An IOException based on a list of Throwable causes.
* <p>
* The first exception in the list is used as this exception's cause and is accessible with the usual
* {@link #getCause()} while the complete list is accessible with {@link #getCauseList()}.
@@ -54,7 +54,7 @@ private static boolean isEmpty(final List<? extends Throwable> causeList) {
}
private static String toMessage(final List<? extends Throwable> causeList) {
- return String.format("%,d exceptions: %s", causeList == null ? 0 : causeList.size(), causeList);
+ return String.format("%,d exception(s): %s", causeList == null ? 0 : causeList.size(), causeList);
}
private final List<? extends Throwable> causeList;
@@ -100,7 +100,7 @@ public IOExceptionList(final String message, final List<? extends Throwable> cau
* @return The list of causes.
*/
public <T extends Throwable> T getCause(final int index, final Class<T> clazz) {
- return clazz.cast(causeList.get(index));
+ return clazz.cast(getCause(index));
}
/**

MODIFY
src/test/java/org/apache/commons/io/IOExceptionListTest.java
src/test/java/org/apache/commons/io/IOExceptionListTest.java
@@ -108,7 +108,7 @@ public void testPrintStackTrace() {
final PrintWriter pw = new PrintWriter(sw);
sqlExceptionList.printStackTrace(pw);
final String st = sw.toString();
- assertTrue(st.startsWith("org.apache.commons.io.IOExceptionList: 1 exceptions: [java.io.EOFException]"));
+ assertTrue(st.startsWith("org.apache.commons.io.IOExceptionList: 1 exception(s): [java.io.EOFException]"));
assertTrue(st.contains("Caused by: java.io.EOFException"));
}
}

Adjust exception message. Javadoc typo. Resue own method.