mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8230310: SocksSocketImpl should handle the IllegalArgumentException thrown by ProxySelector.select usage
Catch the IAE thrown by ProxySelector.select and wrap it into a IOException Reviewed-by: dfuchs
This commit is contained in:
parent
1d71dd8604
commit
6fa4babbb2
2 changed files with 118 additions and 2 deletions
|
@ -29,6 +29,7 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.security.AccessController;
|
||||
import java.util.Iterator;
|
||||
|
||||
import jdk.internal.util.StaticProperty;
|
||||
import sun.net.SocksProxy;
|
||||
|
@ -327,8 +328,12 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
|||
}
|
||||
Proxy p = null;
|
||||
IOException savedExc = null;
|
||||
java.util.Iterator<Proxy> iProxy = null;
|
||||
iProxy = sel.select(uri).iterator();
|
||||
final Iterator<Proxy> iProxy;
|
||||
try {
|
||||
iProxy = sel.select(uri).iterator();
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException("Failed to select a proxy", iae);
|
||||
}
|
||||
if (iProxy == null || !(iProxy.hasNext())) {
|
||||
delegate.connect(epoint, remainingMillis(deadlineMillis));
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue