Example usage for org.apache.commons.lang3.exception ExceptionUtils getRootCauseMessage

List of usage examples for org.apache.commons.lang3.exception ExceptionUtils getRootCauseMessage

Introduction

In this page you can find the example usage for org.apache.commons.lang3.exception ExceptionUtils getRootCauseMessage.

Prototype

public static String getRootCauseMessage(final Throwable th) 

Source Link

Document

Gets a short message summarising the root cause exception.

Usage

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectPushResultHandler.java

protected final void doHandle(final AbstractSubject subject) throws JobExecutionException {

    if (profile.getResults() == null) {
        profile.setResults(new ArrayList<SyncResult>());
    }// ww  w .  j  a v  a 2 s . com

    final AbstractSubject toBeHandled = getSubject(subject.getId());

    final AttributableUtil attrUtil = AttributableUtil.getInstance(toBeHandled);

    final SyncResult result = new SyncResult();
    profile.getResults().add(result);

    result.setId(toBeHandled.getId());
    result.setSubjectType(attrUtil.getType());
    result.setName(getName(toBeHandled));

    final Boolean enabled = toBeHandled instanceof SyncopeUser && profile.getSyncTask().isSyncStatus()
            ? ((SyncopeUser) toBeHandled).isSuspended() ? Boolean.FALSE : Boolean.TRUE
            : null;

    LOG.debug("Propagating {} with ID {} towards {}", attrUtil.getType(), toBeHandled.getId(),
            profile.getSyncTask().getResource());

    Object output = null;
    Result resultStatus = null;
    ConnectorObject beforeObj = null;
    String operation = null;

    // Try to read remote object (user / group) BEFORE any actual operation

    final String accountId = MappingUtil.getAccountIdValue(subject, profile.getSyncTask().getResource(),
            getMapping().getAccountIdItem());

    beforeObj = getRemoteObject(accountId);

    Boolean status = profile.getSyncTask().isSyncStatus() ? enabled : null;

    if (profile.isDryRun()) {
        if (beforeObj == null) {
            result.setOperation(getResourceOperation(profile.getSyncTask().getUnmatchingRule()));
        } else {
            result.setOperation(getResourceOperation(profile.getSyncTask().getMatchingRule()));
        }
        result.setStatus(SyncResult.Status.SUCCESS);
    } else {
        try {
            if (beforeObj == null) {
                operation = profile.getSyncTask().getUnmatchingRule().name().toLowerCase();
                result.setOperation(getResourceOperation(profile.getSyncTask().getUnmatchingRule()));

                switch (profile.getSyncTask().getUnmatchingRule()) {
                case ASSIGN:
                    for (PushActions action : profile.getActions()) {
                        action.beforeAssign(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformCreate()) {
                        LOG.debug("PushTask not configured for create");
                    } else {
                        assign(toBeHandled, status);
                    }

                    break;
                case PROVISION:
                    for (PushActions action : profile.getActions()) {
                        action.beforeProvision(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformCreate()) {
                        LOG.debug("PushTask not configured for create");
                    } else {
                        provision(toBeHandled, status);
                    }

                    break;
                case UNLINK:
                    for (PushActions action : profile.getActions()) {
                        action.beforeUnlink(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformUpdate()) {
                        LOG.debug("PushTask not configured for update");
                    } else {
                        link(toBeHandled, true);
                    }

                    break;
                default:
                    // do nothing
                }

            } else {
                operation = profile.getSyncTask().getMatchingRule().name().toLowerCase();
                result.setOperation(getResourceOperation(profile.getSyncTask().getMatchingRule()));

                switch (profile.getSyncTask().getMatchingRule()) {
                case UPDATE:
                    for (PushActions action : profile.getActions()) {
                        action.beforeUpdate(this.getProfile(), toBeHandled);
                    }
                    if (!profile.getSyncTask().isPerformUpdate()) {
                        LOG.debug("PushTask not configured for update");
                    } else {
                        update(toBeHandled, status);
                    }

                    break;
                case DEPROVISION:
                    for (PushActions action : profile.getActions()) {
                        action.beforeDeprovision(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformDelete()) {
                        LOG.debug("PushTask not configured for delete");
                    } else {
                        deprovision(toBeHandled);
                    }

                    break;
                case UNASSIGN:
                    for (PushActions action : profile.getActions()) {
                        action.beforeUnassign(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformDelete()) {
                        LOG.debug("PushTask not configured for delete");
                    } else {
                        unassign(toBeHandled);
                    }

                    break;
                case LINK:
                    for (PushActions action : profile.getActions()) {
                        action.beforeLink(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformUpdate()) {
                        LOG.debug("PushTask not configured for update");
                    } else {
                        link(toBeHandled, false);
                    }

                    break;
                case UNLINK:
                    for (PushActions action : profile.getActions()) {
                        action.beforeUnlink(this.getProfile(), toBeHandled);
                    }

                    if (!profile.getSyncTask().isPerformUpdate()) {
                        LOG.debug("PushTask not configured for update");
                    } else {
                        link(toBeHandled, true);
                    }

                    break;
                default:
                    // do nothing
                }
            }

            for (PushActions action : profile.getActions()) {
                action.after(this.getProfile(), toBeHandled, result);
            }

            result.setStatus(SyncResult.Status.SUCCESS);
            resultStatus = AuditElements.Result.SUCCESS;
            output = getRemoteObject(accountId);
        } catch (Exception e) {
            result.setStatus(SyncResult.Status.FAILURE);
            result.setMessage(ExceptionUtils.getRootCauseMessage(e));
            resultStatus = AuditElements.Result.FAILURE;
            output = e;

            LOG.warn("Error pushing {} towards {}", toBeHandled, profile.getSyncTask().getResource(), e);
            throw new JobExecutionException(e);
        } finally {
            notificationManager.createTasks(AuditElements.EventCategoryType.PUSH,
                    AttributableType.USER.name().toLowerCase(), profile.getSyncTask().getResource().getName(),
                    operation, resultStatus, beforeObj, output, toBeHandled);
            auditManager.audit(AuditElements.EventCategoryType.PUSH, AttributableType.USER.name().toLowerCase(),
                    profile.getSyncTask().getResource().getName(), operation, resultStatus, beforeObj, output,
                    toBeHandled);
        }
    }
}

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectSyncResultHandler.java

private void create(final AbstractSubjectTO subjectTO, final SyncDelta delta, final AttributableUtil attrUtil,
        final String operation, final SyncResult result) throws JobExecutionException {

    Object output;/*from  www  .ja v  a2  s.  c  o  m*/
    Result resultStatus;

    try {
        AbstractSubjectTO actual = create(subjectTO, delta, result);
        result.setName(getName(actual));
        output = actual;
        resultStatus = Result.SUCCESS;

        for (SyncActions action : profile.getActions()) {
            action.after(this.getProfile(), delta, actual, result);
        }
    } catch (PropagationException e) {
        // A propagation failure doesn't imply a synchronization failure.
        // The propagation exception status will be reported into the propagation task execution.
        LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
        output = e;
        resultStatus = Result.FAILURE;
    } catch (Exception e) {
        result.setStatus(SyncResult.Status.FAILURE);
        result.setMessage(ExceptionUtils.getRootCauseMessage(e));
        LOG.error("Could not create {} {} ", attrUtil.getType(), delta.getUid().getUidValue(), e);
        output = e;
        resultStatus = Result.FAILURE;
    }

    audit(operation, resultStatus, null, output, delta);
}

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectSyncResultHandler.java

protected List<SyncResult> update(SyncDelta delta, final List<Long> subjects, final AttributableUtil attrUtil)
        throws JobExecutionException {

    if (!profile.getSyncTask().isPerformUpdate()) {
        LOG.debug("SyncTask not configured for update");
        return Collections.<SyncResult>emptyList();
    }/*  w  ww.j av a  2s .  c  o  m*/

    LOG.debug("About to update {}", subjects);

    List<SyncResult> updResults = new ArrayList<SyncResult>();

    for (Long id : subjects) {
        LOG.debug("About to update {}", id);

        Object output;
        AbstractSubjectTO before = null;
        Result resultStatus;

        final SyncResult result = new SyncResult();
        result.setOperation(ResourceOperation.UPDATE);
        result.setSubjectType(attrUtil.getType());
        result.setStatus(SyncResult.Status.SUCCESS);
        result.setId(id);

        before = getSubjectTO(id);

        if (before == null) {
            result.setStatus(SyncResult.Status.FAILURE);
            result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), id));
        } else {
            result.setName(getName(before));
        }

        if (!profile.isDryRun()) {
            if (before == null) {
                resultStatus = Result.FAILURE;
                output = null;
            } else {
                try {
                    final AbstractSubjectMod attributableMod = getSubjectMod(before, delta);

                    // Attribute value transformation (if configured)
                    final AbstractSubjectMod actual = attrTransformer.transform(attributableMod);
                    LOG.debug("Transformed: {}", actual);

                    for (SyncActions action : profile.getActions()) {
                        delta = action.beforeUpdate(this.getProfile(), delta, before, attributableMod);
                    }

                    final AbstractSubjectTO updated = update(before, attributableMod, delta, result);

                    for (SyncActions action : profile.getActions()) {
                        action.after(this.getProfile(), delta, updated, result);
                    }

                    output = updated;
                    resultStatus = Result.SUCCESS;
                    result.setName(getName(updated));
                    LOG.debug("{} {} successfully updated", attrUtil.getType(), id);
                } catch (PropagationException e) {
                    // A propagation failure doesn't imply a synchronization failure.
                    // The propagation exception status will be reported into the propagation task execution.
                    LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                } catch (Exception e) {
                    result.setStatus(SyncResult.Status.FAILURE);
                    result.setMessage(ExceptionUtils.getRootCauseMessage(e));
                    LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                }
            }
            audit("update", resultStatus, before, output, delta);
        }
        updResults.add(result);
    }
    return updResults;
}

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectSyncResultHandler.java

protected List<SyncResult> deprovision(SyncDelta delta, final List<Long> subjects,
        final AttributableUtil attrUtil, final boolean unlink) throws JobExecutionException {

    if (!profile.getSyncTask().isPerformUpdate()) {
        LOG.debug("SyncTask not configured for update");
        return Collections.<SyncResult>emptyList();
    }/*from  ww w .ja  v  a  2 s .c om*/

    LOG.debug("About to update {}", subjects);

    final List<SyncResult> updResults = new ArrayList<SyncResult>();

    for (Long id : subjects) {
        LOG.debug("About to unassign resource {}", id);

        Object output;
        Result resultStatus;

        final SyncResult result = new SyncResult();
        result.setOperation(ResourceOperation.DELETE);
        result.setSubjectType(attrUtil.getType());
        result.setStatus(SyncResult.Status.SUCCESS);
        result.setId(id);

        final AbstractSubjectTO before = getSubjectTO(id);

        if (before == null) {
            result.setStatus(SyncResult.Status.FAILURE);
            result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), id));
        }

        if (!profile.isDryRun()) {
            if (before == null) {
                resultStatus = Result.FAILURE;
                output = null;
            } else {
                result.setName(getName(before));

                try {
                    if (unlink) {
                        for (SyncActions action : profile.getActions()) {
                            action.beforeUnassign(this.getProfile(), delta, before);
                        }
                    } else {
                        for (SyncActions action : profile.getActions()) {
                            action.beforeDeprovision(this.getProfile(), delta, before);
                        }
                    }

                    deprovision(id, unlink);
                    output = getSubjectTO(id);

                    for (SyncActions action : profile.getActions()) {
                        action.after(this.getProfile(), delta, AbstractSubjectTO.class.cast(output), result);
                    }

                    resultStatus = Result.SUCCESS;
                    LOG.debug("{} {} successfully updated", attrUtil.getType(), id);
                } catch (PropagationException e) {
                    // A propagation failure doesn't imply a synchronization failure.
                    // The propagation exception status will be reported into the propagation task execution.
                    LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                } catch (Exception e) {
                    result.setStatus(SyncResult.Status.FAILURE);
                    result.setMessage(ExceptionUtils.getRootCauseMessage(e));
                    LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                }
            }
            audit(unlink ? "unassign" : "deprovision", resultStatus, before, output, delta);
        }
        updResults.add(result);
    }

    return updResults;
}

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectSyncResultHandler.java

