diff options
author | edyta <edyta.krukowska@nokia.com> | 2020-03-31 15:43:06 +0200 |
---|---|---|
committer | edyta <edyta.krukowska@nokia.com> | 2020-03-31 15:43:06 +0200 |
commit | 3ded702865858013429dda3f3af3d134748e5df7 (patch) | |
tree | 0dcd175b1d1b4feecdfa5901a03e242fed256c9b | |
parent | 26d5436326c8139a5731fd913a8009ca5569be21 (diff) |
Fix sonar issue KeyPairFactory
Issue-ID: AAF-1118
Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com>
Change-Id: I61d714f30c2f4d21b3b4c538e0d85da55b9b322c
2 files changed, 5 insertions, 4 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/KeyPairFactory.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/KeyPairFactory.java index 5bf103ba..85b85ff3 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/KeyPairFactory.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/KeyPairFactory.java @@ -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); } } diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/exception/KeyPairGenerationException.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/exception/KeyPairGenerationException.java index d03c819d..ec6fbb9c 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/exception/KeyPairGenerationException.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/exception/KeyPairGenerationException.java @@ -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; } |