ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject <isset> oddity
Date Mon, 15 Jun 2009 14:15:15 GMT

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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message