commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r1735590 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3: internal/TemplateEngine.java parser/JexlNode.java
Date Fri, 18 Mar 2016 12:37:33 GMT
Author: henrib
Date: Fri Mar 18 12:37:33 2016
New Revision: 1735590

URL: http://svn.apache.org/viewvc?rev=1735590&view=rev
Log:
JEXL:
Get at least line/column info from jexlInfo()

Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/JexlNode.java

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java?rev=1735590&r1=1735589&r2=1735590&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java
(original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java
Fri Mar 18 12:37:33 2016
@@ -540,7 +540,7 @@ public final class TemplateEngine extend
         @Override
         protected TemplateExpression prepare(Interpreter interpreter) {
             String value = interpreter.interpret(node).toString();
-            JexlNode dnode = jexl.parse(jexl.isDebug() ? node.jexlInfo() : null, value, null,
false, noscript);
+            JexlNode dnode = jexl.parse(node.jexlInfo(), value, null, false, noscript);
             return new ImmediateExpression(value, dnode, this);
         }
 

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/JexlNode.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/JexlNode.java?rev=1735590&r1=1735589&r2=1735590&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/JexlNode.java
(original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/parser/JexlNode.java
Fri Mar 18 12:37:33 2016
@@ -62,22 +62,24 @@ public abstract class JexlNode extends S
      * @return the info
      */
     public JexlInfo jexlInfo() {
+        JexlInfo info = null;
         JexlNode node = this;
         while (node != null) {
             if (node.jjtGetValue() instanceof JexlInfo) {
-                JexlInfo info = (JexlInfo) node.jjtGetValue();
-                if (lc >= 0) {
-                    int c = lc & 0xfff;
-                    int l = lc >> 0xc;
-                    return info.at(l, c);
-                } else {
-                    // weird though; no jjSetFirstToken(...) ever called?
-                    return info;
-                }
+                info = (JexlInfo) node.jjtGetValue();
+                break;
             }
             node = node.jjtGetParent();
         }
-        return null;
+        if (lc >= 0) {
+            int c = lc & 0xfff;
+            int l = lc >> 0xc;
+            // at least an info with line/column number
+            return info != null? info.at(l, c) : new JexlInfo(null, l, c);
+        } else {
+            // weird though; no jjSetFirstToken(...) ever called?
+            return info;
+        }
     }
 
     /**



Mime
View raw message