beckchr / juel

Java Unified Expression Language
http://juel.sf.net
Apache License 2.0
133 stars 43 forks source link

2.2.7: JUEL's ${not x} fails with NPE if using custom typeConverter which returns null #89

Open oxygenecore opened 9 years ago

oxygenecore commented 9 years ago

If I override TypeConverterImpl in a manner to return null for input null values (to imitate apache's COERCE_TO_ZERO=false), ${not x} fails with NPE:

java.lang.NullPointerException at de.odysseus.el.tree.impl.ast.AstUnary$3.apply(AstUnary.java:46) at de.odysseus.el.tree.impl.ast.AstUnary$SimpleOperator.eval(AstUnary.java:32) at de.odysseus.el.tree.impl.ast.AstUnary.eval(AstUnary.java:64) at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:51) at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:31) at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)

Also, it seems that math binary operations also do not work with nulls properly - if one of parameters is null and other is not, code proceeds to an actual math block with implicit casts to a primitive number.