followup = the behaviour described in my first posting occurs with Windows2000, jdk 1.5.0_11 i checked with the same propertyfiles, means <xmlkey> </xmlkey> txtkey= *blank* and antscript with isset condition on my private machine = OpenSuse 11.1/64bit, jdk 1.6.0_13 and got equal ouput for all available ant versions =
[echo] Apache Ant version 1.6.5 compiled on June 2 2005 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == ${txtkey} [echo] xmlkey not set [echo] txtkey not set [echo] Apache Ant version 1.7.0 compiled on December 13 2006 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == ${txtkey} [echo] xmlkey not set [echo] txtkey not set [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == ${txtkey} [echo] xmlkey not set [echo] txtkey not set i rechecked on Windows2000, jdk1.5.0_11 [echo] Apache Ant version 1.6.5 compiled on June 2 2005 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null [echo] Apache Ant version 1.7.0 compiled on December 13 2006 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null and AIX 5.3.0.0, J2RE 1.5.0 IBM J9 2.3 AIX ppc-32 [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null Conclusion = there seems to be a difference related to the handling of txt- and xmlproperties on different platforms, maybe it's caused by jdk/jre ? So i need to use a workaround like that, to check whether a property isset or is blank = <if> <!--<isset property="xmlkey"/>--> <not> <or> <contains string="${xmlkey}" substring="$${"/> <equals arg1="${xmlkey}" arg2="" /> </or> </not> <then> <echo>xmlkey set and != null</echo> </then> <else> <echo>xmlkey not set</echo> </else> </if> Any other ideas ? Should i open a bugreport ? Regards, Gilbert -----Original Message----- From: Rebhan, Gilbert Sent: Monday, June 15, 2009 4:15 PM To: 'Ant Users List' Subject: <isset> oddity Hi, found another oddity after upgrading to Ant 1.7.1, regarding the handling of properties and xmlproperties. <project name="bla" default="main" basedir="."> <!-- // Taskdefs --> <!-- Import AntContrib --> <taskdef resource="net/sf/antcontrib/antlib.xml" /> <!-- Taskdefs // --> <!-- // Properties --> <property file="props.txt" /> <xmlproperty file="props.xml" keeproot="false" /> <!-- Properties // --> <target name="main"> <echo>${ant.version}</echo> <echo>$${xmlkey} == ${xmlkey}</echo> <echo>$${txtkey} == ${txtkey}</echo> <if> <isset property="xmlkey"/> <then> <echo>xmlkey set and != null</echo> </then> <else> <echo>xmlkey not set</echo> </else> </if> <if> <isset property="txtkey" /> <then> <echo>txtkey set and != null</echo> </then> <else> <echo>txtkey not set</echo> </else> </if> </target Testpropertyfiles both xmlkey and txtkey are null <?xml version="1.0" encoding="UTF-8"?> <root> <xmlkey></xmlkey> <xmlfoo>bar</xmlfoo> </root> ------ txtfoo=bar txtkey= ant 1.6.5 [echo] Apache Ant version 1.6.5 compiled on June 2 2005 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null means txt and xmlproperty behave different seems to be fixed now, as ant 1.7.1 gives the same result for txt and xmlproperty = ant 1.7.1 [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == [echo] ${txtkey} == [echo] xmlkey set and != null [echo] txtkey set and != null Testpropertyfiles both xmlkey and txtkey are " " <?xml version="1.0" encoding="UTF-8"?> <root> <xmlkey> </xmlkey> <xmlfoo>bar</xmlfoo> </root> ------ txtfoo=bar txtkey= *blank* ant 1.6.5 [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null ant 1.7.1 [echo] Apache Ant version 1.7.1 compiled on June 27 2008 [echo] ${xmlkey} == ${xmlkey} [echo] ${txtkey} == [echo] xmlkey not set [echo] txtkey set and != null means there's a difference between the handling of txtproperties and xmlproperties that existed in 1.6.5 and still exists in 1.7.1, should be the same for both kind of properties, i would expect = [echo] ${xmlkey} == [echo] ${txtkey} == Is that intended behaviour or just a bug ? Regards, Gilbert --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org