You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by gg...@apache.org on 2023/06/23 16:30:50 UTC
[juneau] 02/02: [juneau-common] Throw IllegalArgumentException instead of RuntimeException
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/juneau.git
commit eac32f82d9175c0679c044a716684bd980ef0673
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Fri Jun 23 12:29:44 2023 -0400
[juneau-common] Throw IllegalArgumentException instead of
RuntimeException
---
.../src/main/java/org/apache/juneau/common/internal/IOUtils.java | 2 +-
.../src/main/java/org/apache/juneau/common/internal/StringUtils.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/IOUtils.java b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/IOUtils.java
index 35aa977bc..d401af181 100644
--- a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/IOUtils.java
+++ b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/IOUtils.java
@@ -431,7 +431,7 @@ public final class IOUtils {
return read((File)in);
if (in instanceof byte[])
return read((byte[])in);
- throw new RuntimeException("Invalid type passed to read: " + in.getClass().getName());
+ throw new IllegalArgumentException("Invalid type passed to read: " + in.getClass().getName());
}
/**
diff --git a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/StringUtils.java b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/StringUtils.java
index f3d681597..4777380c6 100644
--- a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/StringUtils.java
+++ b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/StringUtils.java
@@ -186,7 +186,7 @@ public final class StringUtils {
return null;
if (s.length() == 1)
return s.charAt(0);
- throw new RuntimeException("Invalid character: '"+s+"'");
+ throw new IllegalArgumentException("Invalid character: '" + s + "'");
}
/**
@@ -838,7 +838,7 @@ public final class StringUtils {
if (state == S4)
l.add(s.substring(mark));
else if (state == S2 || state == S3)
- throw new RuntimeException("Unmatched string quotes: "+s);
+ throw new IllegalArgumentException("Unmatched string quotes: " + s);
return l.toArray(new String[l.size()]);
}