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

(cherry picked from commit 4e9a59ce16e81b4bd6fae443a997ef24d588a6e8)
This commit is contained in:
Yongjun Zhang 2018-02-02 22:58:44 -08:00
parent 7cd3770fee
commit 6dfea05049

View File

@ -1911,8 +1911,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());