You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ra...@apache.org on 2009/01/07 19:39:22 UTC
svn commit: r732422 -
/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java
Author: rahul
Date: Wed Jan 7 10:39:21 2009
New Revision: 732422
URL: http://svn.apache.org/viewvc?rev=732422&view=rev
Log:
Minor improvements -
* Catch generic Exception during expression evaluator so the ErrorReporter gets notified
* Only first match in evalLocation needs replacement
* Don't return null from a function with Boolean return type
Modified:
commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java
Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java?rev=732422&r1=732421&r2=732422&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java (original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/javascript/JSEvaluator.java Wed Jan 7 10:39:21 2009
@@ -127,7 +127,7 @@
// ... evaluate
return engine.eval(buffer.toString(),new JSBindings(context,bindings));
- } catch (ScriptException x) {
+ } catch (Exception x) {
throw new SCXMLExpressionException("Error evaluating ['" + expression + "'] " + x);
}
}
@@ -149,7 +149,7 @@
Object object;
if ((object = eval(context,expression)) == null) {
- return null;
+ return Boolean.FALSE;
}
if (object instanceof Boolean) {
@@ -184,7 +184,7 @@
// ... replace Data() function
- while (matcher.find()) {
+ if (matcher.find()) {
matcher.appendReplacement(buffer,"xpath.node(_ALL_NAMESPACES," + matcher.group(1) + "," + matcher.group(2) + ")");
}
@@ -193,7 +193,7 @@
// ... evaluate
return (Node) engine.eval(buffer.toString(),new JSBindings(context,bindings));
- } catch (ScriptException x) {
+ } catch (Exception x) {
throw new SCXMLExpressionException("Error evaluating ['" + expression + "'] " + x);
}
}