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

(cherry picked from commit 4e9a59ce16)
This commit is contained in:
Yongjun Zhang 2018-02-02 22:58:44 -08:00
parent 7cd3770fee
commit 6dfea05049
1 changed files with 10 additions and 1 deletions

View File

@ -1911,8 +1911,17 @@ public class WebHdfsFileSystem extends FileSystem
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());