SONAR fixes - log formatting 31/111231/2
authorwaynedunican <wayne.dunican@est.tech>
Thu, 13 Aug 2020 11:23:39 +0000 (12:23 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Thu, 13 Aug 2020 12:22:23 +0000 (13:22 +0100)
Fixed the sonar issues relating to Printf format being used for logging
instead of String concatenation

Issue-ID: POLICY-2773
Change-Id: I38db8d1df077fd7102f6c4f9b33685f2914bd624
Signed-off-by: waynedunican <wayne.dunican@est.tech>
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java

index d7460ec..9fbc361 100644 (file)
@@ -139,8 +139,8 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
         }
         // Everything is now set up
         if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("event receiver " + this.getClass().getName() + ":" + this.name + " subscribed to JMS topic: "
-                    + jmsConsumerProperties.getConsumerTopic());
+            LOGGER.debug("event receiver {}:{} subscribed to JMS topic: {}", this.getClass().getName(),
+                    this.name, jmsConsumerProperties.getConsumerTopic());
         }
     }
 
index 32a6890..62e6c45 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -136,8 +137,8 @@ public class ApexRestServerProducer implements ApexEventProducer {
         }
 
         if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug(name + ": event " + executionId + ':' + eventName + " is a reply to a REST server call from "
-                    + name);
+            LOGGER.debug("{}: event {}:{} is a reply to a REST server call from {}",
+                    name, executionId, eventName, name);
         }
 
         // Add the event to the received event cache
index 04de6b1..076c50b 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -199,14 +200,14 @@ public class ApexFileEventConsumer implements ApexEventConsumer, Runnable {
                 }
             } while (!textBlock.isEndOfText());
         } catch (final Exception e) {
-            LOGGER.warn("\"" + consumerName + "\" failed to read event from file: \""
-                            + fileCarrierTechnologyParameters.getFileName() + "\"", e);
+            LOGGER.warn("\"{}\" failed to read event from file: \"{}\"", consumerName,
+                    fileCarrierTechnologyParameters.getFileName(), e);
         } finally {
             try {
                 eventInputStream.close();
             } catch (final IOException e) {
-                LOGGER.warn(APEX_FILE_CONSUMER_PREAMBLE + consumerName + "\" failed to close file: \""
-                                + fileCarrierTechnologyParameters.getFileName() + "\"", e);
+                LOGGER.warn("{}{}\" failed to close file: \"{}\"", APEX_FILE_CONSUMER_PREAMBLE, consumerName,
+                        fileCarrierTechnologyParameters.getFileName(), e);
             }
         }
 
@@ -220,8 +221,8 @@ public class ApexFileEventConsumer implements ApexEventConsumer, Runnable {
         try {
             eventInputStream.close();
         } catch (final IOException e) {
-            LOGGER.warn(APEX_FILE_CONSUMER_PREAMBLE + consumerName + "\" failed to close file for reading: \""
-                            + fileCarrierTechnologyParameters.getFileName() + "\"", e);
+            LOGGER.warn("{}{}\" failed to close file for reading: \"{}\"",
+                    APEX_FILE_CONSUMER_PREAMBLE, consumerName, fileCarrierTechnologyParameters.getFileName(), e);
         }
 
         if (consumerThread.isAlive() && !consumerThread.isInterrupted()) {
index 4a5fb36..609be10 100644 (file)
@@ -2,6 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
  *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -50,7 +51,8 @@ public class ApexStarterMain {
      * @param args the command line arguments
      */
     public ApexStarterMain(final String[] args) {
-        LOGGER.info("In ApexStarter with parameters " + Arrays.toString(args));
+        final String params = Arrays.toString(args);
+        LOGGER.info("In ApexStarter with parameters {}", params);
 
         // Check the arguments
         final ApexStarterCommandLineArguments arguments = new ApexStarterCommandLineArguments();