syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/2] syncope git commit: [SYNCOPE-949] Remove management of WebApplicationException and BadRequestException
Date Thu, 22 Sep 2016 14:13:13 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X c0124145b -> ea4786ba4
  refs/heads/master c4339686a -> a9aafe2dc


[SYNCOPE-949] Remove management of WebApplicationException and BadRequestException


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ea4786ba
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ea4786ba
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ea4786ba

Branch: refs/heads/2_0_X
Commit: ea4786ba49d14c5ca98769ab7628f095b4e67e7c
Parents: c012414
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Sep 22 16:12:47 2016 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Sep 22 16:12:47 2016 +0200

----------------------------------------------------------------------
 .../rest/cxf/RestServiceExceptionMapper.java    | 21 +-------------------
 1 file changed, 1 insertion(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/ea4786ba/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
index d6fa891..eb584df 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/RestServiceExceptionMapper.java
@@ -28,8 +28,6 @@ import javax.persistence.EntityExistsException;
 import javax.persistence.PersistenceException;
 import javax.persistence.RollbackException;
 import javax.validation.ValidationException;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
@@ -99,15 +97,6 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>,
R
             builder = sce.isComposite()
                     ? getSyncopeClientCompositeExceptionResponse(sce.asComposite())
                     : getSyncopeClientExceptionResponse(sce);
-        } else if (ex instanceof WebApplicationException) {
-            Response response = ((WebApplicationException) ex).getResponse();
-
-            ErrorTO error = new ErrorTO();
-            error.setStatus(response.getStatus());
-            error.setType(ClientExceptionType.Unknown);
-            error.getElements().add(ExceptionUtils.getRootCauseMessage(ex));
-
-            builder = builder(response).entity(error);
         } else if (ex instanceof AccessDeniedException) {
             builder = Response.status(Response.Status.UNAUTHORIZED).
                     header(RESTHeaders.ERROR_CODE, Response.Status.UNAUTHORIZED.getReasonPhrase()).
@@ -260,8 +249,6 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>,
R
     }
 
     private ResponseBuilder processBadRequestExceptions(final Exception ex) {
-        ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-
         // This exception might be raised by Activiti (if enabled)
         Class<?> ibatisPersistenceException = null;
         try {
@@ -270,13 +257,7 @@ public class RestServiceExceptionMapper implements ExceptionMapper<Exception>,
R
             // ignore
         }
 
-        if (ex instanceof BadRequestException) {
-            if (((BadRequestException) ex).getResponse() == null) {
-                return builder;
-            } else {
-                return builder(((BadRequestException) ex).getResponse());
-            }
-        } else if (ex instanceof WorkflowException) {
+        if (ex instanceof WorkflowException) {
             return builder(ClientExceptionType.Workflow, ExceptionUtils.getRootCauseMessage(ex));
         } else if (ex instanceof PersistenceException) {
             return builder(ClientExceptionType.GenericPersistence, ExceptionUtils.getRootCauseMessage(ex));


Mime
View raw message