ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10386] - condition with isset does not return valid results on ${env.<varname>} when varname is not defined
Date Wed, 03 Jul 2002 23:53:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10386>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10386

condition with isset does not return valid results on ${env.<varname>} when varname
is not defined





------- Additional Comments From holtdl@yahoo.com  2002-07-03 23:53 -------
> But another condition, <not> <isset> does not set the variable either.

Yes, it does -- but, again, you've got your defaults *before* your <condition>, 
and that will not work. You've got to move those to *after* the condition:
<project default="whatever">
  <property environment="env"/>
  <target name="whatever">
    <condition property="var7" value="var7 set because env.var0 IS set">
      <isset property="env.var0"/>
    </condition>
    <property name="var7" value="DEFAULT VALUE for var7"/>
    <condition property="var8" value="var8 set because env.var0 is NOT set">
      <not>
        <isset property="env.var0"/>
      </not>
    </condition>
    <property name="var8" value="DEFAULT VALUE for var8"/>
    <echo message="${var7}   ${var8}"/>
  </target>
</project>

$ ant
whatever:
     [echo] DEFAULT VALUE for var7   var8 set because env.var0 is NOT set
$ var0=foo ant
whatever:
     [echo] var7 set because env.var0 IS set   DEFAULT VALUE for var8

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message