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 2006/10/05 09:54:24 UTC

RE: Location attribute in property not resolving correctly

Hi,

still no solution ?
Should i fill a bug report about that behaviour
of <propertyfile file="... " />

resulting in a deformed path, f.e.

Y:/bla/corba.jar >>> Y\:/bla/corba.jar

?!

see example below

same result with ant 1.7.0 beta2


Regards, Gilbert

-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
Sent: Wednesday, September 27, 2006 8:03 AM
To: Ant Users List
Subject: RE: Location attribute in property not resolving correctly

 
Hi,

strange =

<project name="bla" default="main" basedir=".">
    <!-- Import AntContrib -->
    <taskdef resource="net/sf/antcontrib/antlib.xml" />
    <target name="depends">
        <timestampselector 
            outputsetid="mypath"
            count="1"
            age="eldest" >
        <path>
            <fileset dir="Y:/bla">
                <include name="*.jar" />
            </fileset>
        </path>
        </timestampselector>
        <pathconvert refid="mypath" property="myfixedpath"
targetos="unix"/>
        <echo>myfixedpath === ${myfixedpath}</echo>

        <echo
file="Y:/bla/foobar1.properties">filepath=${myfixedpath}</echo>
        <echo
file="Y:/bla/foobar2.properties">filepath=${myfixedpath}</echo>

    </target>

    <target name="main" depends="depends">
        <propertyfile file="Y:/bla/foobar1.properties" />
        <echo>Targetfile === ${filepath}</echo>
    </target>
</project>

foobar1.properties, the file which is loaded in the main target looks
like =
#Wed Sep 27 07:53:37 CEST 2006
filepath=Y\:/bla/corba.jar

foobar2.properties looks like =
filepath=Y:/bla/corba.jar

so it seems like the timestamp gets added when loading the propertyfile
with <propertyfile file="..."> but what is really fishy is that the path
goes bad

from : Y:/bla/corba.jar to: Y\:/bla/corba.jar

What's responsible for that ?
and
how to make the example above working ?

Regards, Gilbert

-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: Tuesday, September 26, 2006 6:34 PM
To: Ant Users List
Subject: Re: Location attribute in property not resolving correctly

>        <echo
file="Y:/bla/foobar.properties">filepath=${myfixedpath}</echo>
>  The foobar.properties looks like =
> #Tue Sep 26 17:40:31 CEST 2006
> filepath=Y\:/bla/corba.jar

This is fishy because <echo> would never add the timestamp, like
java.util.Property#store would. So something else created the file
you're showing...



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Location attribute in property not resolving correctly

Posted by Steve Loughran <st...@apache.org>.
Rebhan, Gilbert wrote:
> Hi,
> 
> still no solution ?
> Should i fill a bug report about that behaviour
> of <propertyfile file="... " />
> 
> resulting in a deformed path, f.e.
> 
> Y:/bla/corba.jar >>> Y\:/bla/corba.jar
> 
> ?!
> 
> see example below
> 
> same result with ant 1.7.0 beta2
> 
> 
> Regards, Gilbert
> 
> -----Original Message-----
> From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
> Sent: Wednesday, September 27, 2006 8:03 AM
> To: Ant Users List
> Subject: RE: Location attribute in property not resolving correctly
> 
>  
> Hi,
> 
> strange =
> 
> <project name="bla" default="main" basedir=".">
>     <!-- Import AntContrib -->
>     <taskdef resource="net/sf/antcontrib/antlib.xml" />
>     <target name="depends">
>         <timestampselector 
>             outputsetid="mypath"
>             count="1"
>             age="eldest" >
>         <path>
>             <fileset dir="Y:/bla">
>                 <include name="*.jar" />
>             </fileset>
>         </path>
>         </timestampselector>
>         <pathconvert refid="mypath" property="myfixedpath"
> targetos="unix"/>
>         <echo>myfixedpath === ${myfixedpath}</echo>
> 
>         <echo
> file="Y:/bla/foobar1.properties">filepath=${myfixedpath}</echo>
>         <echo
> file="Y:/bla/foobar2.properties">filepath=${myfixedpath}</echo>
> 
>     </target>
> 
>     <target name="main" depends="depends">
>         <propertyfile file="Y:/bla/foobar1.properties" />
>         <echo>Targetfile === ${filepath}</echo>
>     </target>
> </project>
> 


