commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r800073 - /commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java
Date Sun, 02 Aug 2009 13:40:35 GMT
Author: sebb
Date: Sun Aug  2 13:40:35 2009
New Revision: 800073

URL: http://svn.apache.org/viewvc?rev=800073&view=rev
Log:
Remove redundant null checks

Modified:
    commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java

Modified: commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java?rev=800073&r1=800072&r2=800073&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java
(original)
+++ commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/Interpreter.java
Sun Aug  2 13:40:35 2009
@@ -736,7 +736,7 @@
                 }
             }
             if (xjexl == null) {
-                Object eval = vm.invoke(data, argv);
+                Object eval = vm.invoke(data, argv); // vm cannot be null if xjexl is null
                 // cache executor in volatile JexlNode.value
                 if (cache) {
                     node.jjtSetValue(vm);
@@ -752,12 +752,11 @@
         } catch (Exception e) {
             xjexl = new JexlException(node, "method error", e);
         }
-        if (xjexl != null) {
-            if (strict) {
-                throw xjexl;
-            }
-            logger.warn(xjexl.getMessage(), xjexl.getCause());
+        // xjexl cannot be null here
+        if (strict) {
+            throw xjexl;
         }
+        logger.warn(xjexl.getMessage(), xjexl.getCause());
         return null;
     }
 
@@ -797,12 +796,11 @@
         } catch (Exception e) {
             xjexl = new JexlException(node, "constructor error", e);
         }
-        if (xjexl != null) {
-            if (strict) {
-                throw xjexl;
-            }
-            logger.warn(xjexl.getMessage(), xjexl.getCause());
+        // xjexl cannot be null here
+        if (strict) {
+            throw xjexl;
         }
+        logger.warn(xjexl.getMessage(), xjexl.getCause());
         return null;
     }
 
@@ -849,7 +847,7 @@
                 }
             }
             if (xjexl == null) {
-                Object eval = vm.invoke(namespace, argv);
+                Object eval = vm.invoke(namespace, argv); // vm cannot be null if xjexl is
null
                 // cache executor in volatile JexlNode.value
                 if (cache) {
                     node.jjtSetValue(vm);
@@ -865,12 +863,11 @@
         } catch (Exception e) {
             xjexl = new JexlException(node, "function error", e);
         }
-        if (xjexl != null) {
-            if (strict) {
-                throw xjexl;
-            }
-            logger.warn(xjexl.getMessage(), xjexl.getCause());
+        // xjexl cannot be null here
+        if (strict) {
+            throw xjexl;
         }
+        logger.warn(xjexl.getMessage(), xjexl.getCause());
         return null;
     }
 



Mime
View raw message