From 7390025bf442b67baf8ab9c9c33d93e79abdce07 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 31 Aug 2012 01:00:30 -0300 Subject: [PATCH] Fix wrong base exception handlers. --- .../main/java/com/wisemapping/rest/BaseController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 f18c9c26..471d662b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java @@ -18,6 +18,7 @@ package com.wisemapping.rest; +import com.wisemapping.exceptions.AccessDeniedSecurityException; import com.wisemapping.filter.UserAgent; import com.wisemapping.mail.NotificationService; import com.wisemapping.model.User; @@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.UndeclaredThrowableException; public class BaseController { @@ -72,14 +74,14 @@ public class BaseController { @ExceptionHandler(java.lang.reflect.UndeclaredThrowableException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) - public RestErrors handleSecurityErrors(@NotNull ValidationException ex) { - return new RestErrors(ex.getErrors(), messageSource); + public RestErrors handleSecurityErrors(@NotNull UndeclaredThrowableException ex) { + return new RestErrors(ex.getMessage()); } @ExceptionHandler(com.wisemapping.exceptions.AccessDeniedSecurityException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) - public RestErrors handleSecurity2Errors(@NotNull ValidationException ex) { - return new RestErrors(ex.getErrors(), messageSource); + public RestErrors handleSecurityException(@NotNull AccessDeniedSecurityException ex) { + return new RestErrors(ex.getMessage()); } }