HDFS-13100. Handle IllegalArgumentException when GETSERVERDEFAULTS is not implemented in webhdfs. Contributed by Aaron T. Myers and Yongjun Zhang.

This commit is contained in:
Yongjun Zhang 2018-02-02 22:58:44 -08:00
parent 2021f4bdce
commit 4e9a59ce16
1 changed files with 10 additions and 1 deletions

View File

@ -1869,8 +1869,17 @@ public URI getKeyProviderUri() throws IOException {
try {
keyProviderUri = getServerDefaults().getKeyProviderUri();
} catch (UnsupportedOperationException e) {
// This means server doesn't supports GETSERVERDEFAULTS call.
// This means server doesn't support GETSERVERDEFAULTS call.
// Do nothing, let keyProviderUri = null.
} catch (RemoteException e) {
if (e.getClassName() != null &&
e.getClassName().equals("java.lang.IllegalArgumentException")) {
// See HDFS-13100.
// This means server doesn't support GETSERVERDEFAULTS call.
// Do nothing, let keyProviderUri = null.
} else {
throw e;
}
}
return HdfsKMSUtil.getKeyProviderUri(ugi, getUri(), keyProviderUri,
getConf());