Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 721f09f

Browse filesBrowse files
authored
Don't swallow IOException caused by opening socket (#2041)
Add additional context to socket exception
1 parent 61dc042 commit 721f09f
Copy full SHA for 721f09f

File tree

2 files changed

+6
-3
lines changed
Filter options

2 files changed

+6
-3
lines changed

‎docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/UnixSocketFactory.java

Copy file name to clipboardExpand all lines: docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/UnixSocketFactory.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public Socket createSocket() {
2020
try {
2121
return UnixSocket.get(socketPath);
2222
} catch (IOException e) {
23-
throw new RuntimeException(e);
23+
throw new RuntimeException("Failed create socket with path " + socketPath, e);
2424
}
2525
}
2626

‎docker-java-transport/src/main/java/com/github/dockerjava/transport/UnixSocket.java

Copy file name to clipboardExpand all lines: docker-java-transport/src/main/java/com/github/dockerjava/transport/UnixSocket.java
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44
import java.io.InputStream;
55
import java.io.OutputStream;
6+
import java.lang.reflect.InvocationTargetException;
67
import java.net.Socket;
78
import java.net.SocketAddress;
89
import java.net.SocketException;
@@ -24,7 +25,8 @@ public class UnixSocket extends AbstractSocket {
2425
public static Socket get(String path) throws IOException {
2526
try {
2627
return new UnixSocket(path);
27-
} catch (Exception e) {
28+
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
29+
IllegalAccessException e) {
2830
//noinspection deprecation
2931
return DomainSocket.get(path);
3032
}
@@ -34,7 +36,8 @@ public static Socket get(String path) throws IOException {
3436

3537
private final SocketChannel socketChannel;
3638

37-
private UnixSocket(String path) throws Exception {
39+
private UnixSocket(String path) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
40+
IllegalAccessException, IOException {
3841
Class<?> unixDomainSocketAddress = Class.forName("java.net.UnixDomainSocketAddress");
3942
this.socketAddress =
4043
(SocketAddress) unixDomainSocketAddress.getMethod("of", String.class)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.