X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ves-nf-oam-adopter%2Fves-nf-oam-adopter-app%2Fsrc%2Fmain%2Fjava%2Forg%2Fo%2Fran%2Foam%2Fnf%2Foam%2Fadopter%2Fapp%2Fcontroller%2FRestExceptionHandler.java;h=fff799a1638e9c94f4ae879e268a28d1251ac249;hb=HEAD;hp=a4a7d6f8f37ed3b2643989928a8a097ec1c84ff3;hpb=e4d3cdf5d8679fdad10e12d16d0913b9754049a4;p=oam%2Fnf-oam-adopter.git diff --git a/ves-nf-oam-adopter/ves-nf-oam-adopter-app/src/main/java/org/o/ran/oam/nf/oam/adopter/app/controller/RestExceptionHandler.java b/ves-nf-oam-adopter/ves-nf-oam-adopter-app/src/main/java/org/o/ran/oam/nf/oam/adopter/app/controller/RestExceptionHandler.java index a4a7d6f..fff799a 100644 --- a/ves-nf-oam-adopter/ves-nf-oam-adopter-app/src/main/java/org/o/ran/oam/nf/oam/adopter/app/controller/RestExceptionHandler.java +++ b/ves-nf-oam-adopter/ves-nf-oam-adopter-app/src/main/java/org/o/ran/oam/nf/oam/adopter/app/controller/RestExceptionHandler.java @@ -51,10 +51,11 @@ public class RestExceptionHandler { /** * Handle Not Found Exceptions. */ + @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler({NotFoundException.class}) - public static ResponseEntity handleNotFoundExceptions(final NotFoundException exception) { + public static String handleNotFoundExceptions(final NotFoundException exception) { LOG.error("Request failed", exception); - return ResponseEntity.notFound().build(); + return exception.getMessage(); } /** @@ -64,7 +65,7 @@ public class RestExceptionHandler { @ExceptionHandler(MethodArgumentNotValidException.class) public Map handleValidationExceptions(final MethodArgumentNotValidException ex) { final Map errors = new HashMap<>(); - ex.getBindingResult().getAllErrors().forEach((error) -> { + ex.getBindingResult().getAllErrors().forEach(error -> { final String fieldName = ((FieldError) error).getField(); final String errorMessage = error.getDefaultMessage(); errors.put(fieldName, errorMessage);