private AmazonS3Exception createExceptionFromHeaders(
     HttpResponse errorResponse, String errorResponseXml) {
   final Map<String, String> headers = errorResponse.getHeaders();
   final int statusCode = errorResponse.getStatusCode();
   final AmazonS3ExceptionBuilder exceptionBuilder = new AmazonS3ExceptionBuilder();
   exceptionBuilder.setErrorMessage(errorResponse.getStatusText());
   exceptionBuilder.setErrorResponseXml(errorResponseXml);
   exceptionBuilder.setStatusCode(statusCode);
   exceptionBuilder.setExtendedRequestId(headers.get(Headers.EXTENDED_REQUEST_ID));
   exceptionBuilder.setRequestId(headers.get(Headers.REQUEST_ID));
   exceptionBuilder.setErrorCode(statusCode + " " + errorResponse.getStatusText());
   exceptionBuilder.addAdditionalDetail(
       Headers.S3_BUCKET_REGION, errorResponse.getHeaders().get(Headers.S3_BUCKET_REGION));
   return exceptionBuilder.build();
 }
 @Override
 public AmazonServiceException handle(com.amazonaws.http.HttpResponse response)
     throws Exception {
   AmazonServiceException ase = new AmazonServiceException("Fake service exception.");
   ase.setStatusCode(response.getStatusCode());
   ase.setErrorCode(response.getStatusText());
   return ase;
 }