Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Don't swallow IOException caused by opening socket
  • Loading branch information
Sineaggi committed Oct 27, 2023
commit e423efe2bd886e4117460401ac19868c2cfd095c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
Expand All @@ -24,7 +25,8 @@ public class UnixSocket extends AbstractSocket {
public static Socket get(String path) throws IOException {
try {
return new UnixSocket(path);
} catch (Exception e) {
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
//noinspection deprecation
return DomainSocket.get(path);
}
Expand All @@ -34,7 +36,8 @@ public static Socket get(String path) throws IOException {

private final SocketChannel socketChannel;

private UnixSocket(String path) throws Exception {
private UnixSocket(String path) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
IllegalAccessException, IOException {
Class<?> unixDomainSocketAddress = Class.forName("java.net.UnixDomainSocketAddress");
this.socketAddress =
(SocketAddress) unixDomainSocketAddress.getMethod("of", String.class)
Expand Down