> foobar1.properties, the file which is loaded in the main target looks
> like =
> #Wed Sep 27 07:53:37 CEST 2006
> filepath=Y\:/bla/corba.jar
> 
> foobar2.properties looks like =
> filepath=Y:/bla/corba.jar


> so it seems like the timestamp gets added when loading the propertyfile
> with <propertyfile file="..."> but what is really fishy is that the path
> goes bad
> 
> from : Y:/bla/corba.jar to: Y\:/bla/corba.jar

1. Timestamps go in when the file is created,  using <propertyfile>, 
which delegates to Properties.store()
2. It is correct to escape the : with a \ , as this is what 
Properties.store() does.

 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)


> 
> What's responsible for that ?

Sun

> and
> how to make the example above working ?

I dont wee why escaping the \: should matter, as when the properties get 
loaded in the escape should be removed and you get what you originally 
asked for.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Location attribute in property not resolving correctly

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Gilbert,

this is not a bug.

propertyfile generates a file with the properties format.
The : in Y:/bla/corba.jar gets escaped.

This works as designed.

Antoine



On Oct 5, 2006, at 10:54 AM, Rebhan, Gilbert wrote:

>
> Hi,
>
> still no solution ?
> Should i fill a bug report about that behaviour
> of <propertyfile file="... " />
>
> resulting in a deformed path, f.e.
>
> Y:/bla/corba.jar >>> Y\:/bla/corba.jar
>
> ?!
>
> see example below
>
> same result with ant 1.7.0 beta2
>
>
> Regards, Gilbert
>
> -----Original Message-----
> From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
> Sent: Wednesday, September 27, 2006 8:03 AM
> To: Ant Users List
> Subject: RE: Location attribute in property not resolving correctly
>
>
> Hi,
>
> strange =
>
> <project name="bla" default="main" basedir=".">
>     <!-- Import AntContrib -->
>     <taskdef resource="net/sf/antcontrib/antlib.xml" />
>     <target name="depends">
>         <timestampselector
>             outputsetid="mypath"
>             count="1"
>             age="eldest" >
>         <path>
>             <fileset dir="Y:/bla">
>                 <include name="*.jar" />
>             </fileset>
>         </path>
>         </timestampselector>
>         <pathconvert refid="mypath" property="myfixedpath"
> targetos="unix"/>
>         <echo>myfixedpath === ${myfixedpath}</echo>
>
>         <echo
> file="Y:/bla/foobar1.properties">filepath=${myfixedpath}</echo>
>         <echo
> file="Y:/bla/foobar2.properties">filepath=${myfixedpath}</echo>
>
>     </target>
>
>     <target name="main" depends="depends">
>         <propertyfile file="Y:/bla/foobar1.properties" />
>         <echo>Targetfile === ${filepath}</echo>
>     </target>
> </project>
>
> foobar1.properties, the file which is loaded in the main target looks
> like =
> #Wed Sep 27 07:53:37 CEST 2006
> filepath=Y\:/bla/corba.jar
>
> foobar2.properties looks like =
> filepath=Y:/bla/corba.jar
>
> so it seems like the timestamp gets added when loading the  
> propertyfile
> with <propertyfile file="..."> but what is really fishy is that the  
> path
> goes bad
>
>> from : Y:/bla/corba.jar to: Y\:/bla/corba.jar
>
> What's responsible for that ?
> and
> how to make the example above working ?
>
> Regards, Gilbert
>
> -----Original Message-----
> From: Dominique Devienne [mailto:ddevienne@gmail.com]
> Sent: Tuesday, September 26, 2006 6:34 PM
> To: Ant Users List
> Subject: Re: Location attribute in property not resolving correctly
>
>>        <echo
> file="Y:/bla/foobar.properties">filepath=${myfixedpath}</echo>
>>  The foobar.properties looks like =
>> #Tue Sep 26 17:40:31 CEST 2006
>> filepath=Y\:/bla/corba.jar
>
> This is fishy because <echo> would never add the timestamp, like
> java.util.Property#store would. So something else created the file
> you're showing...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org