Class ErrorTranslation

java.lang.Object
org.apache.hadoop.fs.s3a.impl.ErrorTranslation

public final class ErrorTranslation extends Object
Translate from AWS SDK-wrapped exceptions into IOExceptions with as much information as possible. The core of the translation logic is in S3AUtils, in translateException and nearby; that has grown to be a large a complex piece of logic, as it ties in with retry/recovery policies, throttling, etc. This class is where future expansion of that code should go so that we have an isolated place for all the changes.. The existing code las been left in S3AUtils it is to avoid cherry-picking problems on backports.
  • Field Details

    • OPENSSL_STREAM_CLOSED

      public static final String OPENSSL_STREAM_CLOSED
      OpenSSL stream closed error: "WFOPENSSL0035". See HADOOP-19027.
      See Also:
  • Method Details

    • isUnknownBucket

      public static boolean isUnknownBucket(software.amazon.awssdk.awscore.exception.AwsServiceException e)
      Does this exception indicate that the AWS Bucket was unknown.
      Parameters:
      e - exception.
      Returns:
      true if the status code and error code mean that the remote bucket is unknown.
    • isObjectNotFound

      public static boolean isObjectNotFound(software.amazon.awssdk.awscore.exception.AwsServiceException e)
      Does this exception indicate that a reference to an object returned a 404. Unknown bucket errors do not match this predicate.
      Parameters:
      e - exception.
      Returns:
      true if the status code and error code mean that the HEAD request returned 404 but the bucket was there.
    • maybeProcessEncryptionClientException

      public static software.amazon.awssdk.core.exception.SdkException maybeProcessEncryptionClientException(software.amazon.awssdk.core.exception.SdkException exception)
      Attempts to extract the underlying SdkException from an S3 encryption client exception.

      This method is designed to handle exceptions that may be wrapped within S3EncryptionClientExceptions. It performs the following steps:

      1. Checks if the input exception is null.
      2. Verifies if the exception contains the S3EncryptionClientException signature.
      3. Examines the cause chain to find the most relevant SdkException.

      The method aims to unwrap nested exceptions to provide more meaningful error information, particularly in the context of S3 encryption operations.

      Parameters:
      exception - The SdkException to analyze. This may be a wrapper exception containing a more specific underlying cause.
      Returns:
      The extracted SdkException if found within the exception chain, or the original exception if no relevant nested exception is found. Returns null if the input exception is null.
      See Also:
      • SdkException
      • AwsServiceException
    • maybeExtractIOException

      public static IOException maybeExtractIOException(String path, Throwable thrown, String message)
      Translate an exception if it or its inner exception is an IOException. This also contains the logic to extract an AWS HTTP channel exception, which may or may not be an IOE, depending on the underlying SSL implementation in use. If an IOException cannot be extracted, null is returned.
      Parameters:
      path - path of operation.
      thrown - exception
      message - message generated by the caller.
      Returns:
      a translated exception or null.
    • maybeExtractChannelException

      @VisibleForTesting public static HttpChannelEOFException maybeExtractChannelException(String path, String message, Throwable thrown)
      Extract an AWS HTTP channel exception if the inner exception is considered an HttpClient NoHttpResponseException or an OpenSSL channel exception. This is based on string matching, which is inelegant and brittle.
      Parameters:
      path - path of the failure.
      message - message generated by the caller.
      thrown - inner exception.
      Returns:
      the new exception.