diff options
author | Pawel Baniewski <pawel.baniewski@nokia.com> | 2021-06-18 10:23:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-06-18 10:23:12 +0000 |
commit | 1003acd962438f82633c8a8a50f03499a8ca61a7 (patch) | |
tree | 8c678560609684024e7e4cc135d1b2bb19e5341c /certService/src/main | |
parent | 649be36042dd5d58022c28e628399e350dc43282 (diff) | |
parent | e3283b7f953eca13ae68933b6d7b8cceb237acc4 (diff) |
Merge "Fix sonar issues"
Diffstat (limited to 'certService/src/main')
3 files changed, 7 insertions, 6 deletions
diff --git a/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java b/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java index d3a83ed1..fd35ec8e 100644 --- a/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java +++ b/certService/src/main/java/org/onap/oom/certservice/api/CertificationController.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PROJECT * ================================================================================ - * Copyright (C) 2020 Nokia. All rights reserved. + * Copyright (C) 2020-2021 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public class CertificationController { @Parameter(description = "Private key in form of PEM object encoded in Base64 (with header and footer).") @RequestHeader("PK") String encodedPrivateKey ) throws DecryptionException, CmpClientException { - caName = caName.replaceAll("[\n|\r|\t]", "_"); + caName = caName.replaceAll("[\n\r\t]", "_"); LOGGER.info("Received certificate signing request for CA named: {}", caName); CertificationModel certificationModel = certificationModelFactory .createCertificationModel(encodedCsr, encodedPrivateKey, caName); diff --git a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpClientImpl.java b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpClientImpl.java index a673869d..38e7e3f8 100644 --- a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpClientImpl.java +++ b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpClientImpl.java @@ -180,13 +180,15 @@ public class CmpClientImpl implements CmpClient { } private void logServerResponse(CertResponse certResponse) { - LOG.info("Response status code: {}", certResponse.getStatus().getStatus().toString()); + if (LOG.isInfoEnabled()) { + LOG.info("Response status code: {}", certResponse.getStatus().getStatus()); + } if (certResponse.getStatus().getStatusString() != null) { String serverMessage = certResponse.getStatus().getStatusString().getStringAt(0).getString(); LOG.warn("Response status text: {}", serverMessage); } - if (certResponse.getStatus().getFailInfo() != null) { - LOG.warn("Response fail info: {}", certResponse.getStatus().getFailInfo().toString()); + if (LOG.isWarnEnabled() && certResponse.getStatus().getFailInfo() != null) { + LOG.warn("Response fail info: {}", certResponse.getStatus().getFailInfo()); } } diff --git a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpMessageHelper.java b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpMessageHelper.java index 1e64a2e0..0255b82e 100644 --- a/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpMessageHelper.java +++ b/certService/src/main/java/org/onap/oom/certservice/cmpv2client/impl/CmpMessageHelper.java @@ -25,7 +25,6 @@ import static org.onap.oom.certservice.cmpv2client.impl.CmpUtil.generateProtecte import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.InvalidKeyException; -import java.security.Key; import java.security.KeyPair; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; |