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.
This commit is contained in:
Nik Everett 2018-03-17 11:06:05 -04:00
parent b56afebad1
commit cd165d1c4b
1 changed files with 6 additions and 0 deletions

View File

@ -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);
}