Repository: apex-malhar
Updated Branches:
  refs/heads/master 2e870f4b8 -> d713e521e


APEXMALHAR-2258 JavaExpressionParser should handle casting of binary expression 
correctly.


Project: http://git-wip-us.apache.org/repos/asf/apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-malhar/commit/d713e521
Tree: http://git-wip-us.apache.org/repos/asf/apex-malhar/tree/d713e521
Diff: http://git-wip-us.apache.org/repos/asf/apex-malhar/diff/d713e521

Branch: refs/heads/master
Commit: d713e521e62849c8116e7c45bfce40ead3c60a73
Parents: 2e870f4
Author: Chinmay Kolhatkar <chin...@datatorrent.com>
Authored: Wed Sep 21 12:46:54 2016 +0530
Committer: Chinmay Kolhatkar <chin...@datatorrent.com>
Committed: Wed Sep 21 12:52:40 2016 +0530

----------------------------------------------------------------------
 .../java/com/datatorrent/lib/expression/JavaExpressionParser.java | 2 +-
 library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/d713e521/library/src/main/java/com/datatorrent/lib/expression/JavaExpressionParser.java
----------------------------------------------------------------------
diff --git 
a/library/src/main/java/com/datatorrent/lib/expression/JavaExpressionParser.java
 
b/library/src/main/java/com/datatorrent/lib/expression/JavaExpressionParser.java
index 15a7a91..257f8a0 100644
--- 
a/library/src/main/java/com/datatorrent/lib/expression/JavaExpressionParser.java
+++ 
b/library/src/main/java/com/datatorrent/lib/expression/JavaExpressionParser.java
@@ -84,7 +84,7 @@ public class JavaExpressionParser implements 
Expression.ExpressionParser
       sb.append(tempExpr.replace("\\$", "$"));
     }
 
-    return "return ((" + returnType.getName().replace("$", "\\$") + ")" + 
sb.toString() + ");";
+    return "return ((" + returnType.getName().replace("$", "\\$") + ")(" + 
sb.toString() + "));";
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/d713e521/library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java
----------------------------------------------------------------------
diff --git a/library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java 
b/library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java
index e8553be..04fef88 100644
--- a/library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java
+++ b/library/src/test/java/com/datatorrent/lib/util/PojoUtilsTest.java
@@ -549,6 +549,9 @@ public class PojoUtilsTest
 
     expression = createExpression(fqcn, 
"round(pow({$.innerObj.privateFloatVal}, {$.innerObj.privateDoubleVal}))", 
long.class, new String[] {"java.lang.Math.*"});
     assertEquals(46162L, expression.execute(testObj));
+
+    expression = createExpression(fqcn, "{$.innerObj.privateFloatVal} > 0 && 
{$.innerObj.privateStringVal}.length() > 0", boolean.class);
+    assertEquals(true, expression.execute(testObj));
   }
 
   @Test

Reply via email to