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 2022/09/17 21:00:37 UTC

[commons-io] branch master updated: Refactor internals

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 153a91c1 Refactor internals
153a91c1 is described below

commit 153a91c1271f4a07d56230670253e94c5ed94683
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 17 17:00:31 2022 -0400

    Refactor internals
---
 src/main/java/org/apache/commons/io/IOExceptionList.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/IOExceptionList.java b/src/main/java/org/apache/commons/io/IOExceptionList.java
index 16e13b6a..ca3f8800 100644
--- a/src/main/java/org/apache/commons/io/IOExceptionList.java
+++ b/src/main/java/org/apache/commons/io/IOExceptionList.java
@@ -51,11 +51,15 @@ public class IOExceptionList extends IOException implements Iterable<Throwable>
     }
 
     private static boolean isEmpty(final List<? extends Throwable> causeList) {
-        return causeList == null || causeList.isEmpty();
+        return size(causeList) == 0;
+    }
+
+    private static int size(final List<? extends Throwable> causeList) {
+        return causeList != null ? causeList.size() : 0;
     }
 
     private static String toMessage(final List<? extends Throwable> causeList) {
-        return String.format("%,d exception(s): %s", causeList == null ? 0 : causeList.size(), causeList);
+        return String.format("%,d exception(s): %s", size(causeList), causeList);
     }
 
     private final List<? extends Throwable> causeList;