commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1234374 - in /commons/proper/configuration/trunk: pom.xml src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java
Date Sat, 21 Jan 2012 17:30:09 GMT
Author: oheger
Date: Sat Jan 21 17:30:09 2012
New Revision: 1234374

URL: http://svn.apache.org/viewvc?rev=1234374&view=rev
Log:
[CONFIGURATION-465] Switched to Jexl 2.1.1.

Modified:
    commons/proper/configuration/trunk/pom.xml
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java

Modified: commons/proper/configuration/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/pom.xml?rev=1234374&r1=1234373&r2=1234374&view=diff
==============================================================================
--- commons/proper/configuration/trunk/pom.xml (original)
+++ commons/proper/configuration/trunk/pom.xml Sat Jan 21 17:30:09 2012
@@ -259,9 +259,9 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-jexl</groupId>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-jexl</artifactId>
-      <version>1.1</version>
+      <version>2.1.1</version>
       <optional>true</optional>
     </dependency>
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java?rev=1234374&r1=1234373&r2=1234374&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/interpol/ExprLookup.java
Sat Jan 21 17:30:09 2012
@@ -20,10 +20,10 @@ import java.util.ArrayList;
 
 import org.apache.commons.configuration.AbstractConfiguration;
 import org.apache.commons.configuration.ConfigurationRuntimeException;
-import org.apache.commons.jexl.Expression;
-import org.apache.commons.jexl.ExpressionFactory;
-import org.apache.commons.jexl.JexlContext;
-import org.apache.commons.jexl.JexlHelper;
+import org.apache.commons.jexl2.Expression;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.MapContext;
 import org.apache.commons.lang.ClassUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.text.StrLookup;
@@ -79,7 +79,10 @@ public class ExprLookup extends StrLooku
     private AbstractConfiguration configuration;
 
     /** The JexlContext */
-    private JexlContext context = JexlHelper.createContext();
+    private JexlContext context = new MapContext();
+
+    /** The engine. */
+    private final JexlEngine engine = new JexlEngine();
 
     /** The String to use to start subordinate lookup expressions */
     private String prefixMatcher = DEFAULT_PREFIX;
@@ -142,13 +145,11 @@ public class ExprLookup extends StrLooku
      * Add the Variables that will be accessible within expressions.
      * @param list The list of Variables.
      */
-    // It should be safe to put data in the JEXL context the way we do it here
-    @SuppressWarnings("unchecked")
     public void setVariables(Variables list)
     {
         for (Variable var : list)
         {
-            context.getVars().put(var.getName(), var.getValue());
+            context.set(var.getName(), var.getValue());
         }
     }
 
@@ -186,7 +187,7 @@ public class ExprLookup extends StrLooku
 
         try
         {
-            Expression exp = ExpressionFactory.createExpression(result);
+            Expression exp = engine.createExpression(result);
             result = (String) exp.evaluate(context);
         }
         catch (Exception e)



Mime
View raw message