Fix sonar warnings in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / config / ConfigurationImpl.java
index c1f687bd55f2bff272b1b6a405c6780047344161..0007d0941b1cab104f62476bc8a856ab5a643dba 100644 (file)
@@ -142,7 +142,7 @@ public class ConfigurationImpl implements Configuration {
 
     @Override
     public Collection<MemberName> getMembersFromShardName(final String shardName) {
-        Preconditions.checkNotNull(shardName, "shardName should not be null");
+        checkNotNullShardName(shardName);
 
         for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
             ShardConfig shardConfig = moduleConfig.getShardConfig(shardName);
@@ -160,6 +160,10 @@ public class ConfigurationImpl implements Configuration {
         return Collections.emptyList();
     }
 
+    private static void checkNotNullShardName(final String shardName) {
+        Preconditions.checkNotNull(shardName, "shardName should not be null");
+    }
+
     @Override
     public Set<String> getAllShardNames() {
         return allShardNames;
@@ -234,13 +238,13 @@ public class ConfigurationImpl implements Configuration {
 
     @Override
     public boolean isShardConfigured(String shardName) {
-        Preconditions.checkNotNull(shardName, "shardName should not be null");
+        checkNotNullShardName(shardName);
         return allShardNames.contains(shardName);
     }
 
     @Override
     public void addMemberReplicaForShard(String shardName, MemberName newMemberName) {
-        Preconditions.checkNotNull(shardName, "shardName should not be null");
+        checkNotNullShardName(shardName);
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
         for (ModuleConfig moduleConfig: moduleConfigMap.values()) {
@@ -256,7 +260,7 @@ public class ConfigurationImpl implements Configuration {
 
     @Override
     public void removeMemberReplicaForShard(String shardName, MemberName newMemberName) {
-        Preconditions.checkNotNull(shardName, "shardName should not be null");
+        checkNotNullShardName(shardName);
         Preconditions.checkNotNull(newMemberName, "MemberName should not be null");
 
         for (ModuleConfig moduleConfig: moduleConfigMap.values()) {