diff options
Diffstat (limited to 'src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java')
-rw-r--r-- | src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java index d1060ab..d31f2bc 100644 --- a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java +++ b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved. + * Copyright (c) 2001-2004, 2007 Ant-Contrib project. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,18 @@ package net.sf.antcontrib.logic.condition; import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.taskdefs.condition.IsTrue; +import org.apache.tools.ant.ProjectComponent; +import org.apache.tools.ant.taskdefs.condition.Condition; /** - * Extends IsTrue condition to check the value of a specified property. + * Checks the value of a specified property. * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003. * * @author Dale Anson, [email protected] * @version $Revision: 1.3 $ */ -public class IsPropertyTrue extends IsTrue { +public final class IsPropertyTrue + extends ProjectComponent implements Condition { private String name = null; @@ -37,9 +39,7 @@ public class IsPropertyTrue extends IsTrue { if ( name == null ) throw new BuildException( "Property name must be set." ); String value = getProject().getProperty( name ); - if ( value == null ) - return false; - return getProject().toBoolean( value ); + return value != null && getProject().toBoolean( value ); } } |