Index: ASTAndNode.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTAndNode.java,v retrieving revision 1.3 diff -u -r1.3 ASTAndNode.java --- ASTAndNode.java 28 Feb 2004 13:45:20 -0000 1.3 +++ ASTAndNode.java 17 Aug 2004 10:19:19 -0000 @@ -47,14 +47,16 @@ throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); + + /* Return now if we already know the answer */ + if (!Coercion.coerceBoolean(left).booleanValue()) + return Boolean.FALSE; + Object right = ((SimpleNode) jjtGetChild(1)).value(jc); - /* - * coercion rules + /* If "left" was true, then the result is whatever the "right" + * is evaluated to. */ - - return (Coercion.coerceBoolean(left).booleanValue() - && Coercion.coerceBoolean(right).booleanValue()) ? - Boolean.TRUE : Boolean.FALSE; + return Coercion.coerceBoolean(right); } } Index: ASTOrNode.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTOrNode.java,v retrieving revision 1.3 diff -u -r1.3 ASTOrNode.java --- ASTOrNode.java 28 Feb 2004 13:45:20 -0000 1.3 +++ ASTOrNode.java 17 Aug 2004 10:19:19 -0000 @@ -47,14 +47,16 @@ throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); + + /* Return now if we already know the answer */ + if (Coercion.coerceBoolean(left).booleanValue()) + return Boolean.TRUE; + Object right = ((SimpleNode) jjtGetChild(1)).value(jc); - - /* - * coercion rules + + /* If "left" was false, then the result is whatever the "right" + * is evaluated to. */ - - return (Coercion.coerceBoolean(left).booleanValue() - || Coercion.coerceBoolean(right).booleanValue()) ? - Boolean.TRUE : Boolean.FALSE; + return Coercion.coerceBoolean(right); } }