Skip to content

Commit e0368f1

Browse files
committed
JAVA-2631: In AsynchronousSocketChannelStream.OpenCompletionHandler, wrap any IOException with MongoSocketOpenException rather than just ConnectException
1 parent 317c431 commit e0368f1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

driver-core/src/main/com/mongodb/connection/AsynchronousSocketChannelStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.bson.ByteBuf;
2424

2525
import java.io.IOException;
26-
import java.net.ConnectException;
2726
import java.net.StandardSocketOptions;
2827
import java.nio.ByteBuffer;
2928
import java.nio.channels.AsynchronousChannelGroup;
@@ -265,7 +264,7 @@ public void completed(final Void result, final Object attachment) {
265264
@Override
266265
public void failed(final Throwable exc, final Object attachment) {
267266
AsyncCompletionHandler<Void> localHandler = getHandlerAndClear();
268-
if (exc instanceof ConnectException) {
267+
if (exc instanceof IOException) {
269268
localHandler.failed(new MongoSocketOpenException("Exception opening socket", getAddress(), exc));
270269
} else {
271270
localHandler.failed(exc);

0 commit comments

Comments
 (0)