protected List<SyncResult> link(SyncDelta delta, final List<Long> subjects, final AttributableUtil attrUtil,
        final boolean unlink) throws JobExecutionException {

    if (!profile.getSyncTask().isPerformUpdate()) {
        LOG.debug("SyncTask not configured for update");
        return Collections.<SyncResult>emptyList();
    }/*  w  ww .  j a  v  a2 s . c o  m*/

    LOG.debug("About to update {}", subjects);

    final List<SyncResult> updResults = new ArrayList<SyncResult>();

    for (Long id : subjects) {
        LOG.debug("About to unassign resource {}", id);

        Object output;
        Result resultStatus;

        final SyncResult result = new SyncResult();
        result.setOperation(ResourceOperation.NONE);
        result.setSubjectType(attrUtil.getType());
        result.setStatus(SyncResult.Status.SUCCESS);
        result.setId(id);

        final AbstractSubjectTO before = getSubjectTO(id);

        if (before == null) {
            result.setStatus(SyncResult.Status.FAILURE);
            result.setMessage(String.format("Subject '%s(%d)' not found", attrUtil.getType().name(), id));
        }

        if (!profile.isDryRun()) {
            if (before == null) {
                resultStatus = Result.FAILURE;
                output = null;
            } else {
                result.setName(getName(before));

                try {
                    if (unlink) {
                        for (SyncActions action : profile.getActions()) {
                            action.beforeUnlink(this.getProfile(), delta, before);
                        }
                    } else {
                        for (SyncActions action : profile.getActions()) {
                            action.beforeLink(this.getProfile(), delta, before);
                        }
                    }

                    output = link(before, result, unlink);

                    for (SyncActions action : profile.getActions()) {
                        action.after(this.getProfile(), delta, AbstractSubjectTO.class.cast(output), result);
                    }

                    resultStatus = Result.SUCCESS;
                    LOG.debug("{} {} successfully updated", attrUtil.getType(), id);
                } catch (PropagationException e) {
                    // A propagation failure doesn't imply a synchronization failure.
                    // The propagation exception status will be reported into the propagation task execution.
                    LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                } catch (Exception e) {
                    result.setStatus(SyncResult.Status.FAILURE);
                    result.setMessage(ExceptionUtils.getRootCauseMessage(e));
                    LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
                    output = e;
                    resultStatus = Result.FAILURE;
                }
            }
            audit(unlink ? "unlink" : "link", resultStatus, before, output, delta);
        }
        updResults.add(result);
    }

    return updResults;
}

