List of usage examples for org.apache.commons.lang3.exception ExceptionUtils getThrowableList
public static List<Throwable> getThrowableList(Throwable throwable)
Returns the list of Throwable
objects in the exception chain.
A throwable without cause will return a list containing one element - the input throwable.
From source file:org.apache.syncope.core.provisioning.api.utils.ExceptionUtils2.java
/** * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable. * * @param t throwable to build stack trace from * @return a string representation of full stack trace of the given throwable *///from w ww .j av a2 s.c om public static String getFullStackTrace(final Throwable t) { StringBuilder result = new StringBuilder(); for (Throwable throwable : ExceptionUtils.getThrowableList(t)) { result.append(ExceptionUtils.getStackTrace(throwable)).append("\n\n"); } return result.toString(); }
From source file:org.eclipse.hawkbit.rest.exception.ResponseExceptionHandler.java
/** * Method for handling exception of type {@link MultipartException} which is * thrown in case the request body is not well formed and cannot be * deserialized. Called by the Spring-Framework for exception handling. * * @param request//from w ww .j a v a 2 s .c om * the Http request * @param ex * the exception which occurred * @return the entity to be responded containing the exception information * as entity. */ @ExceptionHandler(MultipartException.class) public ResponseEntity<ExceptionInfo> handleMultipartException(final HttpServletRequest request, final Exception ex) { logRequest(request, ex); final List<Throwable> throwables = ExceptionUtils.getThrowableList(ex); final Throwable responseCause = Iterables.getLast(throwables); if (responseCause.getMessage().isEmpty()) { LOG.warn("Request {} lead to MultipartException without root cause message:\n{}", request.getRequestURL(), ex.getStackTrace()); } final ExceptionInfo response = createExceptionInfo(new MultiPartFileUploadException(responseCause)); return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); }
From source file:org.languagetool.server.LanguageToolHttpHandler.java
private boolean hasCause(Exception e, Class<AuthException> clazz) { for (Throwable throwable : ExceptionUtils.getThrowableList(e)) { if (throwable.getClass().equals(clazz)) { return true; }/* w w w .j av a2 s.c om*/ } return false; }