JDK-6797318: Undeclared IAE thrown from HttpURLConnection.connect for some URLs
Andreas Rieber
rieberandreas at gmail.com
Thu Jul 17 18:03:49 UTC 2014
Hi,
i would like to contribute a patch for this old issue. The suggested
fix in the issue looks right but instead of the IOE it would simply
connect to localhost. The same wrong behaviour can be reproduced
with ProxySelector.setDefault(null).
I also checked other protocols and http, https and ftp are affected.
The hostname is not checked currently and the used
InetAddress.getAllByName(host) just returns the "loopbackAdress" if
hostname is empty.
Running the test under security manager got me a
StringIndexOutOfBoundsException from the URLPermission/HostPortrange,
where the hostname is not checked for empty string.
With the test i try to cover all cases. Simple connect, with no
ProxySelector, wrong redirect URL and all with security manager.
Bug:
https://bugs.openjdk.java.net/browse/JDK-6797318
Bug also fixed with no additional change (test included):
https://bugs.openjdk.java.net/browse/JDK-6563286
Webrev:
http://cr.openjdk.java.net/~arieber/6797318/webrev.00/
I did run jtreg */net */security on Ubuntu 14, Solaris 11 and Windows 8.1.
Sponsor required as usually.
cheers
Andreas
More information about the net-dev
mailing list