From source file:org.apache.syncope.core.sync.impl.AbstractSubjectSyncResultHandler.java

protected List<SyncResult> delete(SyncDelta delta, final List<Long> subjects, final AttributableUtil attrUtil)
        throws JobExecutionException {

    if (!profile.getSyncTask().isPerformDelete()) {
        LOG.debug("SyncTask not configured for delete");
        return Collections.<SyncResult>emptyList();
    }/* w ww .ja  v  a 2s .  com*/

    LOG.debug("About to delete {}", subjects);

    List<SyncResult> delResults = new ArrayList<SyncResult>();

    for (Long id : subjects) {
        Object output;
        Result resultStatus = Result.FAILURE;

        AbstractSubjectTO before = null;
        final SyncResult result = new SyncResult();

        try {
            before = getSubjectTO(id);

            result.setId(id);
            result.setName(getName(before));
            result.setOperation(ResourceOperation.DELETE);
            result.setSubjectType(attrUtil.getType());
            result.setStatus(SyncResult.Status.SUCCESS);

            if (!profile.isDryRun()) {
                for (SyncActions action : profile.getActions()) {
                    delta = action.beforeDelete(this.getProfile(), delta, before);
                }

                try {
                    delete(id);
                    output = null;
                    resultStatus = Result.SUCCESS;
                } catch (Exception e) {
                    result.setStatus(SyncResult.Status.FAILURE);
                    result.setMessage(ExceptionUtils.getRootCauseMessage(e));
                    LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
                    output = e;
                }

                for (SyncActions action : profile.getActions()) {
                    action.after(this.getProfile(), delta, before, result);
                }

                audit("delete", resultStatus, before, output, delta);
            }

            delResults.add(result);

        } catch (NotFoundException e) {
            LOG.error("Could not find {} {}", attrUtil.getType(), id, e);
        } catch (UnauthorizedRoleException e) {
            LOG.error("Not allowed to read {} {}", attrUtil.getType(), id, e);
        } catch (Exception e) {
            LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
        }
    }

    return delResults;
}

