HADOOP-14194. Aliyun OSS should not use empty endpoint as default. Contributed by Genmao Yu

This commit is contained in:
Kai Zheng 2017-08-21 13:36:28 +08:00
parent 7a82d7bcea
commit 267e19a09f

View File

@ -129,6 +129,10 @@ public void initialize(URI uri, Configuration conf,
} }
String endPoint = conf.getTrimmed(ENDPOINT_KEY, ""); String endPoint = conf.getTrimmed(ENDPOINT_KEY, "");
if (StringUtils.isEmpty(endPoint)) {
throw new IllegalArgumentException("Aliyun OSS endpoint should not be " +
"null or empty. Please set proper endpoint with 'fs.oss.endpoint'.");
}
CredentialsProvider provider = CredentialsProvider provider =
AliyunOSSUtils.getCredentialsProvider(conf); AliyunOSSUtils.getCredentialsProvider(conf);
ossClient = new OSSClient(endPoint, provider, clientConf); ossClient = new OSSClient(endPoint, provider, clientConf);