We are migrating from ant 1.6.2 to ant 1.10.1 and depending on the isset we execute a work flow .. below is the code. config.xml <RMOBINTERMEDIUM> <UserName></UserName> <Password></Password> <SID></SID> <Host></Host> </RMOBINTERMEDIUM> <if> <isset property="RMOBINTERMEDIUM.UserName"/> <then> <echo message="schema exists"/> </then> when executing the above code i am getting the "schema exists: printed .while the config.xml has no value set. below is the output [sqlplus] 11:53:21 SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production [sqlplus] With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, [sqlplus] Advanced Analytics and Real Application Testing options [echo] rmob exists NOTE: it still works when i got back to ant 1.6.2 but we need to upgrade to 1.10.1 and the behavior of the isset is not working as desired.
sorry i had a typo in previous result ,this is the result we are seeing [echo] schema exists
You don't show how you read the file. Can you put the whole example into a simple self-contained build file? Preferably without using ant-contrib, so we get that out of consideration. <project> <condition property="schema" value="exists"> <isset property="RMOBINTERMEDIUM.UserName"/> </condition> <property name="schema" value="doesn't exist"/> <echo>schema: ${schema}</echo> </project> should work well enough for the test. With 1.10.1 I get $ ant -f /tmp/x.xml -DRMOBINTERMEDIUM.UserName=x Buildfile: /tmp/x.xml [echo] schema: exists BUILD SUCCESSFUL Total time: 0 seconds $ ant -f /tmp/x.xml Buildfile: /tmp/x.xml [echo] schema: doesn't exist BUILD SUCCESSFUL Total time: 0 seconds
when I use <condition> <isset> it works fine . can you test it <if> <isset> and see if its returning the same result ?
This works for with Ant-1.9.6 and Ant-1.10.1 <project xmlns:antcontrib="antlib:net.sf.antcontrib"> <echo>using built in condition</echo> <echo>------------------------</echo> <condition property="schema" value="exists"> <isset property="RMOBINTERMEDIUM.UserName"/> </condition> <property name="schema" value="doesn't exist"/> <echo>schema: ${schema}</echo> <echo/> <echo>using ant-contrib::if</echo> <echo>---------------------</echo> <mkdir dir="tmp"/> <get src="http://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" dest="tmp" > <flattenmapper/> </get> <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpath="tmp/ant-contrib-1.0b3.jar"/> <antcontrib:if> <isset property="RMOBINTERMEDIUM.UserName"/> <antcontrib:then> <echo message="schema exists"/> </antcontrib:then> <antcontrib:else> <echo message="schema does not exists"/> </antcontrib:else> </antcontrib:if> </project>
works fine with ant-contrib as well $ cat f.xml <project> <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> <pathelement location="ant-contrib-1.0b3.jar"/> </classpath> </taskdef> <if> <isset property="RMOBINTERMEDIUM.UserName"/> <then> <echo>schema exists</echo> </then> <else> <echo>schema doesn't exists</echo> </else> </if> </project> /tmp$ ant -f f.xml Buildfile: /tmp/f.xml [echo] schema doesn't exists BUILD SUCCESSFUL Total time: 0 seconds $ ant -f f.xml -DRMOBINTERMEDIUM.UserName=x Buildfile: /tmp/f.xml [echo] schema exists BUILD SUCCESSFUL Total time: 0 seconds So I think it is not isset but rather the way you actually set the property (and which you haven't shown). I'm guessing now that you are using xmlproperty - if so bug 26286 which has been fixed for Ant 1.7.0 might be the root cause. If my guess is correct, then your current script depends on something we have considered a bug and fixed almost 11 years ago.
(In reply to Stefan Bodewig from comment #5) > If my guess is correct, then your current script depends on > something we have considered a bug and fixed almost 11 years ago. and you may work around it by using <and> <isset property="RMOBINTERMEDIUM.UserName"/> <not> <equals arg1="" args2="${RMOBINTERMEDIUM.UserName}"/> </not> </and> which should work with 1.6.2 and 1.7.0+
yes, that fixed it . that is how i change my code and it works now.