summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsu622b <su622b@att.com>2019-08-08 15:17:11 -0400
committersu622b <su622b@att.com>2019-08-08 15:17:24 -0400
commitd56955b6ed0374643531bec5b81d6bf2bdd25b74 (patch)
treeeaaad6cf9be1134f6bdc9def077b70b6b6c8531a /src
parentc85ed69c96f2aa17d77248547dee8d64bb4c3c11 (diff)
fix the failing job
Issue-ID: DMAAP-1247 Change-Id: I4533b153445ac9a43849e747831a209078afdc23 Signed-off-by: su622b <su622b@att.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java b/src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java
index f25867d..de33fbe 100644
--- a/src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java
+++ b/src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java
@@ -41,6 +41,7 @@ import java.util.Date;
import java.util.LinkedList;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MediaType;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.http.HttpStatus;
import org.apache.kafka.clients.producer.ProducerRecord;
@@ -237,7 +238,7 @@ public class EventsServiceImpl implements EventsService {
throw new DMaaPAccessDeniedException(errRes);
}
- } else if( null!=metaTopic&& null != metaTopic.getOwner() && !metaTopic.getOwner().isEmpty()) {
+ } else if(metaTopic!=null && null != metaTopic.getOwner() && !metaTopic.getOwner().isEmpty()) {
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(ctx);
if(SUBSCRIBE_ACTION.equals(action)) {
metaTopic.checkUserRead(user);
@@ -264,7 +265,7 @@ public class EventsServiceImpl implements EventsService {
private int getMessageTimeout(HttpServletRequest request) {
String timeoutMsAsString = getPropertyFromAJSCmap(TIMEOUT_PROPERTY);
- int defaultTimeoutMs = timeoutMsAsString!=null ? NumberUtils.toInt(timeoutMsAsString, CambriaConstants.kNoTimeout) :
+ int defaultTimeoutMs = StringUtils.isNotEmpty(timeoutMsAsString) ? NumberUtils.toInt(timeoutMsAsString, CambriaConstants.kNoTimeout) :
CambriaConstants.kNoTimeout;
String timeoutProperty = request.getParameter(TIMEOUT_PROPERTY);
@@ -281,17 +282,17 @@ public class EventsServiceImpl implements EventsService {
private boolean isTopicNameEnforcedAaf(String topicName) {
String topicNameStd = getPropertyFromAJSCmap("enforced.topic.name.AAF");
- return !topicNameStd.isEmpty() && topicName.startsWith(topicNameStd);
+ return StringUtils.isNotEmpty(topicNameStd) && topicName.startsWith(topicNameStd);
}
private boolean isCacheEnabled() {
String cachePropsSetting = getPropertyFromAJSCmap(ConsumerFactory.kSetting_EnableCache);
- return !cachePropsSetting.isEmpty() ? Boolean.parseBoolean(cachePropsSetting) : ConsumerFactory.kDefault_IsCacheEnabled;
+ return StringUtils.isNotEmpty(cachePropsSetting) ? Boolean.parseBoolean(cachePropsSetting) : ConsumerFactory.kDefault_IsCacheEnabled;
}
private void verifyHostId() {
String lhostId = getPropertyFromAJSCmap("clusterhostid");
- if (lhostId.isEmpty()) {
+ if (StringUtils.isEmpty(lhostId)) {
try {
InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
@@ -303,7 +304,7 @@ public class EventsServiceImpl implements EventsService {
private String getMetricTopicName() {
String metricTopicFromProps = getPropertyFromAJSCmap("metrics.send.cambria.topic");
- return !metricTopicFromProps.isEmpty() ? metricTopicFromProps : "msgrtr.apinode.metrics.dmaap";
+ return StringUtils.isNotEmpty(metricTopicFromProps) ? metricTopicFromProps : "msgrtr.apinode.metrics.dmaap";
}
/**
@@ -324,7 +325,6 @@ public class EventsServiceImpl implements EventsService {
validateIpBlacklist(errRespProvider, ctx);
final Topic metaTopic = ctx.getConfigReader().getfMetaBroker().getTopic(topic);
-
final boolean isAAFTopic = authorizeClientWhenNeeded(ctx, metaTopic, topic, errRespProvider, PUBLISH_ACTION);
@@ -358,7 +358,8 @@ public class EventsServiceImpl implements EventsService {
}
private boolean isTransactionIdRequired() {
- return getPropertyFromAJSCmap("transidUEBtopicreqd").equalsIgnoreCase("true");
+ String transIdReqProperty = getPropertyFromAJSCmap("transidUEBtopicreqd");
+ return StringUtils.isNotEmpty(transIdReqProperty) && transIdReqProperty.equalsIgnoreCase("true");
}
/**