mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8177648: getResponseCode() throws IllegalArgumentException caused by protocol error while following redirect
Reviewed-by: michaelm, chegar, dfuchs
This commit is contained in:
parent
ec24017b02
commit
1d67d474a5
5 changed files with 265 additions and 4 deletions
|
@ -44,6 +44,7 @@ import java.net.InetSocketAddress;
|
|||
import java.net.URI;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Iterator;
|
||||
import java.security.Permission;
|
||||
|
@ -242,7 +243,13 @@ public class FtpURLConnection extends URLConnection {
|
|||
});
|
||||
if (sel != null) {
|
||||
URI uri = sun.net.www.ParseUtil.toURI(url);
|
||||
Iterator<Proxy> it = sel.select(uri).iterator();
|
||||
final List<Proxy> proxies;
|
||||
try {
|
||||
proxies = sel.select(uri);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException("Failed to select a proxy", iae);
|
||||
}
|
||||
final Iterator<Proxy> it = proxies.iterator();
|
||||
while (it.hasNext()) {
|
||||
p = it.next();
|
||||
if (p == null || p == Proxy.NO_PROXY ||
|
||||
|
|
|
@ -1178,7 +1178,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
|
||||
logger.finest("ProxySelector Request for " + uri);
|
||||
}
|
||||
Iterator<Proxy> it = sel.select(uri).iterator();
|
||||
final List<Proxy> proxies;
|
||||
try {
|
||||
proxies = sel.select(uri);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException("Failed to select a proxy", iae);
|
||||
}
|
||||
final Iterator<Proxy> it = proxies.iterator();
|
||||
Proxy p;
|
||||
while (it.hasNext()) {
|
||||
p = it.next();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue