Release oam-ves-adopter Contatiner
[oam/nf-oam-adopter.git] / 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 (file)
@@ -51,10 +51,11 @@ public class RestExceptionHandler {
     /**
      * Handle Not Found Exceptions.
      */
+    @ResponseStatus(HttpStatus.NOT_FOUND)
     @ExceptionHandler({NotFoundException.class})
-    public static ResponseEntity<Object> 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<String, String> handleValidationExceptions(final MethodArgumentNotValidException ex) {
         final Map<String, String> 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);