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

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

Introduction

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

Prototype

@Deprecated
public static Throwable getCause(final Throwable throwable) 

Source Link

Document

Introspects the Throwable to obtain the cause.

The method searches for methods with specific names that return a Throwable object.

Usage

From source file:org.mrobson.example.hibernates2i.cxfhibernate.service.PersonRestService.java

@SuppressWarnings("deprecation")
@POST/*from www.  j a v  a  2s  .c  om*/
@Path("/addPerson/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Adding a new Person")
@ApiResponses(value = { @ApiResponse(code = 200, message = "The person has been saved"),
        @ApiResponse(code = 400, message = "Persistence exception"),
        @ApiResponse(code = 500, message = "Invalid Person") })
public Response savePerson(Person ps) throws ApplicationException {
    LOG.info("Invoking savePerson, Person name is: {}", ps.getFirstName());
    Person savedPs = null;
    try {
        savedPs = personService.savePersonWS(ps);
    } catch (Exception e) {
        throw new ApplicationException("Could not save person: " + ps.toString() + " Cause: "
                + ExceptionUtils.getCause(e) + " Error: " + ExceptionUtils.getRootCauseMessage(e));
    }
    return Response.ok().entity(savedPs).build();
}