From 183f472f52977ffbb2d4e14ed2678f806cfcf26d Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 26 Aug 2012 17:02:24 -0300 Subject: [PATCH] Fix exception handing.: --- .../src/main/webapp/samples/sample3.xml | 34 +++++++++++++++++++ .../com/wisemapping/rest/BaseController.java | 5 +++ 2 files changed, 39 insertions(+) create mode 100644 wise-editor/src/main/webapp/samples/sample3.xml diff --git a/wise-editor/src/main/webapp/samples/sample3.xml b/wise-editor/src/main/webapp/samples/sample3.xml new file mode 100644 index 00000000..41060d97 --- /dev/null +++ b/wise-editor/src/main/webapp/samples/sample3.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java index 4096738f..9e7700b4 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java @@ -63,5 +63,10 @@ public class BaseController { return new RestErrors(ex.getErrors(), messageSource); } + @ExceptionHandler(com.wisemapping.exceptions.AccessDeniedSecurityException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public RestErrors handleSecurityErrors(@NotNull ValidationException ex) { + return new RestErrors(ex.getErrors(), messageSource); + } }