Java Code Examples for java.net.SocketException#getCause()

The following examples show how to use java.net.SocketException#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: HttpsClient.java    From openjsse with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 2
Source File: HttpsClient.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 3
Source File: HttpsClient.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 4
Source File: HttpsClient.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 5
Source File: HttpsClient.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 6
Source File: HttpsClient.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 7
Source File: HttpsClient.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 8
Source File: HttpsClient.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 9
Source File: HttpsClient.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 10
Source File: HttpsClient.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 11
Source File: HttpsClient.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 12
Source File: HttpsClient.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 13
Source File: HttpsClient.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 14
Source File: HttpsClient.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 15
Source File: HttpsClient.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following method, createSocket, is defined in NetworkClient
 * and overridden here so that the socket facroty is used to create
 * new sockets.
 */
@Override
protected Socket createSocket() throws IOException {
    try {
        return sslSocketFactory.createSocket();
    } catch (SocketException se) {
        //
        // bug 6771432
        // javax.net.SocketFactory throws a SocketException with an
        // UnsupportedOperationException as its cause to indicate that
        // unconnected sockets have not been implemented.
        //
        Throwable t = se.getCause();
        if (t != null && t instanceof UnsupportedOperationException) {
            return super.createSocket();
        } else {
            throw se;
        }
    }
}
 
Example 16
Source File: TitusExceptionMapper.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
private Response fromSocketException(SocketException e) {
    int status = HttpServletResponse.SC_SERVICE_UNAVAILABLE;

    Throwable cause = e.getCause() == null ? e : e.getCause();
    String errorMessage = toStandardHttpErrorMessage(status, cause);

    ErrorResponse errorResponse = ErrorResponse.newError(status, errorMessage)
            .clientRequest(httpServletRequest)
            .serverContext()
            .exceptionContext(cause)
            .build();
    return Response.status(status).entity(errorResponse).build();
}