Sonar: repeated literals
* Polishing - PR Comments * GatewayParser: Restore suppress warnings; remove size from `toArray()`. * Merge conflict resolution
This commit is contained in:
committed by
Artem Bilan
parent
444cd1e8df
commit
6d7bc1fc39
@@ -40,6 +40,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
|
||||
private static final String KEY_MUST_NOT_BE_NULL = "'key' must not be null.";
|
||||
|
||||
public static final String KEY = "MetaData";
|
||||
|
||||
private final RedisProperties properties;
|
||||
@@ -109,7 +111,7 @@ public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
*/
|
||||
@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.properties.put(key, value);
|
||||
}
|
||||
@@ -121,7 +123,7 @@ public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
*/
|
||||
@Override
|
||||
public String get(String key) {
|
||||
Assert.notNull(key, "'key' must not be null.");
|
||||
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
|
||||
Object value = this.properties.get(key);
|
||||
if (value != null) {
|
||||
Assert.isInstanceOf(String.class, value, "Invalid type in the store");
|
||||
@@ -132,7 +134,7 @@ public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
@Override
|
||||
|
||||
public String remove(String key) {
|
||||
Assert.notNull(key, "'key' must not be null.");
|
||||
Assert.notNull(key, KEY_MUST_NOT_BE_NULL);
|
||||
Object removed = this.properties.remove(key);
|
||||
if (removed != null) {
|
||||
Assert.isInstanceOf(String.class, removed, "The removed value was an invalid type");
|
||||
@@ -142,7 +144,7 @@ public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
|
||||
@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.");
|
||||
Object oldValue = this.properties.putIfAbsent(key, value);
|
||||
if (oldValue != null) {
|
||||
@@ -153,7 +155,7 @@ public class RedisMetadataStore implements ConcurrentMetadataStore {
|
||||
|
||||
@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.properties.replace(key, oldValue, newValue);
|
||||
|
||||
@@ -43,6 +43,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class RedisMessageStore extends AbstractKeyValueMessageStore implements BeanClassLoaderAware {
|
||||
|
||||
private static final String ID_MUST_NOT_BE_NULL = "'id' must not be null";
|
||||
|
||||
private final RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
private final boolean unlinkAvailable;
|
||||
@@ -92,7 +94,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore implements B
|
||||
|
||||
@Override
|
||||
protected Object doRetrieve(Object id) {
|
||||
Assert.notNull(id, "'id' must not be null");
|
||||
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
|
||||
BoundValueOperations<Object, Object> ops = this.redisTemplate.boundValueOps(id);
|
||||
return ops.get();
|
||||
}
|
||||
@@ -100,7 +102,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore implements B
|
||||
|
||||
@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");
|
||||
BoundValueOperations<Object, Object> ops = this.redisTemplate.boundValueOps(id);
|
||||
try {
|
||||
@@ -114,7 +116,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore implements B
|
||||
|
||||
@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");
|
||||
BoundValueOperations<Object, Object> ops = this.redisTemplate.boundValueOps(id);
|
||||
try {
|
||||
@@ -131,7 +133,7 @@ public class RedisMessageStore extends AbstractKeyValueMessageStore implements B
|
||||
|
||||
@Override
|
||||
protected Object doRemove(Object id) {
|
||||
Assert.notNull(id, "'id' must not be null");
|
||||
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
|
||||
Object removedObject = this.doRetrieve(id);
|
||||
if (removedObject != null) {
|
||||
if (this.unlinkAvailable) {
|
||||
|
||||
Reference in New Issue
Block a user