diff --git a/build.gradle b/build.gradle index aa0dd05ed38..a360408241a 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ buildscript { } dependencies { classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:7.0.0' - classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.13" + classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.15" classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.1.2' // Scala plugins diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml index fb0e4e9ec0e..1ef5de78bf5 100644 --- a/config/spotbugs/exclude.xml +++ b/config/spotbugs/exclude.xml @@ -14,10 +14,29 @@ ~ limitations under the License. --> - + + + + + + + + + + + diff --git a/driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java b/driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java index 5b6fa8f56fe..272442a190e 100644 --- a/driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java +++ b/driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java @@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import static com.mongodb.assertions.Assertions.assertNotNull; import static com.mongodb.assertions.Assertions.isTrue; import static com.mongodb.connection.ClusterConnectionMode.MULTIPLE; import static com.mongodb.connection.ClusterType.UNKNOWN; @@ -234,7 +235,7 @@ private boolean handleReplicaSetMemberChanged(final ServerDescription newDescrip } if (replicaSetName == null) { - replicaSetName = newDescription.getSetName(); + replicaSetName = assertNotNull(newDescription.getSetName()); } if (!replicaSetName.equals(newDescription.getSetName())) {