summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-22 21:07:43 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-22 21:15:22 +0100
commit6973ec9109fd2651e2284663b6c8039bd830a677 (patch)
treef1f02ef9e5400805e6c2179dc539ad15c3ce5334 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms
parenta02548ec2e98a8a13cd76ecc83379b13cd26030b (diff)
Fix sonar problems in Apex
Fixed some easy to resolve Sonar issues. Issue-ID: POLICY-1034 Change-Id: Ia8e4606bd4307daca499b4a74c96135211e572fd Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
index 8b120ca3a..d4cb2ab9a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
@@ -328,38 +328,38 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
public GroupValidationResult validate() {
final GroupValidationResult result = super.validate();
- if (initialContextFactory == null || initialContextFactory.trim().length() == 0) {
+ if (isNullOrBlank(initialContextFactory)) {
result.setResult("initialContextFactory", ValidationStatus.INVALID,
"initialContextFactory must be specified as a string that is a class that implements the "
+ "interface org.jboss.naming.remote.client.InitialContextFactory");
}
- if (providerUrl == null || providerUrl.trim().length() == 0) {
+ if (isNullOrBlank(providerUrl)) {
result.setResult("providerUrl", ValidationStatus.INVALID,
"providerUrl must be specified as a URL string that specifies the location of "
+ "configuration information for the service provider to use "
+ "such as remote://localhost:4447");
}
- if (securityPrincipal == null || securityPrincipal.trim().length() == 0) {
+ if (isNullOrBlank(securityPrincipal)) {
result.setResult("securityPrincipal", ValidationStatus.INVALID,
"securityPrincipal must be specified the identity of the principal for authenticating "
+ "the caller to the service");
}
- if (securityCredentials == null || securityCredentials.trim().length() == 0) {
+ if (isNullOrBlank(securityCredentials)) {
result.setResult("securityCredentials", ValidationStatus.INVALID,
" securityCredentials must be specified as the credentials of the "
+ "principal for authenticating the caller to the service");
}
- if (producerTopic == null || producerTopic.trim().length() == 0) {
+ if (isNullOrBlank(producerTopic)) {
result.setResult("producerTopic", ValidationStatus.INVALID,
" producerTopic must be a string that identifies the JMS topic "
+ "on which Apex will send events");
}
- if (consumerTopic == null || consumerTopic.trim().length() == 0) {
+ if (isNullOrBlank(consumerTopic)) {
result.setResult("consumerTopic", ValidationStatus.INVALID,
" consumerTopic must be a string that identifies the JMS topic "
+ "on which Apex will recieve events");
@@ -372,4 +372,14 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
return result;
}
+
+ /**
+ * Check if the string is null or blank.
+ *
+ * @param stringValue the string value
+ * @return
+ */
+ private boolean isNullOrBlank(final String stringValue) {
+ return stringValue == null || stringValue.trim().length() == 0;
+ }
}