Skip to content

Commit 28b27df

Browse files
committed
Remove unnecessary null check for ClientSession
It was a vestige of when the driver worked with server releases that didn't support sessions.
1 parent d375cd4 commit 28b27df

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

driver-sync/src/main/com/mongodb/client/internal/MongoClientImpl.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.mongodb.AutoEncryptionSettings;
2020
import com.mongodb.ClientSessionOptions;
21-
import com.mongodb.MongoClientException;
2221
import com.mongodb.MongoClientSettings;
2322
import com.mongodb.MongoDriverInformation;
2423
import com.mongodb.ReadPreference;
@@ -143,12 +142,8 @@ public ClientSession startSession() {
143142

144143
@Override
145144
public ClientSession startSession(final ClientSessionOptions options) {
146-
ClientSession clientSession = delegate.createClientSession(notNull("options", options),
145+
return delegate.createClientSession(notNull("options", options),
147146
settings.getReadConcern(), settings.getWriteConcern(), settings.getReadPreference());
148-
if (clientSession == null) {
149-
throw new MongoClientException("Sessions are not supported by the MongoDB cluster to which this client is connected");
150-
}
151-
return clientSession;
152147
}
153148

154149
@Override

0 commit comments

Comments
 (0)