8000 Don't swallow IOException caused by opening socket by Sineaggi · Pull Request #2041 · docker-java/docker-java · GitHub
[go: up one dir, main page]

Skip to content

Don't swallow IOException caused by opening socket #2041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Socket createSocket() {
try {
return UnixSocket.get(socketPath);
} catch (IOException e) {
throw new RuntimeException(e);
throw new RuntimeException("Failed create socket with path " + socketPath, e);
}
}

Expand Down
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
0