Search in sources :

Example 1 with NetworkError

use of com.questdb.std.ex.NetworkError in project questdb by bluestreak01.

the class SslConfig method createSSLContext.

private SSLContext createSSLContext() {
    try {
        SSLContext sslContext = SSLContext.getInstance("TLS");
        SecureRandom sr = new SecureRandom();
        sr.nextInt();
        sslContext.init(keyManagerFactory != null ? keyManagerFactory.getKeyManagers() : null, trustManagerFactory != null ? trustManagerFactory.getTrustManagers() : (trustAll ? allowAllTrustManagers : null), sr);
        return sslContext;
    } catch (Exception e) {
        throw new NetworkError(e);
    }
}
Also used : NetworkError(com.questdb.std.ex.NetworkError) SSLContext(javax.net.ssl.SSLContext) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException)

Example 2 with NetworkError

use of com.questdb.std.ex.NetworkError in project questdb by bluestreak01.

the class Net method parseIPv4.

private static int parseIPv4(CharSequence address) {
    int ip = 0;
    int count = 0;
    int lo = 0;
    int hi;
    try {
        while ((hi = Chars.indexOf(address, lo, '.')) > -1) {
            int n = Numbers.parseInt(address, lo, hi);
            ip = (ip << 8) | n;
            count++;
            lo = hi + 1;
        }
        if (count != 3) {
            throw new NetworkError("Invalid ip address: " + address);
        }
        return (ip << 8) | Numbers.parseInt(address, lo, address.length());
    } catch (NumericException e) {
        throw new NetworkError("Invalid ip address: " + address);
    }
}
Also used : NetworkError(com.questdb.std.ex.NetworkError) NumericException(com.questdb.common.NumericException)

Aggregations

NetworkError (com.questdb.std.ex.NetworkError)2 NumericException (com.questdb.common.NumericException)1 IOException (java.io.IOException)1 CertificateException (java.security.cert.CertificateException)1 SSLContext (javax.net.ssl.SSLContext)1