diff options
author | Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> | 2020-06-25 10:24:12 +0200 |
---|---|---|
committer | Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> | 2020-06-25 13:13:53 +0200 |
commit | a7340508d11b52ab77f79db24472eab293f64227 (patch) | |
tree | c6497ca97925c2ce44f3903a5175e99145a4db95 /certServiceClient/src/main | |
parent | 34d11834cbe76992246f3a4c5df5807af2e7d0d2 (diff) |
Fix sonar issues
Issue-ID: AAF-1152
Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Change-Id: I6e6ec500720204af32b8581e97fc563ac5c81acb
Diffstat (limited to 'certServiceClient/src/main')
-rw-r--r-- | certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/ConvertedArtifactsCreator.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/ConvertedArtifactsCreator.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/ConvertedArtifactsCreator.java index 0ecee793..4826732c 100644 --- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/ConvertedArtifactsCreator.java +++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/ConvertedArtifactsCreator.java @@ -61,8 +61,8 @@ public class ConvertedArtifactsCreator implements ArtifactsCreator { private void createKeystore(List<String> data, PrivateKey privateKey) throws PemConversionException, CertFileWriterException { Password password = passwordGenerator.generate(PASSWORD_LENGTH); - String keystoreArtifactName = String.format("%s.%s", KEYSTORE, fileExtension); - String keystorePass = String.format("%s.%s", KEYSTORE, PASS_EXT); + String keystoreArtifactName = getFilenameWithExtension(KEYSTORE, fileExtension); + String keystorePass = getFilenameWithExtension(KEYSTORE, PASS_EXT); LOGGER.debug("Attempt to create keystore files and saving data. File names: {}, {}", keystoreArtifactName, keystorePass); @@ -73,8 +73,8 @@ public class ConvertedArtifactsCreator implements ArtifactsCreator { private void createTruststore(List<String> data) throws PemConversionException, CertFileWriterException { Password password = passwordGenerator.generate(PASSWORD_LENGTH); - String truststoreArtifactName = String.format("%s.%s", TRUSTSTORE, fileExtension); - String truststorePass = String.format("%s.%s", TRUSTSTORE, PASS_EXT); + String truststoreArtifactName = getFilenameWithExtension(TRUSTSTORE, fileExtension); + String truststorePass = getFilenameWithExtension(TRUSTSTORE, PASS_EXT); LOGGER.debug("Attempt to create truststore files and saving data. File names: {}, {}", truststoreArtifactName, truststorePass); @@ -85,4 +85,8 @@ public class ConvertedArtifactsCreator implements ArtifactsCreator { private byte[] getPasswordAsBytes(Password password) { return password.getCurrentPassword().getBytes(); } + + private String getFilenameWithExtension(String filename, String extension) { + return String.format("%s.%s", filename, extension); + } } |