commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r1758579 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java
Date Wed, 31 Aug 2016 10:49:00 GMT
Author: henrib
Date: Wed Aug 31 10:48:59 2016
New Revision: 1758579

URL: http://svn.apache.org/viewvc?rev=1758579&view=rev
Log:
JEXL-215: create default jexlinfo in parse() rather than in multiple places

Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java?rev=1758579&r1=1758578&r2=1758579&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java
(original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java
Wed Aug 31 10:48:59 2016
@@ -357,9 +357,6 @@ public class Engine extends JexlEngine {
         if (scriptText == null) {
             throw new NullPointerException("source is null");
         }
-        if (info == null && debug) {
-            info = createInfo();
-        }
         String source = trimSource(scriptText);
         Scope scope = names == null ? null : new Scope(null, names);
         ASTJexlScript tree = parse(info, source, scope, false, false);
@@ -371,9 +368,6 @@ public class Engine extends JexlEngine {
         if (expression == null) {
             throw new NullPointerException("source is null");
         }
-        if (info == null && debug) {
-            info = createInfo();
-        }
         String source = trimSource(expression);
         ASTJexlScript tree = parse(info, source, null, false, true);
         return new Script(this, source, tree);
@@ -393,9 +387,8 @@ public class Engine extends JexlEngine {
         String src = trimSource(expr);
         src = "#0" + (src.charAt(0) == '[' ? "" : ".") + src;
         try {
-            final JexlInfo info = debug ? createInfo() : null;
             final Scope scope = new Scope(null, "#0");
-            final ASTJexlScript script = parse(info, src, scope, true, true);
+            final ASTJexlScript script = parse(null, src, scope, true, true);
             final JexlNode node = script.jjtGetChild(0);
             final Scope.Frame frame = script.createFrame(bean);
             final Interpreter interpreter = createInterpreter(context, frame);
@@ -423,9 +416,8 @@ public class Engine extends JexlEngine {
         String src = trimSource(expr);
         src = "#0" + (src.charAt(0) == '[' ? "" : ".") + src + "=" + "#1";
         try {
-            final JexlInfo info = debug ? createInfo() : null;
             final Scope scope = new Scope(null, "#0", "#1");
-            final ASTJexlScript script = parse(info, src, scope, true, true);
+            final ASTJexlScript script = parse(null, src, scope, true, true);
             final JexlNode node = script.jjtGetChild(0);
             final Scope.Frame frame = script.createFrame(bean, value);
             final Interpreter interpreter = createInterpreter(context, frame);
@@ -685,7 +677,8 @@ public class Engine extends JexlEngine {
                     }
                 }
             }
-            script = parser.parse(info, src, scope, registers, expression);
+            final JexlInfo ninfo = info == null && debug? createInfo() : info;
+            script = parser.parse(ninfo, src, scope, registers, expression);
             if (cached) {
                 cache.put(src, script);
             }



Mime
View raw message