Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8010F200B88 for ; Thu, 22 Sep 2016 16:13:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7EB29160AE0; Thu, 22 Sep 2016 14:13:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C36D1160AAD for ; Thu, 22 Sep 2016 16:13:14 +0200 (CEST) Received: (qmail 47745 invoked by uid 500); 22 Sep 2016 14:13:14 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 47733 invoked by uid 99); 22 Sep 2016 14:13:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Sep 2016 14:13:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C4B5BE0019; Thu, 22 Sep 2016 14:13:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: ilgrosso@apache.org To: commits@syncope.apache.org Date: Thu, 22 Sep 2016 14:13:13 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] syncope git commit: [SYNCOPE-949] Remove management of WebApplicationException and BadRequestException archived-at: Thu, 22 Sep 2016 14:13:15 -0000 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ò Authored: Thu Sep 22 16:12:47 2016 +0200 Committer: Francesco Chicchiriccò 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, 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, 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, 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));