From 0c73dba3a6f2dc57435a069623f6c43e45ce655e Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 28 May 2019 22:50:37 +0100 Subject: [PATCH] HADOOP-16332. Remove S3A dependency on http core. Contributed by Steve Loughran. Change-Id: I53209c993a405fefdb5e1b692d5a56d027d3b845 --- hadoop-tools/hadoop-aws/pom.xml | 5 ----- .../java/org/apache/hadoop/fs/s3a/impl/ChangeTracker.java | 3 ++- .../org/apache/hadoop/fs/s3a/TestStreamChangeTracker.java | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/hadoop-tools/hadoop-aws/pom.xml b/hadoop-tools/hadoop-aws/pom.xml index b2e4a6b639..0baefbe37e 100644 --- a/hadoop-tools/hadoop-aws/pom.xml +++ b/hadoop-tools/hadoop-aws/pom.xml @@ -406,11 +406,6 @@ hadoop-common provided - - org.apache.httpcomponents - httpcore - provided - org.apache.hadoop hadoop-common diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/ChangeTracker.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/ChangeTracker.java index 75fecd5f14..a95282cd8a 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/ChangeTracker.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/ChangeTracker.java @@ -41,7 +41,6 @@ import org.apache.hadoop.fs.s3a.S3ObjectAttributes; import static com.google.common.base.Preconditions.checkNotNull; -import static org.apache.http.HttpStatus.SC_PRECONDITION_FAILED; /** * Change tracking for input streams: the version ID or etag of the object is @@ -57,6 +56,8 @@ public class ChangeTracker { private static final Logger LOG = LoggerFactory.getLogger(ChangeTracker.class); + /** {@code 412 Precondition Failed} (HTTP/1.1 - RFC 2616) */ + public static final int SC_PRECONDITION_FAILED = 412; public static final String CHANGE_REPORTED_BY_S3 = "Change reported by S3"; /** Policy to use. */ diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestStreamChangeTracker.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestStreamChangeTracker.java index c645ac5ad8..8ca2eccfe3 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestStreamChangeTracker.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestStreamChangeTracker.java @@ -36,7 +36,6 @@ import org.apache.hadoop.fs.s3a.impl.ChangeDetectionPolicy; import org.apache.hadoop.fs.s3a.impl.ChangeTracker; import org.apache.hadoop.test.HadoopTestBase; -import org.apache.http.HttpStatus; import static org.apache.hadoop.fs.s3a.impl.ChangeDetectionPolicy.CHANGE_DETECTED; import static org.apache.hadoop.fs.s3a.impl.ChangeDetectionPolicy.createPolicy; @@ -250,7 +249,7 @@ public void testCopyVersionMismatch() throws Throwable { // https://github.com/aws/aws-sdk-java/issues/1644 AmazonServiceException awsException = new AmazonServiceException("aws exception"); - awsException.setStatusCode(HttpStatus.SC_PRECONDITION_FAILED); + awsException.setStatusCode(ChangeTracker.SC_PRECONDITION_FAILED); expectChangeException(tracker, awsException, "copy", RemoteFileChangedException.PRECONDITIONS_FAILED);