You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jesse Glick <Je...@Sun.COM> on 2010/01/15 00:36:56 UTC
Re: svn commit: r899468 - in /ant/antlibs/props/trunk: docs/index.html
src/main/org/apache/ant/props/EncodeURLEvaluator.java
src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
mbenson@apache.org wrote:
> URL: http://svn.apache.org/viewvc/ant/antlibs/props/trunk/src/main/org/apache/ant/props/EncodeURLEvaluator.java?rev=899468&view=auto
> ==============================================================================
> + URI uri = new URI(url.getProtocol(), url.getUserInfo(),
> + url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
Something wrong with
URI uri = url.toURI();
?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: svn commit: r899468 - in /ant/antlibs/props/trunk: docs/index.html src/main/org/apache/ant/props/EncodeURLEvaluator.java src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
Posted by Matt Benson <gu...@gmail.com>.
On Jan 15, 2010, at 6:48 PM, Jesse Glick wrote:
> Matt Benson wrote:
>> Java 5 blows up when call toURI() against a URL with a space
>> included.
>
> Which is correct; such a URL is invalid:
>
> $ jrunscript
> js> new java.net.URL("file:/tmp/foo bar").toURI()
> script error: sun.org.mozilla.javascript.internal.WrappedException:
> Wrapped java.net.URISyntaxException: Illegal character in path at
> index 13: file:/tmp/foo bar (<STDIN>#1) in <STDIN> at line number 1
> js> new java.net.URL("file:/tmp/foo%20bar").toURI()
> file:/tmp/foo%20bar
>
> Maybe I'm missing the purpose of EncodeURLEvaluator, but where
> would you get a bogus URL like that from to begin with? Surely not
> from <makeurl> on a file, which ought to escape spaces in
> filenames. I assumed that the purpose was just to encode non-ASCII
> characters, for which toURI is fine:
>
The main idea here is to allow folk to use URLs containing e.g.
spaces that their browser will accept and silently convert for them.
> js> new java.net.URL("file:/tmp/foočbar").toURI().toASCIIString()
> file:/tmp/foo%C4%8Dbar
>
> Or are you trying to encode path sequences (rather than complete
> URLs)? But then there is an easier way, without using URL at all:
>
> js> new java.net.URI(null, "foo bar", null).rawPath
> foo%20bar
>
> Anyway does this belong in Ant 1.8.0 so late in the release cycle?
>
Ah, but it's not in Ant--it's in the props antlib! -Matt
>
> ---------------------------------------------------------------------
> 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: r899468 - in /ant/antlibs/props/trunk: docs/index.html
src/main/org/apache/ant/props/EncodeURLEvaluator.java src/main/org/apache/ant/props/antlib.xml
src/tests/antunit/encodeURL-test.xml
Posted by Jesse Glick <je...@sun.com>.
Matt Benson wrote:
> Java 5 blows up when call toURI() against a URL with a space included.
Which is correct; such a URL is invalid:
$ jrunscript
js> new java.net.URL("file:/tmp/foo bar").toURI()
script error: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.net.URISyntaxException: Illegal character in path at index 13: file:/tmp/foo bar
(<STDIN>#1) in <STDIN> at line number 1
js> new java.net.URL("file:/tmp/foo%20bar").toURI()
file:/tmp/foo%20bar
Maybe I'm missing the purpose of EncodeURLEvaluator, but where would you get a bogus URL like that from to begin with? Surely not from <makeurl> on a file, which ought to
escape spaces in filenames. I assumed that the purpose was just to encode non-ASCII characters, for which toURI is fine:
js> new java.net.URL("file:/tmp/foočbar").toURI().toASCIIString()
file:/tmp/foo%C4%8Dbar
Or are you trying to encode path sequences (rather than complete URLs)? But then there is an easier way, without using URL at all:
js> new java.net.URI(null, "foo bar", null).rawPath
foo%20bar
Anyway does this belong in Ant 1.8.0 so late in the release cycle?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
AW: svn commit: r899468 - in /ant/antlibs/props/trunk: docs/index.html src/main/org/apache/ant/props/EncodeURLEvaluator.java src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
Posted by Ja...@rzf.fin-nrw.de.
Is this a candidate for FileUtils with a proper javadoc?
Jan
>-----Ursprüngliche Nachricht-----
>Von: Matt Benson [mailto:gudnabrsam@gmail.com]
>Gesendet: Freitag, 15. Januar 2010 00:52
>An: Ant Developers List
>Betreff: Re: svn commit: r899468 - in
>/ant/antlibs/props/trunk: docs/index.html
>src/main/org/apache/ant/props/EncodeURLEvaluator.java
>src/main/org/apache/ant/props/antlib.xml
>src/tests/antunit/encodeURL-test.xml
>
>To confirm that re-testing on OSX Tiger w/ Java 5 blows up when call
>toURI() against a URL with a space included.
>
>On Jan 14, 2010, at 5:45 PM, Matt Benson wrote:
>
>> Yes--my testing seems to indicate that the single-arg constructor
>> of URI is used in this case, which blows up for improperly escaped
>> characters per its javadoc. I'll double-check though.
>>
>> Thanks,
>> Matt
>>
>> On Jan 14, 2010, at 5:36 PM, Jesse Glick wrote:
>>
>>> mbenson@apache.org wrote:
>>>> URL: http://svn.apache.org/viewvc/ant/antlibs/props/trunk/src/
>>>> main/org/apache/ant/props/EncodeURLEvaluator.java?
>>>> rev=899468&view=auto
>>>>
>====================================================================
>>>> ==========
>>>> + URI uri = new URI(url.getProtocol(),
>url.getUserInfo(),
>>>> + url.getHost(), url.getPort(), url.getPath
>>>> (), url.getQuery(), url.getRef());
>>>
>>> Something wrong with
>>>
>>> URI uri = url.toURI();
>>>
>>> ?
>>>
>>>
>---------------------------------------------------------------------
>>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: svn commit: r899468 - in /ant/antlibs/props/trunk: docs/index.html src/main/org/apache/ant/props/EncodeURLEvaluator.java src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
Posted by Matt Benson <gu...@gmail.com>.
To confirm that re-testing on OSX Tiger w/ Java 5 blows up when call
toURI() against a URL with a space included.
On Jan 14, 2010, at 5:45 PM, Matt Benson wrote:
> Yes--my testing seems to indicate that the single-arg constructor
> of URI is used in this case, which blows up for improperly escaped
> characters per its javadoc. I'll double-check though.
>
> Thanks,
> Matt
>
> On Jan 14, 2010, at 5:36 PM, Jesse Glick wrote:
>
>> mbenson@apache.org wrote:
>>> URL: http://svn.apache.org/viewvc/ant/antlibs/props/trunk/src/
>>> main/org/apache/ant/props/EncodeURLEvaluator.java?
>>> rev=899468&view=auto
>>> ====================================================================
>>> ==========
>>> + URI uri = new URI(url.getProtocol(), url.getUserInfo(),
>>> + url.getHost(), url.getPort(), url.getPath
>>> (), url.getQuery(), url.getRef());
>>
>> Something wrong with
>>
>> URI uri = url.toURI();
>>
>> ?
>>
>> ---------------------------------------------------------------------
>> 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: r899468 - in /ant/antlibs/props/trunk: docs/index.html src/main/org/apache/ant/props/EncodeURLEvaluator.java src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
Posted by Matt Benson <gu...@gmail.com>.
Yes--my testing seems to indicate that the single-arg constructor of
URI is used in this case, which blows up for improperly escaped
characters per its javadoc. I'll double-check though.
Thanks,
Matt
On Jan 14, 2010, at 5:36 PM, Jesse Glick wrote:
> mbenson@apache.org wrote:
>> URL: http://svn.apache.org/viewvc/ant/antlibs/props/trunk/src/main/
>> org/apache/ant/props/EncodeURLEvaluator.java?rev=899468&view=auto
>> =====================================================================
>> =========
>> + URI uri = new URI(url.getProtocol(), url.getUserInfo(),
>> + url.getHost(), url.getPort(), url.getPath(),
>> url.getQuery(), url.getRef());
>
> Something wrong with
>
> URI uri = url.toURI();
>
> ?
>
> ---------------------------------------------------------------------
> 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