8235783: DatagramSocket::disconnect should allow an implementation to throw UncheckedIOException

Undocumented throwing of Errors changed to throw a more user friendly UncheckedIOException

Reviewed-by: alanb, chegar, dfuchs
This commit is contained in:
Patrick Concannon 2020-01-23 14:43:37 +00:00
parent 4eacb6361b
commit 94bb505c94
2 changed files with 33 additions and 10 deletions

View file

@ -26,6 +26,7 @@
package sun.nio.ch;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
@ -116,7 +117,7 @@ public class DatagramSocketAdaptor
try {
connectInternal(new InetSocketAddress(address, port));
} catch (SocketException x) {
throw new Error(x);
throw new UncheckedIOException(x);
}
}
@ -132,7 +133,7 @@ public class DatagramSocketAdaptor
try {
dc.disconnect();
} catch (IOException x) {
throw new Error(x);
throw new UncheckedIOException(x);
}
}