This is an automated email from the ASF dual-hosted git repository.

henrib pushed a commit to tag 2.1
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git

commit feeffea95fda19116c778ee2ff989304bb89d61b
Author: Henri Biestro <hen...@apache.org>
AuthorDate: Wed Nov 30 22:10:55 2011 +0000

    Partial JEXL-83 fix rollback, deprecated setLenient and associated field in 
JexlArithmetic in an attempt to release 2.1
    
    git-svn-id: 
https://svn-us.apache.org/repos/asf/commons/proper/jexl/branches/2.0@1208830 
13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/commons/jexl2/JexlArithmetic.java    | 21 +++++++++++++++++++--
 .../java/org/apache/commons/jexl2/JexlEngine.java   | 14 +++++++++-----
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java 
b/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
index 21e0aad..8c831c8 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
@@ -55,7 +55,8 @@ public class JexlArithmetic {
     /** Default BigDecimal scale. */
     protected static final int BIGD_SCALE = -1;
     /** Whether this JexlArithmetic instance behaves in strict or lenient 
mode. */
-    protected final boolean strict;
+    /** @deprecated : will become final in next version. */
+    protected boolean strict;
     /** The big decimal math context. */
     protected final MathContext mathContext;
     /** The big decimal scale. */
@@ -81,6 +82,22 @@ public class JexlArithmetic {
         this.mathContext = bigdContext;
         this.mathScale = bigdScale;
     }
+    
+    
+    /**
+     * Sets whether this JexlArithmetic instance triggers errors during 
evaluation when
+     * null is used as an operand.
+     * <p>This method is <em>not</em> thread safe; it may be called as an 
optional step by the JexlEngine
+     * in its initialization code before expression creation &amp; 
evaluation.</p>
+     * @see JexlEngine#setSilent
+     * @see JexlEngine#setDebug
+     * @param flag true means no JexlException will occur, false allows them
+     * @deprecated as of 2.1
+     */
+    @Deprecated
+    void setLenient(boolean flag) {
+        this.strict = !flag;
+    }
 
     /**
      * Checks whether this JexlArithmetic instance triggers errors during 
evaluation
@@ -101,7 +118,7 @@ public class JexlArithmetic {
     }
 
     /**
-     * The BigDecimal scale used for comparison and coericion operations.
+     * The BigDecimal scale used for comparison and coercion operations.
      * @return the scale
      * @since 2.1
      */
diff --git a/src/main/java/org/apache/commons/jexl2/JexlEngine.java 
b/src/main/java/org/apache/commons/jexl2/JexlEngine.java
index 0a8d6a1..8e2020b 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlEngine.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlEngine.java
@@ -157,8 +157,9 @@ public class JexlEngine {
     protected boolean silent = false;
     /**
      * Whether this engine is in lenient or strict mode; if unspecified, use 
the arithmetic lenient property.
+     * Provision for version after 2.1.
      */
-    protected Boolean strict = null;
+    // protected Boolean strict = null;
     /**
      * Whether error messages will carry debugging information.
      */
@@ -274,23 +275,25 @@ public class JexlEngine {
     public boolean isSilent() {
         return this.silent;
     }
-
+    
     /**
      * Sets whether this engine considers unknown variables, methods and 
constructors as errors or evaluates them
      * as null.
      * <p>This method is <em>not</em> thread safe; it should be called as an 
optional step of the JexlEngine
      * initialization code before expression creation &amp; evaluation.</p>
-     * <p>As of 2.1, you need a JexlThreadedArithmetic instance for this call 
to also modify the JexlArithmetic
+     * <p>After 2.1, you will need a JexlThreadedArithmetic instance for this 
call to also modify the JexlArithmetic
      * leniency behavior.</p>
      * @see JexlEngine#setSilent
      * @see JexlEngine#setDebug
      * @param flag true means no JexlException will occur, false allows them
      */
+    @SuppressWarnings("deprecation")
     public void setLenient(boolean flag) {
         if (arithmetic instanceof JexlThreadedArithmetic) {
             JexlThreadedArithmetic.setLenient(Boolean.valueOf(flag));
         } else {
-            strict = flag ? Boolean.FALSE : Boolean.TRUE;
+            //strict = flag ? Boolean.FALSE : Boolean.TRUE;
+            this.arithmetic.setLenient(flag);
         }
     }
 
@@ -300,7 +303,8 @@ public class JexlEngine {
      * @return true if lenient, false if strict
      */
     public boolean isLenient() {
-        return strict == null ? arithmetic.isLenient() : 
!strict.booleanValue();
+        //return strict == null ? arithmetic.isLenient() : 
!strict.booleanValue();
+        return this.arithmetic.isLenient();
     }
 
     /**

Reply via email to