Example usage for org.springframework.core NestedCheckedException getMessage

List of usage examples for org.springframework.core NestedCheckedException getMessage

Introduction

In this page you can find the example usage for org.springframework.core NestedCheckedException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:org.springframework.web.server.handler.ExceptionHandlingWebHandler.java

private void logException(Throwable ex) {
    @SuppressWarnings("serial")
    NestedCheckedException nestedException = new NestedCheckedException("", ex) {
    };// w  ww . j  av a 2s  . c om

    if ("Broken pipe".equalsIgnoreCase(nestedException.getMostSpecificCause().getMessage())
            || DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName())) {

        if (disconnectedClientLogger.isTraceEnabled()) {
            disconnectedClientLogger.trace("Looks like the client has gone away", ex);
        } else if (disconnectedClientLogger.isDebugEnabled()) {
            disconnectedClientLogger.debug("Looks like the client has gone away: "
                    + nestedException.getMessage() + " (For full stack trace, set the '"
                    + DISCONNECTED_CLIENT_LOG_CATEGORY + "' log category to TRACE level)");
        }
    } else {
        logger.error("Could not complete request", ex);
    }
}