aboutsummaryrefslogtreecommitdiffstats
path: root/certServiceClient/src/main
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-03-04 13:52:10 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-04 13:52:10 +0000
commit475767191e107a1c385d5b031ff88ab8034278e4 (patch)
treebe2bfbfde78528e87dab467bbd7aef0065fb400e /certServiceClient/src/main
parentd5aa15227f0c8a8bd57b668fdc25eb3935be81c5 (diff)
parentd18af899b0bb9813c3e1bc3111171787e85ccfc4 (diff)
Merge "Improve paths validation and creation in certServiceClient, improve coverage"
Diffstat (limited to 'certServiceClient/src/main')
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/PKCS12FilesCreator.java10
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtils.java2
2 files changed, 7 insertions, 5 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/PKCS12FilesCreator.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/PKCS12FilesCreator.java
index 60121b03..d8c41bfd 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/PKCS12FilesCreator.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/certification/conversion/PKCS12FilesCreator.java
@@ -21,6 +21,8 @@ package org.onap.aaf.certservice.client.certification.conversion;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.file.Path;
+
import org.onap.aaf.certservice.client.certification.exception.PemToPKCS12ConverterException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,10 +41,10 @@ class PKCS12FilesCreator {
PKCS12FilesCreator(String path) {
- keystoreJksPath = path + KEYSTORE_JKS;
- keystorePassPath = path + KEYSTORE_PASS;
- truststoreJksPath = path + TRUSTSTORE_JKS;
- truststorePassPath = path + TRUSTSTORE_PASS;
+ keystoreJksPath = Path.of(path, KEYSTORE_JKS).toString();
+ keystorePassPath = Path.of(path, KEYSTORE_PASS).toString();
+ truststoreJksPath = Path.of(path, TRUSTSTORE_JKS).toString();
+ truststorePassPath = Path.of(path, TRUSTSTORE_PASS).toString();
}
void saveKeystoreData(byte[] keystoreData, String keystorePassword) throws PemToPKCS12ConverterException {
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtils.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtils.java
index e65d688d..b0405274 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtils.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtils.java
@@ -27,7 +27,7 @@ public final class EnvValidationUtils {
private EnvValidationUtils() {}
public static Boolean isPathValid(String path) {
- return path.matches("^/|(/[a-zA-Z0-9_-]+)+$");
+ return path.matches("^/|(/[a-zA-Z0-9_-]+)+/?$");
}
public static Boolean isAlphaNumeric(String caName) {