You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ke...@apache.org on 2007/04/23 07:53:00 UTC

svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Author: kevj
Date: Sun Apr 22 22:52:59 2007
New Revision: 531340

URL: http://svn.apache.org/viewvc?view=rev&rev=531340
Log:
-fix problem with windows file uris (stupid "Documents and Settings" bloody folder)

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=diff&rev=531340&r1=531339&r2=531340
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Sun Apr 22 22:52:59 2007
@@ -159,7 +159,7 @@
             try {
                 java.lang.reflect.Method createMethod
                     = uriClazz.getMethod("create", new Class[] {String.class});
-                Object uriObj = createMethod.invoke(null, new Object[] {uri});
+                Object uriObj = createMethod.invoke(null, new Object[] {encodeURI(uri)});
                 java.lang.reflect.Constructor fileConst
                     = File.class.getConstructor(new Class[] {uriClazz});
                 File f = (File) fileConst.newInstance(new Object[] {uriObj});



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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Kevin Jackson <fo...@gmail.com>.
Hi all,

I quick dissection of the code and I realized that I was encoding the
file path to ensure that it was compatible with the URI requirements,
but not decoding it before returning the value.

A tiny change to the Locator.java code and the test case provided now passes.

I need to re-test my initial usecase to verify I haven't broken anything.

If all is ok, I will commit the fix in the next 10 mins

Thanks,
Kev

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Steve Loughran <st...@apache.org>.
Kevin Jackson wrote:
> Hi,
> 
> Looking deeper into this, the reason that the bug #42227 has appeared
> is because ImportTask uses Location which uses FileUtils.fromURI,
> which is using the new Locator.fromURI
> 

One thing I'm thinking of for <import> is how to resource enable it; 
which means we need a way (an interface) of opening a resource relative 
to another resource:

interface RelativeResource {

   Resource createResource(String relativePath);

}


We'd then have every build file knowing where it came from, and, if it 
came from a resource that implemented RelativeResource(), return a new 
resource.

<import file="../something.xml" /> would call 
FileResource.createResource("../something.xml"); on the local file, or, 
if it was loaded off a clasloader, 
ClassResource.createResource("../something.xml") would return something 
new in the classpath.

steve

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,

Looking deeper into this, the reason that the bug #42227 has appeared
is because ImportTask uses Location which uses FileUtils.fromURI,
which is using the new Locator.fromURI

I'll continue to try to find a workaround
Kev

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Kevin Jackson <fo...@gmail.com>.
Hi,

> I'm looking for the problem that is resolved by commit r531340 .
>
> This commit introduced two bugs,
> http://issues.apache.org/bugzilla/show_bug.cgi?id=42227
> http://issues.apache.org/bugzilla/show_bug.cgi?id=42222
>
> I'm trying to fix these bugs, but would like to know which failing usecase
> was resolved by the commit.
>

The usecase that failed was when I used ant as a library (ant.jar &
ant-launcher.jar) within the context of a maven2 plugin.

I got the same results (pre-commit) as bug #42222 ie.
Caused by: java.net.URISyntaxException: Illegal character in path at index 18:
file:/C:/Documents and
Settings

the character at index 18 is of course the Space that should be a %20 for a URI.

Regarding the bug #42227, it does look like my commit has caused the
import to break, although what the immediate fix is that will also
prevent #42222 I'm not sure at present.

Thanks for the bug report and bringing it to my attention,
Kev

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by jc...@gmail.com.
I'm looking for the problem that is resolved by commit r531340 .

This commit introduced two bugs,
http://issues.apache.org/bugzilla/show_bug.cgi?id=42227
http://issues.apache.org/bugzilla/show_bug.cgi?id=42222

I'm trying to fix these bugs, but would like to know which failing usecase 
was resolved by the commit.

Regards, Jan

----- Original Message ----- 
From: <ke...@apache.org>
To: <an...@apache.org>
Sent: Monday, April 23, 2007 7:53 AM
Subject: svn commit: r531340 - 
/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java


> Author: kevj
> Date: Sun Apr 22 22:52:59 2007
> New Revision: 531340
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=531340
> Log:
> -fix problem with windows file uris (stupid "Documents and Settings" 
> bloody folder)
>
> Modified:
>    ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
>
> Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
> URL: 
> http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=diff&rev=531340&r1=531339&r2=531340
> ==============================================================================
> --- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java 
> (original)
> +++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Sun 
> Apr 22 22:52:59 2007
> @@ -159,7 +159,7 @@
>             try {
>                 java.lang.reflect.Method createMethod
>                     = uriClazz.getMethod("create", new Class[] 
> {String.class});
> -                Object uriObj = createMethod.invoke(null, new Object[] 
> {uri});
> +                Object uriObj = createMethod.invoke(null, new Object[] 
> {encodeURI(uri)});
>                 java.lang.reflect.Constructor fileConst
>                     = File.class.getConstructor(new Class[] {uriClazz});
>                 File f = (File) fileConst.newInstance(new Object[] 
> {uriObj});
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 


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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Matt Benson <gu...@yahoo.com>.
It occurs to me, Darin, that nobody would complain if
you wanted to open a new issue and immediately close
as fixed just for documentation's sake.

-Matt

--- Darin Swanson <Da...@us.ibm.com> wrote:

> Thanks Kevin.
> 
> I agree that it is a regression between 1.6.5 and
> 1.7.0
> As well there is that silly Program Files folder :-)
> 
> I will doc it in the Eclipse 3.3 readme as a known
> issue as it is unlikely 
> that Ant 1.7.1 will make it before then: your
> shipping it and our IP 
> process approving it.
> 
> Thanks again
> Darins
> 
> 
> 
> 
> "Kevin Jackson" <fo...@gmail.com> 
> 04/23/2007 07:20 PM
> 
> To
> "Ant Developers List" <de...@ant.apache.org>
> cc
> Darin Swanson/Minneapolis/IBM@IBMUS
> Subject
> Re: svn commit: r531340 - 
>
/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
> 
> 
> 
> 
> 
> 
> Hi Darin,
> 
> > Is there a bug report I could reference for this?
> 
> Not that I know of.  I 'discovered' this whilst
> using ant as an API to
> let me build a mvn plugin.  As soon as I had tracked
> it down to the
> Locator class, I went back through the old code to
> see what was
> different in the most recent version and saw that we
> no longer encode
> the URI before handing it to java.net.URI.create
> 
> > We have:
> >
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=183283
> 
> I have re-tested my plugin code with ant + this fix
> and it works as
> expected (mvn on windows uses those stupid Docs &
> Settings folders).
> Ant 1.6.5 also works fine, it seems to be a
> regression from 1.6.5 ->
> 1.7.0
> 
> Kev
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Darin Swanson <Da...@us.ibm.com>.
Thanks Kevin.

I agree that it is a regression between 1.6.5 and 1.7.0
As well there is that silly Program Files folder :-)

