Add string formatter to error message 80/106480/1
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Thu, 23 Apr 2020 06:32:22 +0000 (08:32 +0200)
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Thu, 23 Apr 2020 06:32:22 +0000 (08:32 +0200)
Logger.error is seen by sonar as bug due to message formatting.
To resolve this issue formatting was extracted to previous line.

Issue-ID: INT-1533
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: If470a94fe4349759a46ac4ff70301c5bdddc619f

pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/utils/ssl/SslSupportLevel.java

index 2325ebc..fb3b958 100644 (file)
@@ -68,7 +68,15 @@ public enum SslSupportLevel {
                         .build();
 
             } catch (GeneralSecurityException e) {
-                LOGGER.error("Could not initialize client due to SSL exception: {}. Default client without SSL support will be used instead.\nCause: {}", e.getMessage(), e.getCause());
+                String errorMessage =
+                    String.format(
+                        "Could not initialize client due to SSL exception: %s. " +
+                            "Default client without SSL support will be used instead." +
+                            "\nCause: %s",
+                        e.getMessage(),
+                        e.getCause()
+                    );
+                LOGGER.error(errorMessage, e);
                 client = NONE.getClient(requestConfig, sslAuthenticationHelper);
             }
             return client;