Skip to content

Commit

Permalink
Fix: MongoClientSettings.applyConnectionString retryReads bug
Browse files Browse the repository at this point in the history
Ensure that retryReads is copied.

JAVA-5048
  • Loading branch information
rozza committed Jul 11, 2023
1 parent 1630676 commit 2bad9c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions driver-core/src/main/com/mongodb/MongoClientSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ public Builder applyConnectionString(final ConnectionString connectionString) {
if (retryWritesValue != null) {
retryWrites = retryWritesValue;
}
Boolean retryReadsValue = connectionString.getRetryReads();
if (retryReadsValue != null) {
retryReads = retryReadsValue;
}
if (connectionString.getUuidRepresentation() != null) {
uuidRepresentation = connectionString.getUuidRepresentation();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class MongoClientSettingsSpecification extends Specification {
.readPreference(ReadPreference.secondary())
.writeConcern(WriteConcern.JOURNALED)
.retryWrites(true)
.retryReads(false)
.retryReads(true)
.readConcern(ReadConcern.LOCAL)
.applicationName('app1')
.addCommandListener(commandListener)
Expand Down

0 comments on commit 2bad9c5

Please sign in to comment.