Fix sonar issue KeyPairFactory
authoredyta <edyta.krukowska@nokia.com>
Tue, 31 Mar 2020 13:43:06 +0000 (15:43 +0200)
committeredyta <edyta.krukowska@nokia.com>
Tue, 31 Mar 2020 13:43:06 +0000 (15:43 +0200)
Issue-ID: AAF-1118
Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com>
Change-Id: I61d714f30c2f4d21b3b4c538e0d85da55b9b322c

certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/KeyPairFactory.java
certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/exception/KeyPairGenerationException.java

index 5bf103b..85b85ff 100644 (file)
@@ -42,8 +42,8 @@ public class KeyPairFactory {
             LOGGER.info("KeyPair generation started with algorithm: {} and key size: {}", encryptionAlgorithm, keySize);
             return createKeyPairGenerator().generateKeyPair();
         } catch (NoSuchAlgorithmException e) {
-            LOGGER.error("Generation of KeyPair failed, exception message: {}", e.getMessage());
-            throw new KeyPairGenerationException(e);
+            String errorMessage = String.format("Generation of KeyPair failed, exception message: %s", e.getMessage());
+            throw new KeyPairGenerationException(errorMessage);
         }
     }
 
index d03c819..ec6fbb9 100644 (file)
@@ -24,10 +24,11 @@ import org.onap.aaf.certservice.client.api.ExitableException;
 public class KeyPairGenerationException extends ExitableException {
     private static final ExitStatus EXIT_STATUS = ExitStatus.KEY_PAIR_GENERATION_EXCEPTION;
 
-    public KeyPairGenerationException(Throwable e) {
-        super(e);
+    public KeyPairGenerationException(String errorMessage) {
+        super(errorMessage);
     }
 
+
     public ExitStatus applicationExitStatus() {
         return EXIT_STATUS;
     }