Client: Wrap SSLHandshakeException in sync calls
Adds SSLHandshakeException to the list of Exceptions that are
specifically rethrown from the async thread so its type is preserved.
This should make it easier to debug synchronous calls with ssl issues.
@@ -72,6 +72,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import javax.net.ssl.SSLHandshakeException;
/**
* Client that connects to an Elasticsearch cluster through HTTP.
@@ -717,6 +718,11 @@ public class RestClient implements Closeable {
e.initCause(exception);
throw e;
}
+ if (exception instanceof SSLHandshakeException) {
+ SSLHandshakeException e = new SSLHandshakeException(exception.getMessage());
+ e.initCause(exception);
+ throw e;
+ }
if (exception instanceof IOException) {
throw new IOException(exception.getMessage(), exception);
}
