summaryrefslogtreecommitdiffstats
path: root/certService/src/main/java
diff options
context:
space:
mode:
authorPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>2021-07-14 09:45:18 +0200
committerPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>2021-07-19 06:46:32 +0000
commit59d3b4a3351a8146a562bbda2ebb9e8b4b5f0e3e (patch)
treeba09fe82d98891f1d06bcb82f4d2bb21e5d49b81 /certService/src/main/java
parentc386b2b9fbf44de105f68ffa87bdcb3328e9c6ee (diff)
[OOM-CERT-SERVICE] Add CertificateDecriptionException handler
Issue-ID: OOM-2753 Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> Change-Id: If4f705b11cdaf1c98f49875b40eb970563d4c3dd
Diffstat (limited to 'certService/src/main/java')
-rw-r--r--certService/src/main/java/org/onap/oom/certservice/api/advice/CertificationExceptionAdvice.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/certService/src/main/java/org/onap/oom/certservice/api/advice/CertificationExceptionAdvice.java b/certService/src/main/java/org/onap/oom/certservice/api/advice/CertificationExceptionAdvice.java
index 1c6c3a0a..e3fa1cb2 100644
--- a/certService/src/main/java/org/onap/oom/certservice/api/advice/CertificationExceptionAdvice.java
+++ b/certService/src/main/java/org/onap/oom/certservice/api/advice/CertificationExceptionAdvice.java
@@ -22,6 +22,7 @@
package org.onap.oom.certservice.api.advice;
import org.onap.oom.certservice.api.CertificationController;
+import org.onap.oom.certservice.certification.exception.CertificateDecryptionException;
import org.onap.oom.certservice.certification.exception.Cmpv2ClientAdapterException;
import org.onap.oom.certservice.certification.exception.Cmpv2ServerNotFoundException;
import org.onap.oom.certservice.certification.exception.CsrDecryptionException;
@@ -59,6 +60,15 @@ public final class CertificationExceptionAdvice {
);
}
+ @ExceptionHandler(value = CertificateDecryptionException.class)
+ public ResponseEntity<ErrorResponseModel> handle(CertificateDecryptionException exception) {
+ LOGGER.error("Exception occurred decoding certificate:", exception);
+ return getErrorResponseEntity(
+ "Wrong certificate format",
+ HttpStatus.BAD_REQUEST
+ );
+ }
+
@ExceptionHandler(value = Cmpv2ServerNotFoundException.class)
public ResponseEntity<ErrorResponseModel> handle(Cmpv2ServerNotFoundException exception) {
LOGGER.error("Exception occurred selecting CMPv2 server:", exception);