This is an automated email from the ASF dual-hosted git repository. mbenson pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push: new 5fb187d fix bug with scriptcondition eval result 5fb187d is described below commit 5fb187d3e6e7cb7f83d3b8ba3b3276f1576dcc35 Author: Matt Benson <mben...@apache.org> AuthorDate: Mon Feb 14 15:18:28 2022 -0600 fix bug with scriptcondition eval result --- src/main/org/apache/tools/ant/types/optional/ScriptCondition.java | 2 +- src/tests/antunit/types/optional/scriptcondition-test.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/types/optional/ScriptCondition.java b/src/main/org/apache/tools/ant/types/optional/ScriptCondition.java index d3fbe9e..51972f7 100644 --- a/src/main/org/apache/tools/ant/types/optional/ScriptCondition.java +++ b/src/main/org/apache/tools/ant/types/optional/ScriptCondition.java @@ -45,7 +45,7 @@ public class ScriptCondition extends AbstractScriptComponent implements Conditio public boolean eval() throws BuildException { initScriptRunner(); final Object result = getRunner().evaluateScript("ant_condition"); - return Boolean.TRUE.equals(result) || getValue(); + return result instanceof Boolean ? Boolean.TRUE.equals(result) : getValue(); } /** diff --git a/src/tests/antunit/types/optional/scriptcondition-test.xml b/src/tests/antunit/types/optional/scriptcondition-test.xml index 16d4af1..40315c1 100644 --- a/src/tests/antunit/types/optional/scriptcondition-test.xml +++ b/src/tests/antunit/types/optional/scriptcondition-test.xml @@ -77,11 +77,11 @@ </target> <target name="test-return-value-false"> - <au:assertTrue> + <au:assertFalse> <scriptcondition language="beanshell" value="true"> false </scriptcondition> - </au:assertTrue> + </au:assertFalse> </target> </project>