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/11/28 18:51:17 UTC
[commons-jexl] branch master updated: Fix PMD issues
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 ad4984cc Fix PMD issues
ad4984cc is described below
commit ad4984cc383cda5784cc2a676b9041d09a9f7cf3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 28 13:51:12 2022 -0500
Fix PMD issues
---
src/main/java/org/apache/commons/jexl3/JexlArithmetic.java | 8 ++++++--
.../java/org/apache/commons/jexl3/internal/InterpreterBase.java | 4 ++--
.../apache/commons/jexl3/internal/introspection/Uberspect.java | 1 +
.../java/org/apache/commons/jexl3/parser/FeatureController.java | 5 +++--
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
index 1be73232..487d4c17 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
@@ -792,6 +792,8 @@ public class JexlArithmetic {
case SIZE:
case CONTAINS:
return false;
+ default:
+ return isStrict();
}
}
return isStrict();
@@ -2014,8 +2016,10 @@ public class JexlArithmetic {
private double parseDouble(String arg) throws ArithmeticException {
try {
return arg.isEmpty()? Double.NaN : Double.parseDouble(arg);
- } catch(NumberFormatException xformat) {
- throw new ArithmeticException("Double coercion: ("+ arg +")");
+ } catch (NumberFormatException e) {
+ final ArithmeticException arithmeticException = new ArithmeticException("Double coercion: ("+ arg +")");
+ arithmeticException.initCause(e);
+ throw arithmeticException;
}
}
diff --git a/src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java b/src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java
index e8dd199b..fd23c7e8 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java
@@ -264,9 +264,9 @@ public abstract class InterpreterBase extends ParserVisitor {
if (cacheable) {
nsNode.jjtSetValue(namespace);
}
- } catch (final ClassNotFoundException xignore) {
+ } catch (final ClassNotFoundException e) {
// not a class
- throw new JexlException(node, "no such class namespace " + prefix, null);
+ throw new JexlException(node, "no such class namespace " + prefix, e);
}
}
}
diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
index 1e2a01c8..3f741d2a 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
@@ -155,6 +155,7 @@ public class Uberspect implements JexlUberspect {
* @param className the class name
* @return the class instance or null if it could not be found
*/
+ @Override
public final Class<?> getClassByName(final String className) {
return base().getClassByName(className);
}
diff --git a/src/main/java/org/apache/commons/jexl3/parser/FeatureController.java b/src/main/java/org/apache/commons/jexl3/parser/FeatureController.java
index ba226d8d..e40d6ca9 100644
--- a/src/main/java/org/apache/commons/jexl3/parser/FeatureController.java
+++ b/src/main/java/org/apache/commons/jexl3/parser/FeatureController.java
@@ -24,11 +24,12 @@ import org.apache.commons.jexl3.internal.ScriptVisitor;
* Controls that a script only uses enabled features.
*/
public class FeatureController extends ScriptVisitor {
+
/** The set of features. */
- private JexlFeatures features = null;
+ private JexlFeatures features;
/**
- * Creates a features controller .
+ * Creates a features controller.
*/
public FeatureController(final JexlFeatures features) {
this.features = features;