commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r799926 - in /commons/proper/jexl/branches/2.0/src: java/org/apache/commons/jexl/scripting/JexlScriptEngine.java test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java
Date Sat, 01 Aug 2009 21:09:34 GMT
Author: sebb
Date: Sat Aug  1 21:09:34 2009
New Revision: 799926

URL: http://svn.apache.org/viewvc?rev=799926&view=rev
Log:
Ensure "context" key is defined in engine context

Modified:
    commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
    commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java

Modified: commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java?rev=799926&r1=799925&r2=799926&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
(original)
+++ commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
Sat Aug  1 21:09:34 2009
@@ -55,6 +55,8 @@
  */
 public class JexlScriptEngine extends AbstractScriptEngine {
 
+    public static final String CONTEXT_KEY = "context";
+
     private final ScriptEngineFactory factory;
     
     private final JexlEngine engine;
@@ -107,7 +109,7 @@
             throw new NullPointerException("script and context must be non-null");
         }
         // This is mandated by JSR-223 (end of section SCR.4.3.4.1.2 - Script Execution)
-        context.setAttribute("context", context, ScriptContext.ENGINE_SCOPE);
+        context.setAttribute(CONTEXT_KEY, context, ScriptContext.ENGINE_SCOPE);
         try {
             Script script = engine.createScript(scriptText);
             JexlContext ctxt = new JexlContext(){

Modified: commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java?rev=799926&r1=799925&r2=799926&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java
(original)
+++ commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/scripting/JexlScriptEngineTest.java
Sat Aug  1 21:09:34 2009
@@ -49,6 +49,7 @@
         assertEquals(newValue,engine.eval("old=value;value=value+1"));
         assertEquals(initialValue,engine.get("old"));
         assertEquals(newValue,engine.get("value"));
+        assertEquals(engine.getContext(),engine.get(JexlScriptEngine.CONTEXT_KEY));
     }
     
     public void testNulls() throws Exception {



Mime
View raw message