aboutsummaryrefslogtreecommitdiffstats
path: root/certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-03-18 09:38:27 +0100
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-03-18 09:38:27 +0100
commitc85a8965e876fde2089582a6468eb02ce18bafd5 (patch)
tree1ab921ecfb1221f1e58d9ea7fd9d2be6e58acd47 /certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java
parent15b97eff96d424102f1ced9d5bd37616260414a3 (diff)
Resolve all checkstyle warnings
Issue-ID: AAF-1107 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: I28cfc2b82f1a4800a984e30f59ff36fe90bebb38
Diffstat (limited to 'certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java')
-rw-r--r--certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java b/certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java
index 501ed6d0..b4f94b93 100644
--- a/certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java
+++ b/certService/src/main/java/org/onap/aaf/certservice/certification/CsrModelFactory.java
@@ -40,8 +40,8 @@ public class CsrModelFactory {
private final PemObjectFactory pemObjectFactory
= new PemObjectFactory();
- private final PKCS10CertificationRequestFactory certificationRequestFactory
- = new PKCS10CertificationRequestFactory();
+ private final Pkcs10CertificationRequestFactory certificationRequestFactory
+ = new Pkcs10CertificationRequestFactory();
public CsrModel createCsrModel(StringBase64 csr, StringBase64 privateKey)
@@ -57,15 +57,15 @@ public class CsrModelFactory {
return privateKey.asString()
.flatMap(pemObjectFactory::createPemObject)
.orElseThrow(
- () -> new KeyDecryptionException("Incorrect Key, decryption failed")
- );
+ () -> new KeyDecryptionException("Incorrect Key, decryption failed")
+ );
}
private PKCS10CertificationRequest decodeCsr(StringBase64 csr)
throws CsrDecryptionException {
return csr.asString()
.flatMap(pemObjectFactory::createPemObject)
- .flatMap(certificationRequestFactory::createKCS10CertificationRequest)
+ .flatMap(certificationRequestFactory::createPkcs10CertificationRequest)
.orElseThrow(
() -> new CsrDecryptionException("Incorrect CSR, decryption failed")
);
@@ -84,20 +84,28 @@ public class CsrModelFactory {
try {
String decodedString = new String(decoder.decode(value));
return Optional.of(decodedString);
- } catch(RuntimeException e) {
+ } catch (RuntimeException e) {
LOGGER.error("Exception occurred during decoding:", e);
return Optional.empty();
}
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- StringBase64 that = (StringBase64) o;
+ public boolean equals(Object otherObject) {
+ if (this == otherObject) {
+ return true;
+ }
+ if (otherObject == null || getClass() != otherObject.getClass()) {
+ return false;
+ }
+ StringBase64 that = (StringBase64) otherObject;
return Objects.equals(value, that.value);
}
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
}
}