Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 43328 invoked from network); 13 Oct 2009 10:58:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Oct 2009 10:58:34 -0000 Received: (qmail 94478 invoked by uid 500); 13 Oct 2009 10:58:34 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 94397 invoked by uid 500); 13 Oct 2009 10:58:33 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 94385 invoked by uid 99); 13 Oct 2009 10:58:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 10:58:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 10:58:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0BFE323888EA; Tue, 13 Oct 2009 10:58:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r824688 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java Date: Tue, 13 Oct 2009 10:58:09 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091013105810.0BFE323888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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("> "); } } }