X Tutup
Skip to content

Commit 54c86ce

Browse files
authored
Catch more generic FileSystemException in NamedPipeSocket (#1418)
When npipe is busy, it throws the following exception: `java.nio.file.FileSystemException: \\.\pipe\docker_engine: All pipe instances are busy.` The previous, RandomAccessFile-base implementation was catching it as `FileNotFoundException`. But the NIO-based one seems to be throwing a generic `FileSystemException`.
1 parent 4497e18 commit 54c86ce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5/NamedPipeSocket.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.nio.channels.AsynchronousFileChannel;
1616
import java.nio.channels.Channels;
1717
import java.nio.channels.CompletionHandler;
18-
import java.nio.file.NoSuchFileException;
18+
import java.nio.file.FileSystemException;
1919
import java.nio.file.Paths;
2020
import java.nio.file.StandardOpenOption;
2121
import java.util.concurrent.CompletableFuture;
@@ -57,7 +57,7 @@ public void connect(SocketAddress endpoint, int timeout) throws IOException {
5757
)
5858
);
5959
break;
60-
} catch (NoSuchFileException e) {
60+
} catch (FileSystemException e) {
6161
if (System.currentTimeMillis() - startedAt >= timeout) {
6262
throw new RuntimeException(e);
6363
} else {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.nio.channels.AsynchronousFileChannel;
1616
import java.nio.channels.Channels;
1717
import java.nio.channels.CompletionHandler;
18-
import java.nio.file.NoSuchFileException;
18+
import java.nio.file.FileSystemException;
1919
import java.nio.file.Paths;
2020
import java.nio.file.StandardOpenOption;
2121
import java.util.concurrent.CompletableFuture;
@@ -58,7 +58,7 @@ public void connect(SocketAddress endpoint, int timeout) throws IOException {
5858
)
5959
);
6060
break;
61-
} catch (NoSuchFileException e) {
61+
} catch (FileSystemException e) {
6262
if (System.currentTimeMillis() - startedAt >= timeout) {
6363
throw new RuntimeException(e);
6464
} else {

0 commit comments

Comments
 (0)
X Tutup