Sonar: repeated literals

* Polishing - PR Comments

* GatewayParser: Restore suppress warnings; remove size from `toArray()`.

* Merge conflict resolution
This commit is contained in:
Gary Russell
2019-05-03 12:39:02 -04:00
committed by Artem Bilan
parent 444cd1e8df
commit 6d7bc1fc39
38 changed files with 382 additions and 281 deletions

View File

@@ -44,6 +44,8 @@ import org.springframework.util.Assert;
*/
public class GemfireMetadataStore implements ListenableMetadataStore {
private static final String KEY_MUST_NOT_BE_NULL = "'key' must not be null.";
public static final String KEY = "MetaData";
private final GemfireCacheListener cacheListener = new GemfireCacheListener();
@@ -66,21 +68,21 @@ public class GemfireMetadataStore implements ListenableMetadataStore {
@Override
public void put(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
Assert.notNull(value, "'value' must not be null.");
this.region.put(key, value);
}
@Override
public String putIfAbsent(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
Assert.notNull(value, "'value' must not be null.");
return this.region.putIfAbsent(key, value);
}
@Override
public boolean replace(String key, String oldValue, String newValue) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
Assert.notNull(oldValue, "'oldValue' must not be null.");
Assert.notNull(newValue, "'newValue' must not be null.");
return this.region.replace(key, oldValue, newValue);
@@ -88,13 +90,13 @@ public class GemfireMetadataStore implements ListenableMetadataStore {
@Override
public String get(String key) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
return this.region.get(key);
}
@Override
public String remove(String key) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
return this.region.remove(key);
}

View File

@@ -41,6 +41,8 @@ import org.springframework.util.PatternMatchUtils;
*/
public class GemfireMessageStore extends AbstractKeyValueMessageStore {
private static final String ID_MUST_NOT_BE_NULL = "'id' must not be null";
private final Region<Object, Object> messageStoreRegion;
/**
@@ -68,20 +70,20 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore {
@Override
protected Object doRetrieve(Object id) {
Assert.notNull(id, "'id' must not be null");
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
return this.messageStoreRegion.get(id);
}
@Override
protected void doStore(Object id, Object objectToStore) {
Assert.notNull(id, "'id' must not be null");
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
Assert.notNull(objectToStore, "'objectToStore' must not be null");
this.messageStoreRegion.put(id, objectToStore);
}
@Override
protected void doStoreIfAbsent(Object id, Object objectToStore) {
Assert.notNull(id, "'id' must not be null");
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
Assert.notNull(objectToStore, "'objectToStore' must not be null");
Object present = this.messageStoreRegion.putIfAbsent(id, objectToStore);
if (present != null && logger.isDebugEnabled()) {
@@ -92,7 +94,7 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore {
@Override
protected Object doRemove(Object id) {
Assert.notNull(id, "'id' must not be null");
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
return this.messageStoreRegion.remove(id);
}