6563286: HttpURLConnection.followRedirect(..) follows malformed url.
Andreas Rieber
rieberandreas at gmail.com
Mon Jun 24 12:42:07 PDT 2013
Hi,
here a small fix for 2 older issues. First i wrote the test for wrong
URL at connection time and at redirect time.
Bug(s):
http://bugs.sun.com/view_bug.do?bug_id=6563286
http://bugs.sun.com/view_bug.do?bug_id=5069130
Webrev:
http://cr.openjdk.java.net/~arieber/6563286/webrev.00/
What happens is that the java.net.ProxySelector.select(URI uri) is
called, which throws the IllegalArgumentException if uri is null. But
it uses sun.net.spi.DefaultProxySelector.java and also throws the
exception if uri.getScheme() is null or uri.getHost() is null. I
updated the javadoc in ProxySelector.
To change the exception to an IOException would mean a wider
refactoring and API change, not good. So i checked down to
net.www.protocol.http.HttpURLConnection.java.
There the IllegalArgumentException can be caught and thrown as
IOException. This will handle wrong URLs in both cases (connect and
redirect). I checked also all other possible cases but they are
handled with correct exceptions.
I run all tests on ubuntu, so a test run on all relevant platforms is
required.
thanks for checking this one
Andreas
More information about the net-dev
mailing list