You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/10/13 12:58:09 UTC

svn commit: r824688 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java

Author: sebb
Date: Tue Oct 13 10:58:09 2009
New Revision: 824688

URL: http://svn.apache.org/viewvc?rev=824688&view=rev
Log:
Document expected behaviour when Exceptions occur.
Don't exit interactive session on ScriptException.
Print prompt after exception as well.

Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java?rev=824688&r1=824687&r2=824688&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java Tue Oct 13 10:58:09 2009
@@ -22,8 +22,7 @@
 import java.io.InputStreamReader;
 
 import javax.script.ScriptEngine;
-
-import org.apache.commons.jexl.JexlException;
+import javax.script.ScriptException;
 
 /**
  * Test application for JexlScriptEngine (JSR-223 implementation).
@@ -35,8 +34,11 @@
      * Test application for JexlScriptEngine (JSR-223 implementation).
      * 
      * If a single argument is present, it is treated as a filename of a JEXL
-     * script to be executed.
+     * script to be evaluated. Any exceptions terminate the application.
+     * 
      * Otherwise, lines are read from standard input and evaluated.
+     * ScriptExceptions are logged, and do not cause the application to exit.
+     * This is done so that interactive testing is easier.
      * 
      * @param args (optional) filename to evaluate. Stored in the args variable.
      * 
@@ -57,10 +59,10 @@
                 try {
                     Object value = engine.eval(line);
                     System.out.println("Return value: "+value);
-                    System.out.print("> ");
-                } catch (JexlException e) {
+                } catch (ScriptException e) {
                     System.out.println(e.getLocalizedMessage());
                 }
+                System.out.print("> ");
             }
         }
     }