commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r799790 - /commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.java
Date Sat, 01 Aug 2009 02:45:43 GMT
Author: sebb
Date: Sat Aug  1 02:45:43 2009
New Revision: 799790

URL: http://svn.apache.org/viewvc?rev=799790&view=rev
Log:
Add some docn.
Remove some debug code (oops!)
No need to convert put key to String as JexlContext now uses String keys

Modified:
    commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngine.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=799790&r1=799789&r2=799790&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 02:45:43 2009
@@ -96,6 +96,7 @@
         if (scriptText == null) {
             return 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);
         try {
             Script script = engine.createScript(scriptText);
@@ -108,15 +109,10 @@
                     return new JexlContextWrapper(context);
                 }
             };
-
-            ctxt.getVars().put("context", "value");
-
             return script.execute(ctxt);
         } catch (ParseException e) {
-            e.printStackTrace();
-            throw new ScriptException(e);
+            throw new ScriptException(e.toString());
         } catch (Exception e) {
-            e.printStackTrace();
             throw new ScriptException(e.toString());
         }
     }
@@ -131,8 +127,8 @@
         private static final JexlScriptEngineFactory DEFAULT_FACTORY = new JexlScriptEngineFactory();
     }
 
-    /**
-     * Wrapper to convert a JSR-223 ScriptContext into a JexlContext.
+    /*
+     * Wrapper to help convert a JSR-223 ScriptContext into a JexlContext.
      * 
      * Current implementation only gives access to ENGINE_SCOPE binding.
      */
@@ -182,7 +178,7 @@
 
         public Object put(final String key, final Object value) {
             Bindings bnd = context.getBindings(ScriptContext.ENGINE_SCOPE);
-            return bnd.put(String.valueOf(key), value);
+            return bnd.put(key, value);
         }
 
         public void putAll(Map t) {



Mime
View raw message