aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-06 11:28:53 -0400
committerJim Hahn <jrh3@att.com>2021-05-06 15:26:24 -0400
commit1d0aaaa5b31719c1718700bb0d1a99c413fd513c (patch)
treebd2687f1d38f3e3c4e53a68695c8c91c6866468e /policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
parent3b00f1c32b89282dcbb74d3d3645e263f005319e (diff)
Fix sonars in policy-common
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
index 98b6ed6f..62ac08bb 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
@@ -32,6 +33,7 @@ import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
* Noop Topic Factory.
*/
public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends TopicBaseHashedFactory<T> {
+ private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*");
/**
* Get Topics Property Name.
@@ -50,7 +52,7 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
return new ArrayList<>();
}
- return Arrays.asList(topics.split("\\s*,\\s*"));
+ return Arrays.asList(COMMA_SPACE_PAT.split(topics));
}
/**
@@ -66,7 +68,7 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
servers = CommInfrastructure.NOOP.toString();
}
- return new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*")));
+ return new ArrayList<>(Arrays.asList(COMMA_SPACE_PAT.split(servers)));
}
/**
@@ -74,11 +76,11 @@ public abstract class NoopTopicFactory<T extends NoopTopicEndpoint> extends Topi
*/
@Override
protected boolean isManaged(String topicName, Properties properties) {
- String managedString =
+ var managedString =
properties.getProperty(getTopicsPropertyName()
+ "." + topicName + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX);
- boolean managed = true;
+ var managed = true;
if (managedString != null && !managedString.isEmpty()) {
managed = Boolean.parseBoolean(managedString);
}