I will doc it in the Eclipse 3.3 readme as a known issue as it is unlikely 
that Ant 1.7.1 will make it before then: your shipping it and our IP 
process approving it.

Thanks again
Darins




"Kevin Jackson" <fo...@gmail.com> 
04/23/2007 07:20 PM

To
"Ant Developers List" <de...@ant.apache.org>
cc
Darin Swanson/Minneapolis/IBM@IBMUS
Subject
Re: svn commit: r531340 - 
/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java






Hi Darin,

> Is there a bug report I could reference for this?

Not that I know of.  I 'discovered' this whilst using ant as an API to
let me build a mvn plugin.  As soon as I had tracked it down to the
Locator class, I went back through the old code to see what was
different in the most recent version and saw that we no longer encode
the URI before handing it to java.net.URI.create

> We have:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=183283

I have re-tested my plugin code with ant + this fix and it works as
expected (mvn on windows uses those stupid Docs & Settings folders).
Ant 1.6.5 also works fine, it seems to be a regression from 1.6.5 ->
1.7.0

Kev


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Kevin Jackson <fo...@gmail.com>.
Hi Darin,

> Is there a bug report I could reference for this?

Not that I know of.  I 'discovered' this whilst using ant as an API to
let me build a mvn plugin.  As soon as I had tracked it down to the
Locator class, I went back through the old code to see what was
different in the most recent version and saw that we no longer encode
the URI before handing it to java.net.URI.create

> We have:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=183283

I have re-tested my plugin code with ant + this fix and it works as
expected (mvn on windows uses those stupid Docs & Settings folders).
Ant 1.6.5 also works fine, it seems to be a regression from 1.6.5 ->
1.7.0

Kev

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


Re: svn commit: r531340 - /ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Posted by Darin Swanson <Da...@us.ibm.com>.
Is there a bug report I could reference for this?

We have:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=183283

Thank you
Darins




kevj@apache.org 
04/22/2007 10:53 PM
Please respond to
"Ant Developers List" <de...@ant.apache.org>


To
ant-cvs@apache.org
cc

Subject
svn commit: r531340 - 
/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java






Author: kevj
Date: Sun Apr 22 22:52:59 2007
New Revision: 531340

URL: http://svn.apache.org/viewvc?view=rev&rev=531340
Log:
-fix problem with windows file uris (stupid "Documents and Settings" 
bloody folder)

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?view=diff&rev=531340&r1=531339&r2=531340

==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Sun 
Apr 22 22:52:59 2007
@@ -159,7 +159,7 @@
             try {
                 java.lang.reflect.Method createMethod
                     = uriClazz.getMethod("create", new Class[] 
{String.class});
-                Object uriObj = createMethod.invoke(null, new Object[] 
{uri});
+                Object uriObj = createMethod.invoke(null, new Object[] 
{encodeURI(uri)});
                 java.lang.reflect.Constructor fileConst
                     = File.class.getConstructor(new Class[] {uriClazz});
                 File f = (File) fileConst.newInstance(new Object[] 
{uriObj});



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