diff options
author | 2020-02-27 09:56:08 +0100 | |
---|---|---|
committer | 2020-02-27 11:27:46 +0100 | |
commit | 5b1830d2eec4eddbeaeea9b4076404fbdb78e5e2 (patch) | |
tree | edee4ec658596157dbd149df23e76b9dd72c0f02 /certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java | |
parent | 628ed81f0e56f7163b08b57a8d54833b646239d5 (diff) |
Replacement of RuntimeException with Exception class
Clean up in tests and run method.
Issue-ID: AAF-996
Signed-off-by: kjaniak <kornel.janiak@nokia.com>
Change-Id: I2abbfa9af4a77960cb65e9b9ecfcb058eb69cf12
Diffstat (limited to 'certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java')
-rw-r--r-- | certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java index ac1062a0..f8867846 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClient.java @@ -29,8 +29,8 @@ import org.onap.aaf.certservice.client.configuration.model.ClientConfiguration; import org.onap.aaf.certservice.client.configuration.model.CsrConfiguration; import java.security.KeyPair; -import java.util.Optional; +import static org.onap.aaf.certservice.client.api.ExitCode.SUCCESS_EXIT_CODE; import static org.onap.aaf.certservice.client.certification.EncryptionAlgorithmConstants.KEY_SIZE; import static org.onap.aaf.certservice.client.certification.EncryptionAlgorithmConstants.RSA_ENCRYPTION_ALGORITHM; @@ -42,23 +42,15 @@ public class CertServiceClient { } public void run() { - ClientConfiguration clientConfiguration; - CsrConfiguration csrConfiguration; - clientConfiguration = new ClientConfigurationFactory(new EnvsForClient()).create(); - csrConfiguration = new CsrConfigurationFactory(new EnvsForCsr()).create(); - KeyPairFactory keyPairFactory = new KeyPairFactory(RSA_ENCRYPTION_ALGORITHM, KEY_SIZE); - Optional<KeyPair> keyPair = generateKeyPair(keyPairFactory); - - appExitHandler.exit(0); - } - - public Optional<KeyPair> generateKeyPair(KeyPairFactory keyPairFactory) { try { - return Optional.of(keyPairFactory.create()); + ClientConfiguration clientConfiguration = new ClientConfigurationFactory(new EnvsForClient()).create(); + CsrConfiguration csrConfiguration = new CsrConfigurationFactory(new EnvsForCsr()).create(); + KeyPair keyPair = keyPairFactory.create(); } catch (ExitableException e) { appExitHandler.exit(e.applicationExitCode()); } - return Optional.empty(); + appExitHandler.exit(SUCCESS_EXIT_CODE.getValue()); } + } |