Skip to content

Apache Lucene open-source search software

LUCENE-5207: Throw correct exception in JavascriptFunction ctor

Uwe Schindler98e055a539d7
diff --git a/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptFunction.java b/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptFunction.java
index 7dd9dd59869..11d034ef201 100644
--- a/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptFunction.java
+++ b/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptFunction.java
@@ -83,10 +83,10 @@ class JavascriptFunction {
private JavascriptFunction(String call, Method method) {
// do some checks if the signature is "compatible":
if (!Modifier.isStatic(method.getModifiers())) {
- throw new Error(method + " is not static.");
+ throw new IllegalArgumentException(method + " is not static.");
}
if (method.getReturnType() != double.class) {
- throw new Error(method + " does not return a double.");
+ throw new IllegalArgumentException(method + " does not return a double.");
}
this.call = call;