From source file:org.apache.syncope.core.sync.impl.UserSyncResultHandler.java

@Override
protected AbstractSubjectTO update(final AbstractSubjectTO before, final AbstractSubjectMod subjectMod,
        final SyncDelta delta, final SyncResult result) throws Exception {

    final UserMod userMod = UserMod.class.cast(subjectMod);

    WorkflowResult<Map.Entry<UserMod, Boolean>> updated;
    try {/*w  ww  .  j a v a 2s  .  co  m*/
        updated = uwfAdapter.update(userMod);
    } catch (Exception e) {
        LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)", before.getId(),
                e);

        result.setStatus(SyncResult.Status.FAILURE);
        result.setMessage("Update failed, trying to sync status anyway (if configured)\n"
                + ExceptionUtils.getRootCauseMessage(e));

        updated = new WorkflowResult<Map.Entry<UserMod, Boolean>>(
                new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, false), new PropagationByResource(),
                new HashSet<String>());
    }

    final Boolean enabled = syncUtilities.readEnabled(delta.getObject(), profile.getSyncTask());
    if (enabled != null) {
        SyncopeUser user = userDAO.find(before.getId());

        WorkflowResult<Long> enableUpdate = null;
        if (user.isSuspended() == null) {
            enableUpdate = uwfAdapter.activate(before.getId(), null);
        } else if (enabled && user.isSuspended()) {
            enableUpdate = uwfAdapter.reactivate(before.getId());
        } else if (!enabled && !user.isSuspended()) {
            enableUpdate = uwfAdapter.suspend(before.getId());
        }

        if (enableUpdate != null) {
            if (enableUpdate.getPropByRes() != null) {
                updated.getPropByRes().merge(enableUpdate.getPropByRes());
                updated.getPropByRes().purge();
            }
            updated.getPerformedTasks().addAll(enableUpdate.getPerformedTasks());
        }
    }

    final List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated,
            updated.getResult().getKey().getPassword() != null,
            Collections.singleton(profile.getSyncTask().getResource().getName()));

    taskExecutor.execute(tasks);

    return userDataBinder.getUserTO(updated.getResult().getKey().getId());
}

