[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: r31993 - JavaHL Path.isUrl method

From: Nick Crossley <ndjc_at_ncrossley.com>
Date: Thu, 03 Jul 2008 21:22:23 -0700

> On Thu, 03 Jul 2008, Mark Phippard wrote:
>
>> Dan,
>>
>> Not sure if you have any plans for this method, but it is generally
>> not a good idea to use the java.net.URL class any more than necessary.
>> When you construct the class doesn't it try to make a connection to
>> the URL? It can make things very slow to use it.
>
> Mark, I used it in the patch I just sent to Alexander Kitaev for a problem
> he turned up while using SVNKit (dev@ is CC'd on the discussion).
>
> To the best of my knowledge, java.net.URL doesn't establish a network
> connection until its openConnection() method is called, and I didn't notice
> anything at odds with that expectation in its documention [1]. Do you know
> something I don't? :-)
>
> This is a trivial method, so I'd be fine switching to any other
> implementation which obeys the test case I provided (e.g. URI [2], perhaps?).

The hashcode() and equals() methods of java.net.URL resolve the hostname
with DNS, and so can also be blocking operations.

As others have said, in many cases the java.net.URI class is better if you
can do what you need with its methods.

Nick.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-04 06:23:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.