ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: Resource.getURL()
Date Thu, 21 Sep 2006 13:15:09 GMT
Antoine Levy-Lambert wrote:
> Hi,
> I would like to add getURL() to Resource before Ant 1.7 ships.
> I would add it to the Resource base class, and to ZipResource, FileResource.
> I am not clear whether it is better to signal that a particular Resource does not provide
URL by throwing UnsupportedOperationException (as Matt suggested) or by returning null.
> Concerning custom URLProtocolHandler (s), I am not clear how this works ?

first you provide something that lets you open connections

and connections should be openable, or, as in this case, tell you off 
for trying to do so

The real problem is that to use URLs with URL.openConnection() you need 
to register the protocol in the top  classloader, or the URL class 
cannot open them. The alternative is to have a method in some class, 
openConnection(URL), which looks through its list of registered handlers 
and picks the right one:

To summarise: ***If you are going to play with URLs, you are going to 
discover problems with classloaders***

dont say I didnt warn you...


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

View raw message