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 17:51:01 UTC
[juneau] 04/11: [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 98aa38fc86f1d8ec3c3ce41782ed844473e0cd56
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Fri Jun 23 13:48:07 2023 -0400
[juneau-common] Throw IllegalArgumentException instead of
RuntimeException
---
.../src/main/java/org/apache/juneau/common/internal/AsciiSet.java | 2 +-
.../src/main/java/org/apache/juneau/common/internal/ThrowableUtils.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/AsciiSet.java b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/AsciiSet.java
index 53a3636c2..6fbb63e8d 100644
--- a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/AsciiSet.java
+++ b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/AsciiSet.java
@@ -75,7 +75,7 @@ public final class AsciiSet {
public AsciiSet.Builder ranges(String...s) {
for (String ss : s) {
if (ss.length() != 3 || ss.charAt(1) != '-')
- throw new RuntimeException("Value passed to ranges() must be 3 characters");
+ throw new IllegalArgumentException("Value passed to ranges() must be 3 characters");
range(ss.charAt(0), ss.charAt(2));
}
return this;
diff --git a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/ThrowableUtils.java b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/ThrowableUtils.java
index eed0a6ec3..f6264fc64 100644
--- a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/ThrowableUtils.java
+++ b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/ThrowableUtils.java
@@ -43,7 +43,7 @@ public class ThrowableUtils {
try {
return type.isInstance(t) ? type.cast(t) : type.getConstructor(Throwable.class).newInstance(t);
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalArgumentException(e);
}
}