ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: svn commit: r899468 - in /ant/antlibs/props/trunk: docs/index.html src/main/org/apache/ant/props/ src/main/org/apache/ant/props/antlib.xml src/tests/antunit/encodeURL-test.xml
Date Sat, 16 Jan 2010 00:48:38 GMT
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"file:/tmp/foo bar").toURI()
script error: Wrapped
Illegal character in path at index 13: file:/tmp/foo bar 
(<STDIN>#1) in <STDIN> at line number 1
js> new"file:/tmp/foo%20bar").toURI()

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"file:/tmp/foočbar").toURI().toASCIIString()

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, "foo bar", null).rawPath

Anyway does this belong in Ant 1.8.0 so late in the release cycle?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message