HADOOP-16197 S3AUtils.translateException to map CredentialInitializationException to AccessDeniedException

Contributed by Steve Loughran.

Change-Id: Ie98ca5210bf0009f297edbcacf1fc6dfe5ea70cd.
This commit is contained in:
Steve Loughran 2019-04-04 21:14:18 +01:00
parent 2bf82aee82
commit 215ffc792e

View File

@ -48,7 +48,6 @@
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.fs.RemoteIterator;
import org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider;
import org.apache.hadoop.fs.s3a.auth.NoAuthWithAWSException;
import org.apache.hadoop.fs.s3native.S3xLoginHelper;
import org.apache.hadoop.net.ConnectTimeoutException;
import org.apache.hadoop.security.ProviderUtils;
@ -193,7 +192,7 @@ public static IOException translateException(@Nullable String operation,
// call considered an sign of connectivity failure
return (EOFException)new EOFException(message).initCause(exception);
}
if (exception instanceof NoAuthWithAWSException) {
if (exception instanceof CredentialInitializationException) {
// the exception raised by AWSCredentialProvider list if the
// credentials were not accepted.
return (AccessDeniedException)new AccessDeniedException(path, null,