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 2013/04/09 14:30:55 UTC

[Bug 54819] New: PropertyFile Task entry key/value adds backslash to properties

https://issues.apache.org/bugzilla/show_bug.cgi?id=54819

            Bug ID: 54819
           Summary: PropertyFile Task entry key/value adds backslash to
                    properties
           Product: Ant
           Version: 1.8.4
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: vasilena.treneva@softwareag.com
    Classification: Unclassified

Here is the how the script looks:

    <property name="machinename" value="localhost" />
    <property name="installdir" value="C:/SoftwareAG" />
    <property name="platform.profiles" value="SPM,CTP" />
    <property name="reusable.ant.targets" location="./../reusable-ant-targets"
/>
    <property name="event.type.store.location"
value="${installdir}/common/EventTypeStore" />
    <property name="broker.name" value="Broker #1" />
    <property name="broker.port" value="6849" />
    <property name="broker.host" value="${machinename}" />
    <property name="use.nirvana" value="false" />
    <property name="nirvana.port" value="9000" />
    <property name="nirvana.protocol" value="nsp" />
    <property name="nirvana.host" value="${machinename}" />
    <property name="nerv.property.file.name"
value="com.softwareag.eda.nerv.properties" />
    <property name="nirvana.sync.mode" value="false" />
    <property name="platform.config.file.name" value="wrapper.conf" />

<target name="set.platform.props">
        <for list="${platform.profiles}" param="profile" delimiter=",">
            <sequential>
                <echo message="Starting substitution of platform config
properties for profile: @{profile}" />
                <echo message="Setting nirvana.syncSendPersistent:
${nirvana.sync.mode}" />
                <var name="platform.config.location"
value="${installdir}/profiles/@{profile}/configuration" />
                <propertyfile
file="${platform.config.location}/${platform.config.file.name}">
                    <entry key="wrapper.java.additional.77"
value="-Dnirvana.syncSendPersistent=${nirvana.sync.mode}" />
                </propertyfile>
            </sequential>
        </for>
    </target>

There is only a single property that we need to add to this wrapper.conf file.
It is: wrapper.java.additional.77=-Dnirvana.syncSendPersistent=false
After the file is processed by the script all properties in it, are "escaped",
i.e:

Original value of the property: 
wrapper.java.additional.4=-XX:MaxPermSize=256M

New value of the property: 
wrapper.java.additional.4=-XX\:MaxPermSize\=256M

This breaks products that use the file.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 54819] PropertyFile Task entry key/value adds backslash to properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54819

Jesse Glick <jg...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jglick@apache.org

--- Comment #2 from Jesse Glick <jg...@apache.org> ---
Or more precisely, _a_ correct format. In this case it is not necessary to emit
the backslashes. It is just simpler to escape all occurrences of certain
characters, rather than determining in each case whether it might be
interpreted as a metacharacter in input. Other implementations such as
http://hg.netbeans.org/main-silver/raw-file/ccc42f413d4c/openide.util/src/org/openide/util/EditableProperties.java
may choose to be more sparing with escape characters so as to maximize human
readability, so long as Properties.load still recognizes the result. At any
rate, any tool dealing with *.properties files must follow the standard syntax.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 54819] PropertyFile Task entry key/value adds backslash to properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54819

Peter Reilly <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 OS|                            |All

--- Comment #1 from Peter Reilly <pe...@apache.org> ---
This is not a bug. This is the correct format for a properties file.
See
http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#store(java.io.Writer,
java.lang.String)

Also:
    @Test public void property() throws Exception {
        Properties p = new Properties();
        p.setProperty("name", "-Dnirvana.syncSendPersistent=false
-XX:MaxPermSize=256M");
        StringWriter sw = new StringWriter();
        p.store(sw, "");
        System.out.println(sw.toString());
    }

outputs:

#
#Tue Apr 09 14:09:54 IST 2013
name=-Dnirvana.syncSendPersistent\=false -XX\:MaxPermSize\=256M

-- 
You are receiving this mail because:
You are the assignee for the bug.