You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/06/17 13:28:12 UTC
DO NOT REPLY [Bug 47381] New: XmlProperty doesn' allow propertvalues
with only space(s)
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
Summary: XmlProperty doesn' allow propertvalues with only
space(s)
Product: Ant
Version: 1.7.1
Platform: PC
OS/Version: Windows Server 2003
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: notifications@ant.apache.org
ReportedBy: Gilbert.Rebhan@huk-coburg.de
Created an attachment (id=23823)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23823)
XmlProperty.java.diff.txt
Discovered a difference related to the handling of txtproperties and
xmlproperties after upgrading from ant 1.6.5 to ant 1.7.1
**Test 1**
* props.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<xmlkey></xmlkey>
<xmlfoo>bar</xmlfoo>
</root>
* props.txt
txtfoo=bar
txtkey=
*TestScript
<project name="foobar" 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</echo>
</then>
<else>
<echo>xmlkey not set</echo>
</else>
</if>
<if>
<isset property="txtkey" />
<then>
<echo>txtkey set</echo>
</then>
<else>
<echo>txtkey not set</echo>
</else>
</if>
</target>
</project>
*Output
[echo] Apache Ant version 1.6.5 compiled on June 2 2005
[echo] ${xmlkey} == ${xmlkey}
[echo] ${txtkey} ==
[echo] xmlkey not set
[echo] txtkey set
[echo] Apache Ant version 1.7.0 compiled on December 13 2006
[echo] ${xmlkey} ==
[echo] ${txtkey} ==
[echo] xmlkey set
[echo] txtkey set
[echo] Apache Ant version 1.7.1 compiled on June 27 2008
[echo] ${xmlkey} ==
[echo] ${txtkey} ==
[echo] xmlkey set
[echo] txtkey set
the different handling of empty txt and xml properties seems
to be fixed in conjunction with Bug 26286 - XmlProperty: empty element semantic
problems
but Test 2 shows another problem when xmlpropertyfile contains a node which has
only
1 or more spaces, which is no problem in a txtpropertyfile
** Test 2 **
* props.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<xmlkey> </xmlkey>
<xmlfoo>bar</xmlfoo>
</root>
* props.txt
txtfoo=bar
txtkey=*blank*
*Output
[echo] Apache Ant version 1.6.5 compiled on June 2 2005
[echo] ${xmlkey} == ${xmlkey}
[echo] ${txtkey} ==
[echo] xmlkey not set
[echo] txtkey set
[echo] Apache Ant version 1.7.0 compiled on December 13 2006
[echo] ${xmlkey} == ${xmlkey}
[echo] ${txtkey} ==
[echo] xmlkey not set
[echo] txtkey set
[echo] Apache Ant version 1.7.1 compiled on June 27 2008
[echo] ${xmlkey} == ${xmlkey}
[echo] ${txtkey} ==
[echo] xmlkey not set
[echo] txtkey set
which is wrong, as value of xmlkey is also = " " like value of txtkey
Fixed line 469 in org/apache/tools/taskdefs/XmlProperty
< if (nodeText.trim().length() != 0 || emptyNode) {
---
> if (nodeText.trim().length() >= 0 || emptyNode) {
and it works as expected =
[echo] Apache Ant version 1.7.1 compiled on June 27 2008
[echo] ${xmlkey} ==
[echo] ${txtkey} ==
[echo] xmlkey set
[echo] txtkey set
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 47381] XmlProperty doesn't allow propertvalues
with only space(s)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |PatchAvailable
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 47381] XmlProperty doesn' allow propertvalues with
only space(s)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
--- Comment #1 from Gilbert Rebhan <Gi...@huk-coburg.de> 2009-06-17 13:45:49 PST ---
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 ?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 47381] XmlProperty doesn't allow propertvalues
with only space(s)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47381
Gilbert Rebhan <Gi...@huk-coburg.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|XmlProperty doesn' allow |XmlProperty doesn't allow
|propertvalues with only |propertvalues with only
|space(s) |space(s)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.