Java Code Examples for com.sun.jersey.api.client.ClientHandlerException#getCause()

The following examples show how to use com.sun.jersey.api.client.ClientHandlerException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestRequests.java    From usergrid with Apache License 2.0 6 votes vote down vote up
/**
 * Performs a GET HTTP operation against the /status endpoint.
 *
 * @param runner the runner to perform the status operation on
 *
 * @return the result of the operation
 */
public static Result status( Runner runner ) {
    preparations( runner );

    try {
        return newStatusOp( runner ).execute( Result.class );
    }
    catch ( ClientHandlerException e ) {
        if ( e.getCause() instanceof SSLHandshakeException &&
                e.getCause().toString().contains( "PKIX path building failed" ) ) {

            /*
             * Oddly this fails the first time but works the second time. Until
             * I get to the bottom of this and figure it out this is the work
             * around we will use to make sure this does not fail. We retry once
             * on the failure.
             */

            return newStatusOp( runner ).execute( Result.class );
        }
    }

    throw new RuntimeException( "If we got here then the retry also failed." );
}
 
Example 2
Source File: ChannelFinderException.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
public ChannelFinderException(ClientHandlerException cause) {
    super(cause.getMessage());
    if(cause.getCause() instanceof SocketException) {
        this.setStatus(Status.NOT_FOUND);
    } else {
        this.setStatus(Status.SEE_OTHER);
    }
}