Skip to content

Commit

Permalink
Adjust exception message. Javadoc typo. Resue own method.
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Nov 7, 2021
1 parent e32e939 commit d790873
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/apache/commons/io/IOExceptionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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()}.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -100,7 +100,7 @@ public <T extends Throwable> T getCause(final int index) {
* @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));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

0 comments on commit d790873

Please sign in to comment.