commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [2/2] commons-scxml git commit: Javascript conditional expressions must be evaluated as (converted to) effective boolean expression
Date Mon, 28 Dec 2015 20:45:38 GMT
Javascript conditional expressions must be evaluated as (converted to) effective boolean expression


Project: http://git-wip-us.apache.org/repos/asf/commons-scxml/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-scxml/commit/4f0841e0
Tree: http://git-wip-us.apache.org/repos/asf/commons-scxml/tree/4f0841e0
Diff: http://git-wip-us.apache.org/repos/asf/commons-scxml/diff/4f0841e0

Branch: refs/heads/master
Commit: 4f0841e04d88db62129618493ff85b87efec7712
Parents: b24e7f3
Author: Ate Douma <ate@apache.org>
Authored: Mon Dec 28 21:45:01 2015 +0100
Committer: Ate Douma <ate@apache.org>
Committed: Mon Dec 28 21:45:01 2015 +0100

----------------------------------------------------------------------
 .../commons/scxml2/env/javascript/JSEvaluator.java      | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/4f0841e0/src/main/java/org/apache/commons/scxml2/env/javascript/JSEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/scxml2/env/javascript/JSEvaluator.java b/src/main/java/org/apache/commons/scxml2/env/javascript/JSEvaluator.java
index aa0a744..a901136 100644
--- a/src/main/java/org/apache/commons/scxml2/env/javascript/JSEvaluator.java
+++ b/src/main/java/org/apache/commons/scxml2/env/javascript/JSEvaluator.java
@@ -188,17 +188,7 @@ public class JSEvaluator extends AbstractBaseEvaluator {
      */
     @Override
     public Boolean evalCond(Context context, String expression) throws SCXMLExpressionException
{
-        final Object result = eval(context, expression);
-
-        if (result == null) {
-            return Boolean.FALSE;
-        }
-
-        if (result instanceof Boolean) {
-            return (Boolean)result;
-        }
-
-        throw new SCXMLExpressionException("Invalid boolean expression: " + expression);
+        return (Boolean)eval(context, "Boolean("+expression+")");
     }
 
     /**


Mime
View raw message