Fix simple sonar issues in BusConsumer 23/44223/1
authorJim Hahn <jrh3@att.com>
Mon, 23 Apr 2018 17:04:59 +0000 (13:04 -0400)
committerJim Hahn <jrh3@att.com>
Mon, 23 Apr 2018 17:04:59 +0000 (13:04 -0400)
Fixed simple sonar issues in policy-endpoints BusConsumer.

Change-Id: I6dbcdc58bf26d62eeb6bc0357d5f859474028984
Issue-ID: POLICY-728
Signed-off-by: Jim Hahn <jrh3@att.com>
policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java

index a299060..828bb92 100644 (file)
@@ -262,6 +262,11 @@ public interface BusConsumer {
      */
     private static Logger logger = LoggerFactory.getLogger(DmaapConsumerWrapper.class);
 
+    /**
+     * Name of the "protocol" property.
+     */
+    protected static final String PROTOCOL_PROP = "Protocol";
+
     /**
      * fetch timeout
      */
@@ -294,7 +299,7 @@ public interface BusConsumer {
      */
     public DmaapConsumerWrapper(List<String> servers, String topic, String apiKey, String apiSecret,
         String username, String password, String consumerGroup, String consumerInstance,
-        int fetchTimeout, int fetchLimit, boolean useHttps) throws MalformedURLException {
+        int fetchTimeout, int fetchLimit) throws MalformedURLException {
 
       this.fetchTimeout = fetchTimeout;
 
@@ -390,7 +395,7 @@ public interface BusConsumer {
         throws MalformedURLException {
 
       super(servers, topic, apiKey, apiSecret, aafLogin, aafPassword, consumerGroup,
-          consumerInstance, fetchTimeout, fetchLimit, useHttps);
+          consumerInstance, fetchTimeout, fetchLimit);
 
       // super constructor sets servers = {""} if empty to avoid errors when using DME2
       if ((servers.size() == 1 && ("".equals(servers.get(0)))) || (servers == null)
@@ -403,11 +408,11 @@ public interface BusConsumer {
       props = new Properties();
 
       if (useHttps) {
-        props.setProperty("Protocol", "https");
+        props.setProperty(PROTOCOL_PROP, "https");
         this.consumer.setHost(servers.get(0) + ":3905");
 
       } else {
-        props.setProperty("Protocol", "http");
+        props.setProperty(PROTOCOL_PROP, "http");
         this.consumer.setHost(servers.get(0) + ":3904");
       }
 
@@ -441,7 +446,7 @@ public interface BusConsumer {
 
 
       super(servers, topic, apiKey, apiSecret, dme2Login, dme2Password, consumerGroup,
-          consumerInstance, fetchTimeout, fetchLimit, useHttps);
+          consumerInstance, fetchTimeout, fetchLimit);
 
 
       final String dme2RouteOffer =
@@ -510,10 +515,10 @@ public interface BusConsumer {
       props.setProperty("MethodType", "GET");
 
       if (useHttps) {
-        props.setProperty("Protocol", "https");
+        props.setProperty(PROTOCOL_PROP, "https");
 
       } else {
-        props.setProperty("Protocol", "http");
+        props.setProperty(PROTOCOL_PROP, "http");
       }
 
       props.setProperty("contenttype", "application/json");