From source file:org.apache.syncope.ext.scimv2.cxf.SCIMExceptionMapper.java

@Override
public Response toResponse(final Exception ex) {
    LOG.error("Exception thrown", ex);

    ResponseBuilder builder;/*from   ww w . jav  a  2s. c  om*/

    if (ex instanceof AccessDeniedException || ex instanceof ForbiddenException
            || ex instanceof NotAuthorizedException) {

        // leaves the default exception processing
        builder = null;
    } else if (ex instanceof NotFoundException) {
        return Response
                .status(Response.Status.NOT_FOUND).entity(new SCIMError(null,
                        Response.Status.NOT_FOUND.getStatusCode(), ExceptionUtils.getRootCauseMessage(ex)))
                .build();
    } else if (ex instanceof SyncopeClientException) {
        SyncopeClientException sce = (SyncopeClientException) ex;
        builder = builder(sce.getType(), ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof DelegatedAdministrationException
            || ExceptionUtils.getRootCause(ex) instanceof DelegatedAdministrationException) {

        builder = builder(ClientExceptionType.DelegatedAdministration, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ENTITYEXISTS_EXCLASS.isAssignableFrom(ex.getClass()) || ex instanceof DuplicateException
            || PERSISTENCE_EXCLASS.isAssignableFrom(ex.getClass())
                    && ENTITYEXISTS_EXCLASS.isAssignableFrom(ex.getCause().getClass())) {

        builder = builder(ClientExceptionType.EntityExists, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof DataIntegrityViolationException
            || JPASYSTEM_EXCLASS.isAssignableFrom(ex.getClass())) {
        builder = builder(ClientExceptionType.DataIntegrityViolation, ExceptionUtils.getRootCauseMessage(ex));
    } else if (CONNECTOR_EXCLASS.isAssignableFrom(ex.getClass())) {
        builder = builder(ClientExceptionType.ConnectorException, ExceptionUtils.getRootCauseMessage(ex));
    } else {
        builder = processInvalidEntityExceptions(ex);
        if (builder == null) {
            builder = processBadRequestExceptions(ex);
        }
        // process JAX-RS validation errors
        if (builder == null && ex instanceof ValidationException) {
            builder = builder(ClientExceptionType.RESTValidation, ExceptionUtils.getRootCauseMessage(ex));
        }
        // ...or just report as InternalServerError
        if (builder == null) {
            builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                    .entity(ExceptionUtils.getRootCauseMessage(ex));
        }
    }

    return builder == null ? null : builder.build();
}

From source file:org.apache.syncope.ext.scimv2.cxf.SCIMExceptionMapper.java

private ResponseBuilder processBadRequestExceptions(final Exception ex) {
    if (ex instanceof WorkflowException) {
        return builder(ClientExceptionType.Workflow, ExceptionUtils.getRootCauseMessage(ex));
    } else if (PERSISTENCE_EXCLASS.isAssignableFrom(ex.getClass())) {
        return builder(ClientExceptionType.GenericPersistence, ExceptionUtils.getRootCauseMessage(ex));
    } else if (IBATISPERSISTENCE_EXCLASS != null && IBATISPERSISTENCE_EXCLASS.isAssignableFrom(ex.getClass())) {
        return builder(ClientExceptionType.Workflow, "Currently unavailable. Please try later.");
    } else if (JPASYSTEM_EXCLASS.isAssignableFrom(ex.getClass())) {
        return builder(ClientExceptionType.DataIntegrityViolation, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof ConfigurationException) {
        return builder(ClientExceptionType.InvalidConnIdConf, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof ParsingValidationException) {
        return builder(ClientExceptionType.InvalidValues, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof MalformedPathException) {
        return builder(ClientExceptionType.InvalidPath, ExceptionUtils.getRootCauseMessage(ex));
    } else if (ex instanceof BadRequestException) {
        return Response.status(Response.Status.BAD_REQUEST).entity(new SCIMError((BadRequestException) ex));
    }/* www. j  a  va2  s .  c  o m*/

    return null;
}

From source file:org.apereo.openlrs.model.error.XAPIErrorInfo.java

public XAPIErrorInfo(final HttpStatus status, final HttpServletRequest request,
        final Exception resultingException) {
    this(status, request);
    this.messages.add(ExceptionUtils.getRootCauseMessage(resultingException));
}