You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2009/06/15 16:15:15 UTC
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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: oddity
Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
-----Original Message-----
From: Rebhan, Gilbert
Sent: Wednesday, June 17, 2009 1:58 PM
To: 'Ant Users List'
Subject: RE: <isset> oddity
/*
Bugreport opened, Patch attached =
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
[...]
Works with ant 1.7.1, jdk 1.5.0_11 and jdk 1.6.0_07 on Windows 2000
Have to recheck on my machine later ..
*/
.. and also with J2RE 1.5.0 IBM J9 2.3 AIX ppc-32 on AIX 5.3.0.0
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: oddity
Posted by Gilbert Rebhan <an...@schillbaer.de>.
Stefan Bodewig schrieb:
> On 2009-06-17, Rebhan, Gilbert wrote:
>
>> It wasn't an issue with jdk, but the processNode Method in XmlProperty
>
>> if (nodeText.trim().length() != 0 || emptyNode) {
>> addProperty(prefix, nodeText, id);
>> }
>
>> when trim removes all white spaces, so it works with
>
>> if (nodeText.trim().length() >= 0 || emptyNode) {
>> addProperty(prefix, nodeText, id);
>> }
>
>> Works with ant 1.7.1, jdk 1.5.0_11 and jdk 1.6.0_07 on Windows 2000
>> Have to recheck on my machine later ..
>
> I guess this is for convenience so that
>
> <foo></foo>
>
> and
>
> <foo/>
>
> mean the same thing as
>
> <foo>
> </foo>
>
> (it's not that likely that people actually want a value of newline).
>
> Maybe we need some sort of flag?
hmm, i just checked on my private machine - OpenSUSE 11.1/64bit
with jdk 1.5.0_18 and jdk 1.6.0_13 and the same propertyfiles,
means <xmlkey> <xmlkey/> and txtkey=*blank*
but the patch has no impact, still the same output !?
Using a " " property may not be of practical importance, but the
behaviour should be the same for txtproperty and xmlproperty,
it is, but diametrical =
on my LinuxBox (jdk 5 +6, the same behavior already with ant 1.6.5)
[echo] ${xmlkey} == ${xmlkey}
[echo] ${txtkey} == ${txtkey}
[echo] xmlkey not set
[echo] txtkey not set
and on Windows and AIX (jdk 5 + 6)
[echo] ${xmlkey} ==
[echo] ${txtkey} ==
[echo] xmlkey set
[echo] txtkey set
maybe a 32bit <> 64bit issue ?
Right now i have no 32bit Linux around to check ..
Can someone confirm my investigations ?
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: oddity
Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-06-17, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> It wasn't an issue with jdk, but the processNode Method in XmlProperty
> if (nodeText.trim().length() != 0 || emptyNode) {
> addProperty(prefix, nodeText, id);
> }
> when trim removes all white spaces, so it works with
> if (nodeText.trim().length() >= 0 || emptyNode) {
> addProperty(prefix, nodeText, id);
> }
> Works with ant 1.7.1, jdk 1.5.0_11 and jdk 1.6.0_07 on Windows 2000
> Have to recheck on my machine later ..
I guess this is for convenience so that
<foo></foo>
and
<foo/>
mean the same thing as
<foo>
</foo>
(it's not that likely that people actually want a value of newline).
Maybe we need some sort of flag?
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: oddity
Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Wednesday, June 17, 2009 9:49 AM
To: user@ant.apache.org
Subject: Re: <isset> oddity
/*
On 2009-06-16, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> 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 ?
Looked like a Java5/Java6 difference, maybe inside the XML parser.
> Should i open a bugreport ?
Yes, please do (so I can "untick" yur emails ;-)
*/
Bugreport opened, Patch attached =
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
It wasn't an issue with jdk, but the processNode Method in XmlProperty =
if (nodeText.trim().length() != 0 || emptyNode) {
addProperty(prefix, nodeText, id);
}
when trim removes all white spaces, so it works with =
if (nodeText.trim().length() >= 0 || emptyNode) {
addProperty(prefix, nodeText, id);
}
Works with ant 1.7.1, jdk 1.5.0_11 and jdk 1.6.0_07 on Windows 2000
Have to recheck on my machine later ..
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: oddity
Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-06-16, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> 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 ?
Looked like a Java5/Java6 difference, maybe inside the XML parser.
> Should i open a bugreport ?
Yes, please do (so I can "untick" yur emails ;-)
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: oddity
Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org