You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/07 17:00:20 UTC

[commons-io] branch master updated: Adjust exception message. Javadoc typo. Resue own method.

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 d790873  Adjust exception message. Javadoc typo. Resue own method.
d790873 is described below

commit d790873fdd9f8c39475812d5ade94d08675ed722
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 7 12:00:18 2021 -0500

    Adjust exception message. Javadoc typo. Resue own method.
---
 src/main/java/org/apache/commons/io/IOExceptionList.java     | 6 +++---
 src/test/java/org/apache/commons/io/IOExceptionListTest.java | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/IOExceptionList.java b/src/main/java/org/apache/commons/io/IOExceptionList.java
index fb6a11a..e434357 100644
--- a/src/main/java/org/apache/commons/io/IOExceptionList.java
+++ b/src/main/java/org/apache/commons/io/IOExceptionList.java
@@ -23,7 +23,7 @@ import java.util.List;
 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 @@ public class IOExceptionList extends IOException {
     }
 
     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 class IOExceptionList extends IOException {
      * @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));
     }
 
     /**
diff --git a/src/test/java/org/apache/commons/io/IOExceptionListTest.java b/src/test/java/org/apache/commons/io/IOExceptionListTest.java
index 059ce14..19275fa 100644
--- a/src/test/java/org/apache/commons/io/IOExceptionListTest.java
+++ b/src/test/java/org/apache/commons/io/IOExceptionListTest.java
@@ -108,7 +108,7 @@ public class IOExceptionListTest {
         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"));
     }
 }