HDFS-13690. Improve error message when creating encryption zone while KMS is unreachable. Contributed by Kitti Nanasi.
This commit is contained in:
parent
0c7a578927
commit
d2874e0417
@ -56,6 +56,7 @@
|
|||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.lang.reflect.UndeclaredThrowableException;
|
import java.lang.reflect.UndeclaredThrowableException;
|
||||||
|
import java.net.ConnectException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
@ -478,10 +479,14 @@ public HttpURLConnection run() throws Exception {
|
|||||||
return authUrl.openConnection(url, authToken, doAsUser);
|
return authUrl.openConnection(url, authToken, doAsUser);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (IOException ex) {
|
} catch (ConnectException ex) {
|
||||||
if (ex instanceof SocketTimeoutException) {
|
String msg = "Failed to connect to: " + url.toString();
|
||||||
|
LOG.warn(msg);
|
||||||
|
throw new IOException(msg, ex);
|
||||||
|
} catch (SocketTimeoutException ex) {
|
||||||
LOG.warn("Failed to connect to {}:{}", url.getHost(), url.getPort());
|
LOG.warn("Failed to connect to {}:{}", url.getHost(), url.getPort());
|
||||||
}
|
throw ex;
|
||||||
|
} catch (IOException ex) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (UndeclaredThrowableException ex) {
|
} catch (UndeclaredThrowableException ex) {
|
||||||
throw new IOException(ex.getUndeclaredThrowable());
|
throw new IOException(ex.getUndeclaredThrowable());
|
||||||
|
Loading…
Reference in New Issue
Block a user