Merge changes I17a289cd,Ie0d50a2c
authorsunil unnava <su622b@att.com>
Thu, 8 Aug 2019 14:54:04 +0000 (14:54 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 8 Aug 2019 14:54:04 +0000 (14:54 +0000)
* changes:
  revert topic exist  check while publishing
  revert topic exist topic check while publishing

1  2 
src/main/java/org/onap/dmaap/dmf/mr/service/impl/EventsServiceImpl.java

@@@ -41,7 -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;
@@@ -265,7 -264,7 +265,7 @@@ public class EventsServiceImpl implemen
  
        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);
  
        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) {
  
        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";
        }
  
        /**
                validateIpBlacklist(errRespProvider, ctx);
  
                final Topic metaTopic = ctx.getConfigReader().getfMetaBroker().getTopic(topic);
-               if (metaTopic == null) {
-                       throw new CambriaApiException(errRespProvider.getTopicNotFoundError());
-               }
+               
  
                final boolean isAAFTopic = authorizeClientWhenNeeded(ctx, metaTopic, topic, errRespProvider, PUBLISH_ACTION);
  
        }
  
        private boolean isTransactionIdRequired() {
 -              return getPropertyFromAJSCmap("transidUEBtopicreqd").equalsIgnoreCase("true");
 +              String transIdReqProperty = getPropertyFromAJSCmap("transidUEBtopicreqd");
 +              return StringUtils.isNotEmpty(transIdReqProperty) && transIdReqProperty.equalsIgnoreCase("true");
        }
  
        /**