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 2023/06/23 19:36:42 UTC
[commons-jexl] branch master updated: Throw a specialized RuntimeException 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/commons-jexl.git
The following commit(s) were added to refs/heads/master by this push:
new d628119a Throw a specialized RuntimeException instead of RuntimeException
d628119a is described below
commit d628119a3736615053492eb8ac7a22fad00d46f4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 15:36:38 2023 -0400
Throw a specialized RuntimeException instead of
RuntimeException
---
src/test/java/org/apache/commons/jexl3/CacheTest.java | 4 ++--
src/test/java/org/apache/commons/jexl3/internal/Util.java | 4 ++--
.../apache/commons/jexl3/introspection/SandboxTest.java | 14 +++++++-------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/test/java/org/apache/commons/jexl3/CacheTest.java b/src/test/java/org/apache/commons/jexl3/CacheTest.java
index 62b1749a..4391f6dd 100644
--- a/src/test/java/org/apache/commons/jexl3/CacheTest.java
+++ b/src/test/java/org/apache/commons/jexl3/CacheTest.java
@@ -184,7 +184,7 @@ public class CacheTest extends JexlTestCase {
if ("flag".equals(prop)) {
return Boolean.valueOf(flag);
}
- throw new RuntimeException("no such property");
+ throw new IllegalArgumentException("no such property");
}
public void set(final String p, Object v) {
@@ -196,7 +196,7 @@ public class CacheTest extends JexlTestCase {
} else if ("flag".equals(p)) {
flag = Boolean.parseBoolean(v.toString());
} else {
- throw new RuntimeException("no such property");
+ throw new IllegalArgumentException("no such property");
}
}
}
diff --git a/src/test/java/org/apache/commons/jexl3/internal/Util.java b/src/test/java/org/apache/commons/jexl3/internal/Util.java
index dfb8887f..f49b02f8 100644
--- a/src/test/java/org/apache/commons/jexl3/internal/Util.java
+++ b/src/test/java/org/apache/commons/jexl3/internal/Util.java
@@ -62,13 +62,13 @@ public class Util {
// test equality
final String reason = checkEquals(root, node);
if (reason != null) {
- throw new RuntimeException("check equal failed: "
+ throw new IllegalStateException("check equal failed: "
+ expressiondbg
+ " /**** " + reason + " **** */ "
+ entry.getKey());
}
} catch (final JexlException xjexl) {
- throw new RuntimeException("check parse failed: "
+ throw new IllegalStateException("check parse failed: "
+ expressiondbg
+ " /*********/ "
+ entry.getKey(), xjexl);
diff --git a/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java b/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java
index 323da027..475062c9 100644
--- a/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java
+++ b/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.jexl3.introspection;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -31,10 +33,8 @@ import org.apache.commons.jexl3.JexlScript;
import org.apache.commons.jexl3.JexlTestCase;
import org.apache.commons.jexl3.MapContext;
import org.apache.commons.jexl3.annotations.NoJexl;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.junit.Assert;
import org.junit.Test;
@@ -72,7 +72,7 @@ public class SandboxTest extends JexlTestCase {
@NoJexl
public void callMeNot() {
- throw new RuntimeException("should not be callable!");
+ fail("should not be callable!");
}
public String allowInherit() {
@@ -86,7 +86,7 @@ public class SandboxTest extends JexlTestCase {
public @NoJexl
Foo(final String name, final String notcallable) {
- throw new RuntimeException("should not be callable!");
+ throw new UnsupportedOperationException("should not be callable!");
}
public Foo(final String name) {
@@ -112,17 +112,17 @@ public class SandboxTest extends JexlTestCase {
@NoJexl
public String cantCallMe() {
- throw new RuntimeException("should not be callable!");
+ throw new UnsupportedOperationException("should not be callable!");
}
@Override
public void tryMe() {
- throw new RuntimeException("should not be callable!");
+ throw new UnsupportedOperationException("should not be callable!");
}
@Override
public void tryMeARiver() {
- throw new RuntimeException("should not be callable!");
+ throw new UnsupportedOperationException("should not be callable!");
}
}